Browse Source

CPP: Fix compilation error in default_logger.h on Visual Studio 2010.

Review URL: http://codereview.appspot.com/5436046
pull/567/head
Philippe Liard 14 years ago
committed by Mihaela Rosca
parent
commit
c29f95866f
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      cpp/src/phonenumbers/default_logger.h

+ 8
- 4
cpp/src/phonenumbers/default_logger.h View File

@ -39,11 +39,13 @@ class StdoutLogger : public Logger {
#else
#include <sstream>
#include <string>
#include "phonenumbers/logger.h"
using std::string;
using std::stringstream;
// Make the logging functions private (not declared in logger.h) as the client
// should not have any reason to use them.
@ -65,10 +67,12 @@ struct ConvertToString {
template <>
struct ConvertToString<int> {
static inline string DoWork(const int& n) {
char buffer[16];
std::snprintf(buffer, sizeof(buffer), "%d", n);
return string(buffer);
static inline string DoWork(int n) {
stringstream stream;
stream << n;
string result;
stream >> result;
return result;
}
};


Loading…
Cancel
Save