diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-04-18 18:47:48 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-04-18 18:47:48 +0400 |
commit | bd79fc2c131f05abe5ef52329896803d2d2a255b (patch) | |
tree | c2b9e6c6ce71ea5ec4bb9e993ffbe7bf3d0eee39 /mert/Data.cpp | |
parent | 623e8859014cdd3ebdfc61593ac71b3f16a12914 (diff) |
Use std::stringstream instead of using snprintf() for Windows.
This commit fixes compilation problems related to
snprintf() for Windows users.
Thanks to Raka Prasetya for reporting the errors.
Thanks also to Kenneth Heafield and Barry Haddow for suggestions.
Diffstat (limited to 'mert/Data.cpp')
-rw-r--r-- | mert/Data.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mert/Data.cpp b/mert/Data.cpp index 5405b0cb9..be4c65fb2 100644 --- a/mert/Data.cpp +++ b/mert/Data.cpp @@ -173,15 +173,15 @@ void Data::InitFeatureMap(const string& str) { string features = ""; string tmp_name = ""; size_t tmp_index = 0; - char tmp[64]; // for snprintf(); while (!buf.empty()) { getNextPound(buf, substr); // string ending with ":" are skipped, because they are the names of the features if (!EndsWith(substr, ":")) { - snprintf(tmp, sizeof(tmp), "%s_%lu ", tmp_name.c_str(), tmp_index); - features.append(tmp); + stringstream ss; + ss << tmp_name << "_" << tmp_index << " "; + features.append(ss.str()); tmp_index++; } else if (substr.find("_") != string::npos) { |