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

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: 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
Ryan Sleevi 2011/07/02 23:25:42 I believe it may be necessary to add #include <st
20 #include <string> 20 #include <string>
21 21
22 #include "logger.h" 22 #include "logger.h"
23 23
24 using std::string; 24 using std::string;
25 25
26 // Make the logging functions private (not declared in logger.h) as the client 26 // Make the logging functions private (not declared in logger.h) as the client
27 // should not have any reason to use them. 27 // should not have any reason to use them.
28 namespace { 28 namespace {
29 29
(...skipping 11 matching lines...) Expand all
41 } 41 }
42 }; 42 };
43 43
44 template <> 44 template <>
45 struct ConvertToString<int> { 45 struct ConvertToString<int> {
46 static inline string DoWork(const int& n) { 46 static inline string DoWork(const int& n) {
47 char buffer[16]; 47 char buffer[16];
48 #if defined(OS_WIN) 48 #if defined(OS_WIN)
49 _itoa_s(n, buffer, sizeof(buffer), 10); 49 _itoa_s(n, buffer, sizeof(buffer), 10);
50 #else 50 #else
51 std::snprintf(buffer, sizeof(buffer), "%d", n); 51 snprintf(buffer, sizeof(buffer), "%d", n);
52 #endif 52 #endif
53 return string(buffer); 53 return string(buffer);
54 } 54 }
55 }; 55 };
56 56
57 class LoggerHandler { 57 class LoggerHandler {
58 public: 58 public:
59 LoggerHandler(Logger* impl) : impl_(impl) {} 59 LoggerHandler(Logger* impl) : impl_(impl) {}
60 60
61 ~LoggerHandler() { 61 ~LoggerHandler() {
(...skipping 26 matching lines...) Expand all
88 virtual ~StdoutLogger() {} 88 virtual ~StdoutLogger() {}
89 89
90 virtual void WriteLevel(); 90 virtual void WriteLevel();
91 virtual void WriteMessage(const string& msg); 91 virtual void WriteMessage(const string& msg);
92 }; 92 };
93 93
94 } // namespace phonenumbers 94 } // namespace phonenumbers
95 } // namespace i18n 95 } // namespace i18n
96 96
97 #endif // I18N_PHONENUMBERS_DEFAULT_LOGGER_H_ 97 #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