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
a667d536
Commit
a667d536
authored
Mar 29, 2005
by
Peter Berg Larsen
Committed by
Alexandre Julliard
Mar 29, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Janitorial: Get rid of strncpy/strncpyW.
parent
4a8ce2ae
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
16 deletions
+19
-16
format.c
dlls/msacm/format.c
+4
-5
psapi_main.c
dlls/psapi/psapi_main.c
+4
-2
text.c
dlls/user/text.c
+3
-3
netconnection.c
dlls/wininet/netconnection.c
+8
-6
No files found.
dlls/msacm/format.c
View file @
a667d536
...
@@ -72,7 +72,7 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
...
@@ -72,7 +72,7 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
if
(
acmDriverOpen
(
&
had
,
hadid
,
0
)
==
MMSYSERR_NOERROR
)
{
if
(
acmDriverOpen
(
&
had
,
hadid
,
0
)
==
MMSYSERR_NOERROR
)
{
ACMFORMATDETAILSA
afd
;
ACMFORMATDETAILSA
afd
;
unsigned
int
i
,
idx
;
unsigned
int
i
,
len
;
MMRESULT
mmr
;
MMRESULT
mmr
;
char
buffer
[
ACMFORMATDETAILS_FORMAT_CHARS
+
16
];
char
buffer
[
ACMFORMATDETAILS_FORMAT_CHARS
+
16
];
...
@@ -88,10 +88,9 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
...
@@ -88,10 +88,9 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
afd
.
dwFormatIndex
=
i
;
afd
.
dwFormatIndex
=
i
;
mmr
=
acmFormatDetailsA
(
had
,
&
afd
,
ACM_FORMATDETAILSF_INDEX
);
mmr
=
acmFormatDetailsA
(
had
,
&
afd
,
ACM_FORMATDETAILSF_INDEX
);
if
(
mmr
==
MMSYSERR_NOERROR
)
{
if
(
mmr
==
MMSYSERR_NOERROR
)
{
strncpy
(
buffer
,
afd
.
szFormat
,
ACMFORMATTAGDETAILS_FORMATTAG_CHARS
);
lstrcpynA
(
buffer
,
afd
.
szFormat
,
ACMFORMATTAGDETAILS_FORMATTAG_CHARS
+
1
);
for
(
idx
=
strlen
(
buffer
);
len
=
strlen
(
buffer
);
idx
<
ACMFORMATTAGDETAILS_FORMATTAG_CHARS
;
idx
++
)
memset
(
buffer
+
len
,
' '
,
ACMFORMATTAGDETAILS_FORMATTAG_CHARS
-
len
);
buffer
[
idx
]
=
' '
;
wsprintfA
(
buffer
+
ACMFORMATTAGDETAILS_FORMATTAG_CHARS
,
wsprintfA
(
buffer
+
ACMFORMATTAGDETAILS_FORMATTAG_CHARS
,
"%d Ko/s"
,
"%d Ko/s"
,
(
afd
.
pwfx
->
nAvgBytesPerSec
+
512
)
/
1024
);
(
afd
.
pwfx
->
nAvgBytesPerSec
+
512
)
/
1024
);
...
...
dlls/psapi/psapi_main.c
View file @
a667d536
...
@@ -338,6 +338,7 @@ DWORD WINAPI GetModuleBaseNameW(HANDLE hProcess, HMODULE hModule,
...
@@ -338,6 +338,7 @@ DWORD WINAPI GetModuleBaseNameW(HANDLE hProcess, HMODULE hModule,
{
{
WCHAR
tmp
[
MAX_PATH
];
WCHAR
tmp
[
MAX_PATH
];
WCHAR
*
ptr
;
WCHAR
*
ptr
;
int
ptrlen
;
if
(
!
lpBaseName
||
!
nSize
)
{
if
(
!
lpBaseName
||
!
nSize
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
...
@@ -349,8 +350,9 @@ DWORD WINAPI GetModuleBaseNameW(HANDLE hProcess, HMODULE hModule,
...
@@ -349,8 +350,9 @@ DWORD WINAPI GetModuleBaseNameW(HANDLE hProcess, HMODULE hModule,
return
0
;
return
0
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
tmp
));
TRACE
(
"%s
\n
"
,
debugstr_w
(
tmp
));
if
((
ptr
=
strrchrW
(
tmp
,
'\\'
))
!=
NULL
)
ptr
++
;
else
ptr
=
tmp
;
if
((
ptr
=
strrchrW
(
tmp
,
'\\'
))
!=
NULL
)
ptr
++
;
else
ptr
=
tmp
;
strncpyW
(
lpBaseName
,
ptr
,
nSize
);
ptrlen
=
strlenW
(
ptr
);
return
min
(
strlenW
(
ptr
),
nSize
);
memcpy
(
lpBaseName
,
ptr
,
min
(
ptrlen
+
1
,
nSize
)
*
sizeof
(
WCHAR
));
return
min
(
ptrlen
,
nSize
);
}
}
/***********************************************************************
/***********************************************************************
...
...
dlls/user/text.c
View file @
a667d536
...
@@ -163,7 +163,7 @@ static void TEXT_Ellipsify (HDC hdc, WCHAR *str, unsigned int max_len,
...
@@ -163,7 +163,7 @@ static void TEXT_Ellipsify (HDC hdc, WCHAR *str, unsigned int max_len,
/* Now this should take only a couple iterations at most. */
/* Now this should take only a couple iterations at most. */
for
(
;
;
)
for
(
;
;
)
{
{
strncpyW
(
str
+
*
len_str
,
ELLIPSISW
,
len_ellipsis
);
memcpy
(
str
+
*
len_str
,
ELLIPSISW
,
len_ellipsis
*
sizeof
(
WCHAR
)
);
if
(
!
GetTextExtentExPointW
(
hdc
,
str
,
*
len_str
+
len_ellipsis
,
width
,
if
(
!
GetTextExtentExPointW
(
hdc
,
str
,
*
len_str
+
len_ellipsis
,
width
,
NULL
,
NULL
,
size
))
break
;
NULL
,
NULL
,
size
))
break
;
...
@@ -178,7 +178,7 @@ static void TEXT_Ellipsify (HDC hdc, WCHAR *str, unsigned int max_len,
...
@@ -178,7 +178,7 @@ static void TEXT_Ellipsify (HDC hdc, WCHAR *str, unsigned int max_len,
if
(
modstr
)
if
(
modstr
)
{
{
strncpyW
(
modstr
,
str
,
*
len_str
);
memcpy
(
modstr
,
str
,
*
len_str
*
sizeof
(
WCHAR
)
);
*
(
str
+*
len_str
)
=
'\0'
;
*
(
str
+*
len_str
)
=
'\0'
;
}
}
}
}
...
@@ -253,7 +253,7 @@ static void TEXT_PathEllipsify (HDC hdc, WCHAR *str, unsigned int max_len,
...
@@ -253,7 +253,7 @@ static void TEXT_PathEllipsify (HDC hdc, WCHAR *str, unsigned int max_len,
/* overlap-safe movement to the right */
/* overlap-safe movement to the right */
memmove
(
lastSlash
+
len_ellipsis
,
lastSlash
,
len_trailing
*
sizeof
(
WCHAR
));
memmove
(
lastSlash
+
len_ellipsis
,
lastSlash
,
len_trailing
*
sizeof
(
WCHAR
));
strncpyW
(
lastSlash
,
ELLIPSISW
,
len_ellipsis
);
memcpy
(
lastSlash
,
ELLIPSISW
,
len_ellipsis
*
sizeof
(
WCHAR
)
);
len_trailing
+=
len_ellipsis
;
len_trailing
+=
len_ellipsis
;
/* From this point on lastSlash actually points to the ellipsis in front
/* From this point on lastSlash actually points to the ellipsis in front
* of the last slash and len_trailing includes the ellipsis
* of the last slash and len_trailing includes the ellipsis
...
...
dlls/wininet/netconnection.c
View file @
a667d536
...
@@ -354,16 +354,18 @@ BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int f
...
@@ -354,16 +354,18 @@ BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int f
}
}
else
if
(
flags
&
MSG_PEEK
&&
peek_msg
)
else
if
(
flags
&
MSG_PEEK
&&
peek_msg
)
{
{
if
(
len
<
strlen
(
peek_msg
))
size_t
peek_msg_len
=
strlen
(
peek_msg
);
if
(
len
<
peek_msg_len
)
FIXME
(
"buffer isn't big enough. Do the expect us to wrap?
\n
"
);
FIXME
(
"buffer isn't big enough. Do the expect us to wrap?
\n
"
);
strncpy
(
buf
,
peek_msg
,
len
);
memcpy
(
buf
,
peek_msg
,
min
(
len
,
peek_msg_len
+
1
)
);
*
recvd
=
(
strlen
(
peek_msg
)
<=
len
?
strlen
(
peek_msg
)
:
len
);
*
recvd
=
min
(
len
,
peek_msg_
len
);
return
TRUE
;
return
TRUE
;
}
}
else
if
(
peek_msg
)
else
if
(
peek_msg
)
{
{
strncpy
(
buf
,
peek_msg
,
len
);
size_t
peek_msg_len
=
strlen
(
peek_msg
);
peek_msg
+=
*
recvd
=
min
(
len
,
strlen
(
peek_msg
));
memcpy
(
buf
,
peek_msg
,
min
(
len
,
peek_msg_len
+
1
));
peek_msg
+=
*
recvd
=
min
(
len
,
peek_msg_len
);
if
(
*
peek_msg
==
'\0'
||
*
(
peek_msg
-
1
)
==
'\0'
)
if
(
*
peek_msg
==
'\0'
||
*
(
peek_msg
-
1
)
==
'\0'
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
peek_msg_mem
);
HeapFree
(
GetProcessHeap
(),
0
,
peek_msg_mem
);
...
@@ -383,7 +385,7 @@ BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int f
...
@@ -383,7 +385,7 @@ BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int f
}
}
else
else
{
{
strn
cpy
(
peek_msg
,
buf
,
*
recvd
);
mem
cpy
(
peek_msg
,
buf
,
*
recvd
);
peek_msg
[
*
recvd
]
=
'\0'
;
peek_msg
[
*
recvd
]
=
'\0'
;
}
}
}
}
...
...
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