summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-24 22:01:00 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-24 22:01:00 +0000
commit1e13a939b177960b7048b8532205bc369501d399 (patch)
treeedd1afd10b00d768db2280e4157bc198d6445b33 /src/modules
parentc619ad70603e5355e68e78001df154c98306e805 (diff)
char* mir_urlEncode(const char *szUrl) added
git-svn-id: http://svn.miranda-ng.org/main/trunk@4180 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/netlib/netlib.cpp38
1 files changed, 7 insertions, 31 deletions
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp
index 4245a0e5d6..5758824627 100644
--- a/src/modules/netlib/netlib.cpp
+++ b/src/modules/netlib/netlib.cpp
@@ -409,43 +409,19 @@ INT_PTR NetlibShutdown(WPARAM wParam, LPARAM)
return 0;
}
-static const char szHexDigits[] = "0123456789ABCDEF";
INT_PTR NetlibHttpUrlEncode(WPARAM, LPARAM lParam)
{
- unsigned char *szOutput, *szInput = (unsigned char*)lParam;
- unsigned char *pszIn, *pszOut;
- int outputLen;
-
- if (szInput == NULL) {
+ if (lParam == NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
- return (INT_PTR)(char*)NULL;
- }
- for (outputLen = 0, pszIn = szInput;*pszIn;pszIn++) {
- if ((48 <= *pszIn && *pszIn <= 57) || //0-9
- (65 <= *pszIn && *pszIn <= 90) || //ABC...XYZ
- (97 <= *pszIn && *pszIn <= 122) || //abc...xyz
- *pszIn == '-' || *pszIn == '_' || *pszIn == '.' || *pszIn == ' ') outputLen++;
- else outputLen+=3;
+ return NULL;
}
- szOutput = (unsigned char*)HeapAlloc(GetProcessHeap(), 0, outputLen+1);
- if (szOutput == NULL) {
+
+ char *p = mir_urlEncode((LPCSTR)lParam);
+ if (p == NULL) {
SetLastError(ERROR_OUTOFMEMORY);
- return (INT_PTR)(unsigned char*)NULL;
- }
- for (pszOut = szOutput, pszIn = szInput;*pszIn;pszIn++) {
- if ((48 <= *pszIn && *pszIn <= 57) ||
- (65 <= *pszIn && *pszIn <= 90) ||
- (97 <= *pszIn && *pszIn <= 122) ||
- *pszIn == '-' || *pszIn == '_' || *pszIn == '.') *pszOut++=*pszIn;
- else if (*pszIn == ' ') *pszOut++='+';
- else {
- *pszOut++='%';
- *pszOut++=szHexDigits[*pszIn>>4];
- *pszOut++=szHexDigits[*pszIn&0xF];
- }
+ return NULL;
}
- *pszOut = '\0';
- return (INT_PTR)szOutput;
+ return (INT_PTR)p;
}
static const char base64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";