wininet: Avoid a conflict with the sun macro when compiling on Solaris. (try 2)
Francois Gouget
fgouget at codeweavers.com
Fri Mar 11 11:22:23 CST 2011
---
dlls/wininet/http.c | 27 ++++++++++++---------------
1 files changed, 12 insertions(+), 15 deletions(-)
The previous try did not apply. I suspect that's because I used icedove
and inlined the patch instead of attaching it (I rarely use icedove so I
tend to forget this detail).
This really did seem to call for an array+loop treatment so I'm
resubmiting a slightly different version this time around (and I'll try
to keep a closer eye on it this time, if only for bug 26385).
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index a0574bf..5ae3e4d 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3582,21 +3582,18 @@ 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 days[7][4] = {{ 's','u','n',0 },
+ { 'm','o','n',0 },
+ { 't','u','e',0 },
+ { 'w','e','d',0 },
+ { 't','h','u',0 },
+ { 'f','r','i',0 },
+ { 's','a','t',0 }};
+ int i;
+ for (i = 0; i < sizeof(days)/sizeof(*days); i++)
+ if (!strcmpiW(day, days[i]))
+ return i;
+
/* Invalid */
return 7;
}
--
1.7.2.3
More information about the wine-patches
mailing list