diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-11 12:05:04 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-11 12:05:04 -0700 |
commit | 677b8fffb0c76c009ad808ed91a27738e5420254 (patch) | |
tree | 3cf9937569b7ca0cb93b6dfd04ac854f414f9d36 /core/src/fxcodec/codec | |
parent | 2b5e0d5b20654d116045484868c9e015ed698124 (diff) | |
download | pdfium-677b8fffb0c76c009ad808ed91a27738e5420254.tar.xz |
Kill FXSYS_mem{cpy,cmp,set.move}{32,8}.
At one point in time, it may have made sense to indicate the
expected alignment of the memory you're about to copy, but that
was last century. The compiler will take care of it just fine.
I stopped short of removing the FXSYS_ wrapper macros entirely.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1179693003.
Diffstat (limited to 'core/src/fxcodec/codec')
-rw-r--r-- | core/src/fxcodec/codec/fx_codec.cpp | 10 | ||||
-rw-r--r-- | core/src/fxcodec/codec/fx_codec_fax.cpp | 22 | ||||
-rw-r--r-- | core/src/fxcodec/codec/fx_codec_flate.cpp | 22 | ||||
-rw-r--r-- | core/src/fxcodec/codec/fx_codec_icc.cpp | 2 | ||||
-rw-r--r-- | core/src/fxcodec/codec/fx_codec_jbig.cpp | 6 | ||||
-rw-r--r-- | core/src/fxcodec/codec/fx_codec_jpeg.cpp | 14 | ||||
-rw-r--r-- | core/src/fxcodec/codec/fx_codec_jpx_opj.cpp | 8 |
7 files changed, 42 insertions, 42 deletions
diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index 1068126d5d..db95053efd 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -98,7 +98,7 @@ uint8_t* CCodec_ScanlineDecoder::ReadNextLine() return NULL; } if (m_pDataCache && m_NextLine == m_pDataCache->m_nCachedLines) { - FXSYS_memcpy32(&m_pDataCache->m_Data + m_NextLine * m_Pitch, pLine, m_Pitch); + FXSYS_memcpy(&m_pDataCache->m_Data + m_NextLine * m_Pitch, pLine, m_Pitch); m_pDataCache->m_nCachedLines ++; } return pLine; @@ -337,7 +337,7 @@ FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_si } FX_BOOL CCodec_RLScanlineDecoder::v_Rewind() { - FXSYS_memset32(m_pScanline, 0, m_Pitch); + FXSYS_memset(m_pScanline, 0, m_Pitch); m_SrcOffset = 0; m_bEOD = FALSE; m_Operator = 0; @@ -352,7 +352,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() return NULL; } } - FXSYS_memset32(m_pScanline, 0, m_Pitch); + FXSYS_memset(m_pScanline, 0, m_Pitch); FX_DWORD col_pos = 0; FX_BOOL eol = FALSE; while (m_SrcOffset < m_SrcSize && !eol) { @@ -366,7 +366,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() copy_len = m_SrcSize - m_SrcOffset; m_bEOD = TRUE; } - FXSYS_memcpy32(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len); + FXSYS_memcpy(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len); col_pos += copy_len; UpdateOperator((uint8_t)copy_len); } else if (m_Operator > 128) { @@ -379,7 +379,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() duplicate_len = m_dwLineBytes - col_pos; eol = TRUE; } - FXSYS_memset8(m_pScanline + col_pos, fill, duplicate_len); + FXSYS_memset(m_pScanline + col_pos, fill, duplicate_len); col_pos += duplicate_len; UpdateOperator((uint8_t)duplicate_len); } else { diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index 40502362d5..148d3d49fc 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -130,7 +130,7 @@ void _FaxFillBits(uint8_t* dest_buf, int columns, int startpos, int endpos) dest_buf[last_byte] -= 1 << (7 - i); } if (last_byte > first_byte + 1) { - FXSYS_memset32(dest_buf + first_byte + 1, 0, last_byte - first_byte - 1); + FXSYS_memset(dest_buf + first_byte + 1, 0, last_byte - first_byte - 1); } } #define NEXTBIT src_buf[bitpos/8] & (1 << (7-bitpos%8)); bitpos ++; @@ -633,7 +633,7 @@ FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int } FX_BOOL CCodec_FaxDecoder::v_Rewind() { - FXSYS_memset8(m_pRefBuf, 0xff, m_Pitch); + FXSYS_memset(m_pRefBuf, 0xff, m_Pitch); bitpos = 0; return TRUE; } @@ -644,10 +644,10 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() if (bitpos >= bitsize) { return NULL; } - FXSYS_memset8(m_pScanlineBuf, 0xff, m_Pitch); + FXSYS_memset(m_pScanlineBuf, 0xff, m_Pitch); if (m_Encoding < 0) { _FaxG4GetRow(m_pSrcBuf, bitsize, bitpos, m_pScanlineBuf, m_pRefBuf, m_OrigWidth); - FXSYS_memcpy32(m_pRefBuf, m_pScanlineBuf, m_Pitch); + FXSYS_memcpy(m_pRefBuf, m_pScanlineBuf, m_Pitch); } else if (m_Encoding == 0) { _FaxGet1DLine(m_pSrcBuf, bitsize, bitpos, m_pScanlineBuf, m_OrigWidth); } else { @@ -658,7 +658,7 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() } else { _FaxG4GetRow(m_pSrcBuf, bitsize, bitpos, m_pScanlineBuf, m_pRefBuf, m_OrigWidth); } - FXSYS_memcpy32(m_pRefBuf, m_pScanlineBuf, m_Pitch); + FXSYS_memcpy(m_pRefBuf, m_pScanlineBuf, m_Pitch); } if (m_bEndOfLine) { _FaxSkipEOL(m_pSrcBuf, bitsize, bitpos); @@ -700,13 +700,13 @@ extern "C" { pitch = (width + 7) / 8; } uint8_t* ref_buf = FX_Alloc(uint8_t, pitch); - FXSYS_memset8(ref_buf, 0xff, pitch); + FXSYS_memset(ref_buf, 0xff, pitch); int bitpos = *pbitpos; for (int iRow = 0; iRow < height; iRow ++) { uint8_t* line_buf = dest_buf + iRow * pitch; - FXSYS_memset8(line_buf, 0xff, pitch); + FXSYS_memset(line_buf, 0xff, pitch); _FaxG4GetRow(src_buf, src_size << 3, bitpos, line_buf, ref_buf, width); - FXSYS_memcpy32(ref_buf, line_buf, pitch); + FXSYS_memcpy(ref_buf, line_buf, pitch); } FX_Free(ref_buf); *pbitpos = bitpos; @@ -938,7 +938,7 @@ CCodec_FaxEncoder::CCodec_FaxEncoder(const uint8_t* src_buf, int width, int heig m_Rows = height; m_Pitch = pitch; m_pRefLine = FX_Alloc(uint8_t, m_Pitch); - FXSYS_memset8(m_pRefLine, 0xff, m_Pitch); + FXSYS_memset(m_pRefLine, 0xff, m_Pitch); m_pLineBuf = FX_Alloc2D(uint8_t, m_Pitch, 8); m_DestBuf.EstimateSize(0, 10240); } @@ -957,13 +957,13 @@ void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size) uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i ++) { const uint8_t* scan_line = m_pSrcBuf + i * m_Pitch; - FXSYS_memset32(m_pLineBuf, 0, m_Pitch * 8); + FXSYS_memset(m_pLineBuf, 0, m_Pitch * 8); m_pLineBuf[0] = last_byte; _FaxEncode2DLine(m_pLineBuf, dest_bitpos, scan_line, m_pRefLine, m_Cols); m_DestBuf.AppendBlock(m_pLineBuf, dest_bitpos / 8); last_byte = m_pLineBuf[dest_bitpos / 8]; dest_bitpos %= 8; - FXSYS_memcpy32(m_pRefLine, scan_line, m_Pitch); + FXSYS_memcpy(m_pRefLine, scan_line, m_Pitch); } if (dest_bitpos) { m_DestBuf.AppendByte(last_byte); diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index 2e6cf4e8db..f9925c323c 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -26,7 +26,7 @@ extern "C" if (p == NULL) { return NULL; } - FXSYS_memset32(p, 0, sizeof(z_stream)); + FXSYS_memset(p, 0, sizeof(z_stream)); p->zalloc = alloc_func; p->zfree = free_func; inflateInit(p); @@ -50,7 +50,7 @@ extern "C" unsigned int post_pos = (unsigned int)FPDFAPI_FlateGetTotalOut(context); unsigned int written = post_pos - pre_pos; if (written < dest_size) { - FXSYS_memset8(dest_buf + written, '\0', dest_size - written); + FXSYS_memset(dest_buf + written, '\0', dest_size - written); } return ret; } @@ -252,7 +252,7 @@ static FX_BOOL PNG_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, if (move_size * (row + 1) > (int)data_size) { move_size = data_size - (move_size * row); } - FXSYS_memmove32(pDestData + 1, pSrcData, move_size); + FXSYS_memmove(pDestData + 1, pSrcData, move_size); pDestData += (move_size + 1); pSrcData += move_size; byte_cnt += move_size; @@ -330,7 +330,7 @@ static void PNG_PredictLine(uint8_t* pDestData, const uint8_t* pSrcData, const u int BytesPerPixel = (bpc * nColors + 7) / 8; uint8_t tag = pSrcData[0]; if (tag == 0) { - FXSYS_memmove32(pDestData, pSrcData + 1, row_size); + FXSYS_memmove(pDestData, pSrcData + 1, row_size); return; } for (int byte = 0; byte < row_size; byte ++) { @@ -407,7 +407,7 @@ static FX_BOOL PNG_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, if ((row + 1) * (move_size + 1) > (int)data_size) { move_size = last_row_size - 1; } - FXSYS_memmove32(pDestData, pSrcData + 1, move_size); + FXSYS_memmove(pDestData, pSrcData + 1, move_size); pSrcData += move_size + 1; pDestData += move_size; byte_cnt += move_size; @@ -685,7 +685,7 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() if (m_Predictor == 2) { FPDFAPI_FlateOutput(m_pFlate, m_pPredictRaw, m_PredictPitch + 1); PNG_PredictLine(m_pScanline, m_pPredictRaw, m_pLastLine, m_BitsPerComponent, m_Colors, m_Columns); - FXSYS_memcpy32(m_pLastLine, m_pScanline, m_PredictPitch); + FXSYS_memcpy(m_pLastLine, m_pScanline, m_PredictPitch); } else { FPDFAPI_FlateOutput(m_pFlate, m_pScanline, m_Pitch); TIFF_PredictLine(m_pScanline, m_PredictPitch, m_bpc, m_nComps, m_OutputWidth); @@ -694,7 +694,7 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() int bytes_to_go = m_Pitch; int read_leftover = m_LeftOver > bytes_to_go ? bytes_to_go : m_LeftOver; if (read_leftover) { - FXSYS_memcpy32(m_pScanline, m_pPredictBuffer + m_PredictPitch - m_LeftOver, read_leftover); + FXSYS_memcpy(m_pScanline, m_pPredictBuffer + m_PredictPitch - m_LeftOver, read_leftover); m_LeftOver -= read_leftover; bytes_to_go -= read_leftover; } @@ -702,13 +702,13 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() if (m_Predictor == 2) { FPDFAPI_FlateOutput(m_pFlate, m_pPredictRaw, m_PredictPitch + 1); PNG_PredictLine(m_pPredictBuffer, m_pPredictRaw, m_pLastLine, m_BitsPerComponent, m_Colors, m_Columns); - FXSYS_memcpy32(m_pLastLine, m_pPredictBuffer, m_PredictPitch); + FXSYS_memcpy(m_pLastLine, m_pPredictBuffer, m_PredictPitch); } else { FPDFAPI_FlateOutput(m_pFlate, m_pPredictBuffer, m_PredictPitch); TIFF_PredictLine(m_pPredictBuffer, m_PredictPitch, m_BitsPerComponent, m_Colors, m_Columns); } int read_bytes = m_PredictPitch > bytes_to_go ? bytes_to_go : m_PredictPitch; - FXSYS_memcpy32(m_pScanline + m_Pitch - bytes_to_go, m_pPredictBuffer, read_bytes); + FXSYS_memcpy(m_pScanline + m_Pitch - bytes_to_go, m_pPredictBuffer, read_bytes); m_LeftOver += m_PredictPitch - read_bytes; bytes_to_go -= read_bytes; } @@ -809,7 +809,7 @@ static void FlateUncompress(const uint8_t* src_buf, FX_DWORD src_size, FX_DWORD if (i == result_tmp_bufs.GetSize() - 1) { tmp_buf_size = last_buf_size; } - FXSYS_memcpy32(result_buf + result_pos, tmp_buf, tmp_buf_size); + FXSYS_memcpy(result_buf + result_pos, tmp_buf, tmp_buf_size); result_pos += tmp_buf_size; FX_Free(result_tmp_bufs[i]); } @@ -888,7 +888,7 @@ FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, } uint8_t* pSrcBuf = NULL; pSrcBuf = FX_Alloc(uint8_t, src_size); - FXSYS_memcpy32(pSrcBuf, src_buf, src_size); + FXSYS_memcpy(pSrcBuf, src_buf, src_size); FX_BOOL ret = TRUE; if (predictor == 2) { ret = TIFF_PredictorEncode(pSrcBuf, src_size, Colors, BitsPerComponent, diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp index 6fe92ff240..26537b541c 100644 --- a/core/src/fxcodec/codec/fx_codec_icc.cpp +++ b/core/src/fxcodec/codec/fx_codec_icc.cpp @@ -414,7 +414,7 @@ void* CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc MD5ComputeID(pIccParam->pProfileData, pIccParam->dwProfileSize, ID); break; case Icc_PARAMTYPE_PARAM: - FXSYS_memset32(ID, 0, 16); + FXSYS_memset(ID, 0, 16); switch (pIccParam->ColorSpace) { case IccCS_Gray: text.Format("%lf", pIccParam->Gamma); diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index b908915227..b50ae6460d 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -8,7 +8,7 @@ #include "codec_int.h" CCodec_Jbig2Context::CCodec_Jbig2Context() { - FXSYS_memset32(this, 0, sizeof(CCodec_Jbig2Context)); + FXSYS_memset(this, 0, sizeof(CCodec_Jbig2Context)); } CCodec_Jbig2Module::~CCodec_Jbig2Module() { @@ -28,7 +28,7 @@ void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch) { - FXSYS_memset32(dest_buf, 0, height * dest_pitch); + FXSYS_memset(dest_buf, 0, height * dest_pitch); CJBig2_Context* pContext = CJBig2_Context::CreateContext(&m_Module, (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache); if (pContext == NULL) { @@ -97,7 +97,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD wid m_pJbig2Context->m_dest_pitch = dest_pitch; m_pJbig2Context->m_pPause = pPause; m_pJbig2Context->m_bFileReader = FALSE; - FXSYS_memset32(dest_buf, 0, height * dest_pitch); + FXSYS_memset(dest_buf, 0, height * dest_pitch); m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext(&m_Module, (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); if(!m_pJbig2Context->m_pContext) { diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 4017be56b3..bb60300d7d 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -89,16 +89,16 @@ static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, const uint8_t* icc_buf } FX_DWORD icc_data_length = JPEG_OVERHEAD_LEN + (icc_segment_num > 1 ? icc_segment_size : icc_length); uint8_t* icc_data = FX_Alloc(uint8_t, icc_data_length); - FXSYS_memcpy32(icc_data, "\x49\x43\x43\x5f\x50\x52\x4f\x46\x49\x4c\x45\x00", 12); + FXSYS_memcpy(icc_data, "\x49\x43\x43\x5f\x50\x52\x4f\x46\x49\x4c\x45\x00", 12); icc_data[13] = (uint8_t)icc_segment_num; for (uint8_t i = 0; i < (icc_segment_num - 1); i++) { icc_data[12] = i + 1; - FXSYS_memcpy32(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + i * icc_segment_size, icc_segment_size); + FXSYS_memcpy(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + i * icc_segment_size, icc_segment_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, icc_data_length); } icc_data[12] = (uint8_t)icc_segment_num; FX_DWORD icc_size = (icc_segment_num - 1) * icc_segment_size; - FXSYS_memcpy32(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + icc_size, icc_length - icc_size); + FXSYS_memcpy(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + icc_size, icc_length - icc_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, JPEG_OVERHEAD_LEN + icc_length - icc_size); FX_Free(icc_data); return TRUE; @@ -312,9 +312,9 @@ CCodec_JpegDecoder::CCodec_JpegDecoder() m_bInited = FALSE; m_pExtProvider = NULL; m_pExtContext = NULL; - FXSYS_memset32(&cinfo, 0, sizeof(cinfo)); - FXSYS_memset32(&jerr, 0, sizeof(jerr)); - FXSYS_memset32(&src, 0, sizeof(src)); + FXSYS_memset(&cinfo, 0, sizeof(cinfo)); + FXSYS_memset(&jerr, 0, sizeof(jerr)); + FXSYS_memset(&src, 0, sizeof(src)); m_nDefaultScaleDenom = 1; } CCodec_JpegDecoder::~CCodec_JpegDecoder() @@ -388,7 +388,7 @@ FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, in src.fill_input_buffer = _src_fill_buffer; src.resync_to_restart = _src_resync; m_bJpegTransform = ColorTransform; - if(src_size > 1 && FXSYS_memcmp32(src_buf + src_size - 2, "\xFF\xD9", 2) != 0) { + if(src_size > 1 && FXSYS_memcmp(src_buf + src_size - 2, "\xFF\xD9", 2) != 0) { ((uint8_t*)src_buf)[src_size - 2] = 0xFF; ((uint8_t*)src_buf)[src_size - 1] = 0xD9; } diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 8895024338..7dd91b3289 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -472,9 +472,9 @@ void color_apply_icc_profile(opj_image_t *image) image->comps[1] = image->comps[0]; image->comps[2] = image->comps[0]; image->comps[1].data = FX_Alloc(int, (size_t)max); - FXSYS_memset8(image->comps[1].data, 0, sizeof(int) * (size_t)max); + FXSYS_memset(image->comps[1].data, 0, sizeof(int) * (size_t)max); image->comps[2].data = FX_Alloc(int, (size_t)max); - FXSYS_memset8(image->comps[2].data, 0, sizeof(int) * (size_t)max); + FXSYS_memset(image->comps[2].data, 0, sizeof(int) * (size_t)max); image->numcomps += 2; r = image->comps[0].data; for(int i = 0; i < max; ++i) { @@ -630,7 +630,7 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, int src_size) opj_set_default_decoder_parameters(¶meters); parameters.decod_format = 0; parameters.cod_format = 3; - if(FXSYS_memcmp32(m_SrcData, szJP2Header, sizeof(szJP2Header)) == 0) { + if(FXSYS_memcmp(m_SrcData, szJP2Header, sizeof(szJP2Header)) == 0) { l_codec = opj_create_decompress(OPJ_CODEC_JP2); parameters.decod_format = 1; } else { @@ -707,7 +707,7 @@ FX_BOOL CJPX_Decoder::Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateCol if(pitch < (int)(image->comps[0].w * 8 * image->numcomps + 31) >> 5 << 2) { return FALSE; } - FXSYS_memset8(dest_buf, 0xff, image->y1 * pitch); + FXSYS_memset(dest_buf, 0xff, image->y1 * pitch); uint8_t** channel_bufs = FX_Alloc(uint8_t*, image->numcomps); FX_BOOL result = FALSE; int* adjust_comps = FX_Alloc(int, image->numcomps); |