Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
a5f17fac
Commit
a5f17fac
authored
Nov 02, 2023
by
Brendan Shanks
Committed by
Alexandre Julliard
Nov 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/unix: Replace sprintf with snprintf to avoid deprecation warnings on macOS.
parent
90920400
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
37 additions
and
37 deletions
+37
-37
cdrom.c
dlls/ntdll/unix/cdrom.c
+1
-1
debug.c
dlls/ntdll/unix/debug.c
+3
-3
env.c
dlls/ntdll/unix/env.c
+7
-7
file.c
dlls/ntdll/unix/file.c
+1
-1
loader.c
dlls/ntdll/unix/loader.c
+2
-2
process.c
dlls/ntdll/unix/process.c
+1
-1
registry.c
dlls/ntdll/unix/registry.c
+3
-3
serial.c
dlls/ntdll/unix/serial.c
+1
-1
sync.c
dlls/ntdll/unix/sync.c
+1
-1
system.c
dlls/ntdll/unix/system.c
+13
-13
tape.c
dlls/ntdll/unix/tape.c
+1
-1
thread.c
dlls/ntdll/unix/thread.c
+3
-3
No files found.
dlls/ntdll/unix/cdrom.c
View file @
a5f17fac
...
...
@@ -203,7 +203,7 @@ static const char *iocodex(DWORD code)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
iocodextable
);
i
++
)
if
(
code
==
iocodextable
[
i
].
code
)
return
iocodextable
[
i
].
codex
;
s
printf
(
buffer
,
"IOCTL_CODE_%x"
,
(
int
)
code
);
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"IOCTL_CODE_%x"
,
(
int
)
code
);
return
buffer
;
}
...
...
dlls/ntdll/unix/debug.c
View file @
a5f17fac
...
...
@@ -318,10 +318,10 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
if
(
TRACE_ON
(
timestamp
))
{
UINT
ticks
=
NtGetTickCount
();
pos
+=
s
printf
(
pos
,
"%3u.%03u:"
,
ticks
/
1000
,
ticks
%
1000
);
pos
+=
s
nprintf
(
pos
,
sizeof
(
info
->
output
)
-
(
pos
-
info
->
output
)
,
"%3u.%03u:"
,
ticks
/
1000
,
ticks
%
1000
);
}
if
(
TRACE_ON
(
pid
))
pos
+=
s
printf
(
pos
,
"%04x:"
,
(
UINT
)
GetCurrentProcessId
()
);
pos
+=
s
printf
(
pos
,
"%04x:"
,
(
UINT
)
GetCurrentThreadId
()
);
if
(
TRACE_ON
(
pid
))
pos
+=
s
nprintf
(
pos
,
sizeof
(
info
->
output
)
-
(
pos
-
info
->
output
)
,
"%04x:"
,
(
UINT
)
GetCurrentProcessId
()
);
pos
+=
s
nprintf
(
pos
,
sizeof
(
info
->
output
)
-
(
pos
-
info
->
output
)
,
"%04x:"
,
(
UINT
)
GetCurrentThreadId
()
);
}
if
(
function
&&
cls
<
ARRAY_SIZE
(
classes
))
pos
+=
snprintf
(
pos
,
sizeof
(
info
->
output
)
-
(
pos
-
info
->
output
),
"%s:%s:%s "
,
...
...
dlls/ntdll/unix/env.c
View file @
a5f17fac
...
...
@@ -95,7 +95,7 @@ static char *get_nls_file_path( UINT type, UINT id )
{
case
NLS_SECTION_SORTKEYS
:
name
=
"sortdefault"
;
break
;
case
NLS_SECTION_CASEMAP
:
name
=
"l_intl"
;
break
;
case
NLS_SECTION_CODEPAGE
:
name
=
tmp
;
s
printf
(
tmp
,
"c_%03u"
,
id
);
break
;
case
NLS_SECTION_CODEPAGE
:
name
=
tmp
;
s
nprintf
(
tmp
,
sizeof
(
tmp
)
,
"c_%03u"
,
id
);
break
;
case
NLS_SECTION_NORMALIZE
:
switch
(
id
)
{
...
...
@@ -182,10 +182,10 @@ static NTSTATUS get_nls_section_name( UINT type, UINT id, WCHAR name[32] )
strcpy
(
buffer
,
"
\\
NLS
\\
NlsSectionLANG_INTL"
);
break
;
case
NLS_SECTION_CODEPAGE
:
s
printf
(
buffer
,
"
\\
NLS
\\
NlsSectionCP%03u"
,
id
);
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"
\\
NLS
\\
NlsSectionCP%03u"
,
id
);
break
;
case
NLS_SECTION_NORMALIZE
:
s
printf
(
buffer
,
"
\\
NLS
\\
NlsSectionNORM%08x"
,
id
);
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"
\\
NLS
\\
NlsSectionNORM%08x"
,
id
);
break
;
default:
return
STATUS_INVALID_PARAMETER_1
;
...
...
@@ -303,7 +303,7 @@ static void init_unix_codepage(void)
char
buffer
[
16
];
void
*
data
;
s
printf
(
buffer
,
"c_%03u.nls"
,
charset_names
[
pos
].
cp
);
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"c_%03u.nls"
,
charset_names
[
pos
].
cp
);
if
((
data
=
read_nls_file
(
buffer
)))
init_codepage_table
(
data
,
&
unix_cp
);
}
return
;
...
...
@@ -1077,10 +1077,10 @@ static void add_dynamic_environment( WCHAR **env, SIZE_T *pos, SIZE_T *size )
add_path_var
(
env
,
pos
,
size
,
"WINECONFIGDIR"
,
config_dir
);
for
(
i
=
0
;
dll_paths
[
i
];
i
++
)
{
s
printf
(
str
,
"WINEDLLDIR%u"
,
i
);
s
nprintf
(
str
,
sizeof
(
str
)
,
"WINEDLLDIR%u"
,
i
);
add_path_var
(
env
,
pos
,
size
,
str
,
dll_paths
[
i
]
);
}
s
printf
(
str
,
"WINEDLLDIR%u"
,
i
);
s
nprintf
(
str
,
sizeof
(
str
)
,
"WINEDLLDIR%u"
,
i
);
append_envW
(
env
,
pos
,
size
,
str
,
NULL
);
add_system_dll_path_var
(
env
,
pos
,
size
);
append_envA
(
env
,
pos
,
size
,
"WINELOADER"
,
wineloader
);
...
...
@@ -1088,7 +1088,7 @@ static void add_dynamic_environment( WCHAR **env, SIZE_T *pos, SIZE_T *size )
append_envA
(
env
,
pos
,
size
,
"WINEDLLOVERRIDES"
,
overrides
);
if
(
unix_cp
.
CodePage
!=
CP_UTF8
)
{
s
printf
(
str
,
"%u"
,
unix_cp
.
CodePage
);
s
nprintf
(
str
,
sizeof
(
str
)
,
"%u"
,
unix_cp
.
CodePage
);
append_envA
(
env
,
pos
,
size
,
"WINEUNIXCP"
,
str
);
}
else
append_envW
(
env
,
pos
,
size
,
"WINEUNIXCP"
,
NULL
);
...
...
dlls/ntdll/unix/file.c
View file @
a5f17fac
...
...
@@ -1613,7 +1613,7 @@ static int fd_set_dos_attrib( int fd, UINT attr, BOOL force_set )
* this format with more features, but retains compatibility with the
* earlier format. */
char
data
[
11
];
int
len
=
s
printf
(
data
,
"0x%x"
,
attr
);
int
len
=
s
nprintf
(
data
,
sizeof
(
data
)
,
"0x%x"
,
attr
);
return
xattr_fset
(
fd
,
SAMBA_XATTR_DOS_ATTRIB
,
data
,
len
);
}
else
return
xattr_fremove
(
fd
,
SAMBA_XATTR_DOS_ATTRIB
);
...
...
dlls/ntdll/unix/loader.c
View file @
a5f17fac
...
...
@@ -757,8 +757,8 @@ NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_i
signal
(
SIGPIPE
,
SIG_DFL
);
s
printf
(
socket_env
,
"WINESERVERSOCKET=%u"
,
socketfd
);
s
printf
(
preloader_reserve
,
"WINEPRELOADRESERVE=%x%08x-%x%08x"
,
s
nprintf
(
socket_env
,
sizeof
(
socket_env
)
,
"WINESERVERSOCKET=%u"
,
socketfd
);
s
nprintf
(
preloader_reserve
,
sizeof
(
preloader_reserve
)
,
"WINEPRELOADRESERVE=%x%08x-%x%08x"
,
(
UINT
)(
res_start
>>
32
),
(
UINT
)
res_start
,
(
UINT
)(
res_end
>>
32
),
(
UINT
)
res_end
);
putenv
(
preloader_reserve
);
...
...
dlls/ntdll/unix/process.c
View file @
a5f17fac
...
...
@@ -1042,7 +1042,7 @@ void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid )
if
(
unix_pid
==
-
1
)
strcpy
(
path
,
"/proc/self/status"
);
else
s
printf
(
path
,
"/proc/%u/status"
,
unix_pid
);
s
nprintf
(
path
,
sizeof
(
path
)
,
"/proc/%u/status"
,
unix_pid
);
f
=
fopen
(
path
,
"r"
);
if
(
!
f
)
return
;
...
...
dlls/ntdll/unix/registry.c
View file @
a5f17fac
...
...
@@ -55,12 +55,12 @@ NTSTATUS open_hkcu_key( const char *path, HANDLE *key )
if
(
status
)
return
status
;
sid
=
((
TOKEN_USER
*
)
sid_data
)
->
User
.
Sid
;
len
=
s
printf
(
buffer
,
"
\\
Registry
\\
User
\\
S-%u-%u"
,
sid
->
Revision
,
len
=
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"
\\
Registry
\\
User
\\
S-%u-%u"
,
sid
->
Revision
,
(
int
)
MAKELONG
(
MAKEWORD
(
sid
->
IdentifierAuthority
.
Value
[
5
],
sid
->
IdentifierAuthority
.
Value
[
4
]
),
MAKEWORD
(
sid
->
IdentifierAuthority
.
Value
[
3
],
sid
->
IdentifierAuthority
.
Value
[
2
]
)));
for
(
i
=
0
;
i
<
sid
->
SubAuthorityCount
;
i
++
)
len
+=
s
printf
(
buffer
+
len
,
"-%u"
,
(
int
)
sid
->
SubAuthority
[
i
]
);
len
+=
s
printf
(
buffer
+
len
,
"
\\
%s"
,
path
);
len
+=
s
nprintf
(
buffer
+
len
,
sizeof
(
buffer
)
-
len
,
"-%u"
,
(
int
)
sid
->
SubAuthority
[
i
]
);
len
+=
s
nprintf
(
buffer
+
len
,
sizeof
(
buffer
)
-
len
,
"
\\
%s"
,
path
);
ascii_to_unicode
(
bufferW
,
buffer
,
len
+
1
);
init_unicode_string
(
&
name
,
bufferW
);
...
...
dlls/ntdll/unix/serial.c
View file @
a5f17fac
...
...
@@ -113,7 +113,7 @@ static const char* iocode2str(UINT ioc)
X
(
IOCTL_SERIAL_WAIT_ON_MASK
);
X
(
IOCTL_SERIAL_XOFF_COUNTER
);
#undef X
default:
{
static
char
tmp
[
32
];
sprintf
(
tmp
,
"IOCTL_SERIAL_%d
\n
"
,
ioc
);
return
tmp
;
}
default:
return
wine_dbg_sprintf
(
"IOCTL_SERIAL_%d
\n
"
,
ioc
);
}
}
...
...
dlls/ntdll/unix/sync.c
View file @
a5f17fac
...
...
@@ -2207,7 +2207,7 @@ done:
static
ULONG
integral_atom_name
(
WCHAR
*
buffer
,
ULONG
len
,
RTL_ATOM
atom
)
{
char
tmp
[
16
];
int
ret
=
s
printf
(
tmp
,
"#%u"
,
atom
);
int
ret
=
s
nprintf
(
tmp
,
sizeof
(
tmp
)
,
"#%u"
,
atom
);
len
/=
sizeof
(
WCHAR
);
if
(
len
)
...
...
dlls/ntdll/unix/system.c
View file @
a5f17fac
...
...
@@ -938,7 +938,7 @@ static NTSTATUS create_logical_proc_info(void)
continue
;
}
s
printf
(
name
,
core_info
,
i
,
"physical_package_id"
);
s
nprintf
(
name
,
sizeof
(
name
)
,
core_info
,
i
,
"physical_package_id"
);
f
=
fopen
(
name
,
"r"
);
if
(
f
)
{
...
...
@@ -964,13 +964,13 @@ static NTSTATUS create_logical_proc_info(void)
*/
/* Mask of logical threads sharing same physical core in kernel core numbering. */
s
printf
(
name
,
core_info
,
i
,
"thread_siblings"
);
s
nprintf
(
name
,
sizeof
(
name
)
,
core_info
,
i
,
"thread_siblings"
);
if
(
!
sysfs_parse_bitmap
(
name
,
&
thread_mask
))
thread_mask
=
1
<<
i
;
/* Needed later for NumaNode and Group. */
all_cpus_mask
|=
thread_mask
;
s
printf
(
name
,
core_info
,
i
,
"thread_siblings_list"
);
s
nprintf
(
name
,
sizeof
(
name
)
,
core_info
,
i
,
"thread_siblings_list"
);
f
=
fopen
(
name
,
"r"
);
if
(
f
)
{
...
...
@@ -990,31 +990,31 @@ static NTSTATUS create_logical_proc_info(void)
CACHE_DESCRIPTOR
cache
;
ULONG_PTR
mask
=
0
;
s
printf
(
name
,
cache_info
,
i
,
j
,
"shared_cpu_map"
);
s
nprintf
(
name
,
sizeof
(
name
)
,
cache_info
,
i
,
j
,
"shared_cpu_map"
);
if
(
!
sysfs_parse_bitmap
(
name
,
&
mask
))
continue
;
s
printf
(
name
,
cache_info
,
i
,
j
,
"level"
);
s
nprintf
(
name
,
sizeof
(
name
)
,
cache_info
,
i
,
j
,
"level"
);
f
=
fopen
(
name
,
"r"
);
if
(
!
f
)
continue
;
fscanf
(
f
,
"%u"
,
&
r
);
fclose
(
f
);
cache
.
Level
=
r
;
s
printf
(
name
,
cache_info
,
i
,
j
,
"ways_of_associativity"
);
s
nprintf
(
name
,
sizeof
(
name
)
,
cache_info
,
i
,
j
,
"ways_of_associativity"
);
f
=
fopen
(
name
,
"r"
);
if
(
!
f
)
continue
;
fscanf
(
f
,
"%u"
,
&
r
);
fclose
(
f
);
cache
.
Associativity
=
r
;
s
printf
(
name
,
cache_info
,
i
,
j
,
"coherency_line_size"
);
s
nprintf
(
name
,
sizeof
(
name
)
,
cache_info
,
i
,
j
,
"coherency_line_size"
);
f
=
fopen
(
name
,
"r"
);
if
(
!
f
)
continue
;
fscanf
(
f
,
"%u"
,
&
r
);
fclose
(
f
);
cache
.
LineSize
=
r
;
s
printf
(
name
,
cache_info
,
i
,
j
,
"size"
);
s
nprintf
(
name
,
sizeof
(
name
)
,
cache_info
,
i
,
j
,
"size"
);
f
=
fopen
(
name
,
"r"
);
if
(
!
f
)
continue
;
fscanf
(
f
,
"%u%c"
,
&
r
,
&
op
);
...
...
@@ -1023,7 +1023,7 @@ static NTSTATUS create_logical_proc_info(void)
WARN
(
"unknown cache size %u%c
\n
"
,
r
,
op
);
cache
.
Size
=
(
op
==
'K'
?
r
*
1024
:
r
);
s
printf
(
name
,
cache_info
,
i
,
j
,
"type"
);
s
nprintf
(
name
,
sizeof
(
name
)
,
cache_info
,
i
,
j
,
"type"
);
f
=
fopen
(
name
,
"r"
);
if
(
!
f
)
continue
;
fscanf
(
f
,
"%s"
,
name
);
...
...
@@ -1066,7 +1066,7 @@ static NTSTATUS create_logical_proc_info(void)
{
ULONG_PTR
mask
=
0
;
s
printf
(
name
,
numa_info
,
i
);
s
nprintf
(
name
,
sizeof
(
name
)
,
numa_info
,
i
);
if
(
!
sysfs_parse_bitmap
(
name
,
&
mask
))
continue
;
if
(
!
logical_proc_info_add_numa_node
(
mask
,
i
))
...
...
@@ -2218,7 +2218,7 @@ static void find_reg_tz_info(RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi, const char*
char
buffer
[
128
];
KEY_BASIC_INFORMATION
*
info
=
(
KEY_BASIC_INFORMATION
*
)
buffer
;
s
printf
(
buffer
,
"%u"
,
year
);
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"%u"
,
year
);
ascii_to_unicode
(
yearW
,
buffer
,
strlen
(
buffer
)
+
1
);
init_unicode_string
(
&
nameW
,
Time_ZonesW
);
InitializeObjectAttributes
(
&
attr
,
&
nameW
,
0
,
0
,
NULL
);
...
...
@@ -3780,7 +3780,7 @@ NTSTATUS WINAPI NtPowerInformation( POWER_INFORMATION_LEVEL level, void *input,
FILE
*
f
;
for
(
i
=
0
;
i
<
out_cpus
;
i
++
)
{
s
printf
(
filename
,
"/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq"
,
i
);
s
nprintf
(
filename
,
sizeof
(
filename
)
,
"/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq"
,
i
);
f
=
fopen
(
filename
,
"r"
);
if
(
f
&&
(
fscanf
(
f
,
"%u"
,
&
val
)
==
1
))
{
cpu_power
[
i
].
MaxMhz
=
val
/
1000
;
...
...
@@ -3799,7 +3799,7 @@ NTSTATUS WINAPI NtPowerInformation( POWER_INFORMATION_LEVEL level, void *input,
if
(
f
)
fclose
(
f
);
}
s
printf
(
filename
,
"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_max_freq"
,
i
);
s
nprintf
(
filename
,
sizeof
(
filename
)
,
"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_max_freq"
,
i
);
f
=
fopen
(
filename
,
"r"
);
if
(
f
&&
(
fscanf
(
f
,
"%u"
,
&
val
)
==
1
))
{
cpu_power
[
i
].
MhzLimit
=
val
/
1000
;
...
...
dlls/ntdll/unix/tape.c
View file @
a5f17fac
...
...
@@ -84,7 +84,7 @@ static const char *io2str( unsigned int io )
X
(
IOCTL_TAPE_SET_POSITION
);
X
(
IOCTL_TAPE_WRITE_MARKS
);
#undef X
default:
{
static
char
tmp
[
32
];
sprintf
(
tmp
,
"IOCTL_TAPE_%d
\n
"
,
io
);
return
tmp
;
}
default:
return
wine_dbg_sprintf
(
"IOCTL_TAPE_%d
\n
"
,
io
);
}
}
...
...
dlls/ntdll/unix/thread.c
View file @
a5f17fac
...
...
@@ -1799,9 +1799,9 @@ BOOL get_thread_times(int unix_pid, int unix_tid, LARGE_INTEGER *kernel_time, LA
int
i
;
if
(
unix_tid
==
-
1
)
s
printf
(
buf
,
"/proc/%u/stat"
,
unix_pid
);
s
nprintf
(
buf
,
sizeof
(
buf
)
,
"/proc/%u/stat"
,
unix_pid
);
else
s
printf
(
buf
,
"/proc/%u/task/%u/stat"
,
unix_pid
,
unix_tid
);
s
nprintf
(
buf
,
sizeof
(
buf
)
,
"/proc/%u/task/%u/stat"
,
unix_pid
,
unix_tid
);
if
(
!
(
f
=
fopen
(
buf
,
"r"
)))
{
WARN
(
"Failed to open %s: %s
\n
"
,
buf
,
strerror
(
errno
));
...
...
@@ -1904,7 +1904,7 @@ static void set_native_thread_name( HANDLE handle, const UNICODE_STRING *name )
}
len
=
ntdll_wcstoumbs
(
name
->
Buffer
,
name
->
Length
/
sizeof
(
WCHAR
),
nameA
,
sizeof
(
nameA
),
FALSE
);
s
printf
(
path
,
"/proc/%u/task/%u/comm"
,
unix_pid
,
unix_tid
);
s
nprintf
(
path
,
sizeof
(
path
)
,
"/proc/%u/task/%u/comm"
,
unix_pid
,
unix_tid
);
if
((
fd
=
open
(
path
,
O_WRONLY
))
!=
-
1
)
{
write
(
fd
,
nameA
,
len
);
...
...
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