summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-22 16:08:28 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-22 16:08:28 +0000
commit101da6bc6d6cb5b8dabeaf19a7a0758017f37958 (patch)
tree462e5972c022e92a523ba6b44d377c687d0f154e
parent1f4d8492095a3d6c6d3452ef075a91d4764a5dc5 (diff)
downloadpdfium-101da6bc6d6cb5b8dabeaf19a7a0758017f37958.tar.xz
Remove JBIG2_memcpy() and JBIG2_memset().
Just use memcpy() and memset(). Change-Id: Id6c6fab4e65a5524786ae318270c5981313825f2 Reviewed-on: https://pdfium-review.googlesource.com/32743 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--core/fxcodec/jbig2/JBig2_Context.cpp10
-rw-r--r--core/fxcodec/jbig2/JBig2_Define.h4
-rw-r--r--core/fxcodec/jbig2/JBig2_Image.cpp16
-rw-r--r--core/fxcodec/jbig2/JBig2_SddProc.cpp6
4 files changed, 19 insertions, 17 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index 5a10cc39a4..72670049cd 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -6,6 +6,8 @@
#include "core/fxcodec/jbig2/JBig2_Context.h"
+#include <string.h>
+
#include <algorithm>
#include <limits>
#include <list>
@@ -877,7 +879,7 @@ JBig2_Result CJBig2_Context::ParseTextRegion(CJBig2_Segment* pSegment) {
if (pTRD->SBREFINE == 1) {
const size_t size = GetRefAggContextSize(pTRD->SBRTEMPLATE);
grContext.reset(FX_Alloc(JBig2ArithCtx, size));
- JBIG2_memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size);
+ memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size);
}
if (pTRD->SBHUFF == 0) {
auto pArithDecoder =
@@ -931,7 +933,7 @@ JBig2_Result CJBig2_Context::ParsePatternDict(CJBig2_Segment* pSegment,
const size_t size = GetHuffContextSize(pPDD->HDTEMPLATE);
std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext(
FX_Alloc(JBig2ArithCtx, size));
- JBIG2_memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size);
+ memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size);
auto pArithDecoder =
pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_PatternDict =
@@ -1000,7 +1002,7 @@ JBig2_Result CJBig2_Context::ParseHalftoneRegion(CJBig2_Segment* pSegment,
const size_t size = GetHuffContextSize(pHRD->HTEMPLATE);
std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext(
FX_Alloc(JBig2ArithCtx, size));
- JBIG2_memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size);
+ memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size);
auto pArithDecoder =
pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_Image =
@@ -1180,7 +1182,7 @@ JBig2_Result CJBig2_Context::ParseGenericRefinementRegion(
const size_t size = GetRefAggContextSize(pGRRD->GRTEMPLATE);
std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> grContext(
FX_Alloc(JBig2ArithCtx, size));
- JBIG2_memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size);
+ memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size);
auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_nResultType = JBIG2_IMAGE_POINTER;
pSegment->m_Image = pGRRD->Decode(pArithDecoder.get(), grContext.get());
diff --git a/core/fxcodec/jbig2/JBig2_Define.h b/core/fxcodec/jbig2/JBig2_Define.h
index 6fc3434ac7..17eb007bd4 100644
--- a/core/fxcodec/jbig2/JBig2_Define.h
+++ b/core/fxcodec/jbig2/JBig2_Define.h
@@ -7,10 +7,8 @@
#ifndef CORE_FXCODEC_JBIG2_JBIG2_DEFINE_H_
#define CORE_FXCODEC_JBIG2_JBIG2_DEFINE_H_
-#include "core/fxcrt/fx_system.h"
+#include <stdint.h>
-#define JBIG2_memset memset
-#define JBIG2_memcpy memcpy
#define JBIG2_OOB 1
struct JBig2RegionInfo {
diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp
index 2719c2733d..442a36d2a6 100644
--- a/core/fxcodec/jbig2/JBig2_Image.cpp
+++ b/core/fxcodec/jbig2/JBig2_Image.cpp
@@ -7,6 +7,7 @@
#include "core/fxcodec/jbig2/JBig2_Image.h"
#include <limits.h>
+#include <string.h>
#include <algorithm>
#include <memory>
@@ -62,7 +63,7 @@ CJBig2_Image::CJBig2_Image(const CJBig2_Image& other)
if (other.m_pData) {
m_pData.Reset(std::unique_ptr<uint8_t, FxFreeDeleter>(
FX_Alloc2D(uint8_t, m_nStride, m_nHeight)));
- JBIG2_memcpy(data(), other.data(), m_nStride * m_nHeight);
+ memcpy(data(), other.data(), m_nStride * m_nHeight);
}
}
@@ -109,17 +110,16 @@ void CJBig2_Image::CopyLine(int32_t hTo, int32_t hFrom) {
return;
if (hFrom < 0 || hFrom >= m_nHeight) {
- JBIG2_memset(data() + hTo * m_nStride, 0, m_nStride);
+ memset(data() + hTo * m_nStride, 0, m_nStride);
} else {
- JBIG2_memcpy(data() + hTo * m_nStride, data() + hFrom * m_nStride,
- m_nStride);
+ memcpy(data() + hTo * m_nStride, data() + hFrom * m_nStride, m_nStride);
}
}
void CJBig2_Image::Fill(bool v) {
if (!m_pData)
return;
- JBIG2_memset(data(), v ? 0xff : 0, m_nStride * m_nHeight);
+ memset(data(), v ? 0xff : 0, m_nStride * m_nHeight);
}
bool CJBig2_Image::ComposeTo(CJBig2_Image* pDst,
int32_t x,
@@ -234,10 +234,10 @@ void CJBig2_Image::Expand(int32_t h, bool v) {
uint8_t* pExternalBuffer = data();
m_pData.Reset(std::unique_ptr<uint8_t, FxFreeDeleter>(
FX_Alloc(uint8_t, h * m_nStride)));
- JBIG2_memcpy(data(), pExternalBuffer, m_nHeight * m_nStride);
+ memcpy(data(), pExternalBuffer, m_nHeight * m_nStride);
}
- JBIG2_memset(data() + m_nHeight * m_nStride, v ? 0xff : 0,
- (h - m_nHeight) * m_nStride);
+ memset(data() + m_nHeight * m_nStride, v ? 0xff : 0,
+ (h - m_nHeight) * m_nStride);
m_nHeight = h;
}
diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp
index 6bf40efd8f..29c604f1c7 100644
--- a/core/fxcodec/jbig2/JBig2_SddProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp
@@ -6,6 +6,8 @@
#include "core/fxcodec/jbig2/JBig2_SddProc.h"
+#include <string.h>
+
#include <algorithm>
#include <memory>
#include <utility>
@@ -448,8 +450,8 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::DecodeHuffman(
if (pStream->getByteLeft() >= stride * HCHEIGHT) {
BHC = pdfium::MakeUnique<CJBig2_Image>(TOTWIDTH, HCHEIGHT);
for (I = 0; I < HCHEIGHT; I++) {
- JBIG2_memcpy(BHC->data() + I * BHC->stride(), pStream->getPointer(),
- stride);
+ memcpy(BHC->data() + I * BHC->stride(), pStream->getPointer(),
+ stride);
pStream->offset(stride);
}
} else {