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

Side by Side Diff: base/strings/string_util.h

Issue 1295163005: Update Crashpad to 1a770c8237733e2f68bd506a99d05d82fe25fc6b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove TODO Created 5 years, 4 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
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file defines utility functions for working with strings. 5 // This file defines utility functions for working with strings.
6 6
7 #ifndef BASE_STRINGS_STRING_UTIL_H_ 7 #ifndef BASE_STRINGS_STRING_UTIL_H_
8 #define BASE_STRINGS_STRING_UTIL_H_ 8 #define BASE_STRINGS_STRING_UTIL_H_
9 9
10 #include <ctype.h> 10 #include <ctype.h>
(...skipping 28 matching lines...) Expand all
39 inline int snprintf(char* buffer, size_t size, const char* format, ...) 39 inline int snprintf(char* buffer, size_t size, const char* format, ...)
40 PRINTF_FORMAT(3, 4); 40 PRINTF_FORMAT(3, 4);
41 inline int snprintf(char* buffer, size_t size, const char* format, ...) { 41 inline int snprintf(char* buffer, size_t size, const char* format, ...) {
42 va_list arguments; 42 va_list arguments;
43 va_start(arguments, format); 43 va_start(arguments, format);
44 int result = vsnprintf(buffer, size, format, arguments); 44 int result = vsnprintf(buffer, size, format, arguments);
45 va_end(arguments); 45 va_end(arguments);
46 return result; 46 return result;
47 } 47 }
48 48
49 // TODO(mark) http://crbug.com/472900 crashpad shouldn't use base while
50 // being DEPSed in. This backwards-compat hack is provided until crashpad is
51 // updated.
52 #if defined(OS_WIN)
53 inline int strcasecmp(const char* s1, const char* s2) {
54 return _stricmp(s1, s2);
55 }
56 #else // Posix
57 inline int strcasecmp(const char* string1, const char* string2) {
58 return ::strcasecmp(string1, string2);
59 }
60 #endif
61
62 // BSD-style safe and consistent string copy functions. 49 // BSD-style safe and consistent string copy functions.
63 // Copies |src| to |dst|, where |dst_size| is the total allocated size of |dst|. 50 // Copies |src| to |dst|, where |dst_size| is the total allocated size of |dst|.
64 // Copies at most |dst_size|-1 characters, and always NULL terminates |dst|, as 51 // Copies at most |dst_size|-1 characters, and always NULL terminates |dst|, as
65 // long as |dst_size| is not 0. Returns the length of |src| in characters. 52 // long as |dst_size| is not 0. Returns the length of |src| in characters.
66 // If the return value is >= dst_size, then the output was truncated. 53 // If the return value is >= dst_size, then the output was truncated.
67 // NOTE: All sizes are in number of characters, NOT in bytes. 54 // NOTE: All sizes are in number of characters, NOT in bytes.
68 BASE_EXPORT size_t strlcpy(char* dst, const char* src, size_t dst_size); 55 BASE_EXPORT size_t strlcpy(char* dst, const char* src, size_t dst_size);
69 BASE_EXPORT size_t wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size); 56 BASE_EXPORT size_t wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size);
70 57
71 // Scan a wprintf format string to determine whether it's portable across a 58 // Scan a wprintf format string to determine whether it's portable across a
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 453
467 #if defined(OS_WIN) 454 #if defined(OS_WIN)
468 #include "base/strings/string_util_win.h" 455 #include "base/strings/string_util_win.h"
469 #elif defined(OS_POSIX) 456 #elif defined(OS_POSIX)
470 #include "base/strings/string_util_posix.h" 457 #include "base/strings/string_util_posix.h"
471 #else 458 #else
472 #error Define string operations appropriately for your platform 459 #error Define string operations appropriately for your platform
473 #endif 460 #endif
474 461
475 #endif // BASE_STRINGS_STRING_UTIL_H_ 462 #endif // BASE_STRINGS_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698