Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: Source/wtf/StringExtras.h

Issue 13901012: Remove OS(WINCE) as blink and chromium does not support WinCe. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (count > 0) 62 if (count > 0)
63 buffer[count - 1] = '\0'; 63 buffer[count - 1] = '\0';
64 64
65 return result; 65 return result;
66 } 66 }
67 67
68 // Work around a difference in Microsoft's implementation of vsnprintf, where 68 // Work around a difference in Microsoft's implementation of vsnprintf, where
69 // vsnprintf does not null terminate the buffer. WebKit can rely on the null ter mination. 69 // vsnprintf does not null terminate the buffer. WebKit can rely on the null ter mination.
70 #define vsnprintf(buffer, count, format, args) wtf_vsnprintf(buffer, count, form at, args) 70 #define vsnprintf(buffer, count, format, args) wtf_vsnprintf(buffer, count, form at, args)
71 71
72 #if OS(WINCE)
73
74 inline int strnicmp(const char* string1, const char* string2, size_t count)
75 {
76 return _strnicmp(string1, string2, count);
77 }
78
79 inline int stricmp(const char* string1, const char* string2)
80 {
81 return _stricmp(string1, string2);
82 }
83
84 inline char* strdup(const char* strSource)
85 {
86 return _strdup(strSource);
87 }
88
89 #endif
90
91 inline int strncasecmp(const char* s1, const char* s2, size_t len) 72 inline int strncasecmp(const char* s1, const char* s2, size_t len)
92 { 73 {
93 return _strnicmp(s1, s2, len); 74 return _strnicmp(s1, s2, len);
94 } 75 }
95 76
96 inline int strcasecmp(const char* s1, const char* s2) 77 inline int strcasecmp(const char* s1, const char* s2)
97 { 78 {
98 return _stricmp(s1, s2); 79 return _stricmp(s1, s2);
99 } 80 }
100 81
101 #endif 82 #endif
102 83
103 #if !HAVE(STRNSTR) 84 #if !HAVE(STRNSTR)
104 85
105 inline char* strnstr(const char* buffer, const char* target, size_t bufferLength ) 86 inline char* strnstr(const char* buffer, const char* target, size_t bufferLength )
106 { 87 {
107 size_t targetLength = strlen(target); 88 size_t targetLength = strlen(target);
108 if (targetLength == 0) 89 if (targetLength == 0)
109 return const_cast<char*>(buffer); 90 return const_cast<char*>(buffer);
110 for (const char* start = buffer; *start && start + targetLength <= buffer + bufferLength; start++) { 91 for (const char* start = buffer; *start && start + targetLength <= buffer + bufferLength; start++) {
111 if (*start == *target && strncmp(start + 1, target + 1, targetLength - 1 ) == 0) 92 if (*start == *target && strncmp(start + 1, target + 1, targetLength - 1 ) == 0)
112 return const_cast<char*>(start); 93 return const_cast<char*>(start);
113 } 94 }
114 return 0; 95 return 0;
115 } 96 }
116 97
117 #endif 98 #endif
118 99
119 #endif // WTF_StringExtras_h 100 #endif // WTF_StringExtras_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698