From 12367cb5e83e771cd67948c810fdd5f63d61af87 Mon Sep 17 00:00:00 2001 From: weili Date: Fri, 3 Jun 2016 11:22:16 -0700 Subject: Fix some code which causes warnings when compiled by /analyze tool The code may not cause error conditions, but can be improved. These warnings include uninitialized variables, signed/unsigned mismatch, redundant condition, and using bool in arithmetic operations. Also remove a chunk of unused code. BUG=chromium:613623, chromium:427616 Review-Url: https://codereview.chromium.org/2036203004 --- fpdfsdk/fsdk_baseannot.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fpdfsdk/fsdk_baseannot.cpp') diff --git a/fpdfsdk/fsdk_baseannot.cpp b/fpdfsdk/fsdk_baseannot.cpp index e2ee6f7c73..1345f234b6 100644 --- a/fpdfsdk/fsdk_baseannot.cpp +++ b/fpdfsdk/fsdk_baseannot.cpp @@ -346,14 +346,14 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() { CFX_ByteString str1; - str1.Format("%04d-%02d-%02d %02d:%02d:%02d ", dt.year, dt.month, dt.day, + str1.Format("%04d-%02u-%02u %02u:%02u:%02u ", dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second); if (dt.tzHour < 0) str1 += "-"; else str1 += "+"; CFX_ByteString str2; - str2.Format("%02d:%02d", abs(dt.tzHour), dt.tzMinute); + str2.Format("%02d:%02u", abs(dt.tzHour), dt.tzMinute); return str1 + str2; } @@ -361,7 +361,7 @@ CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() { CFX_ByteString dtStr; char tempStr[32]; memset(tempStr, 0, sizeof(tempStr)); - FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02d%02d%02d%02d%02d", + FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02u%02u%02u%02u%02u", dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second); dtStr = CFX_ByteString(tempStr); if (dt.tzHour < 0) @@ -369,7 +369,7 @@ CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() { else dtStr += CFX_ByteString("+"); memset(tempStr, 0, sizeof(tempStr)); - FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02d'", abs(dt.tzHour), + FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", abs(dt.tzHour), dt.tzMinute); dtStr += CFX_ByteString(tempStr); return dtStr; -- cgit v1.2.3