wininet: Avoid a conflict with the sun macro when compiling on Solaris.
Francois Gouget
fgouget at codeweavers.com
Sat Mar 5 04:59:04 CST 2011
---
dlls/wininet/http.c | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
Of course there are many other ways to solve this. I chose to add a
trailing 'W' as is sometimes done to denote Unicode strings in Wine
code. I also chose to apply it uniformly to all the local variables for
consistency. Some other solutions would be to:
* '#undef sun' but that seems ugly.
* Rename only 'sun' but that would be inconsistent.
* Use the full day names for the variable names.
* Convert the variables to a single array and use a loop.
Let me know if one of these other solutions or yet another is preferred.
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index d47ebd6..9f60bf4 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3580,21 +3580,21 @@ static void HTTP_InsertCookies(http_request_t
*request)
static WORD HTTP_ParseDay(LPCWSTR day)
{
- static const WCHAR sun[] = { 's','u','n',0 };
- static const WCHAR mon[] = { 'm','o','n',0 };
- static const WCHAR tue[] = { 't','u','e',0 };
- static const WCHAR wed[] = { 'w','e','d',0 };
- static const WCHAR thu[] = { 't','h','u',0 };
- static const WCHAR fri[] = { 'f','r','i',0 };
- static const WCHAR sat[] = { 's','a','t',0 };
-
- if (!strcmpiW(day, sun)) return 0;
- if (!strcmpiW(day, mon)) return 1;
- if (!strcmpiW(day, tue)) return 2;
- if (!strcmpiW(day, wed)) return 3;
- if (!strcmpiW(day, thu)) return 4;
- if (!strcmpiW(day, fri)) return 5;
- if (!strcmpiW(day, sat)) return 6;
+ static const WCHAR sunW[] = { 's','u','n',0 };
+ static const WCHAR monW[] = { 'm','o','n',0 };
+ static const WCHAR tueW[] = { 't','u','e',0 };
+ static const WCHAR wedW[] = { 'w','e','d',0 };
+ static const WCHAR thuW[] = { 't','h','u',0 };
+ static const WCHAR friW[] = { 'f','r','i',0 };
+ static const WCHAR satW[] = { 's','a','t',0 };
+
+ if (!strcmpiW(day, sunW)) return 0;
+ if (!strcmpiW(day, monW)) return 1;
+ if (!strcmpiW(day, tueW)) return 2;
+ if (!strcmpiW(day, wedW)) return 3;
+ if (!strcmpiW(day, thuW)) return 4;
+ if (!strcmpiW(day, friW)) return 5;
+ if (!strcmpiW(day, satW)) return 6;
/* Invalid */
return 7;
}
--
1.7.2.3
More information about the wine-patches
mailing list