summaryrefslogtreecommitdiff
path: root/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-06-09 13:24:12 -0700
committerTom Sepez <tsepez@chromium.org>2015-06-09 13:24:12 -0700
commitbfa9a824a20f37c2dd7111012b46c929cf2ed8a0 (patch)
tree4cfbe682869d89900f33751c37f6a84865beeb0a /xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
parentb116136da234afcad018bb44a3ccb64b9ad2a554 (diff)
downloadpdfium-bfa9a824a20f37c2dd7111012b46c929cf2ed8a0.tar.xz
Merge to XFA: Use stdint.h types throughout PDFium.
Near-automatic merge, plus re-running scripts to update additional usage. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1172793002
Diffstat (limited to 'xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp')
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 19f7f7cede..fdf791c686 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -40,7 +40,7 @@ CBC_OnedEAN8Writer::CBC_OnedEAN8Writer()
CBC_OnedEAN8Writer::~CBC_OnedEAN8Writer()
{
}
-void CBC_OnedEAN8Writer::SetDataLength(FX_INT32 length)
+void CBC_OnedEAN8Writer::SetDataLength(int32_t length)
{
m_iDataLenth = 8;
}
@@ -54,7 +54,7 @@ FX_BOOL CBC_OnedEAN8Writer::SetTextLocation(BC_TEXT_LOC location)
}
FX_BOOL CBC_OnedEAN8Writer::CheckContentValidity(FX_WSTR contents)
{
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
continue;
} else {
@@ -67,7 +67,7 @@ CFX_WideString CBC_OnedEAN8Writer::FilterContents(FX_WSTR contents)
{
CFX_WideString filtercontents;
FX_WCHAR ch;
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
ch = contents.GetAt(i);
if(ch > 175) {
i++;
@@ -79,12 +79,12 @@ CFX_WideString CBC_OnedEAN8Writer::FilterContents(FX_WSTR contents)
}
return filtercontents;
}
-FX_INT32 CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString &contents)
+int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString &contents)
{
- FX_INT32 odd = 0;
- FX_INT32 even = 0;
- FX_INT32 j = 1;
- for(FX_INT32 i = contents.GetLength() - 1; i >= 0; i--) {
+ int32_t odd = 0;
+ int32_t even = 0;
+ int32_t j = 1;
+ for(int32_t i = contents.GetLength() - 1; i >= 0; i--) {
if(j % 2) {
odd += FXSYS_atoi(contents.Mid(i, 1));
} else {
@@ -92,44 +92,44 @@ FX_INT32 CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString &contents)
}
j++;
}
- FX_INT32 checksum = (odd * 3 + even) % 10;
+ int32_t checksum = (odd * 3 + even) % 10;
checksum = (10 - checksum) % 10;
return (checksum);
}
-FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight , FX_INT32 &e)
+uint8_t *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight , int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints , FX_INT32 &e)
+uint8_t *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints , int32_t &e)
{
if (format != BCFORMAT_EAN_8) {
e = BCExceptionOnlyEncodeEAN_8;
return NULL;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, FX_INT32 &outLength , FX_INT32 &e)
+uint8_t *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, int32_t &outLength , int32_t &e)
{
if (contents.GetLength() != 8) {
e = BCExceptionDigitLengthMustBe8;
return NULL;
}
outLength = m_codeWidth;
- FX_BYTE *result = FX_Alloc(FX_BYTE, m_codeWidth);
- FX_INT32 pos = 0;
+ uint8_t *result = FX_Alloc(uint8_t, m_codeWidth);
+ int32_t pos = 0;
pos += AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
return NULL;
}
- FX_INT32 i = 0;
+ int32_t i = 0;
for (i = 0; i <= 3; i++) {
- FX_INT32 digit = FXSYS_atoi(contents.Mid(i, 1));
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1));
pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 0, e);
if (e != BCExceptionNO) {
FX_Free (result);
@@ -142,7 +142,7 @@ FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, FX_INT32 &ou
return NULL;
}
for (i = 4; i <= 7; i++) {
- FX_INT32 digit = FXSYS_atoi(contents.Mid(i, 1));
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1));
pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
@@ -156,31 +156,31 @@ FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, FX_INT32 &ou
}
return result;
}
-void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e)
+void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e)
{
if (device == NULL && pOutBitmap == NULL) {
e = BCExceptionIllegalArgument;
return;
}
- FX_INT32 leftPosition = 3 * multiple;
+ int32_t leftPosition = 3 * multiple;
CFX_ByteString str = FX_UTF8Encode(contents);
- FX_INT32 iLength = str.GetLength();
+ int32_t iLength = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLength);
if (!pCharPos) {
return;
}
FXSYS_memset32(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLength);
CFX_ByteString tempStr = str.Mid(0, 4);
- FX_INT32 iLen = tempStr.GetLength();
- FX_INT32 strWidth = 7 * multiple * 4;
+ int32_t iLen = tempStr.GetLength();
+ int32_t strWidth = 7 * multiple * 4;
FX_FLOAT blank = 0.0;
CFX_FxgeDevice geBitmap;
if (pOutBitmap != NULL) {
geBitmap.Attach(pOutBitmap);
}
FX_FLOAT charsWidth = 0;
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
if (pOutBitmap == NULL) {
CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect((FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
@@ -196,7 +196,7 @@ void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, C
device->FillRect(&re, m_backgroundColor);
}
if (pOutBitmap == NULL) {
- strWidth = (FX_INT32)(strWidth * m_outputHScale);
+ strWidth = (int32_t)(strWidth * m_outputHScale);
}
CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, blank);
CFX_AffineMatrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
@@ -255,7 +255,7 @@ void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, C
}
FX_Free(pCharPos);
}
-void CBC_OnedEAN8Writer::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedEAN8Writer::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
}