Commit 353ce51b authored by Jon Griffiths's avatar Jon Griffiths Committed by Alexandre Julliard

Make hex digits static const & share them.

parent f5b34b5b
...@@ -56,6 +56,8 @@ typedef enum { ...@@ -56,6 +56,8 @@ typedef enum {
USERPASS, USERPASS,
} WINE_URL_SCAN_TYPE; } WINE_URL_SCAN_TYPE;
static const CHAR hexDigits[] = "0123456789ABCDEF";
static const WCHAR fileW[] = {'f','i','l','e','\0'}; static const WCHAR fileW[] = {'f','i','l','e','\0'};
static const unsigned char HashDataLookup[256] = { static const unsigned char HashDataLookup[256] = {
...@@ -730,7 +732,6 @@ HRESULT WINAPI UrlEscapeA( ...@@ -730,7 +732,6 @@ HRESULT WINAPI UrlEscapeA(
DWORD needed = 0, ret; DWORD needed = 0, ret;
BOOL stop_escaping = FALSE; BOOL stop_escaping = FALSE;
char next[3], *dst = pszEscaped; char next[3], *dst = pszEscaped;
char hex[] = "0123456789ABCDEF";
INT len; INT len;
TRACE("(%s %p %p 0x%08lx)\n", debugstr_a(pszUrl), pszEscaped, TRACE("(%s %p %p 0x%08lx)\n", debugstr_a(pszUrl), pszEscaped,
...@@ -762,8 +763,8 @@ HRESULT WINAPI UrlEscapeA( ...@@ -762,8 +763,8 @@ HRESULT WINAPI UrlEscapeA(
if(URL_NeedEscapeA(*src, dwFlags) && stop_escaping == FALSE) { if(URL_NeedEscapeA(*src, dwFlags) && stop_escaping == FALSE) {
/* TRACE("escaping %c\n", *src); */ /* TRACE("escaping %c\n", *src); */
next[0] = '%'; next[0] = '%';
next[1] = hex[(*src >> 4) & 0xf]; next[1] = hexDigits[(*src >> 4) & 0xf];
next[2] = hex[*src & 0xf]; next[2] = hexDigits[*src & 0xf];
len = 3; len = 3;
} else { } else {
/* TRACE("passing %c\n", *src); */ /* TRACE("passing %c\n", *src); */
...@@ -804,7 +805,6 @@ HRESULT WINAPI UrlEscapeW( ...@@ -804,7 +805,6 @@ HRESULT WINAPI UrlEscapeW(
DWORD needed = 0, ret; DWORD needed = 0, ret;
BOOL stop_escaping = FALSE; BOOL stop_escaping = FALSE;
WCHAR next[5], *dst = pszEscaped; WCHAR next[5], *dst = pszEscaped;
CHAR hex[] = "0123456789ABCDEF";
INT len; INT len;
TRACE("(%s %p %p 0x%08lx)\n", debugstr_w(pszUrl), pszEscaped, TRACE("(%s %p %p 0x%08lx)\n", debugstr_w(pszUrl), pszEscaped,
...@@ -846,14 +846,14 @@ HRESULT WINAPI UrlEscapeW( ...@@ -846,14 +846,14 @@ HRESULT WINAPI UrlEscapeW(
* the character with 4 hex digits (or even 8), * the character with 4 hex digits (or even 8),
* however, experiments show that native shlwapi escapes * however, experiments show that native shlwapi escapes
* with only 2 hex digits. * with only 2 hex digits.
* next[1] = hex[(*src >> 12) & 0xf]; * next[1] = hexDigits[(*src >> 12) & 0xf];
* next[2] = hex[(*src >> 8) & 0xf]; * next[2] = hexDigits[(*src >> 8) & 0xf];
* next[3] = hex[(*src >> 4) & 0xf]; * next[3] = hexDigits[(*src >> 4) & 0xf];
* next[4] = hex[*src & 0xf]; * next[4] = hexDigits[*src & 0xf];
* len = 5; * len = 5;
*/ */
next[1] = hex[(*src >> 4) & 0xf]; next[1] = hexDigits[(*src >> 4) & 0xf];
next[2] = hex[*src & 0xf]; next[2] = hexDigits[*src & 0xf];
len = 3; len = 3;
} else { } else {
/* TRACE("passing %c\n", *src); */ /* TRACE("passing %c\n", *src); */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment