summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-03-21 11:20:44 -0700
committerWei Li <weili@chromium.org>2016-03-21 11:20:44 -0700
commitd4e8f1222ca17b57ac74019b2fc3706e1192645c (patch)
tree0dd5e1627fd684205631f875cbf5946178177766 /fpdfsdk
parent34fa8d90ae2f60fae219e4dbeff14c053d2e8eef (diff)
downloadpdfium-d4e8f1222ca17b57ac74019b2fc3706e1192645c.tar.xz
Re-enable several MSVC warnings
Re-enable the following warnings: 4245: signed/unsigned conversion mismatch; 4310: cast may truncate data; 4389: operator on signed/unsigned mismatch; 4701: use potentially uninitialized local variable; 4706: assignment within conditional expression Clean up the code to avoid those warnings. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1801383002 .
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp4
-rw-r--r--fpdfsdk/fpdfppo.cpp3
-rw-r--r--fpdfsdk/fpdftext.cpp2
-rw-r--r--fpdfsdk/fpdfview.cpp2
-rw-r--r--fpdfsdk/fxedit/fxet_ap.cpp10
-rw-r--r--fpdfsdk/javascript/Document.cpp4
6 files changed, 11 insertions, 14 deletions
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index 519c7d8cef..caa0704955 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -206,8 +206,8 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
}
CFX_ByteString sDA;
- CPDF_Object* pObj;
- if ((pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA")))
+ CPDF_Object* pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA");
+ if (pObj)
sDA = pObj->GetString();
if (bWidget) {
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index 4377c3ed94..6a72141e7d 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -86,8 +86,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
CPDF_Array* pKeysArray = pNewPages->GetArrayBy("Kids");
if (!pKeysArray) {
CPDF_Array* pNewKids = new CPDF_Array;
- FX_DWORD Kidsobjnum = -1;
- Kidsobjnum = pDestPDFDoc->AddIndirectObject(pNewKids);
+ FX_DWORD Kidsobjnum = pDestPDFDoc->AddIndirectObject(pNewKids);
pNewPages->SetAt("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum));
pNewPages->SetAt("Count", new CPDF_Number(0));
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp
index cbb8e00a40..24b592a88b 100644
--- a/fpdfsdk/fpdftext.cpp
+++ b/fpdfsdk/fpdftext.cpp
@@ -51,7 +51,7 @@ DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) {
DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page,
int index) {
if (!text_page)
- return -1;
+ return 0;
IPDF_TextPage* textpage = (IPDF_TextPage*)text_page;
if (index < 0 || index >= textpage->CountChars())
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 1c9024d836..589a6de644 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -282,7 +282,7 @@ int GetLastError() {
#endif // _WIN32
void ProcessParseError(CPDF_Parser::Error err) {
- FX_DWORD err_code;
+ FX_DWORD err_code = FPDF_ERR_SUCCESS;
// Translate FPDFAPI error code to FPDFVIEW error code
switch (err) {
case CPDF_Parser::SUCCESS:
diff --git a/fpdfsdk/fxedit/fxet_ap.cpp b/fpdfsdk/fxedit/fxet_ap.cpp
index 6f064b2ce8..5bf61365c5 100644
--- a/fpdfsdk/fxedit/fxet_ap.cpp
+++ b/fpdfsdk/fxedit/fxet_ap.cpp
@@ -18,12 +18,10 @@ CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap,
if (SubWord > 0) {
Word = SubWord;
} else {
- FX_DWORD dwCharCode = -1;
-
- if (pPDFFont->IsUnicodeCompatible())
- dwCharCode = pPDFFont->CharCodeFromUnicode(Word);
- else
- dwCharCode = pFontMap->CharCodeFromUnicode(nFontIndex, Word);
+ FX_DWORD dwCharCode =
+ pPDFFont->IsUnicodeCompatible()
+ ? pPDFFont->CharCodeFromUnicode(Word)
+ : pFontMap->CharCodeFromUnicode(nFontIndex, Word);
if (dwCharCode > 0) {
pPDFFont->AppendChar(sWord, dwCharCode);
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 144d428989..36ea910a47 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -1459,7 +1459,7 @@ int Document::CountWords(CPDF_TextObject* pTextObj) {
FX_BOOL bIsLatin = FALSE;
for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) {
- FX_DWORD charcode = -1;
+ FX_DWORD charcode = static_cast<FX_DWORD>(-1);
FX_FLOAT kerning;
pTextObj->GetCharInfo(i, charcode, kerning);
@@ -1492,7 +1492,7 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj,
FX_BOOL bIsLatin = FALSE;
for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) {
- FX_DWORD charcode = -1;
+ FX_DWORD charcode = static_cast<FX_DWORD>(-1);
FX_FLOAT kerning;
pTextObj->GetCharInfo(i, charcode, kerning);