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

Unified Diff: core/src/fxcrt/extension.h

Issue 1518593002: Get rid of most uses of CFX_PtrArray. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix botch. Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdftext/txtproc.h ('k') | core/src/fxge/agg/include/fx_agg_driver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/extension.h
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index a23eab5c58274effa2a9044691bcc3483e53a232..58b0457a7cd67a95a18655855ead6147fd947cdf 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -99,7 +99,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
~CFX_MemoryStream() override {
if (m_dwFlags & FX_MEMSTREAM_TakeOver) {
for (int32_t i = 0; i < m_Blocks.GetSize(); i++) {
- FX_Free((uint8_t*)m_Blocks[i]);
+ FX_Free(m_Blocks[i]);
}
}
m_Blocks.RemoveAll();
@@ -134,7 +134,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
m_nCurPos = newPos.ValueOrDie();
if (m_dwFlags & FX_MEMSTREAM_Consecutive) {
- FXSYS_memcpy(buffer, (uint8_t*)m_Blocks[0] + (size_t)offset, size);
+ FXSYS_memcpy(buffer, m_Blocks[0] + (size_t)offset, size);
return TRUE;
}
size_t nStartBlock = (size_t)offset / m_nGrowSize;
@@ -144,8 +144,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
if (nRead > size) {
nRead = size;
}
- FXSYS_memcpy(
- buffer, (uint8_t*)m_Blocks[(int)nStartBlock] + (size_t)offset, nRead);
+ FXSYS_memcpy(buffer, m_Blocks[(int)nStartBlock] + (size_t)offset, nRead);
buffer = ((uint8_t*)buffer) + nRead;
size -= nRead;
nStartBlock++;
@@ -180,7 +179,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
m_nTotalSize =
(m_nCurPos + m_nGrowSize - 1) / m_nGrowSize * m_nGrowSize;
if (m_Blocks.GetSize() < 1) {
- void* block = FX_Alloc(uint8_t, m_nTotalSize);
+ uint8_t* block = FX_Alloc(uint8_t, m_nTotalSize);
m_Blocks.Add(block);
} else {
m_Blocks[0] = FX_Realloc(uint8_t, m_Blocks[0], m_nTotalSize);
@@ -190,7 +189,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
return FALSE;
}
}
- FXSYS_memcpy((uint8_t*)m_Blocks[0] + (size_t)offset, buffer, size);
+ FXSYS_memcpy(m_Blocks[0] + (size_t)offset, buffer, size);
if (m_nCurSize < m_nCurPos) {
m_nCurSize = m_nCurPos;
}
@@ -214,8 +213,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
if (nWrite > size) {
nWrite = size;
}
- FXSYS_memcpy((uint8_t*)m_Blocks[(int)nStartBlock] + (size_t)offset,
- buffer, nWrite);
+ FXSYS_memcpy(m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite);
buffer = ((uint8_t*)buffer) + nWrite;
size -= nWrite;
nStartBlock++;
@@ -239,7 +237,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
}
}
uint8_t* GetBuffer() const override {
- return m_Blocks.GetSize() ? (uint8_t*)m_Blocks[0] : NULL;
+ return m_Blocks.GetSize() ? m_Blocks[0] : nullptr;
}
void AttachBuffer(uint8_t* pBuffer,
size_t nSize,
@@ -264,7 +262,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
}
protected:
- CFX_PtrArray m_Blocks;
+ CFX_ArrayTemplate<uint8_t*> m_Blocks;
FX_DWORD m_dwCount;
size_t m_nTotalSize;
size_t m_nCurSize;
« no previous file with comments | « core/src/fpdftext/txtproc.h ('k') | core/src/fxge/agg/include/fx_agg_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698