Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1907)

Unified Diff: xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp

Issue 1986533002: Fix the code that causes warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fgas/xml/fgas_sax.cpp ('k') | xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
diff --git a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
index 1c20b7c8a1bae36bf898c9419e3c3b36c79b7b28..8f54353d4ade02f0f8ba74bfda80b4faef986f9a 100644
--- a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -172,14 +172,12 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
int32_t len,
int32_t numECWords,
int32_t& e) {
- int32_t table = -1;
- for (int32_t i = 0; i < sizeof(FACTOR_SETS) / sizeof(int32_t); i++) {
- if (FACTOR_SETS[i] == numECWords) {
- table = i;
- break;
- }
- }
- if (table < 0) {
+ static const size_t kFactorTableNum = sizeof(FACTOR_SETS) / sizeof(int32_t);
+ size_t table = 0;
+ while (table < kFactorTableNum && FACTOR_SETS[table] != numECWords)
+ table++;
+
+ if (table >= kFactorTableNum) {
e = BCExceptionIllegalArgument;
return (FX_WCHAR*)"";
}
« no previous file with comments | « xfa/fgas/xml/fgas_sax.cpp ('k') | xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698