summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-06-02 15:48:15 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-02 15:48:16 -0700
commitdb444d2063df6c574882d9263e885c4fe1134133 (patch)
tree27ce4a3f181ae0b5ad4eff6893016e7d49dfce0a /core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
parentad700c2c1fc3c3843dae71e5982f462e42efc987 (diff)
downloadpdfium-db444d2063df6c574882d9263e885c4fe1134133.tar.xz
Fix all the code which has duplicate variable declarations
When there are duplicate variable declarations, the inner names shadow the outter ones. This is error prone and harder to read. Remove all the instances found by /analyze. BUG=chromium:613623, chromium:427616 Review-Url: https://codereview.chromium.org/2027273002
Diffstat (limited to 'core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp')
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index e9f5a6d468..7c489a35dc 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -447,12 +447,11 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
if (unicode == 0x1b) {
i += 2;
while (i < max_chars * 2) {
- uint16_t unicode = bBE ? (uni_str[i] << 8 | uni_str[i + 1])
- : (uni_str[i + 1] << 8 | uni_str[i]);
+ uint16_t unicode2 = bBE ? (uni_str[i] << 8 | uni_str[i + 1])
+ : (uni_str[i + 1] << 8 | uni_str[i]);
i += 2;
- if (unicode == 0x1b) {
+ if (unicode2 == 0x1b)
break;
- }
}
} else {
dest_buf[dest_pos++] = unicode;
@@ -506,9 +505,9 @@ CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len) {
dest_buf2[0] = 0xfe;
dest_buf2[1] = 0xff;
dest_buf2 += 2;
- for (int i = 0; i < len; i++) {
+ for (int j = 0; j < len; j++) {
*dest_buf2++ = pString[i] >> 8;
- *dest_buf2++ = (uint8_t)pString[i];
+ *dest_buf2++ = (uint8_t)pString[j];
}
result.ReleaseBuffer(encLen);
return result;