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

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

Issue 1611343002: wtf reformat test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pydent Created 4 years, 11 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 22 matching lines...) Expand all
33 33
34 #if OS(POSIX) 34 #if OS(POSIX)
35 #include <strings.h> 35 #include <strings.h>
36 #endif 36 #endif
37 37
38 #if COMPILER(MSVC) 38 #if COMPILER(MSVC)
39 // FIXME: why a COMPILER check instead of OS? also, these should be HAVE checks 39 // FIXME: why a COMPILER check instead of OS? also, these should be HAVE checks
40 40
41 #if _MSC_VER < 1900 41 #if _MSC_VER < 1900
42 // snprintf is implemented in VS 2015 42 // snprintf is implemented in VS 2015
43 inline int snprintf(char* buffer, size_t count, const char* format, ...) 43 inline int snprintf(char* buffer, size_t count, const char* format, ...) {
44 { 44 int result;
45 int result; 45 va_list args;
46 va_list args; 46 va_start(args, format);
47 va_start(args, format); 47 result = _vsnprintf(buffer, count, format, args);
48 result = _vsnprintf(buffer, count, format, args); 48 va_end(args);
49 va_end(args);
50 49
51 // In the case where the string entirely filled the buffer, _vsnprintf will not 50 // In the case where the string entirely filled the buffer, _vsnprintf will no t
52 // null-terminate it, but snprintf must. 51 // null-terminate it, but snprintf must.
53 if (count > 0) 52 if (count > 0)
54 buffer[count - 1] = '\0'; 53 buffer[count - 1] = '\0';
55 54
56 return result; 55 return result;
57 } 56 }
58 57
59 inline double wtf_vsnprintf(char* buffer, size_t count, const char* format, va_l ist args) 58 inline double wtf_vsnprintf(char* buffer,
60 { 59 size_t count,
61 int result = _vsnprintf(buffer, count, format, args); 60 const char* format,
61 va_list args) {
62 int result = _vsnprintf(buffer, count, format, args);
62 63
63 // In the case where the string entirely filled the buffer, _vsnprintf will not 64 // In the case where the string entirely filled the buffer, _vsnprintf will no t
64 // null-terminate it, but vsnprintf must. 65 // null-terminate it, but vsnprintf must.
65 if (count > 0) 66 if (count > 0)
66 buffer[count - 1] = '\0'; 67 buffer[count - 1] = '\0';
67 68
68 return result; 69 return result;
69 } 70 }
70 71
71 // Work around a difference in Microsoft's implementation of vsnprintf, where 72 // Work around a difference in Microsoft's implementation of vsnprintf, where
72 // vsnprintf does not null terminate the buffer. WebKit can rely on the null 73 // vsnprintf does not null terminate the buffer. WebKit can rely on the null
73 // termination. Microsoft's implementation is fixed in VS 2015. 74 // termination. Microsoft's implementation is fixed in VS 2015.
74 #define vsnprintf(buffer, count, format, args) wtf_vsnprintf(buffer, count, form at, args) 75 #define vsnprintf(buffer, count, format, args) \
76 wtf_vsnprintf(buffer, count, format, args)
75 #endif 77 #endif
76 78
77 inline int strncasecmp(const char* s1, const char* s2, size_t len) 79 inline int strncasecmp(const char* s1, const char* s2, size_t len) {
78 { 80 return _strnicmp(s1, s2, len);
79 return _strnicmp(s1, s2, len);
80 } 81 }
81 82
82 inline int strcasecmp(const char* s1, const char* s2) 83 inline int strcasecmp(const char* s1, const char* s2) {
83 { 84 return _stricmp(s1, s2);
84 return _stricmp(s1, s2);
85 } 85 }
86 86
87 #endif 87 #endif
88 88
89 #endif // WTF_StringExtras_h 89 #endif // WTF_StringExtras_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/StdLibExtras.h ('k') | third_party/WebKit/Source/wtf/StringExtrasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698