summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoragoode <agoode@chromium.org>2016-07-07 00:38:31 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-07 00:38:31 -0700
commitc9a0ec50d813d13498830c05d60d01360729a156 (patch)
treeac2d673ddf7bb11e5da42bb1766db525d7270a9a
parent44105d862bfcaf9fce0ee0dfe283337bf5980337 (diff)
downloadpdfium-c9a0ec50d813d13498830c05d60d01360729a156.tar.xz
Fix compilation with strict format checking
abs() is bit tricky in C++ and this use of abs is returning double. FXSYS_snprintf is strictly checking this on Fedora 24 and results in: ../../third_party/pdfium/fpdfsdk/fsdk_baseannot.cpp:309:18: error: format specifies type 'int' but the argument has type 'typename __gnu_cxx::__enable_if<__is_integer<signed char>::__value, double>::__type' (aka 'double') [-Werror,-Wformat] Review-Url: https://codereview.chromium.org/2124083002
-rw-r--r--fpdfsdk/fsdk_baseannot.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/fpdfsdk/fsdk_baseannot.cpp b/fpdfsdk/fsdk_baseannot.cpp
index 9b214738d8..2ef28716d0 100644
--- a/fpdfsdk/fsdk_baseannot.cpp
+++ b/fpdfsdk/fsdk_baseannot.cpp
@@ -289,7 +289,7 @@ CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() {
else
str1 += "+";
CFX_ByteString str2;
- str2.Format("%02d:%02u", abs(dt.tzHour), dt.tzMinute);
+ str2.Format("%02d:%02u", std::abs(static_cast<int>(dt.tzHour)), dt.tzMinute);
return str1 + str2;
}
@@ -305,8 +305,8 @@ CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() {
else
dtStr += CFX_ByteString("+");
memset(tempStr, 0, sizeof(tempStr));
- FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", abs(dt.tzHour),
- dt.tzMinute);
+ FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'",
+ std::abs(static_cast<int>(dt.tzHour)), dt.tzMinute);
dtStr += CFX_ByteString(tempStr);
return dtStr;
}