Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
9b63daca
Commit
9b63daca
authored
Apr 11, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include: Default to the standards-compliant version of swprintf().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e79b0fd7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
59 additions
and
27 deletions
+59
-27
stdio.h
include/msvcrt/stdio.h
+18
-2
wchar.h
include/msvcrt/wchar.h
+17
-2
export.c
programs/reg/export.c
+6
-6
reg.c
programs/reg/reg.c
+4
-4
framewnd.c
programs/regedit/framewnd.c
+2
-1
regproc.c
programs/regedit/regproc.c
+7
-7
graph.c
programs/taskmgr/graph.c
+3
-3
taskmgr.c
programs/taskmgr/taskmgr.c
+1
-1
wordpad.c
programs/wordpad/wordpad.c
+1
-1
No files found.
include/msvcrt/stdio.h
View file @
9b63daca
...
...
@@ -246,14 +246,12 @@ wchar_t* __cdecl getws(wchar_t*);
wint_t
__cdecl
putwc
(
wint_t
,
FILE
*
);
wint_t
__cdecl
putwchar
(
wint_t
);
int
__cdecl
putws
(
const
wchar_t
*
);
int
WINAPIV
swprintf
(
wchar_t
*
,
const
wchar_t
*
,...);
int
WINAPIV
swprintf_s
(
wchar_t
*
,
size_t
,
const
wchar_t
*
,...);
int
WINAPIV
swscanf
(
const
wchar_t
*
,
const
wchar_t
*
,...);
int
WINAPIV
swscanf_s
(
const
wchar_t
*
,
const
wchar_t
*
,...);
wint_t
__cdecl
ungetwc
(
wint_t
,
FILE
*
);
int
__cdecl
vfwprintf
(
FILE
*
,
const
wchar_t
*
,
__ms_va_list
);
int
__cdecl
vfwprintf_s
(
FILE
*
,
const
wchar_t
*
,
__ms_va_list
);
int
__cdecl
vswprintf
(
wchar_t
*
,
const
wchar_t
*
,
__ms_va_list
);
int
__cdecl
vswprintf_s
(
wchar_t
*
,
size_t
,
const
wchar_t
*
,
__ms_va_list
);
int
__cdecl
vwprintf
(
const
wchar_t
*
,
__ms_va_list
);
int
__cdecl
vwprintf_s
(
const
wchar_t
*
,
__ms_va_list
);
...
...
@@ -261,6 +259,24 @@ int WINAPIV wprintf(const wchar_t*,...);
int
WINAPIV
wprintf_s
(
const
wchar_t
*
,...);
int
WINAPIV
wscanf
(
const
wchar_t
*
,...);
int
WINAPIV
wscanf_s
(
const
wchar_t
*
,...);
#ifdef _CRT_NON_CONFORMING_SWPRINTFS
int
WINAPIV
swprintf
(
wchar_t
*
,
const
wchar_t
*
,...);
int
__cdecl
vswprintf
(
wchar_t
*
,
const
wchar_t
*
,
__ms_va_list
);
#else
/* _CRT_NON_CONFORMING_SWPRINTFS */
static
inline
int
vswprintf
(
wchar_t
*
buffer
,
size_t
size
,
const
wchar_t
*
format
,
__ms_va_list
args
)
{
return
_vsnwprintf
(
buffer
,
size
,
format
,
args
);
}
static
inline
int
WINAPIV
swprintf
(
wchar_t
*
buffer
,
size_t
size
,
const
wchar_t
*
format
,
...)
{
int
ret
;
__ms_va_list
args
;
__ms_va_start
(
args
,
format
);
ret
=
_vsnwprintf
(
buffer
,
size
,
format
,
args
);
__ms_va_end
(
args
);
return
ret
;
}
#endif
/* _CRT_NON_CONFORMING_SWPRINTFS */
#endif
/* _WSTDIO_DEFINED */
#endif
/* _STDIO_DEFINED */
...
...
include/msvcrt/wchar.h
View file @
9b63daca
...
...
@@ -357,14 +357,12 @@ wchar_t* __cdecl getws(wchar_t*);
wint_t
__cdecl
putwc
(
wint_t
,
FILE
*
);
wint_t
__cdecl
putwchar
(
wint_t
);
int
__cdecl
putws
(
const
wchar_t
*
);
int
WINAPIV
swprintf
(
wchar_t
*
,
const
wchar_t
*
,...);
int
WINAPIV
swprintf_s
(
wchar_t
*
,
size_t
,
const
wchar_t
*
,...);
int
WINAPIV
swscanf
(
const
wchar_t
*
,
const
wchar_t
*
,...);
int
WINAPIV
swscanf_s
(
const
wchar_t
*
,
const
wchar_t
*
,...);
wint_t
__cdecl
ungetwc
(
wint_t
,
FILE
*
);
int
__cdecl
vfwprintf
(
FILE
*
,
const
wchar_t
*
,
__ms_va_list
);
int
__cdecl
vfwprintf_s
(
FILE
*
,
const
wchar_t
*
,
__ms_va_list
);
int
__cdecl
vswprintf
(
wchar_t
*
,
const
wchar_t
*
,
__ms_va_list
);
int
__cdecl
vswprintf_s
(
wchar_t
*
,
size_t
,
const
wchar_t
*
,
__ms_va_list
);
int
__cdecl
vwprintf
(
const
wchar_t
*
,
__ms_va_list
);
int
__cdecl
vwprintf_s
(
const
wchar_t
*
,
__ms_va_list
);
...
...
@@ -372,6 +370,23 @@ int WINAPIV wprintf(const wchar_t*,...);
int
WINAPIV
wprintf_s
(
const
wchar_t
*
,...);
int
WINAPIV
wscanf
(
const
wchar_t
*
,...);
int
WINAPIV
wscanf_s
(
const
wchar_t
*
,...);
#ifdef _CRT_NON_CONFORMING_SWPRINTFS
int
WINAPIV
swprintf
(
wchar_t
*
,
const
wchar_t
*
,...);
int
__cdecl
vswprintf
(
wchar_t
*
,
const
wchar_t
*
,
__ms_va_list
);
#else
/* _CRT_NON_CONFORMING_SWPRINTFS */
static
inline
int
vswprintf
(
wchar_t
*
buffer
,
size_t
size
,
const
wchar_t
*
format
,
__ms_va_list
args
)
{
return
_vsnwprintf
(
buffer
,
size
,
format
,
args
);
}
static
inline
int
WINAPIV
swprintf
(
wchar_t
*
buffer
,
size_t
size
,
const
wchar_t
*
format
,
...)
{
int
ret
;
__ms_va_list
args
;
__ms_va_start
(
args
,
format
);
ret
=
_vsnwprintf
(
buffer
,
size
,
format
,
args
);
__ms_va_end
(
args
);
return
ret
;
}
#endif
/* _CRT_NON_CONFORMING_SWPRINTFS */
#endif
/* _WSTDIO_DEFINED */
#ifndef _WSTDLIB_DEFINED
...
...
programs/reg/export.c
View file @
9b63daca
...
...
@@ -92,7 +92,7 @@ static size_t export_value_name(HANDLE hFile, WCHAR *name, size_t len)
{
WCHAR
*
str
=
escape_string
(
name
,
len
,
&
line_len
);
WCHAR
*
buf
=
heap_xalloc
((
line_len
+
4
)
*
sizeof
(
WCHAR
));
line_len
=
swprintf
(
buf
,
quoted_fmt
,
str
);
line_len
=
swprintf
(
buf
,
line_len
+
4
,
quoted_fmt
,
str
);
write_file
(
hFile
,
buf
);
heap_free
(
buf
);
heap_free
(
str
);
...
...
@@ -116,7 +116,7 @@ static void export_string_data(WCHAR **buf, WCHAR *data, size_t size)
len
=
size
/
sizeof
(
WCHAR
)
-
1
;
str
=
escape_string
(
data
,
len
,
&
line_len
);
*
buf
=
heap_xalloc
((
line_len
+
3
)
*
sizeof
(
WCHAR
));
swprintf
(
*
buf
,
fmt
,
str
);
swprintf
(
*
buf
,
line_len
+
3
,
fmt
,
str
);
heap_free
(
str
);
}
...
...
@@ -125,7 +125,7 @@ static void export_dword_data(WCHAR **buf, DWORD *data)
static
const
WCHAR
fmt
[]
=
{
'd'
,
'w'
,
'o'
,
'r'
,
'd'
,
':'
,
'%'
,
'0'
,
'8'
,
'x'
,
0
};
*
buf
=
heap_xalloc
(
15
*
sizeof
(
WCHAR
));
swprintf
(
*
buf
,
fmt
,
*
data
);
swprintf
(
*
buf
,
15
,
fmt
,
*
data
);
}
static
size_t
export_hex_data_type
(
HANDLE
hFile
,
DWORD
type
)
...
...
@@ -142,7 +142,7 @@ static size_t export_hex_data_type(HANDLE hFile, DWORD type)
else
{
WCHAR
*
buf
=
heap_xalloc
(
15
*
sizeof
(
WCHAR
));
line_len
=
swprintf
(
buf
,
hexp_fmt
,
type
);
line_len
=
swprintf
(
buf
,
15
,
hexp_fmt
,
type
);
write_file
(
hFile
,
buf
);
heap_free
(
buf
);
}
...
...
@@ -168,7 +168,7 @@ static void export_hex_data(HANDLE hFile, WCHAR **buf, DWORD type,
for
(
i
=
0
,
pos
=
0
;
i
<
size
;
i
++
)
{
pos
+=
swprintf
(
*
buf
+
pos
,
fmt
,
((
BYTE
*
)
data
)[
i
]);
pos
+=
swprintf
(
*
buf
+
pos
,
3
,
fmt
,
((
BYTE
*
)
data
)[
i
]);
if
(
i
==
num_commas
)
break
;
(
*
buf
)[
pos
++
]
=
','
;
(
*
buf
)[
pos
]
=
0
;
...
...
@@ -233,7 +233,7 @@ static void export_key_name(HANDLE hFile, WCHAR *name)
WCHAR
*
buf
;
buf
=
heap_xalloc
((
lstrlenW
(
name
)
+
7
)
*
sizeof
(
WCHAR
));
swprintf
(
buf
,
fmt
,
name
);
swprintf
(
buf
,
lstrlenW
(
name
)
+
7
,
fmt
,
name
);
write_file
(
hFile
,
buf
);
heap_free
(
buf
);
}
...
...
programs/reg/reg.c
View file @
9b63daca
...
...
@@ -539,7 +539,7 @@ static WCHAR *reg_data_to_wchar(DWORD type, const BYTE *src, DWORD size_bytes)
buffer
=
heap_xalloc
((
size_bytes
*
2
+
1
)
*
sizeof
(
WCHAR
));
ptr
=
buffer
;
for
(
i
=
0
;
i
<
size_bytes
;
i
++
)
ptr
+=
swprintf
(
ptr
,
fmt
,
src
[
i
]);
ptr
+=
swprintf
(
ptr
,
3
,
fmt
,
src
[
i
]);
break
;
}
case
REG_DWORD
:
...
...
@@ -550,7 +550,7 @@ static WCHAR *reg_data_to_wchar(DWORD type, const BYTE *src, DWORD size_bytes)
static
const
WCHAR
fmt
[]
=
{
'0'
,
'x'
,
'%'
,
'x'
,
0
};
buffer
=
heap_xalloc
((
zero_x_dword
+
1
)
*
sizeof
(
WCHAR
));
swprintf
(
buffer
,
fmt
,
*
(
DWORD
*
)
src
);
swprintf
(
buffer
,
zero_x_dword
+
1
,
fmt
,
*
(
DWORD
*
)
src
);
break
;
}
case
REG_MULTI_SZ
:
...
...
@@ -635,7 +635,7 @@ WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'\\'
,
'%'
,
's'
,
0
};
subkey_path
=
heap_xalloc
((
path_len
+
subkey_len
+
2
)
*
sizeof
(
WCHAR
));
swprintf
(
subkey_path
,
fmt
,
path
,
subkey_name
);
swprintf
(
subkey_path
,
path_len
+
subkey_len
+
2
,
fmt
,
path
,
subkey_name
);
return
subkey_path
;
}
...
...
@@ -856,7 +856,7 @@ static WCHAR *get_long_key(HKEY root, WCHAR *path)
len
+=
lstrlenW
(
path
)
+
1
;
/* add one for the backslash */
long_key
=
heap_xalloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
swprintf
(
long_key
,
fmt
,
root_rels
[
i
].
long_name
,
path
);
swprintf
(
long_key
,
len
+
1
,
fmt
,
root_rels
[
i
].
long_name
,
path
);
return
long_key
;
}
...
...
programs/regedit/framewnd.c
View file @
9b63daca
...
...
@@ -426,7 +426,8 @@ static BOOL InitOpenFileName(HWND hWnd, OPENFILENAMEW *pofn)
LoadStringW
(
hInst
,
IDS_FILEDIALOG_FILTER_REG
,
filter_reg
,
MAX_PATH
);
LoadStringW
(
hInst
,
IDS_FILEDIALOG_FILTER_REG4
,
filter_reg4
,
MAX_PATH
);
LoadStringW
(
hInst
,
IDS_FILEDIALOG_FILTER_ALL
,
filter_all
,
MAX_PATH
);
swprintf
(
FilterBuffer
,
filterW
,
filter_reg
,
0
,
0
,
filter_reg4
,
0
,
0
,
filter_all
,
0
,
0
);
swprintf
(
FilterBuffer
,
ARRAY_SIZE
(
FilterBuffer
),
filterW
,
filter_reg
,
0
,
0
,
filter_reg4
,
0
,
0
,
filter_all
,
0
,
0
);
}
pofn
->
lpstrFilter
=
FilterBuffer
;
pofn
->
nFilterIndex
=
1
;
...
...
programs/regedit/regproc.c
View file @
9b63daca
...
...
@@ -1216,7 +1216,7 @@ static size_t export_value_name(FILE *fp, WCHAR *name, size_t len, BOOL unicode)
{
WCHAR
*
str
=
REGPROC_escape_string
(
name
,
len
,
&
line_len
);
WCHAR
*
buf
=
heap_xalloc
((
line_len
+
4
)
*
sizeof
(
WCHAR
));
line_len
=
swprintf
(
buf
,
quoted_fmt
,
str
);
line_len
=
swprintf
(
buf
,
line_len
+
4
,
quoted_fmt
,
str
);
REGPROC_write_line
(
fp
,
buf
,
unicode
);
heap_free
(
buf
);
heap_free
(
str
);
...
...
@@ -1240,7 +1240,7 @@ static void export_string_data(WCHAR **buf, WCHAR *data, size_t size)
len
=
size
/
sizeof
(
WCHAR
)
-
1
;
str
=
REGPROC_escape_string
(
data
,
len
,
&
line_len
);
*
buf
=
heap_xalloc
((
line_len
+
3
)
*
sizeof
(
WCHAR
));
swprintf
(
*
buf
,
fmt
,
str
);
swprintf
(
*
buf
,
line_len
+
3
,
fmt
,
str
);
heap_free
(
str
);
}
...
...
@@ -1249,7 +1249,7 @@ static void export_dword_data(WCHAR **buf, DWORD *data)
static
const
WCHAR
fmt
[]
=
{
'd'
,
'w'
,
'o'
,
'r'
,
'd'
,
':'
,
'%'
,
'0'
,
'8'
,
'x'
,
0
};
*
buf
=
heap_xalloc
(
15
*
sizeof
(
WCHAR
));
swprintf
(
*
buf
,
fmt
,
*
data
);
swprintf
(
*
buf
,
15
,
fmt
,
*
data
);
}
static
size_t
export_hex_data_type
(
FILE
*
fp
,
DWORD
type
,
BOOL
unicode
)
...
...
@@ -1266,7 +1266,7 @@ static size_t export_hex_data_type(FILE *fp, DWORD type, BOOL unicode)
else
{
WCHAR
*
buf
=
heap_xalloc
(
15
*
sizeof
(
WCHAR
));
line_len
=
swprintf
(
buf
,
hexp_fmt
,
type
);
line_len
=
swprintf
(
buf
,
15
,
hexp_fmt
,
type
);
REGPROC_write_line
(
fp
,
buf
,
unicode
);
heap_free
(
buf
);
}
...
...
@@ -1295,7 +1295,7 @@ static void export_hex_data(FILE *fp, WCHAR **buf, DWORD type, DWORD line_len,
for
(
i
=
0
,
pos
=
0
;
i
<
size
;
i
++
)
{
pos
+=
swprintf
(
*
buf
+
pos
,
fmt
,
((
BYTE
*
)
data
)[
i
]);
pos
+=
swprintf
(
*
buf
+
pos
,
3
,
fmt
,
((
BYTE
*
)
data
)[
i
]);
if
(
i
==
num_commas
)
break
;
(
*
buf
)[
pos
++
]
=
','
;
(
*
buf
)[
pos
]
=
0
;
...
...
@@ -1360,7 +1360,7 @@ static WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name,
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'\\'
,
'%'
,
's'
,
0
};
subkey_path
=
heap_xalloc
((
path_len
+
subkey_len
+
2
)
*
sizeof
(
WCHAR
));
swprintf
(
subkey_path
,
fmt
,
path
,
subkey_name
);
swprintf
(
subkey_path
,
path_len
+
subkey_len
+
2
,
fmt
,
path
,
subkey_name
);
return
subkey_path
;
}
...
...
@@ -1371,7 +1371,7 @@ static void export_key_name(FILE *fp, WCHAR *name, BOOL unicode)
WCHAR
*
buf
;
buf
=
heap_xalloc
((
lstrlenW
(
name
)
+
7
)
*
sizeof
(
WCHAR
));
swprintf
(
buf
,
fmt
,
name
);
swprintf
(
buf
,
lstrlenW
(
name
)
+
7
,
fmt
,
name
);
REGPROC_write_line
(
fp
,
buf
,
unicode
);
heap_free
(
buf
);
}
...
...
programs/taskmgr/graph.c
View file @
9b63daca
...
...
@@ -83,15 +83,15 @@ static void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
*/
if
(
CpuUsage
==
100
)
{
swprintf
(
Text
,
wszFormatI
,
(
int
)
CpuUsage
);
swprintf
(
Text
,
ARRAY_SIZE
(
Text
),
wszFormatI
,
(
int
)
CpuUsage
);
}
else
if
(
CpuUsage
<
10
)
{
swprintf
(
Text
,
wszFormatII
,
(
int
)
CpuUsage
);
swprintf
(
Text
,
ARRAY_SIZE
(
Text
),
wszFormatII
,
(
int
)
CpuUsage
);
}
else
{
swprintf
(
Text
,
wszFormatIII
,
(
int
)
CpuUsage
);
swprintf
(
Text
,
ARRAY_SIZE
(
Text
),
wszFormatIII
,
(
int
)
CpuUsage
);
}
/*
...
...
programs/taskmgr/taskmgr.c
View file @
9b63daca
...
...
@@ -698,7 +698,7 @@ LPWSTR GetLastErrorText(LPWSTR lpwszBuf, DWORD dwSize)
lpwszBuf
[
0
]
=
'\0'
;
}
else
{
lpwszTemp
[
lstrlenW
(
lpwszTemp
)
-
2
]
=
'\0'
;
/* remove cr and newline character */
swprintf
(
lpwszBuf
,
wszFormat
,
lpwszTemp
,
GetLastError
());
swprintf
(
lpwszBuf
,
dwSize
,
wszFormat
,
lpwszTemp
,
GetLastError
());
}
if
(
lpwszTemp
)
{
LocalFree
(
lpwszTemp
);
...
...
programs/wordpad/wordpad.c
View file @
9b63daca
...
...
@@ -1382,7 +1382,7 @@ static void number_with_units(LPWSTR buffer, int number)
static
const
WCHAR
fmt
[]
=
{
'%'
,
'.'
,
'2'
,
'f'
,
' '
,
'%'
,
's'
,
'\0'
};
float
converted
=
(
float
)
number
/
(
float
)
TWIPS_PER_INCH
*
(
float
)
CENTMM_PER_INCH
/
1000
.
0
;
swprintf
(
buffer
,
fmt
,
converted
,
units_cmW
);
swprintf
(
buffer
,
MAX_STRING_LEN
,
fmt
,
converted
,
units_cmW
);
}
static
BOOL
get_comboexlist_selection
(
HWND
hComboEx
,
LPWSTR
wszBuffer
,
UINT
bufferLength
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment