Jacek Caban : urlmon: Move strndupW implementation to header file.
Alexandre Julliard
julliard at winehq.org
Mon Mar 2 09:01:39 CST 2009
Module: wine
Branch: master
Commit: 4ae60c6f006a1f6da054b46bbc371b5256a12db9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4ae60c6f006a1f6da054b46bbc371b5256a12db9
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Mar 2 03:19:18 2009 +0100
urlmon: Move strndupW implementation to header file.
---
dlls/urlmon/http.c | 20 ++++----------------
dlls/urlmon/urlmon_main.h | 15 +++++++++++++++
2 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/dlls/urlmon/http.c b/dlls/urlmon/http.c
index edaa340..87d2036 100644
--- a/dlls/urlmon/http.c
+++ b/dlls/urlmon/http.c
@@ -219,18 +219,6 @@ static void CALLBACK HTTPPROTOCOL_InternetStatusCallback(
IInternetProtocolSink_ReportProgress(This->base.protocol_sink, ulStatusCode, (LPWSTR)lpvStatusInformation);
}
-static inline LPWSTR strndupW(LPCWSTR string, int len)
-{
- LPWSTR ret = NULL;
- if (string &&
- (ret = heap_alloc((len+1)*sizeof(WCHAR))) != NULL)
- {
- memcpy(ret, string, len*sizeof(WCHAR));
- ret[len] = 0;
- }
- return ret;
-}
-
/*
* Interface implementations
*/
@@ -345,10 +333,10 @@ static HRESULT WINAPI HttpProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
hres = MK_E_SYNTAX;
goto done;
}
- host = strndupW(url.lpszHostName, url.dwHostNameLength);
- path = strndupW(url.lpszUrlPath, url.dwUrlPathLength);
- user = strndupW(url.lpszUserName, url.dwUserNameLength);
- pass = strndupW(url.lpszPassword, url.dwPasswordLength);
+ host = heap_strndupW(url.lpszHostName, url.dwHostNameLength);
+ path = heap_strndupW(url.lpszUrlPath, url.dwUrlPathLength);
+ user = heap_strndupW(url.lpszUserName, url.dwUserNameLength);
+ pass = heap_strndupW(url.lpszPassword, url.dwPasswordLength);
if (!url.nPort)
url.nPort = This->https ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT;
diff --git a/dlls/urlmon/urlmon_main.h b/dlls/urlmon/urlmon_main.h
index bc2fea8..36862d1 100644
--- a/dlls/urlmon/urlmon_main.h
+++ b/dlls/urlmon/urlmon_main.h
@@ -133,6 +133,21 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
return ret;
}
+static inline LPWSTR heap_strndupW(LPCWSTR str, int len)
+{
+ LPWSTR ret = NULL;
+
+ if(str) {
+ ret = heap_alloc((len+1)*sizeof(WCHAR));
+ if(ret) {
+ memcpy(ret, str, len*sizeof(WCHAR));
+ ret[len] = 0;
+ }
+ }
+
+ return ret;
+}
+
static inline LPWSTR heap_strdupAtoW(const char *str)
{
LPWSTR ret = NULL;
More information about the wine-cvs
mailing list