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

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

Issue 1434533004: include what you use: errno.h and string.h in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: insert blank line Created 5 years, 1 month 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/process/process_posix.cc ('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 #include "base/strings/safe_sprintf.h" 5 #include "base/strings/safe_sprintf.h"
6 6
7 #include <errno.h>
8 #include <string.h>
9
7 #include <limits> 10 #include <limits>
8 11
9 #if !defined(NDEBUG) 12 #if !defined(NDEBUG)
10 // In debug builds, we use RAW_CHECK() to print useful error messages, if 13 // In debug builds, we use RAW_CHECK() to print useful error messages, if
11 // SafeSPrintf() is called with broken arguments. 14 // SafeSPrintf() is called with broken arguments.
12 // As our contract promises that SafeSPrintf() can be called from any 15 // As our contract promises that SafeSPrintf() can be called from any
13 // restricted run-time context, it is not actually safe to call logging 16 // restricted run-time context, it is not actually safe to call logging
14 // functions from it; and we only ever do so for debug builds and hope for the 17 // functions from it; and we only ever do so for debug builds and hope for the
15 // best. We should _never_ call any logging function other than RAW_CHECK(), 18 // best. We should _never_ call any logging function other than RAW_CHECK(),
16 // and we should _never_ include any logging code that is active in production 19 // and we should _never_ include any logging code that is active in production
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 DEBUG_CHECK(src[0] != '%' || src[1] == '%'); 679 DEBUG_CHECK(src[0] != '%' || src[1] == '%');
677 if (src[0] == '%' && src[1] == '%') { 680 if (src[0] == '%' && src[1] == '%') {
678 ++src; 681 ++src;
679 } 682 }
680 } 683 }
681 return buffer.GetCount(); 684 return buffer.GetCount();
682 } 685 }
683 686
684 } // namespace strings 687 } // namespace strings
685 } // namespace base 688 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698