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
9b4e3718
Commit
9b4e3718
authored
Mar 19, 2024
by
Brendan Shanks
Committed by
Alexandre Julliard
Mar 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Replace sprintf with snprintf to avoid deprecation warnings on macOS.
parent
4e04b2d5
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
29 additions
and
28 deletions
+29
-28
change.c
server/change.c
+1
-1
directory.c
server/directory.c
+1
-1
fd.c
server/fd.c
+6
-6
mapping.c
server/mapping.c
+1
-1
process.c
server/process.c
+1
-1
procfs.c
server/procfs.c
+2
-2
ptrace.c
server/ptrace.c
+2
-2
registry.c
server/registry.c
+9
-8
trace.c
server/trace.c
+1
-1
unicode.c
server/unicode.c
+5
-5
No files found.
server/change.c
View file @
9b4e3718
...
@@ -726,7 +726,7 @@ static char *get_path_from_fd( int fd, int sz )
...
@@ -726,7 +726,7 @@ static char *get_path_from_fd( int fd, int sz )
#ifdef linux
#ifdef linux
char
*
ret
=
malloc
(
32
+
sz
);
char
*
ret
=
malloc
(
32
+
sz
);
if
(
ret
)
s
printf
(
ret
,
"/proc/self/fd/%u"
,
fd
);
if
(
ret
)
s
nprintf
(
ret
,
32
+
sz
,
"/proc/self/fd/%u"
,
fd
);
return
ret
;
return
ret
;
#elif defined(F_GETPATH)
#elif defined(F_GETPATH)
char
*
ret
=
malloc
(
PATH_MAX
+
sz
);
char
*
ret
=
malloc
(
PATH_MAX
+
sz
);
...
...
server/directory.c
View file @
9b4e3718
...
@@ -320,7 +320,7 @@ static void create_session( unsigned int id )
...
@@ -320,7 +320,7 @@ static void create_session( unsigned int id )
release_object
(
dir_sessions
);
release_object
(
dir_sessions
);
}
}
s
printf
(
id_strA
,
"%u"
,
id
);
s
nprintf
(
id_strA
,
sizeof
(
id_strA
)
,
"%u"
,
id
);
id_strW
=
ascii_to_unicode_str
(
id_strA
,
&
id_str
);
id_strW
=
ascii_to_unicode_str
(
id_strA
,
&
id_str
);
dir_id
=
create_directory
(
&
dir_sessions
->
obj
,
&
id_str
,
0
,
HASH_SIZE
,
NULL
);
dir_id
=
create_directory
(
&
dir_sessions
->
obj
,
&
id_str
,
0
,
HASH_SIZE
,
NULL
);
dir_dosdevices
=
create_directory
(
&
dir_id
->
obj
,
&
dir_dosdevices_str
,
OBJ_PERMANENT
,
HASH_SIZE
,
NULL
);
dir_dosdevices
=
create_directory
(
&
dir_id
->
obj
,
&
dir_dosdevices_str
,
OBJ_PERMANENT
,
HASH_SIZE
,
NULL
);
...
...
server/fd.c
View file @
9b4e3718
...
@@ -465,7 +465,7 @@ const char *get_timeout_str( timeout_t timeout )
...
@@ -465,7 +465,7 @@ const char *get_timeout_str( timeout_t timeout )
{
{
secs
=
-
timeout
/
TICKS_PER_SEC
;
secs
=
-
timeout
/
TICKS_PER_SEC
;
nsecs
=
-
timeout
%
TICKS_PER_SEC
;
nsecs
=
-
timeout
%
TICKS_PER_SEC
;
s
printf
(
buffer
,
"+%ld.%07ld"
,
secs
,
nsecs
);
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"+%ld.%07ld"
,
secs
,
nsecs
);
}
}
else
/* absolute */
else
/* absolute */
{
{
...
@@ -477,12 +477,12 @@ const char *get_timeout_str( timeout_t timeout )
...
@@ -477,12 +477,12 @@ const char *get_timeout_str( timeout_t timeout )
secs
--
;
secs
--
;
}
}
if
(
secs
>=
0
)
if
(
secs
>=
0
)
s
printf
(
buffer
,
"%x%08x (+%ld.%07ld)"
,
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"%x%08x (+%ld.%07ld)"
,
(
unsigned
int
)(
timeout
>>
32
),
(
unsigned
int
)
timeout
,
secs
,
nsecs
);
(
unsigned
int
)(
timeout
>>
32
),
(
unsigned
int
)
timeout
,
secs
,
nsecs
);
else
else
s
printf
(
buffer
,
"%x%08x (-%ld.%07ld)"
,
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"%x%08x (-%ld.%07ld)"
,
(
unsigned
int
)(
timeout
>>
32
),
(
unsigned
int
)
timeout
,
(
unsigned
int
)(
timeout
>>
32
),
(
unsigned
int
)
timeout
,
-
(
secs
+
1
),
TICKS_PER_SEC
-
nsecs
);
-
(
secs
+
1
),
TICKS_PER_SEC
-
nsecs
);
}
}
return
buffer
;
return
buffer
;
}
}
...
...
server/mapping.c
View file @
9b4e3718
...
@@ -292,7 +292,7 @@ static int make_temp_file( char name[16] )
...
@@ -292,7 +292,7 @@ static int make_temp_file( char name[16] )
value
+=
(
current_time
>>
16
)
+
current_time
;
value
+=
(
current_time
>>
16
)
+
current_time
;
for
(
i
=
0
;
i
<
0x8000
&&
fd
<
0
;
i
++
,
value
+=
7777
)
for
(
i
=
0
;
i
<
0x8000
&&
fd
<
0
;
i
++
,
value
+=
7777
)
{
{
s
printf
(
name
,
"tmpmap-%08x"
,
value
);
s
nprintf
(
name
,
16
,
"tmpmap-%08x"
,
value
);
fd
=
open
(
name
,
O_RDWR
|
O_CREAT
|
O_EXCL
,
0600
);
fd
=
open
(
name
,
O_RDWR
|
O_CREAT
|
O_EXCL
,
0600
);
}
}
return
fd
;
return
fd
;
...
...
server/process.c
View file @
9b4e3718
...
@@ -1552,7 +1552,7 @@ DECL_HANDLER(get_process_vm_counters)
...
@@ -1552,7 +1552,7 @@ DECL_HANDLER(get_process_vm_counters)
char
proc_path
[
32
],
line
[
256
];
char
proc_path
[
32
],
line
[
256
];
unsigned
long
value
;
unsigned
long
value
;
s
printf
(
proc_path
,
"/proc/%u/status"
,
process
->
unix_pid
);
s
nprintf
(
proc_path
,
sizeof
(
proc_path
)
,
"/proc/%u/status"
,
process
->
unix_pid
);
if
((
f
=
fopen
(
proc_path
,
"r"
)))
if
((
f
=
fopen
(
proc_path
,
"r"
)))
{
{
while
(
fgets
(
line
,
sizeof
(
line
),
f
))
while
(
fgets
(
line
,
sizeof
(
line
),
f
))
...
...
server/procfs.c
View file @
9b4e3718
...
@@ -55,7 +55,7 @@ static int open_proc_as( struct process *process, int flags )
...
@@ -55,7 +55,7 @@ static int open_proc_as( struct process *process, int flags )
return
-
1
;
return
-
1
;
}
}
s
printf
(
buffer
,
"/proc/%u/as"
,
process
->
unix_pid
);
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"/proc/%u/as"
,
process
->
unix_pid
);
if
((
fd
=
open
(
buffer
,
flags
))
==
-
1
)
if
((
fd
=
open
(
buffer
,
flags
))
==
-
1
)
{
{
if
(
errno
==
ENOENT
)
/* probably got killed */
if
(
errno
==
ENOENT
)
/* probably got killed */
...
@@ -75,7 +75,7 @@ static int open_proc_lwpctl( struct thread *thread )
...
@@ -75,7 +75,7 @@ static int open_proc_lwpctl( struct thread *thread )
if
(
thread
->
unix_pid
==
-
1
)
return
-
1
;
if
(
thread
->
unix_pid
==
-
1
)
return
-
1
;
s
printf
(
buffer
,
"/proc/%u/lwp/%u/lwpctl"
,
thread
->
unix_pid
,
thread
->
unix_tid
);
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"/proc/%u/lwp/%u/lwpctl"
,
thread
->
unix_pid
,
thread
->
unix_tid
);
if
((
fd
=
open
(
buffer
,
O_WRONLY
))
==
-
1
)
if
((
fd
=
open
(
buffer
,
O_WRONLY
))
==
-
1
)
{
{
if
(
errno
==
ENOENT
)
/* probably got killed */
if
(
errno
==
ENOENT
)
/* probably got killed */
...
...
server/ptrace.c
View file @
9b4e3718
...
@@ -366,7 +366,7 @@ int read_process_memory( struct process *process, client_ptr_t ptr, data_size_t
...
@@ -366,7 +366,7 @@ int read_process_memory( struct process *process, client_ptr_t ptr, data_size_t
char
procmem
[
24
];
char
procmem
[
24
];
int
fd
;
int
fd
;
s
printf
(
procmem
,
"/proc/%u/mem"
,
process
->
unix_pid
);
s
nprintf
(
procmem
,
sizeof
(
procmem
)
,
"/proc/%u/mem"
,
process
->
unix_pid
);
if
((
fd
=
open
(
procmem
,
O_RDONLY
))
!=
-
1
)
if
((
fd
=
open
(
procmem
,
O_RDONLY
))
!=
-
1
)
{
{
ssize_t
ret
=
pread
(
fd
,
dest
,
size
,
ptr
);
ssize_t
ret
=
pread
(
fd
,
dest
,
size
,
ptr
);
...
@@ -467,7 +467,7 @@ int write_process_memory( struct process *process, client_ptr_t ptr, data_size_t
...
@@ -467,7 +467,7 @@ int write_process_memory( struct process *process, client_ptr_t ptr, data_size_t
char
procmem
[
24
];
char
procmem
[
24
];
int
fd
;
int
fd
;
s
printf
(
procmem
,
"/proc/%u/mem"
,
process
->
unix_pid
);
s
nprintf
(
procmem
,
sizeof
(
procmem
)
,
"/proc/%u/mem"
,
process
->
unix_pid
);
if
((
fd
=
open
(
procmem
,
O_WRONLY
))
!=
-
1
)
if
((
fd
=
open
(
procmem
,
O_WRONLY
))
!=
-
1
)
{
{
ssize_t
r
=
pwrite
(
fd
,
src
,
size
,
ptr
);
ssize_t
r
=
pwrite
(
fd
,
src
,
size
,
ptr
);
...
...
server/registry.c
View file @
9b4e3718
...
@@ -1831,15 +1831,16 @@ static int load_init_registry_from_file( const char *filename, struct key *key )
...
@@ -1831,15 +1831,16 @@ static int load_init_registry_from_file( const char *filename, struct key *key )
static
WCHAR
*
format_user_registry_path
(
const
struct
sid
*
sid
,
struct
unicode_str
*
path
)
static
WCHAR
*
format_user_registry_path
(
const
struct
sid
*
sid
,
struct
unicode_str
*
path
)
{
{
char
buffer
[
7
+
11
+
11
+
11
*
ARRAY_SIZE
(
sid
->
sub_auth
)]
,
*
p
=
buffer
;
char
buffer
[
7
+
11
+
11
+
11
*
ARRAY_SIZE
(
sid
->
sub_auth
)];
unsigned
int
i
;
unsigned
int
i
;
int
len
;
p
+=
sprintf
(
p
,
"User
\\
S-%u-%u"
,
sid
->
revision
,
((
unsigned
int
)
sid
->
id_auth
[
2
]
<<
24
)
|
len
=
snprintf
(
buffer
,
sizeof
(
buffer
),
"User
\\
S-%u-%u"
,
sid
->
revision
,
((
unsigned
int
)
sid
->
id_auth
[
3
]
<<
16
)
|
((
unsigned
int
)
sid
->
id_auth
[
2
]
<<
24
)
|
((
unsigned
int
)
sid
->
id_auth
[
4
]
<<
8
)
|
((
unsigned
int
)
sid
->
id_auth
[
3
]
<<
16
)
|
((
unsigned
int
)
sid
->
id_auth
[
5
])
);
((
unsigned
int
)
sid
->
id_auth
[
4
]
<<
8
)
|
for
(
i
=
0
;
i
<
sid
->
sub_count
;
i
++
)
p
+=
sprintf
(
p
,
"-%u"
,
sid
->
sub_auth
[
i
]
);
((
unsigned
int
)
sid
->
id_auth
[
5
])
);
for
(
i
=
0
;
i
<
sid
->
sub_count
;
i
++
)
len
+=
snprintf
(
buffer
+
len
,
sizeof
(
buffer
)
-
len
,
"-%u"
,
sid
->
sub_auth
[
i
]
);
return
ascii_to_unicode_str
(
buffer
,
path
);
return
ascii_to_unicode_str
(
buffer
,
path
);
}
}
...
...
server/trace.c
View file @
9b4e3718
...
@@ -5645,7 +5645,7 @@ static const char *get_status_name( unsigned int status )
...
@@ -5645,7 +5645,7 @@ static const char *get_status_name( unsigned int status )
for
(
i
=
0
;
status_names
[
i
].
name
;
i
++
)
for
(
i
=
0
;
status_names
[
i
].
name
;
i
++
)
if
(
status_names
[
i
].
value
==
status
)
return
status_names
[
i
].
name
;
if
(
status_names
[
i
].
value
==
status
)
return
status_names
[
i
].
name
;
}
}
s
printf
(
buffer
,
"%x"
,
status
);
s
nprintf
(
buffer
,
sizeof
(
buffer
)
,
"%x"
,
status
);
return
buffer
;
return
buffer
;
}
}
...
...
server/unicode.c
View file @
9b4e3718
...
@@ -212,19 +212,19 @@ int dump_strW( const WCHAR *str, data_size_t len, FILE *f, const char escape[2]
...
@@ -212,19 +212,19 @@ int dump_strW( const WCHAR *str, data_size_t len, FILE *f, const char escape[2]
if
(
*
str
>
127
)
/* hex escape */
if
(
*
str
>
127
)
/* hex escape */
{
{
if
(
len
>
1
&&
str
[
1
]
<
128
&&
isxdigit
((
char
)
str
[
1
]))
if
(
len
>
1
&&
str
[
1
]
<
128
&&
isxdigit
((
char
)
str
[
1
]))
pos
+=
s
printf
(
pos
,
"
\\
x%04x"
,
*
str
);
pos
+=
s
nprintf
(
pos
,
sizeof
(
buffer
)
-
(
pos
-
buffer
)
,
"
\\
x%04x"
,
*
str
);
else
else
pos
+=
s
printf
(
pos
,
"
\\
x%x"
,
*
str
);
pos
+=
s
nprintf
(
pos
,
sizeof
(
buffer
)
-
(
pos
-
buffer
)
,
"
\\
x%x"
,
*
str
);
continue
;
continue
;
}
}
if
(
*
str
<
32
)
/* octal or C escape */
if
(
*
str
<
32
)
/* octal or C escape */
{
{
if
(
escapes
[
*
str
]
!=
'.'
)
if
(
escapes
[
*
str
]
!=
'.'
)
pos
+=
s
printf
(
pos
,
"
\\
%c"
,
escapes
[
*
str
]
);
pos
+=
s
nprintf
(
pos
,
sizeof
(
buffer
)
-
(
pos
-
buffer
)
,
"
\\
%c"
,
escapes
[
*
str
]
);
else
if
(
len
>
1
&&
str
[
1
]
>=
'0'
&&
str
[
1
]
<=
'7'
)
else
if
(
len
>
1
&&
str
[
1
]
>=
'0'
&&
str
[
1
]
<=
'7'
)
pos
+=
s
printf
(
pos
,
"
\\
%03o"
,
*
str
);
pos
+=
s
nprintf
(
pos
,
sizeof
(
buffer
)
-
(
pos
-
buffer
)
,
"
\\
%03o"
,
*
str
);
else
else
pos
+=
s
printf
(
pos
,
"
\\
%o"
,
*
str
);
pos
+=
s
nprintf
(
pos
,
sizeof
(
buffer
)
-
(
pos
-
buffer
)
,
"
\\
%o"
,
*
str
);
continue
;
continue
;
}
}
if
(
*
str
==
'\\'
||
*
str
==
escape
[
0
]
||
*
str
==
escape
[
1
])
*
pos
++
=
'\\'
;
if
(
*
str
==
'\\'
||
*
str
==
escape
[
0
]
||
*
str
==
escape
[
1
])
*
pos
++
=
'\\'
;
...
...
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