Changeset 62457 in webkit for trunk/JavaScriptCore/wtf/StringExtras.h
- Timestamp:
- Jul 3, 2010, 5:11:41 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/StringExtras.h
r61489 r62457 1 1 /* 2 * Copyright (C) 2006 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 45 45 result = _vsnprintf(buffer, count, format, args); 46 46 va_end(args); 47 48 // In the case where the string entirely filled the buffer, _vsnprintf will not 49 // null-terminate it, but snprintf must. 50 if (count > 0) 51 buffer[count - 1] = '\0'; 52 47 53 return result; 48 54 } 49 55 50 #if COMPILER(MSVC7_OR_LOWER) || OS(WINCE) 56 inline double wtf_vsnprintf(char* buffer, size_t count, const char* format, va_list args) 57 { 58 int result = _vsnprintf(buffer, count, format, args); 51 59 52 inline int vsnprintf(char* buffer, size_t count, const char* format, va_list args) 53 { 54 return _vsnprintf(buffer, count, format, args); 60 // In the case where the string entirely filled the buffer, _vsnprintf will not 61 // null-terminate it, but vsnprintf must. 62 if (count > 0) 63 buffer[count - 1] = '\0'; 64 65 return result; 55 66 } 56 67 57 #endif 68 // Work around a bug in Microsoft's implementation of vsnprintf, where 69 // vsnprintf does not null terminate the buffer 70 #define vsnprintf(buffer, count, format, args) wtf_vsnprintf(buffer, count, format, args) 58 71 59 72 #if OS(WINCE)
Note:
See TracChangeset
for help on using the changeset viewer.