summaryrefslogtreecommitdiff
path: root/core/fxcrt/widestring.h
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-27 10:53:11 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-27 16:11:38 +0000
commit875e98c581952478f3a3ccef9b2f2e3ed06c5346 (patch)
tree8e0d7e032056bf4c73d6da43c0f3ce4eadb74dfd /core/fxcrt/widestring.h
parentcc3a3ee3ebcc1baabdfa7ffca5876dbbfa3980c1 (diff)
downloadpdfium-875e98c581952478f3a3ccef9b2f2e3ed06c5346.tar.xz
Remove FX_STRSIZE and replace with size_t
BUG=pdfium:828 Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16 Reviewed-on: https://pdfium-review.googlesource.com/13230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcrt/widestring.h')
-rw-r--r--core/fxcrt/widestring.h66
1 files changed, 32 insertions, 34 deletions
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index f56703f1ab..73846e1be0 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -47,7 +47,7 @@ class WideString {
// NOLINTNEXTLINE(runtime/explicit)
WideString(char) = delete;
- WideString(const wchar_t* ptr, FX_STRSIZE len);
+ WideString(const wchar_t* ptr, size_t len);
explicit WideString(const WideStringView& str);
WideString(const WideStringView& str1, const WideStringView& str2);
@@ -59,9 +59,9 @@ class WideString {
static WideString FromCodePage(const ByteStringView& str, uint16_t codepage);
static WideString FromUTF8(const ByteStringView& str);
- static WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len);
+ static WideString FromUTF16LE(const unsigned short* str, size_t len);
- static FX_STRSIZE WStringLength(const unsigned short* str);
+ static size_t WStringLength(const unsigned short* str);
// Explicit conversion to C-style wide string.
// Note: Any subsequent modification of |this| will invalidate the result.
@@ -89,13 +89,13 @@ class WideString {
void clear() { m_pData.Reset(); }
- FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
- FX_STRSIZE GetStringLength() const {
+ size_t GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
+ size_t GetStringLength() const {
return m_pData ? FXSYS_wcslen(m_pData->m_String) : 0;
}
bool IsEmpty() const { return !GetLength(); }
- bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
- bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
+ bool IsValidIndex(size_t index) const { return index < GetLength(); }
+ bool IsValidLength(size_t length) const { return length <= GetLength(); }
const WideString& operator=(const wchar_t* str);
const WideString& operator=(const WideString& stringSrc);
@@ -116,7 +116,7 @@ class WideString {
bool operator<(const WideString& str) const;
- CharType operator[](const FX_STRSIZE index) const {
+ CharType operator[](const size_t index) const {
ASSERT(IsValidIndex(index));
return m_pData ? m_pData->m_String[index] : 0;
}
@@ -124,20 +124,20 @@ class WideString {
CharType First() const { return GetLength() ? (*this)[0] : 0; }
CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
- void SetAt(FX_STRSIZE index, wchar_t c);
+ void SetAt(size_t index, wchar_t c);
int Compare(const wchar_t* str) const;
int Compare(const WideString& str) const;
int CompareNoCase(const wchar_t* str) const;
- WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
- WideString Left(FX_STRSIZE count) const;
- WideString Right(FX_STRSIZE count) const;
+ WideString Mid(size_t first, size_t count) const;
+ WideString Left(size_t count) const;
+ WideString Right(size_t count) const;
- FX_STRSIZE Insert(FX_STRSIZE index, wchar_t ch);
- FX_STRSIZE InsertAtFront(wchar_t ch) { return Insert(0, ch); }
- FX_STRSIZE InsertAtBack(wchar_t ch) { return Insert(GetLength(), ch); }
- FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
+ size_t Insert(size_t index, wchar_t ch);
+ size_t InsertAtFront(wchar_t ch) { return Insert(0, ch); }
+ size_t InsertAtBack(wchar_t ch) { return Insert(GetLength(), ch); }
+ size_t Delete(size_t index, size_t count = 1);
void Format(const wchar_t* lpszFormat, ...);
void FormatV(const wchar_t* lpszFormat, va_list argList);
@@ -153,27 +153,27 @@ class WideString {
void TrimLeft(wchar_t chTarget);
void TrimLeft(const WideStringView& pTargets);
- void Reserve(FX_STRSIZE len);
- wchar_t* GetBuffer(FX_STRSIZE len);
- void ReleaseBuffer(FX_STRSIZE len);
+ void Reserve(size_t len);
+ wchar_t* GetBuffer(size_t len);
+ void ReleaseBuffer(size_t len);
int GetInteger() const;
float GetFloat() const;
- pdfium::Optional<FX_STRSIZE> Find(const WideStringView& pSub,
- FX_STRSIZE start = 0) const;
- pdfium::Optional<FX_STRSIZE> Find(wchar_t ch, FX_STRSIZE start = 0) const;
+ pdfium::Optional<size_t> Find(const WideStringView& pSub,
+ size_t start = 0) const;
+ pdfium::Optional<size_t> Find(wchar_t ch, size_t start = 0) const;
- bool Contains(const WideStringView& lpszSub, FX_STRSIZE start = 0) const {
+ bool Contains(const WideStringView& lpszSub, size_t start = 0) const {
return Find(lpszSub, start).has_value();
}
- bool Contains(char ch, FX_STRSIZE start = 0) const {
+ bool Contains(char ch, size_t start = 0) const {
return Find(ch, start).has_value();
}
- FX_STRSIZE Replace(const WideStringView& pOld, const WideStringView& pNew);
- FX_STRSIZE Remove(wchar_t ch);
+ size_t Replace(const WideStringView& pOld, const WideStringView& pNew);
+ size_t Remove(wchar_t ch);
ByteString UTF8Encode() const;
ByteString UTF16LE_Encode() const;
@@ -181,16 +181,14 @@ class WideString {
protected:
using StringData = StringDataTemplate<wchar_t>;
- void ReallocBeforeWrite(FX_STRSIZE nLen);
- void AllocBeforeWrite(FX_STRSIZE nLen);
- void AllocCopy(WideString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const;
- void AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen);
- void Concat(const wchar_t* lpszSrcData, FX_STRSIZE nSrcLen);
+ void ReallocBeforeWrite(size_t nLen);
+ void AllocBeforeWrite(size_t nLen);
+ void AllocCopy(WideString& dest, size_t nCopyLen, size_t nCopyIndex) const;
+ void AssignCopy(const wchar_t* pSrcData, size_t nSrcLen);
+ void Concat(const wchar_t* lpszSrcData, size_t nSrcLen);
// Returns true unless we ran out of space.
- bool TryVSWPrintf(FX_STRSIZE size, const wchar_t* format, va_list argList);
+ bool TryVSWPrintf(size_t size, const wchar_t* format, va_list argList);
RetainPtr<StringData> m_pData;