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

Side by Side Diff: xfa/src/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 // Original code is licensed as follows: 6 // Original code is licensed as follows:
7 /* 7 /*
8 * Copyright 2006-2007 Jeremias Maerki. 8 * Copyright 2006-2007 Jeremias Maerki.
9 * 9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * Licensed under the Apache License, Version 2.0 (the "License");
(...skipping 16 matching lines...) Expand all
27 #include "BC_SymbolInfo.h" 27 #include "BC_SymbolInfo.h"
28 #include "BC_EncoderContext.h" 28 #include "BC_EncoderContext.h"
29 #include "BC_HighLevelEncoder.h" 29 #include "BC_HighLevelEncoder.h"
30 #include "BC_ASCIIEncoder.h" 30 #include "BC_ASCIIEncoder.h"
31 CBC_ASCIIEncoder::CBC_ASCIIEncoder() 31 CBC_ASCIIEncoder::CBC_ASCIIEncoder()
32 { 32 {
33 } 33 }
34 CBC_ASCIIEncoder::~CBC_ASCIIEncoder() 34 CBC_ASCIIEncoder::~CBC_ASCIIEncoder()
35 { 35 {
36 } 36 }
37 FX_INT32 CBC_ASCIIEncoder::getEncodingMode() 37 int32_t CBC_ASCIIEncoder::getEncodingMode()
38 { 38 {
39 return ASCII_ENCODATION; 39 return ASCII_ENCODATION;
40 } 40 }
41 void CBC_ASCIIEncoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) 41 void CBC_ASCIIEncoder::Encode(CBC_EncoderContext &context, int32_t &e)
42 { 42 {
43 FX_INT32 n = CBC_HighLevelEncoder::determineConsecutiveDigitCount(context.m_ msg, context.m_pos); 43 int32_t n = CBC_HighLevelEncoder::determineConsecutiveDigitCount(context.m_m sg, context.m_pos);
44 if (n >= 2) { 44 if (n >= 2) {
45 FX_WCHAR code = encodeASCIIDigits(context.m_msg.GetAt(context.m_pos), co ntext.m_msg.GetAt(context.m_pos + 1), e); 45 FX_WCHAR code = encodeASCIIDigits(context.m_msg.GetAt(context.m_pos), co ntext.m_msg.GetAt(context.m_pos + 1), e);
46 if (e != BCExceptionNO) { 46 if (e != BCExceptionNO) {
47 return; 47 return;
48 } 48 }
49 context.writeCodeword(code); 49 context.writeCodeword(code);
50 context.m_pos += 2; 50 context.m_pos += 2;
51 } else { 51 } else {
52 FX_WCHAR c = context.getCurrentChar(); 52 FX_WCHAR c = context.getCurrentChar();
53 FX_INT32 newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, co ntext.m_pos, getEncodingMode()); 53 int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, con text.m_pos, getEncodingMode());
54 if (newMode != getEncodingMode()) { 54 if (newMode != getEncodingMode()) {
55 switch (newMode) { 55 switch (newMode) {
56 case BASE256_ENCODATION: 56 case BASE256_ENCODATION:
57 context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_BASE256 ); 57 context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_BASE256 );
58 context.signalEncoderChange(BASE256_ENCODATION); 58 context.signalEncoderChange(BASE256_ENCODATION);
59 return; 59 return;
60 case C40_ENCODATION: 60 case C40_ENCODATION:
61 context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_C40); 61 context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_C40);
62 context.signalEncoderChange(C40_ENCODATION); 62 context.signalEncoderChange(C40_ENCODATION);
63 return; 63 return;
(...skipping 16 matching lines...) Expand all
80 } else if (CBC_HighLevelEncoder::isExtendedASCII(c)) { 80 } else if (CBC_HighLevelEncoder::isExtendedASCII(c)) {
81 context.writeCodeword(CBC_HighLevelEncoder::UPPER_SHIFT); 81 context.writeCodeword(CBC_HighLevelEncoder::UPPER_SHIFT);
82 context.writeCodeword((FX_WCHAR) (c - 128 + 1)); 82 context.writeCodeword((FX_WCHAR) (c - 128 + 1));
83 context.m_pos++; 83 context.m_pos++;
84 } else { 84 } else {
85 context.writeCodeword((FX_WCHAR) (c + 1)); 85 context.writeCodeword((FX_WCHAR) (c + 1));
86 context.m_pos++; 86 context.m_pos++;
87 } 87 }
88 } 88 }
89 } 89 }
90 FX_WCHAR CBC_ASCIIEncoder::encodeASCIIDigits(FX_WCHAR digit1, FX_WCHAR digit2, F X_INT32 &e) 90 FX_WCHAR CBC_ASCIIEncoder::encodeASCIIDigits(FX_WCHAR digit1, FX_WCHAR digit2, i nt32_t &e)
91 { 91 {
92 if (CBC_HighLevelEncoder::isDigit(digit1) && CBC_HighLevelEncoder::isDigit(d igit2)) { 92 if (CBC_HighLevelEncoder::isDigit(digit1) && CBC_HighLevelEncoder::isDigit(d igit2)) {
93 FX_INT32 num = (digit1 - 48) * 10 + (digit2 - 48); 93 int32_t num = (digit1 - 48) * 10 + (digit2 - 48);
94 FX_WCHAR a = (FX_WCHAR) (num + 130); 94 FX_WCHAR a = (FX_WCHAR) (num + 130);
95 return (FX_WCHAR) (num + 130); 95 return (FX_WCHAR) (num + 130);
96 } 96 }
97 e = BCExceptionIllegalArgumentNotGigits; 97 e = BCExceptionIllegalArgumentNotGigits;
98 return 0; 98 return 0;
99 } 99 }
OLDNEW
« no previous file with comments | « xfa/src/fxbarcode/datamatrix/BC_ASCIIEncoder.h ('k') | xfa/src/fxbarcode/datamatrix/BC_Base256Encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698