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
e09dfcfa
Commit
e09dfcfa
authored
Jul 17, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 17, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Rename WININET_strdup_AtoW to heap_strdupAtoW and handle NULL argument…
wininet: Rename WININET_strdup_AtoW to heap_strdupAtoW and handle NULL argument in its implementation.
parent
f5987092
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
22 deletions
+29
-22
ftp.c
dlls/wininet/ftp.c
+16
-16
internet.h
dlls/wininet/internet.h
+12
-5
utility.c
dlls/wininet/utility.c
+1
-1
No files found.
dlls/wininet/ftp.c
View file @
e09dfcfa
...
...
@@ -228,8 +228,8 @@ BOOL WINAPI FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
LPWSTR
lpwzNewRemoteFile
;
BOOL
ret
;
lpwzLocalFile
=
lpszLocalFile
?
WININET_strdup_AtoW
(
lpszLocalFile
)
:
NULL
;
lpwzNewRemoteFile
=
lpszNewRemoteFile
?
WININET_strdup_AtoW
(
lpszNewRemoteFile
)
:
NULL
;
lpwzLocalFile
=
heap_strdupAtoW
(
lpszLocalFile
)
;
lpwzNewRemoteFile
=
heap_strdupAtoW
(
lpszNewRemoteFile
)
;
ret
=
FtpPutFileW
(
hConnect
,
lpwzLocalFile
,
lpwzNewRemoteFile
,
dwFlags
,
dwContext
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwzLocalFile
);
...
...
@@ -413,7 +413,7 @@ BOOL WINAPI FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
LPWSTR
lpwzDirectory
;
BOOL
ret
;
lpwzDirectory
=
lpszDirectory
?
WININET_strdup_AtoW
(
lpszDirectory
)
:
NULL
;
lpwzDirectory
=
heap_strdupAtoW
(
lpszDirectory
)
;
ret
=
FtpSetCurrentDirectoryW
(
hConnect
,
lpwzDirectory
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwzDirectory
);
return
ret
;
...
...
@@ -559,7 +559,7 @@ BOOL WINAPI FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
LPWSTR
lpwzDirectory
;
BOOL
ret
;
lpwzDirectory
=
lpszDirectory
?
WININET_strdup_AtoW
(
lpszDirectory
)
:
NULL
;
lpwzDirectory
=
heap_strdupAtoW
(
lpszDirectory
)
;
ret
=
FtpCreateDirectoryW
(
hConnect
,
lpwzDirectory
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwzDirectory
);
return
ret
;
...
...
@@ -708,7 +708,7 @@ HINTERNET WINAPI FtpFindFirstFileA(HINTERNET hConnect,
LPWIN32_FIND_DATAW
lpFindFileDataW
;
HINTERNET
ret
;
lpwzSearchFile
=
lpszSearchFile
?
WININET_strdup_AtoW
(
lpszSearchFile
)
:
NULL
;
lpwzSearchFile
=
heap_strdupAtoW
(
lpszSearchFile
)
;
lpFindFileDataW
=
lpFindFileData
?&
wfd
:
NULL
;
ret
=
FtpFindFirstFileW
(
hConnect
,
lpwzSearchFile
,
lpFindFileDataW
,
dwFlags
,
dwContext
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwzSearchFile
);
...
...
@@ -1034,7 +1034,7 @@ static BOOL FTP_FtpGetCurrentDirectoryW(ftp_session_t *lpwfs, LPWSTR lpszCurrent
if
(
nResCode
==
257
)
/* Extract directory name */
{
DWORD
firstpos
,
lastpos
,
len
;
LPWSTR
lpszResponseBuffer
=
WININET_strdup_
AtoW
(
INTERNET_GetResponseBuffer
());
LPWSTR
lpszResponseBuffer
=
heap_strdup
AtoW
(
INTERNET_GetResponseBuffer
());
for
(
firstpos
=
0
,
lastpos
=
0
;
lpszResponseBuffer
[
lastpos
];
lastpos
++
)
{
...
...
@@ -1355,7 +1355,7 @@ HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
LPWSTR
lpwzFileName
;
HINTERNET
ret
;
lpwzFileName
=
lpszFileName
?
WININET_strdup_AtoW
(
lpszFileName
)
:
NULL
;
lpwzFileName
=
heap_strdupAtoW
(
lpszFileName
)
;
ret
=
FtpOpenFileW
(
hFtpSession
,
lpwzFileName
,
fdwAccess
,
dwFlags
,
dwContext
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwzFileName
);
return
ret
;
...
...
@@ -1469,8 +1469,8 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
LPWSTR
lpwzNewFile
;
BOOL
ret
;
lpwzRemoteFile
=
lpszRemoteFile
?
WININET_strdup_AtoW
(
lpszRemoteFile
)
:
NULL
;
lpwzNewFile
=
lpszNewFile
?
WININET_strdup_AtoW
(
lpszNewFile
)
:
NULL
;
lpwzRemoteFile
=
heap_strdupAtoW
(
lpszRemoteFile
)
;
lpwzNewFile
=
heap_strdupAtoW
(
lpszNewFile
)
;
ret
=
FtpGetFileW
(
hInternet
,
lpwzRemoteFile
,
lpwzNewFile
,
fFailIfExists
,
dwLocalFlagsAttribute
,
dwInternetFlags
,
dwContext
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwzRemoteFile
);
...
...
@@ -1676,7 +1676,7 @@ BOOL WINAPI FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
LPWSTR
lpwzFileName
;
BOOL
ret
;
lpwzFileName
=
lpszFileName
?
WININET_strdup_AtoW
(
lpszFileName
)
:
NULL
;
lpwzFileName
=
heap_strdupAtoW
(
lpszFileName
)
;
ret
=
FtpDeleteFileW
(
hFtpSession
,
lpwzFileName
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwzFileName
);
return
ret
;
...
...
@@ -1821,7 +1821,7 @@ BOOL WINAPI FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
LPWSTR
lpwzDirectory
;
BOOL
ret
;
lpwzDirectory
=
lpszDirectory
?
WININET_strdup_AtoW
(
lpszDirectory
)
:
NULL
;
lpwzDirectory
=
heap_strdupAtoW
(
lpszDirectory
)
;
ret
=
FtpRemoveDirectoryW
(
hFtpSession
,
lpwzDirectory
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwzDirectory
);
return
ret
;
...
...
@@ -1968,8 +1968,8 @@ BOOL WINAPI FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDes
LPWSTR
lpwzDest
;
BOOL
ret
;
lpwzSrc
=
lpszSrc
?
WININET_strdup_AtoW
(
lpszSrc
)
:
NULL
;
lpwzDest
=
lpszDest
?
WININET_strdup_AtoW
(
lpszDest
)
:
NULL
;
lpwzSrc
=
heap_strdupAtoW
(
lpszSrc
)
;
lpwzDest
=
heap_strdupAtoW
(
lpszDest
)
;
ret
=
FtpRenameFileW
(
hFtpSession
,
lpwzSrc
,
lpwzDest
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwzSrc
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwzDest
);
...
...
@@ -2131,7 +2131,7 @@ BOOL WINAPI FtpCommandA( HINTERNET hConnect, BOOL fExpectResponse, DWORD dwFlags
return
FALSE
;
}
if
(
!
(
cmdW
=
WININET_strdup_
AtoW
(
lpszCommand
)))
if
(
!
(
cmdW
=
heap_strdup
AtoW
(
lpszCommand
)))
{
INTERNET_SetLastError
(
ERROR_OUTOFMEMORY
);
return
FALSE
;
...
...
@@ -3578,7 +3578,7 @@ static BOOL FTP_ParseNextFile(INT nSocket, LPCWSTR lpszSearchFile, LPFILEPROPERT
pszToken
=
strtok
(
NULL
,
szSpace
);
if
(
!
pszToken
)
continue
;
lpfp
->
lpszName
=
WININET_strdup_
AtoW
(
pszToken
);
lpfp
->
lpszName
=
heap_strdup
AtoW
(
pszToken
);
TRACE
(
"File: %s
\n
"
,
debugstr_w
(
lpfp
->
lpszName
));
}
/* NT way of parsing ... :
...
...
@@ -3627,7 +3627,7 @@ static BOOL FTP_ParseNextFile(INT nSocket, LPCWSTR lpszSearchFile, LPFILEPROPERT
pszToken
=
strtok
(
NULL
,
szSpace
);
if
(
!
pszToken
)
continue
;
lpfp
->
lpszName
=
WININET_strdup_
AtoW
(
pszToken
);
lpfp
->
lpszName
=
heap_strdup
AtoW
(
pszToken
);
TRACE
(
"Name: %s
\n
"
,
debugstr_w
(
lpfp
->
lpszName
));
}
/* EPLF format - http://cr.yp.to/ftp/list/eplf.html */
...
...
dlls/wininet/internet.h
View file @
e09dfcfa
...
...
@@ -71,12 +71,19 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
return
ret
;
}
static
inline
LPWSTR
WININET_strdup_AtoW
(
LPCSTR
str
)
static
inline
WCHAR
*
heap_strdupAtoW
(
const
char
*
str
)
{
int
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
LPWSTR
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
ret
)
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
LPWSTR
ret
=
NULL
;
if
(
str
)
{
DWORD
len
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
ret
)
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
}
return
ret
;
}
...
...
dlls/wininet/utility.c
View file @
e09dfcfa
...
...
@@ -306,7 +306,7 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext,
case
INTERNET_STATUS_NAME_RESOLVED
:
case
INTERNET_STATUS_CONNECTING_TO_SERVER
:
case
INTERNET_STATUS_CONNECTED_TO_SERVER
:
lpvNewInfo
=
WININET_strdup_
AtoW
(
lpvStatusInfo
);
lpvNewInfo
=
heap_strdup
AtoW
(
lpvStatusInfo
);
break
;
case
INTERNET_STATUS_RESOLVING_NAME
:
case
INTERNET_STATUS_REDIRECT
:
...
...
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