| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef XFA_SRC_FXBARCODE_UTILS_H_ | |
| 8 #define XFA_SRC_FXBARCODE_UTILS_H_ | |
| 9 | |
| 10 #include "core/include/fxcrt/fx_basic.h" | |
| 11 | |
| 12 typedef CFX_MapPtrTemplate<void*, int32_t> CFX_PtrToInt32; | |
| 13 FX_BOOL BC_FX_ByteString_Replace(CFX_ByteString& dst, | |
| 14 FX_DWORD first, | |
| 15 FX_DWORD last, | |
| 16 int32_t count, | |
| 17 FX_CHAR c); | |
| 18 void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, FX_CHAR c); | |
| 19 void BC_FX_ByteString_Append(CFX_ByteString& dst, const CFX_ByteArray& ba); | |
| 20 typedef FX_BOOL (*BC_PtrArrayCompareCallback)(void* l, void* r); | |
| 21 void BC_FX_PtrArray_Sort(CFX_PtrArray& src, BC_PtrArrayCompareCallback fun); | |
| 22 | |
| 23 #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_) | |
| 24 #include <limits> | |
| 25 #elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_LINUX_DESKTOP_ || \ | |
| 26 _FX_OS_ == _FX_IOS_) | |
| 27 #include <limits.h> | |
| 28 #endif | |
| 29 #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_) | |
| 30 #define FXSYS_isnan(x) _isnan(x) | |
| 31 #elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_) | |
| 32 #include <cmath> | |
| 33 #define FXSYS_isnan(x) std::isnan(x) | |
| 34 #elif(_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_) | |
| 35 #include <math.h> | |
| 36 #define FXSYS_isnan(x) isnan(x) | |
| 37 #endif | |
| 38 #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_) | |
| 39 #define FXSYS_nan() (std::numeric_limits<float>::quiet_NaN()) | |
| 40 #elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_LINUX_DESKTOP_ || \ | |
| 41 _FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_) | |
| 42 #define FXSYS_nan() NAN | |
| 43 #endif | |
| 44 enum BCFORMAT { | |
| 45 BCFORMAT_UNSPECIFY = -1, | |
| 46 BCFORMAT_CODABAR, | |
| 47 BCFORMAT_CODE_39, | |
| 48 BCFORMAT_CODE_128, | |
| 49 BCFORMAT_CODE_128B, | |
| 50 BCFORMAT_CODE_128C, | |
| 51 BCFORMAT_EAN_8, | |
| 52 BCFORMAT_UPC_A, | |
| 53 BCFORMAT_EAN_13, | |
| 54 BCFORMAT_PDF_417, | |
| 55 BCFORMAT_DATAMATRIX, | |
| 56 BCFORMAT_QR_CODE | |
| 57 }; | |
| 58 #define BCFORMAT_ECLEVEL_L 0 | |
| 59 #define BCFORMAT_ECLEVEL_M 1 | |
| 60 #define BCFORMAT_ECLEVEL_Q 2 | |
| 61 #define BCFORMAT_ECLEVEL_H 3 | |
| 62 #include <ctype.h> | |
| 63 #define FXSYS_IntMax INT_MAX | |
| 64 #define FXSYS_Isdigit isdigit | |
| 65 #define BCExceptionNO 0 | |
| 66 #define BCExceptionNotFound 1 | |
| 67 #define BCExceptionEndLessThanStart 2 | |
| 68 #define BCExceptionUnknownDecoder 3 | |
| 69 #define BCExceptionRotateNotSupported 4 | |
| 70 #define BCExceptionHeightAndWidthMustBeAtLeast1 5 | |
| 71 #define BCExceptionRegionMustFitInsideMatrix 6 | |
| 72 #define BCExceptionCanNotCallGetDimensionOnNonSquareMatrix 7 | |
| 73 #define BCExceptionFormatException 8 | |
| 74 #define BCExceptionIllegalArgumentMustMatchVersionSize 9 | |
| 75 #define BCExceptionChecksumException 10 | |
| 76 #define BCExceptionIllegalArgumentInvalidFirstDigit 11 | |
| 77 #define BCExceptionIllegalArgumentInvalidSecondDigit 12 | |
| 78 #define BCExceptionRuntimeDecodingInvalidISO_IEC 13 | |
| 79 #define BCExceptionRuntimeDecodingInvalidAlphanumeric 14 | |
| 80 #define BCExceptionLeftAndTopMustBeNonnegative 15 | |
| 81 #define BCExceptionIllegalArgument 16 | |
| 82 #define BCExceptionBadECI 17 | |
| 83 #define BCExceptionUnSupportedBarcode 18 | |
| 84 #define BCExceptionUnSupportedString 19 | |
| 85 #define BCExceptionDigitLengthMustBe8 20 | |
| 86 #define BCExceptionDataCheckException 21 | |
| 87 #define BCExceptionExtractNumberValueFromBitArray 22 | |
| 88 #define BCExceptionRead 23 | |
| 89 #define BCExceptionRequestedRowIsOutSizeTheImage 24 | |
| 90 #define BCExceptionNoContents 26 | |
| 91 #define BCExceptionUnSupportEclevel 27 | |
| 92 #define BCExceptionUnSupportMode 28 | |
| 93 #define BCExceptionReferenceMustBeBetween0And7 29 | |
| 94 #define BCExceptionBadErrorLocation 30 | |
| 95 #define BCExceptionDegreeIsNegative 31 | |
| 96 #define BCExceptionDivideByZero 32 | |
| 97 #define BCExceptionCoefficientsSizeIsNull 33 | |
| 98 #define BCExceptionNoCorrectionBytes 34 | |
| 99 #define BCExceptionNoDataBytesProvided 35 | |
| 100 #define BCExceptionR_I_1IsZero 36 | |
| 101 #define BCExceptionAIsZero 37 | |
| 102 #define BCExceptionIsZero 38 | |
| 103 #define BCExceptionDegreeNotMatchRoots 39 | |
| 104 #define BCExceptionContentsLengthShouldBetween1and80 40 | |
| 105 #define BCExceptionOnlyEncodeCODE_128 41 | |
| 106 #define BCExceptionOnlyEncodeCODE_39 42 | |
| 107 #define BCExceptionOnlyEncodeEAN_13 43 | |
| 108 #define BCExceptionOnlyEncodeEAN_8 44 | |
| 109 #define BCExceptionOnlyEncodeITF 45 | |
| 110 #define BCExceptionDigitLengthShould13 46 | |
| 111 #define BCExceptionDigitLengthMustBe6or8or10or12or14or16or20or24or44 47 | |
| 112 #define BCExceptionOnlyEncodeUPC_A 48 | |
| 113 #define BCExceptionDigitLengthShouldBe12 49 | |
| 114 #define BCExceptionValueMustBeEither0or1 50 | |
| 115 #define BCExceptionReedsolomnDecodeException 51 | |
| 116 #define BCExceptionBadIndexException 52 | |
| 117 #define BCExceptionBadValueException 53 | |
| 118 #define BCExceptionBadNumBitsException 54 | |
| 119 #define BCExceptioncanNotOperatexorOperator 55 | |
| 120 #define BCExceptionVersionMust1_40 56 | |
| 121 #define BCExceptionUnknown 57 | |
| 122 #define BCExceptionNoSuchVersion 58 | |
| 123 #define BCExceptionCannotFindBlockInfo 59 | |
| 124 #define BCExceptionDataTooBig 60 | |
| 125 #define BCExceptionInvalidQRCode 61 | |
| 126 #define BCExceptionDataTooMany 62 | |
| 127 #define BCExceptionBitsNotEqualCacity 63 | |
| 128 #define BCExceptionUnsupportedMode 64 | |
| 129 #define BCExceptionInvalidateCharacter 65 | |
| 130 #define BCExceptionBytesNotMatchOffset 66 | |
| 131 #define BCExceptionSizeInBytesDiffer 67 | |
| 132 #define BCExceptionInvalidateMaskPattern 68 | |
| 133 #define BCExceptionNullPointer 69 | |
| 134 #define BCExceptionBadMask 70 | |
| 135 #define BCExceptionBitSizeNot15 71 | |
| 136 #define BCExceptionBitSizeNot18 72 | |
| 137 #define BCExceptionInvalidateImageData 73 | |
| 138 #define BCExceptionHeight_8BeZero 74 | |
| 139 #define BCExceptionCharacterNotThisMode 75 | |
| 140 #define BCExceptionBitsBytesNotMatch 76 | |
| 141 #define BCExceptionInvalidateData 77 | |
| 142 #define BCExceptionLoadFile 78 | |
| 143 #define BCExceptionPDF417EncodeFail 79 | |
| 144 #define BCExceptionFailToCreateBitmap 80 | |
| 145 #define BCExceptionLoadFontFail 81 | |
| 146 #define BCExceptionOnlyEncodeCODEBAR 82 | |
| 147 #define BCExceptionCodabarShouldStartWithOneOfABCD 83 | |
| 148 #define BCExceptionCodabarShouldEndWithOneOfTNE 84 | |
| 149 #define BCExceptionCodabarEncodeCharsInvalid 85 | |
| 150 #define BCExceptionOnlyEncodeDATAMATRIX 86 | |
| 151 #define BCExceptionCharactersOutsideISO88591Encoding 87 | |
| 152 #define BCExceptionIllegalDataCodewords 88 | |
| 153 #define BCExceptionCannotHandleThisNumberOfDataRegions 89 | |
| 154 #define BCExceptionIllegalStateUnexpectedCase 90 | |
| 155 #define BCExceptionIllegalStateCountMustNotExceed4 91 | |
| 156 #define BCExceptionIllegalStateMessageLengthInvalid 92 | |
| 157 #define BCExceptionIllegalArgumentNotGigits 93 | |
| 158 #define BCExceptionIllegalStateIllegalMode 94 | |
| 159 #define BCExceptionOnlyEncodePDF417 95 | |
| 160 #define BCExceptionNonEncodableCharacterDetected 96 | |
| 161 #define BCExceptionErrorCorrectionLevelMustBeBetween0And8 97 | |
| 162 #define BCExceptionNoRecommendationPossible 98 | |
| 163 #define BCExceptionIllegalArgumentnMustBeAbove0 99 | |
| 164 #define BCExceptionUnableToFitMessageInColumns 100 | |
| 165 #define BCExceptionEncodedMessageContainsTooManyCodeWords 101 | |
| 166 #define BCExceptionBitmapSizeError 102 | |
| 167 #define BCExceptionFormatInstance 102 | |
| 168 #define BCExceptionChecksumInstance 103 | |
| 169 #define BCExceptiontNotFoundInstance 104 | |
| 170 #define BCExceptionNotFoundInstance 105 | |
| 171 #define BCExceptionCannotMetadata 106 | |
| 172 #define TWO_DIGIT_DATA_LENGTH_SIZE 24 | |
| 173 #define THREE_DIGIT_DATA_LENGTH_SIZE 23 | |
| 174 #define THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH_SIZE 57 | |
| 175 #define FOUR_DIGIT_DATA_LENGTH_SIZE 17 | |
| 176 #define BC_EXCEPTION_CHECK_ReturnVoid(e) \ | |
| 177 if (e != BCExceptionNO) \ | |
| 178 return; | |
| 179 #define BC_EXCEPTION_CHECK_ReturnValue(e, v) \ | |
| 180 if (e != BCExceptionNO) \ | |
| 181 return v; | |
| 182 | |
| 183 #endif // XFA_SRC_FXBARCODE_UTILS_H_ | |
| OLD | NEW |