diff options
author | Ryan Harrison <rharrison@chromium.org> | 2017-09-27 10:53:11 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-27 16:11:38 +0000 |
commit | 875e98c581952478f3a3ccef9b2f2e3ed06c5346 (patch) | |
tree | 8e0d7e032056bf4c73d6da43c0f3ce4eadb74dfd /fxbarcode | |
parent | cc3a3ee3ebcc1baabdfa7ffca5876dbbfa3980c1 (diff) | |
download | pdfium-875e98c581952478f3a3ccef9b2f2e3ed06c5346.tar.xz |
Remove FX_STRSIZE and replace with size_t
BUG=pdfium:828
Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16
Reviewed-on: https://pdfium-review.googlesource.com/13230
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fxbarcode')
-rw-r--r-- | fxbarcode/datamatrix/BC_EncoderContext.cpp | 10 | ||||
-rw-r--r-- | fxbarcode/datamatrix/BC_EncoderContext.h | 10 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OneDimWriter.cpp | 6 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OneDimWriter.h | 2 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OnedCodaBarWriter.cpp | 4 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OnedCode128Writer.cpp | 6 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OnedCode39Writer.cpp | 11 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OnedEAN13Writer.cpp | 2 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OnedEAN8Writer.cpp | 6 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OnedEANChecksum.cpp | 4 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OnedUPCAWriter.cpp | 8 | ||||
-rw-r--r-- | fxbarcode/qrcode/BC_QRCoderEncoder.cpp | 14 |
12 files changed, 41 insertions, 42 deletions
diff --git a/fxbarcode/datamatrix/BC_EncoderContext.cpp b/fxbarcode/datamatrix/BC_EncoderContext.cpp index 6e1671035a..fe0a497d58 100644 --- a/fxbarcode/datamatrix/BC_EncoderContext.cpp +++ b/fxbarcode/datamatrix/BC_EncoderContext.cpp @@ -34,8 +34,8 @@ CBC_EncoderContext::CBC_EncoderContext(const WideString& msg, ByteString dststr; CBC_UtilCodingConvert::UnicodeToUTF8(msg, dststr); WideString sb; - FX_STRSIZE c = dststr.GetLength(); - for (FX_STRSIZE i = 0; i < c; i++) { + size_t c = dststr.GetLength(); + for (size_t i = 0; i < c; i++) { wchar_t ch = static_cast<wchar_t>(dststr[i] & 0xff); if (ch == '?' && dststr[i] != '?') { e = BCExceptionCharactersOutsideISO88591Encoding; @@ -73,7 +73,7 @@ void CBC_EncoderContext::writeCodewords(const WideString& codewords) { void CBC_EncoderContext::writeCodeword(wchar_t codeword) { m_codewords += codeword; } -FX_STRSIZE CBC_EncoderContext::getCodewordCount() { +size_t CBC_EncoderContext::getCodewordCount() { return m_codewords.GetLength(); } void CBC_EncoderContext::signalEncoderChange(int32_t encoding) { @@ -85,7 +85,7 @@ void CBC_EncoderContext::resetEncoderSignal() { bool CBC_EncoderContext::hasMoreCharacters() { return m_pos < getTotalMessageCharCount(); } -FX_STRSIZE CBC_EncoderContext::getRemainingCharacters() { +size_t CBC_EncoderContext::getRemainingCharacters() { return getTotalMessageCharCount() - m_pos; } void CBC_EncoderContext::updateSymbolInfo(int32_t& e) { @@ -103,6 +103,6 @@ void CBC_EncoderContext::resetSymbolInfo() { m_allowRectangular = true; } -FX_STRSIZE CBC_EncoderContext::getTotalMessageCharCount() { +size_t CBC_EncoderContext::getTotalMessageCharCount() { return m_msg.GetLength() - m_skipAtEnd; } diff --git a/fxbarcode/datamatrix/BC_EncoderContext.h b/fxbarcode/datamatrix/BC_EncoderContext.h index 3881319d61..c0ddb20b7b 100644 --- a/fxbarcode/datamatrix/BC_EncoderContext.h +++ b/fxbarcode/datamatrix/BC_EncoderContext.h @@ -25,26 +25,26 @@ class CBC_EncoderContext { wchar_t getCurrent(); void writeCodewords(const WideString& codewords); void writeCodeword(wchar_t codeword); - FX_STRSIZE getCodewordCount(); + size_t getCodewordCount(); void signalEncoderChange(int32_t encoding); void resetEncoderSignal(); bool hasMoreCharacters(); - FX_STRSIZE getRemainingCharacters(); + size_t getRemainingCharacters(); void updateSymbolInfo(int32_t& e); void updateSymbolInfo(int32_t len, int32_t& e); void resetSymbolInfo(); WideString m_msg; WideString m_codewords; - FX_STRSIZE m_pos; + size_t m_pos; int32_t m_newEncoding; UnownedPtr<CBC_SymbolInfo> m_symbolInfo; private: - FX_STRSIZE getTotalMessageCharCount(); + size_t getTotalMessageCharCount(); bool m_allowRectangular; // Force square when false. - FX_STRSIZE m_skipAtEnd; + size_t m_skipAtEnd; }; #endif // FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_ diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp index 5bcb3c38bc..dc0d48c5bd 100644 --- a/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/fxbarcode/oned/BC_OneDimWriter.cpp @@ -136,10 +136,10 @@ void CBC_OneDimWriter::CalcTextInfo(const ByteString& text, std::unique_ptr<CFX_UnicodeEncodingEx> encoding = FX_CreateFontEncodingEx(cFont, FXFM_ENCODING_NONE); - FX_STRSIZE length = text.GetLength(); + size_t length = text.GetLength(); uint32_t* pCharCode = FX_Alloc(uint32_t, text.GetLength()); float charWidth = 0; - for (FX_STRSIZE j = 0; j < length; j++) { + for (size_t j = 0; j < length; j++) { pCharCode[j] = encoding->CharCodeFromUnicode(text[j]); int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]); int32_t glyp_value = cFont->GetGlyphWidth(glyp_code); @@ -162,7 +162,7 @@ void CBC_OneDimWriter::CalcTextInfo(const ByteString& text, charPos[0].m_ExtGID = charPos[0].m_GlyphIndex; #endif penX += (float)(charPos[0].m_FontCharWidth) * (float)fontSize / 1000.0f; - for (FX_STRSIZE i = 1; i < length; i++) { + for (size_t i = 1; i < length; i++) { charPos[i].m_Origin = CFX_PointF(penX + left, penY + top); charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]); charPos[i].m_FontCharWidth = cFont->GetGlyphWidth(charPos[i].m_GlyphIndex); diff --git a/fxbarcode/oned/BC_OneDimWriter.h b/fxbarcode/oned/BC_OneDimWriter.h index 5c9ef09e4d..a597d860f6 100644 --- a/fxbarcode/oned/BC_OneDimWriter.h +++ b/fxbarcode/oned/BC_OneDimWriter.h @@ -91,7 +91,7 @@ class CBC_OneDimWriter : public CBC_Writer { int32_t m_iFontStyle; uint32_t m_fontColor; BC_TEXT_LOC m_locTextLoc; - FX_STRSIZE m_iContentLen; + size_t m_iContentLen; bool m_bLeftPadding; bool m_bRightPadding; std::vector<CFX_PathData> m_output; diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index 4c5ad67194..791904de5b 100644 --- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -105,7 +105,7 @@ WideString CBC_OnedCodaBarWriter::FilterContents( const WideStringView& contents) { WideString filtercontents; wchar_t ch; - for (FX_STRSIZE index = 0; index < contents.GetLength(); index++) { + for (size_t index = 0; index < contents.GetLength(); index++) { ch = contents[index]; if (ch > 175) { index++; @@ -136,7 +136,7 @@ uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const ByteString& contents, uint8_t* result = FX_Alloc2D(uint8_t, m_iWideNarrRatio * 7, data.GetLength()); char ch; int32_t position = 0; - for (FX_STRSIZE index = 0; index < data.GetLength(); index++) { + for (size_t index = 0; index < data.GetLength(); index++) { ch = data[index]; if (((ch >= 'a') && (ch <= 'z'))) { ch = ch - 32; diff --git a/fxbarcode/oned/BC_OnedCode128Writer.cpp b/fxbarcode/oned/BC_OnedCode128Writer.cpp index 61ec77b020..50d3fb65a6 100644 --- a/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -96,7 +96,7 @@ bool CBC_OnedCode128Writer::CheckContentValidity( WideString CBC_OnedCode128Writer::FilterContents( const WideStringView& contents) { WideString filterChineseChar; - for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { + for (size_t i = 0; i < contents.GetLength(); i++) { wchar_t ch = contents[i]; if (ch > 175) { i++; @@ -173,7 +173,7 @@ int32_t CBC_OnedCode128Writer::Encode128B(const ByteString& contents, int32_t checkWeight = 1; patterns->push_back(CODE_START_B); int32_t checkSum = CODE_START_B * checkWeight; - for (FX_STRSIZE position = 0; position < contents.GetLength(); position++) { + for (size_t position = 0; position < contents.GetLength(); position++) { int32_t patternIndex = contents[position] - ' '; patterns->push_back(patternIndex); checkSum += patternIndex * checkWeight++; @@ -187,7 +187,7 @@ int32_t CBC_OnedCode128Writer::Encode128C(const ByteString& contents, int32_t checkWeight = 1; patterns->push_back(CODE_START_C); int32_t checkSum = CODE_START_C * checkWeight; - FX_STRSIZE position = 0; + size_t position = 0; while (position < contents.GetLength()) { int32_t patternIndex; char ch = contents[position]; diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp index 2e02e01583..8adef14765 100644 --- a/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -49,7 +49,7 @@ CBC_OnedCode39Writer::~CBC_OnedCode39Writer() {} bool CBC_OnedCode39Writer::CheckContentValidity( const WideStringView& contents) { - for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { + for (size_t i = 0; i < contents.GetLength(); i++) { wchar_t ch = contents[i]; if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || ch == L'-' || ch == L'.' || ch == L' ' || ch == L'*' || ch == L'$' || @@ -64,7 +64,7 @@ bool CBC_OnedCode39Writer::CheckContentValidity( WideString CBC_OnedCode39Writer::FilterContents( const WideStringView& contents) { WideString filtercontents; - for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { + for (size_t i = 0; i < contents.GetLength(); i++) { wchar_t ch = contents[i]; if (ch == L'*' && (i == 0 || i == contents.GetLength() - 1)) { continue; @@ -87,7 +87,7 @@ WideString CBC_OnedCode39Writer::FilterContents( WideString CBC_OnedCode39Writer::RenderTextContents( const WideStringView& contents) { WideString renderContents; - for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { + for (size_t i = 0; i < contents.GetLength(); i++) { wchar_t ch = contents[i]; if (ch == L'*' && (i == 0 || i == contents.GetLength() - 1)) { continue; @@ -138,8 +138,7 @@ void CBC_OnedCode39Writer::ToIntArray(int32_t a, int8_t* toReturn) { } char CBC_OnedCode39Writer::CalcCheckSum(const ByteString& contents) { - FX_STRSIZE length = contents.GetLength(); - if (length > 80) + if (contents.GetLength() > 80) return '*'; int32_t checksum = 0; @@ -176,7 +175,7 @@ uint8_t* CBC_OnedCode39Writer::EncodeImpl(const ByteString& contents, int32_t codeWidth = (wideStrideNum * m_iWideNarrRatio + narrStrideNum) * 2 + 1 + m_iContentLen; size_t len = strlen(ALPHABET_STRING); - for (FX_STRSIZE j = 0; j < m_iContentLen; j++) { + for (size_t j = 0; j < m_iContentLen; j++) { for (size_t i = 0; i < len; i++) { if (ALPHABET_STRING[i] != encodedContents[j]) continue; diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp index 6de7c2cb20..daf53a8b7b 100644 --- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -63,7 +63,7 @@ bool CBC_OnedEAN13Writer::CheckContentValidity(const WideStringView& contents) { WideString CBC_OnedEAN13Writer::FilterContents(const WideStringView& contents) { WideString filtercontents; wchar_t ch; - for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { + for (size_t i = 0; i < contents.GetLength(); i++) { ch = contents[i]; if (ch > 175) { i++; diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp index f92a1627b6..865979c396 100644 --- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -70,7 +70,7 @@ bool CBC_OnedEAN8Writer::CheckContentValidity(const WideStringView& contents) { WideString CBC_OnedEAN8Writer::FilterContents(const WideStringView& contents) { WideString filtercontents; wchar_t ch; - for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { + for (size_t i = 0; i < contents.GetLength(); i++) { ch = contents[i]; if (ch > 175) { i++; @@ -145,10 +145,10 @@ bool CBC_OnedEAN8Writer::ShowChars(const WideStringView& contents, int32_t leftPosition = 3 * multiple; ByteString str = FX_UTF8Encode(contents); - FX_STRSIZE iLength = str.GetLength(); + size_t iLength = str.GetLength(); std::vector<FXTEXT_CHARPOS> charpos(iLength); ByteString tempStr = str.Left(4); - FX_STRSIZE iLen = tempStr.GetLength(); + size_t iLen = tempStr.GetLength(); int32_t strWidth = 7 * multiple * 4; float blank = 0.0; diff --git a/fxbarcode/oned/BC_OnedEANChecksum.cpp b/fxbarcode/oned/BC_OnedEANChecksum.cpp index 64aa1c5f43..b290c62926 100644 --- a/fxbarcode/oned/BC_OnedEANChecksum.cpp +++ b/fxbarcode/oned/BC_OnedEANChecksum.cpp @@ -9,8 +9,8 @@ int32_t EANCalcChecksum(const ByteString& contents) { int32_t odd = 0; int32_t even = 0; - FX_STRSIZE parity = 1; - for (FX_STRSIZE i = contents.GetLength(); i > 0; i--) { + size_t parity = 1; + for (size_t i = contents.GetLength(); i > 0; i--) { if (parity % 2) odd += FXSYS_DecimalCharToInt(contents[i - 1]); else diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp index 51858452e9..025f851526 100644 --- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -43,7 +43,7 @@ void CBC_OnedUPCAWriter::Init() { CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() {} bool CBC_OnedUPCAWriter::CheckContentValidity(const WideStringView& contents) { - for (FX_STRSIZE i = 0; i < contents.GetLength(); ++i) { + for (size_t i = 0; i < contents.GetLength(); ++i) { if (contents[i] < '0' || contents[i] > '9') return false; } @@ -53,7 +53,7 @@ bool CBC_OnedUPCAWriter::CheckContentValidity(const WideStringView& contents) { WideString CBC_OnedUPCAWriter::FilterContents(const WideStringView& contents) { WideString filtercontents; wchar_t ch; - for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { + for (size_t i = 0; i < contents.GetLength(); i++) { ch = contents[i]; if (ch > 175) { i++; @@ -69,8 +69,8 @@ WideString CBC_OnedUPCAWriter::FilterContents(const WideStringView& contents) { int32_t CBC_OnedUPCAWriter::CalcChecksum(const ByteString& contents) { int32_t odd = 0; int32_t even = 0; - FX_STRSIZE j = 1; - for (FX_STRSIZE i = contents.GetLength(); i > 0; i--) { + size_t j = 1; + for (size_t i = contents.GetLength(); i > 0; i--) { if (j % 2) { odd += FXSYS_DecimalCharToInt(contents[i - 1]); } else { diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp index c8ee709235..a44dfc39f6 100644 --- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp +++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp @@ -134,7 +134,7 @@ void Append8BitBytes(const ByteString& content, CBC_QRCoderBitVector* bits, ByteString encoding, int32_t& e) { - for (FX_STRSIZE i = 0; i < content.GetLength(); i++) + for (size_t i = 0; i < content.GetLength(); i++) bits->AppendBits(content[i], 8); } @@ -381,7 +381,7 @@ void MergeString(std::vector<ModeStringPair>* result, if (e != BCExceptionNO) return; if (element2.first == CBC_QRCoderMode::sBYTE && tmp >= 0 && - element1.second.GetLength() < static_cast<FX_STRSIZE>(tmp)) { + element1.second.GetLength() < static_cast<size_t>(tmp)) { element2.second = element1.second + element2.second; result->erase(result->begin() + i); i--; @@ -400,7 +400,7 @@ void MergeString(std::vector<ModeStringPair>* result, if (e != BCExceptionNO) return; if (element2.first == CBC_QRCoderMode::sBYTE && tmp >= 0 && - element1.second.GetLength() < static_cast<FX_STRSIZE>(tmp)) { + element1.second.GetLength() < static_cast<size_t>(tmp)) { element2.second = element1.second + element2.second; result->erase(result->begin() + i); i--; @@ -411,7 +411,7 @@ void MergeString(std::vector<ModeStringPair>* result, if (e != BCExceptionNO) return; if (element2.first == CBC_QRCoderMode::sALPHANUMERIC && tmp >= 0 && - element1.second.GetLength() < static_cast<FX_STRSIZE>(tmp)) { + element1.second.GetLength() < static_cast<size_t>(tmp)) { element2.second = element1.second + element2.second; result->erase(result->begin() + i); i--; @@ -425,7 +425,7 @@ void MergeString(std::vector<ModeStringPair>* result, void SplitString(const ByteString& content, std::vector<ModeStringPair>* result) { - FX_STRSIZE index = 0; + size_t index = 0; while (index < content.GetLength()) { uint8_t c = static_cast<uint8_t>(content[index]); if (!((c >= 0xA1 && c <= 0xAA) || (c >= 0xB0 && c <= 0xFA))) @@ -437,7 +437,7 @@ void SplitString(const ByteString& content, if (index >= content.GetLength()) return; - FX_STRSIZE flag = index; + size_t flag = index; while (GetAlphaNumericCode(content[index]) == -1 && index < content.GetLength()) { uint8_t c = static_cast<uint8_t>(content[index]); @@ -490,7 +490,7 @@ CBC_QRCoderMode* ChooseMode(const ByteString& content, ByteString encoding) { bool hasNumeric = false; bool hasAlphaNumeric = false; - for (FX_STRSIZE i = 0; i < content.GetLength(); i++) { + for (size_t i = 0; i < content.GetLength(); i++) { if (isdigit(content[i])) { hasNumeric = true; } else if (GetAlphaNumericCode(content[i]) != -1) { |