summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/fx_basic_maps.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-04-22 12:04:14 -0700
committerTom Sepez <tsepez@chromium.org>2015-04-22 12:04:14 -0700
commit1ddf056da74de0a34631b8a719f4f02b4ec82144 (patch)
tree45217449a89d4286a903c76774971c1c2c6c38e4 /core/src/fxcrt/fx_basic_maps.cpp
parentea6a069e6e593d97513e86fc761cf789a9714c22 (diff)
downloadpdfium-1ddf056da74de0a34631b8a719f4f02b4ec82144.tar.xz
Add missing operators for CFX_ByteStringC.
Removing the implicit cast operator forces a build breakage should we use ByteStringC in STL containers. Adding an operator< restores correct behaviour. Adding an operator[] avoids re-writing some code to call GetPtr() prior to array indexing. Part 1 of 4. R=thestig@chromium.org TBR=brucedawson@chromium.org BUG=pdfium:142. Review URL: https://codereview.chromium.org/1090303003
Diffstat (limited to 'core/src/fxcrt/fx_basic_maps.cpp')
-rw-r--r--core/src/fxcrt/fx_basic_maps.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp
index e85d35e4ac..8ae44ce6a0 100644
--- a/core/src/fxcrt/fx_basic_maps.cpp
+++ b/core/src/fxcrt/fx_basic_maps.cpp
@@ -352,7 +352,7 @@ inline FX_DWORD CFX_MapByteStringToPtr::HashKey(FX_BSTR key) const
{
FX_DWORD nHash = 0;
int len = key.GetLength();
- FX_LPCBYTE buf = key;
+ FX_LPCBYTE buf = key.GetPtr();
for (int i = 0; i < len; i ++) {
nHash = (nHash << 5) + nHash + buf[i];
}
@@ -518,7 +518,7 @@ void CFX_CMapByteStringToPtr::SetAt(FX_BSTR key, void* value)
int size = m_Buffer.GetSize();
for (index = 0; index < size; index ++) {
_CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index);
- if (!_CompactStringSame(pKey, (FX_LPCBYTE)key, key_len)) {
+ if (!_CompactStringSame(pKey, key.GetPtr(), key_len)) {
continue;
}
*(void**)(pKey + 1) = value;
@@ -529,19 +529,19 @@ void CFX_CMapByteStringToPtr::SetAt(FX_BSTR key, void* value)
if (pKey->m_CompactLen) {
continue;
}
- _CompactStringStore(pKey, (FX_LPCBYTE)key, key_len);
+ _CompactStringStore(pKey, key.GetPtr(), key_len);
*(void**)(pKey + 1) = value;
return;
}
_CompactString* pKey = (_CompactString*)m_Buffer.Add();
- _CompactStringStore(pKey, (FX_LPCBYTE)key, key_len);
+ _CompactStringStore(pKey, key.GetPtr(), key_len);
*(void**)(pKey + 1) = value;
}
void CFX_CMapByteStringToPtr::AddValue(FX_BSTR key, void* value)
{
ASSERT(value != NULL);
_CompactString* pKey = (_CompactString*)m_Buffer.Add();
- _CompactStringStore(pKey, (FX_LPCBYTE)key, key.GetLength());
+ _CompactStringStore(pKey, key.GetPtr(), key.GetLength());
*(void**)(pKey + 1) = value;
}
void CFX_CMapByteStringToPtr::RemoveKey(FX_BSTR key)
@@ -550,7 +550,7 @@ void CFX_CMapByteStringToPtr::RemoveKey(FX_BSTR key)
int size = m_Buffer.GetSize();
for (int index = 0; index < size; index++) {
_CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index);
- if (!_CompactStringSame(pKey, (FX_LPCBYTE)key, key_len)) {
+ if (!_CompactStringSame(pKey, key.GetPtr(), key_len)) {
continue;
}
_CompactStringRelease(pKey);