diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 06:53:28 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 06:53:28 +0000 |
commit | 34b2b007db875a6acb853c5cd2a247fbb32c0f88 (patch) | |
tree | 6dc39bc9f10d6e8eedcdf14821ba9e96b5ccab51 /courgette/adjustment_method_2.cc | |
parent | 24b857793e27aded8d804a112a5fe6c77e28b081 (diff) | |
download | chromium_src-34b2b007db875a6acb853c5cd2a247fbb32c0f88.zip chromium_src-34b2b007db875a6acb853c5cd2a247fbb32c0f88.tar.gz chromium_src-34b2b007db875a6acb853c5cd2a247fbb32c0f88.tar.bz2 |
Add compiler-specific "examine printf format" attributes to printfs.
Functions that take a printf-style format get a new annotation, which
produces a bunch of compiler warnings when you use printf impoperly.
This change adds the annotations and fixes the warnings.
We now must use PRId64 for 64-bit numbers and the PRIsz for size_t.
Review URL: http://codereview.chromium.org/339059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/adjustment_method_2.cc')
-rw-r--r-- | courgette/adjustment_method_2.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/courgette/adjustment_method_2.cc b/courgette/adjustment_method_2.cc index 49fcf49..9cb9dbd 100644 --- a/courgette/adjustment_method_2.cc +++ b/courgette/adjustment_method_2.cc @@ -15,6 +15,7 @@ #include <iostream> #include "base/basictypes.h" +#include "base/format_macros.h" #include "base/logging.h" #include "base/string_util.h" @@ -461,8 +462,8 @@ std::string ToString(const Shingle* instance) { s += ToString(instance->at(i)); sep = ", "; } - StringAppendF(&s, ">(%u)@{%d}", instance->exemplar_position_, - static_cast<int>(instance->position_count())); + StringAppendF(&s, ">(%" PRIuS ")@{%" PRIuS "}", instance->exemplar_position_, + instance->position_count()); return s; } @@ -578,7 +579,7 @@ std::string HistogramToString(const ShinglePattern::Histogram& histogram, s += " ..."; break; } - StringAppendF(&s, " %d", p->count()); + StringAppendF(&s, " %" PRIuS, p->count()); } return s; } @@ -598,7 +599,7 @@ std::string HistogramToStringFull(const ShinglePattern::Histogram& histogram, s += "...\n"; break; } - StringAppendF(&s, "(%d) ", p->count()); + StringAppendF(&s, "(%" PRIuS ") ", p->count()); s += ToString(&(*p->instance())); s += "\n"; } @@ -633,9 +634,9 @@ std::string ShinglePatternToStringFull(const ShinglePattern* pattern, s += "\n"; size_t model_size = pattern->model_histogram_.size(); size_t program_size = pattern->program_histogram_.size(); - StringAppendF(&s, " model shingles %u\n", model_size); + StringAppendF(&s, " model shingles %" PRIuS "\n", model_size); s += HistogramToStringFull(pattern->model_histogram_, " ", max); - StringAppendF(&s, " program shingles %u\n", program_size); + StringAppendF(&s, " program shingles %" PRIuS "\n", program_size); s += HistogramToStringFull(pattern->program_histogram_, " ", max); return s; } |