diff options
author | Ryan Harrison <rharrison@chromium.org> | 2017-09-18 14:23:18 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-18 18:40:16 +0000 |
commit | 275e260a6cd4a8e506ba974feb85ebcd926c1739 (patch) | |
tree | 2029b9158ec044764ceff122fe5fb5d0a3f123d1 /fxbarcode/pdf417 | |
parent | 450fbeaaabf1ab340c1018de2e58f1950657517e (diff) | |
download | pdfium-275e260a6cd4a8e506ba974feb85ebcd926c1739.tar.xz |
Convert string class names
Automated using git grep & sed.
Replace StringC classes with StringView classes.
Remove the CFX_ prefix and put string classes in fxcrt namespace.
Change AsStringC() to AsStringView().
Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*,
Foo).
Couple of tests needed to have their names regularlized.
BUG=pdfium:894
Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d
Reviewed-on: https://pdfium-review.googlesource.com/14151
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fxbarcode/pdf417')
-rw-r--r-- | fxbarcode/pdf417/BC_PDF417.cpp | 14 | ||||
-rw-r--r-- | fxbarcode/pdf417/BC_PDF417.h | 4 | ||||
-rw-r--r-- | fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp | 4 | ||||
-rw-r--r-- | fxbarcode/pdf417/BC_PDF417ErrorCorrection.h | 4 | ||||
-rw-r--r-- | fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp | 37 | ||||
-rw-r--r-- | fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h | 22 | ||||
-rw-r--r-- | fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp | 14 | ||||
-rw-r--r-- | fxbarcode/pdf417/BC_PDF417Writer.cpp | 2 | ||||
-rw-r--r-- | fxbarcode/pdf417/BC_PDF417Writer.h | 2 |
9 files changed, 51 insertions, 52 deletions
diff --git a/fxbarcode/pdf417/BC_PDF417.cpp b/fxbarcode/pdf417/BC_PDF417.cpp index 3f492f9c10..9b73b49a26 100644 --- a/fxbarcode/pdf417/BC_PDF417.cpp +++ b/fxbarcode/pdf417/BC_PDF417.cpp @@ -399,7 +399,7 @@ CBC_BarcodeMatrix* CBC_PDF417::getBarcodeMatrix() { return m_barcodeMatrix.get(); } -bool CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, +bool CBC_PDF417::generateBarcodeLogic(WideString msg, int32_t errorCorrectionLevel) { int32_t errorCorrectionCodeWords = CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount( @@ -408,7 +408,7 @@ bool CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, return false; int32_t e = BCExceptionNO; - CFX_WideString highLevel = + WideString highLevel = CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e); if (e != BCExceptionNO) return false; @@ -425,19 +425,19 @@ bool CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, return false; int32_t n = sourceCodeWords + pad + 1; - CFX_WideString sb; + WideString sb; sb += (wchar_t)n; sb += highLevel; for (int32_t i = 0; i < pad; i++) sb += (wchar_t)900; - CFX_WideString dataCodewords(sb); - CFX_WideString ec; + WideString dataCodewords(sb); + WideString ec; if (!CBC_PDF417ErrorCorrection::generateErrorCorrection( dataCodewords, errorCorrectionLevel, &ec)) { return false; } - CFX_WideString fullCodewords = dataCodewords + ec; + WideString fullCodewords = dataCodewords + ec; m_barcodeMatrix = pdfium::MakeUnique<CBC_BarcodeMatrix>(rows, cols); encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel, m_barcodeMatrix.get()); @@ -498,7 +498,7 @@ void CBC_PDF417::encodeChar(int32_t pattern, logic->addBar(last, width); } -void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, +void CBC_PDF417::encodeLowLevel(WideString fullCodewords, int32_t c, int32_t r, int32_t errorCorrectionLevel, diff --git a/fxbarcode/pdf417/BC_PDF417.h b/fxbarcode/pdf417/BC_PDF417.h index e6140a8fd7..6014df0e3b 100644 --- a/fxbarcode/pdf417/BC_PDF417.h +++ b/fxbarcode/pdf417/BC_PDF417.h @@ -23,7 +23,7 @@ class CBC_PDF417 { virtual ~CBC_PDF417(); CBC_BarcodeMatrix* getBarcodeMatrix(); - bool generateBarcodeLogic(CFX_WideString msg, int32_t errorCorrectionLevel); + bool generateBarcodeLogic(WideString msg, int32_t errorCorrectionLevel); void setDimensions(int32_t maxCols, int32_t minCols, int32_t maxRows, @@ -45,7 +45,7 @@ class CBC_PDF417 { int32_t c, int32_t r); static void encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic); - void encodeLowLevel(CFX_WideString fullCodewords, + void encodeLowLevel(WideString fullCodewords, int32_t c, int32_t r, int32_t errorCorrectionLevel, diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp index 1d8258e720..ade3eb584d 100644 --- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp +++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp @@ -132,9 +132,9 @@ int32_t CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount( } bool CBC_PDF417ErrorCorrection::generateErrorCorrection( - const CFX_WideString& dataCodewords, + const WideString& dataCodewords, int32_t errorCorrectionLevel, - CFX_WideString* result) { + WideString* result) { assert(result); assert(result->IsEmpty()); diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h index 3a84ef5845..3e28162653 100644 --- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h +++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h @@ -17,9 +17,9 @@ class CBC_PDF417ErrorCorrection { virtual ~CBC_PDF417ErrorCorrection(); static int32_t getErrorCorrectionCodewordCount(int32_t errorCorrectionLevel); - static bool generateErrorCorrection(const CFX_WideString& dataCodewords, + static bool generateErrorCorrection(const WideString& dataCodewords, int32_t errorCorrectionLevel, - CFX_WideString* result); + WideString* result); }; #endif // FXBARCODE_PDF417_BC_PDF417ERRORCORRECTION_H_ diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index c531716e4f..1450b37ea9 100644 --- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -55,24 +55,23 @@ void CBC_PDF417HighLevelEncoder::Initialize() { void CBC_PDF417HighLevelEncoder::Finalize() {} -CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( - CFX_WideString wideMsg, - Compaction compaction, - int32_t& e) { - CFX_ByteString bytes; +WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(WideString wideMsg, + Compaction compaction, + int32_t& e) { + ByteString bytes; CBC_UtilCodingConvert::UnicodeToUTF8(wideMsg, bytes); - CFX_WideString msg; + WideString msg; int32_t len = bytes.GetLength(); for (int32_t i = 0; i < len; i++) { wchar_t ch = (wchar_t)(bytes[i] & 0xff); if (ch == '?' && bytes[i] != '?') { e = BCExceptionCharactersOutsideISO88591Encoding; - return CFX_WideString(); + return WideString(); } msg += ch; } std::vector<uint8_t> byteArr(bytes.begin(), bytes.end()); - CFX_WideString sb; + WideString sb; len = msg.GetLength(); int32_t p = 0; int32_t textSubMode = SUBMODE_ALPHA; @@ -145,12 +144,12 @@ void CBC_PDF417HighLevelEncoder::Inverse() { } } -int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, +int32_t CBC_PDF417HighLevelEncoder::encodeText(WideString msg, int32_t startpos, int32_t count, - CFX_WideString& sb, + WideString& sb, int32_t initialSubmode) { - CFX_WideString tmp; + WideString tmp; int32_t submode = initialSubmode; int32_t idx = 0; while (true) { @@ -262,7 +261,7 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(std::vector<uint8_t>* bytes, int32_t startpos, int32_t count, int32_t startmode, - CFX_WideString& sb) { + WideString& sb) { if (count == 1 && startmode == TEXT_COMPACTION) { sb += (wchar_t)SHIFT_TO_BYTE; } @@ -295,16 +294,16 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(std::vector<uint8_t>* bytes, sb += (wchar_t)ch; } } -void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, +void CBC_PDF417HighLevelEncoder::encodeNumeric(WideString msg, int32_t startpos, int32_t count, - CFX_WideString& sb) { + WideString& sb) { int32_t idx = 0; BigInteger num900 = 900; while (idx < count) { - CFX_WideString tmp; + WideString tmp; int32_t len = 44 < count - idx ? 44 : count - idx; - CFX_ByteString part = + ByteString part = ((wchar_t)'1' + msg.Mid(startpos + idx, len)).UTF8Encode(); BigInteger bigint = stringToBigInteger(part.c_str()); do { @@ -337,7 +336,7 @@ bool CBC_PDF417HighLevelEncoder::isText(wchar_t ch) { return ch == '\t' || ch == '\n' || ch == '\r' || (ch >= 32 && ch <= 126); } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount( - CFX_WideString msg, + WideString msg, int32_t startpos) { int32_t count = 0; int32_t len = msg.GetLength(); @@ -355,7 +354,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount( return count; } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount( - CFX_WideString msg, + WideString msg, int32_t startpos) { int32_t len = msg.GetLength(); int32_t idx = startpos; @@ -384,7 +383,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount( return idx - startpos; } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount( - CFX_WideString msg, + WideString msg, std::vector<uint8_t>* bytes, int32_t startpos, int32_t& e) { diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h index 32482dc22b..2701c810fb 100644 --- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h +++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h @@ -14,9 +14,9 @@ class CBC_PDF417HighLevelEncoder { public: - static CFX_WideString encodeHighLevel(CFX_WideString msg, - Compaction compaction, - int32_t& e); + static WideString encodeHighLevel(WideString msg, + Compaction compaction, + int32_t& e); static void Inverse(); static void Initialize(); static void Finalize(); @@ -35,31 +35,31 @@ class CBC_PDF417HighLevelEncoder { static uint8_t TEXT_PUNCTUATION_RAW[]; static int32_t MIXED[128]; static int32_t PUNCTUATION[128]; - static int32_t encodeText(CFX_WideString msg, + static int32_t encodeText(WideString msg, int32_t startpos, int32_t count, - CFX_WideString& sb, + WideString& sb, int32_t initialSubmode); static void encodeBinary(std::vector<uint8_t>* bytes, int32_t startpos, int32_t count, int32_t startmode, - CFX_WideString& sb); - static void encodeNumeric(CFX_WideString msg, + WideString& sb); + static void encodeNumeric(WideString msg, int32_t startpos, int32_t count, - CFX_WideString& sb); + WideString& sb); static bool isDigit(wchar_t ch); static bool isAlphaUpper(wchar_t ch); static bool isAlphaLower(wchar_t ch); static bool isMixed(wchar_t ch); static bool isPunctuation(wchar_t ch); static bool isText(wchar_t ch); - static int32_t determineConsecutiveDigitCount(CFX_WideString msg, + static int32_t determineConsecutiveDigitCount(WideString msg, int32_t startpos); - static int32_t determineConsecutiveTextCount(CFX_WideString msg, + static int32_t determineConsecutiveTextCount(WideString msg, int32_t startpos); - static int32_t determineConsecutiveBinaryCount(CFX_WideString msg, + static int32_t determineConsecutiveBinaryCount(WideString msg, std::vector<uint8_t>* bytes, int32_t startpos, int32_t& e); diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp index 14311742f1..ad4a59af40 100644 --- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp +++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp @@ -47,8 +47,8 @@ TEST(PDF417HighLevelEncoder, EncodeBinary) { for (size_t j = 0; j < input_length; ++j) { input_array[j] = ptr->input[j]; } - CFX_WideString expected(ptr->expected, ptr->expected_length); - CFX_WideString result; + WideString expected(ptr->expected, ptr->expected_length); + WideString result; CBC_PDF417HighLevelEncoder::encodeBinary( &input_array, ptr->offset, ptr->count, ptr->startmode, result); EXPECT_EQ(expected, result) << " for case number " << i; @@ -109,9 +109,9 @@ TEST(PDF417HighLevelEncoder, EncodeNumeric) { CBC_PDF417HighLevelEncoder::Initialize(); for (size_t i = 0; i < FX_ArraySize(encode_numeric_cases); ++i) { EncodeNumericCase* ptr = &encode_numeric_cases[i]; - CFX_WideString input(ptr->input); - CFX_WideString expected(ptr->expected, ptr->expected_length); - CFX_WideString result; + WideString input(ptr->input); + WideString expected(ptr->expected, ptr->expected_length); + WideString result; CBC_PDF417HighLevelEncoder::encodeNumeric(input, ptr->offset, ptr->count, result); EXPECT_EQ(expected, result) << " for case number " << i; @@ -156,7 +156,7 @@ TEST(PDF417HighLevelEncoder, ConsecutiveDigitCount) { CBC_PDF417HighLevelEncoder::Initialize(); for (size_t i = 0; i < FX_ArraySize(consecutive_digit_cases); ++i) { ConsecutiveDigitCase* ptr = &consecutive_digit_cases[i]; - CFX_WideString input(ptr->input); + WideString input(ptr->input); int actual_count = CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(input, ptr->offset); @@ -217,7 +217,7 @@ TEST(PDF417HighLevelEncoder, ConsecutiveTextCount) { CBC_PDF417HighLevelEncoder::Initialize(); for (size_t i = 0; i < FX_ArraySize(consecutive_text_cases); ++i) { ConsecutiveTextCase* ptr = &consecutive_text_cases[i]; - CFX_WideString input(ptr->input); + WideString input(ptr->input); int actual_count = CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(input, ptr->offset); diff --git a/fxbarcode/pdf417/BC_PDF417Writer.cpp b/fxbarcode/pdf417/BC_PDF417Writer.cpp index 2f6fc9e1b0..4fec974737 100644 --- a/fxbarcode/pdf417/BC_PDF417Writer.cpp +++ b/fxbarcode/pdf417/BC_PDF417Writer.cpp @@ -48,7 +48,7 @@ void CBC_PDF417Writer::SetTruncated(bool truncated) { m_bTruncated = truncated; } -uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents, +uint8_t* CBC_PDF417Writer::Encode(const WideString& contents, int32_t& outWidth, int32_t& outHeight) { CBC_PDF417 encoder; diff --git a/fxbarcode/pdf417/BC_PDF417Writer.h b/fxbarcode/pdf417/BC_PDF417Writer.h index 39418715ce..ef5961653e 100644 --- a/fxbarcode/pdf417/BC_PDF417Writer.h +++ b/fxbarcode/pdf417/BC_PDF417Writer.h @@ -18,7 +18,7 @@ class CBC_PDF417Writer : public CBC_TwoDimWriter { CBC_PDF417Writer(); ~CBC_PDF417Writer() override; - uint8_t* Encode(const CFX_WideString& contents, + uint8_t* Encode(const WideString& contents, int32_t& outWidth, int32_t& outHeight); |