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

Side by Side Diff: base/strings/safe_sprintf.cc

Issue 1548993002: Switch to standard integer types in base/strings/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « base/strings/safe_sprintf.h ('k') | base/strings/safe_sprintf_unittest.cc » ('j') | 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 #include "base/strings/safe_sprintf.h" 5 #include "base/strings/safe_sprintf.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <limits> 10 #include <limits>
11 11
12 #include "base/macros.h"
13 #include "build/build_config.h"
14
12 #if !defined(NDEBUG) 15 #if !defined(NDEBUG)
13 // In debug builds, we use RAW_CHECK() to print useful error messages, if 16 // In debug builds, we use RAW_CHECK() to print useful error messages, if
14 // SafeSPrintf() is called with broken arguments. 17 // SafeSPrintf() is called with broken arguments.
15 // As our contract promises that SafeSPrintf() can be called from any 18 // As our contract promises that SafeSPrintf() can be called from any
16 // restricted run-time context, it is not actually safe to call logging 19 // restricted run-time context, it is not actually safe to call logging
17 // functions from it; and we only ever do so for debug builds and hope for the 20 // functions from it; and we only ever do so for debug builds and hope for the
18 // best. We should _never_ call any logging function other than RAW_CHECK(), 21 // best. We should _never_ call any logging function other than RAW_CHECK(),
19 // and we should _never_ include any logging code that is active in production 22 // and we should _never_ include any logging code that is active in production
20 // builds. Most notably, we should not include these logging functions in 23 // builds. Most notably, we should not include these logging functions in
21 // unofficial release builds, even though those builds would otherwise have 24 // unofficial release builds, even though those builds would otherwise have
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 DEBUG_CHECK(src[0] != '%' || src[1] == '%'); 677 DEBUG_CHECK(src[0] != '%' || src[1] == '%');
675 if (src[0] == '%' && src[1] == '%') { 678 if (src[0] == '%' && src[1] == '%') {
676 ++src; 679 ++src;
677 } 680 }
678 } 681 }
679 return buffer.GetCount(); 682 return buffer.GetCount();
680 } 683 }
681 684
682 } // namespace strings 685 } // namespace strings
683 } // namespace base 686 } // namespace base
OLDNEW
« no previous file with comments | « base/strings/safe_sprintf.h ('k') | base/strings/safe_sprintf_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698