OLD | NEW |
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 2008 ZXing authors | 8 * Copyright 2008 ZXing authors |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 int32_t CBC_CommonByteArray::At(int32_t index) const { | 47 int32_t CBC_CommonByteArray::At(int32_t index) const { |
48 return m_bytes[index] & 0xff; | 48 return m_bytes[index] & 0xff; |
49 } | 49 } |
50 void CBC_CommonByteArray::Set(int32_t index, int32_t value) { | 50 void CBC_CommonByteArray::Set(int32_t index, int32_t value) { |
51 m_bytes[index] = (uint8_t)value; | 51 m_bytes[index] = (uint8_t)value; |
52 } | 52 } |
53 int32_t CBC_CommonByteArray::Size() const { | 53 int32_t CBC_CommonByteArray::Size() const { |
54 return m_size; | 54 return m_size; |
55 } | 55 } |
56 FX_BOOL CBC_CommonByteArray::IsEmpty() const { | 56 bool CBC_CommonByteArray::IsEmpty() const { |
57 return m_size == 0; | 57 return m_size == 0; |
58 } | 58 } |
59 void CBC_CommonByteArray::AppendByte(int32_t value) { | 59 void CBC_CommonByteArray::AppendByte(int32_t value) { |
60 if (m_size == 0 || m_index >= m_size) { | 60 if (m_size == 0 || m_index >= m_size) { |
61 int32_t newSize = std::max(32, m_size << 1); | 61 int32_t newSize = std::max(32, m_size << 1); |
62 Reserve(newSize); | 62 Reserve(newSize); |
63 } | 63 } |
64 m_bytes[m_index] = (uint8_t)value; | 64 m_bytes[m_index] = (uint8_t)value; |
65 m_index++; | 65 m_index++; |
66 } | 66 } |
(...skipping 23 matching lines...) Expand all Loading... |
90 int32_t count) { | 90 int32_t count) { |
91 FX_Free(m_bytes); | 91 FX_Free(m_bytes); |
92 m_bytes = FX_Alloc(uint8_t, count); | 92 m_bytes = FX_Alloc(uint8_t, count); |
93 m_size = count; | 93 m_size = count; |
94 int32_t i; | 94 int32_t i; |
95 for (i = 0; i < count; i++) { | 95 for (i = 0; i < count; i++) { |
96 m_bytes[i] = source->operator[](i + offset); | 96 m_bytes[i] = source->operator[](i + offset); |
97 } | 97 } |
98 m_index = m_size; | 98 m_index = m_size; |
99 } | 99 } |
OLD | NEW |