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

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

Issue 2386843002: reflow comments in wtf (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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 29 matching lines...) Expand all
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 int result; 44 int result;
45 va_list args; 45 va_list args;
46 va_start(args, format); 46 va_start(args, format);
47 result = _vsnprintf(buffer, count, format, args); 47 result = _vsnprintf(buffer, count, format, args);
48 va_end(args); 48 va_end(args);
49 49
50 // In the case where the string entirely filled the buffer, _vsnprintf will no t 50 // In the case where the string entirely filled the buffer, _vsnprintf will
51 // null-terminate it, but snprintf must. 51 // not null-terminate it, but snprintf must.
52 if (count > 0) 52 if (count > 0)
53 buffer[count - 1] = '\0'; 53 buffer[count - 1] = '\0';
54 54
55 return result; 55 return result;
56 } 56 }
57 57
58 inline double wtf_vsnprintf(char* buffer, 58 inline double wtf_vsnprintf(char* buffer,
59 size_t count, 59 size_t count,
60 const char* format, 60 const char* format,
61 va_list args) { 61 va_list args) {
62 int result = _vsnprintf(buffer, count, format, args); 62 int result = _vsnprintf(buffer, count, format, args);
63 63
64 // In the case where the string entirely filled the buffer, _vsnprintf will no t 64 // In the case where the string entirely filled the buffer, _vsnprintf will
65 // null-terminate it, but vsnprintf must. 65 // not null-terminate it, but vsnprintf must.
66 if (count > 0) 66 if (count > 0)
67 buffer[count - 1] = '\0'; 67 buffer[count - 1] = '\0';
68 68
69 return result; 69 return result;
70 } 70 }
71 71
72 // Work around a difference in Microsoft's implementation of vsnprintf, where 72 // Work around a difference in Microsoft's implementation of vsnprintf, where
73 // 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
74 // termination. Microsoft's implementation is fixed in VS 2015. 74 // termination. Microsoft's implementation is fixed in VS 2015.
75 #define vsnprintf(buffer, count, format, args) \ 75 #define vsnprintf(buffer, count, format, args) \
76 wtf_vsnprintf(buffer, count, format, args) 76 wtf_vsnprintf(buffer, count, format, args)
77 #endif 77 #endif
78 78
79 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) {
80 return _strnicmp(s1, s2, len); 80 return _strnicmp(s1, s2, len);
81 } 81 }
82 82
83 inline int strcasecmp(const char* s1, const char* s2) { 83 inline int strcasecmp(const char* s1, const char* s2) {
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/StringHasher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698