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

Side by Side Diff: third_party/libphonenumber/cpp/src/default_logger.h

Issue 7277083: [libphonenumber] snprintf isn't generally in the std:: namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add include Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (C) 2011 Google Inc. 1 // Copyright (C) 2011 Google Inc.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 // Author: Philippe Liard 15 // Author: Philippe Liard
16 16
17 #ifndef I18N_PHONENUMBERS_DEFAULT_LOGGER_H_ 17 #ifndef I18N_PHONENUMBERS_DEFAULT_LOGGER_H_
18 #define I18N_PHONENUMBERS_DEFAULT_LOGGER_H_ 18 #define I18N_PHONENUMBERS_DEFAULT_LOGGER_H_
19 19
20 #include <stdio.h>
21
20 #include <string> 22 #include <string>
21 23
22 #include "logger.h" 24 #include "logger.h"
23 25
24 using std::string; 26 using std::string;
25 27
26 // Make the logging functions private (not declared in logger.h) as the client 28 // Make the logging functions private (not declared in logger.h) as the client
27 // should not have any reason to use them. 29 // should not have any reason to use them.
28 namespace { 30 namespace {
29 31
(...skipping 11 matching lines...) Expand all
41 } 43 }
42 }; 44 };
43 45
44 template <> 46 template <>
45 struct ConvertToString<int> { 47 struct ConvertToString<int> {
46 static inline string DoWork(const int& n) { 48 static inline string DoWork(const int& n) {
47 char buffer[16]; 49 char buffer[16];
48 #if defined(OS_WIN) 50 #if defined(OS_WIN)
49 _itoa_s(n, buffer, sizeof(buffer), 10); 51 _itoa_s(n, buffer, sizeof(buffer), 10);
50 #else 52 #else
51 std::snprintf(buffer, sizeof(buffer), "%d", n); 53 snprintf(buffer, sizeof(buffer), "%d", n);
52 #endif 54 #endif
53 return string(buffer); 55 return string(buffer);
54 } 56 }
55 }; 57 };
56 58
57 class LoggerHandler { 59 class LoggerHandler {
58 public: 60 public:
59 LoggerHandler(Logger* impl) : impl_(impl) {} 61 LoggerHandler(Logger* impl) : impl_(impl) {}
60 62
61 ~LoggerHandler() { 63 ~LoggerHandler() {
(...skipping 26 matching lines...) Expand all
88 virtual ~StdoutLogger() {} 90 virtual ~StdoutLogger() {}
89 91
90 virtual void WriteLevel(); 92 virtual void WriteLevel();
91 virtual void WriteMessage(const string& msg); 93 virtual void WriteMessage(const string& msg);
92 }; 94 };
93 95
94 } // namespace phonenumbers 96 } // namespace phonenumbers
95 } // namespace i18n 97 } // namespace i18n
96 98
97 #endif // I18N_PHONENUMBERS_DEFAULT_LOGGER_H_ 99 #endif // I18N_PHONENUMBERS_DEFAULT_LOGGER_H_
OLDNEW
« no previous file with comments | « third_party/libphonenumber/README.chromium ('k') | third_party/libphonenumber/patches/version277a.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698