summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-08-19 10:03:29 -0700
committerTom Sepez <tsepez@chromium.org>2015-08-19 10:03:29 -0700
commit33db790486b89e9a84622788940fd7995e37cf5e (patch)
tree91bfb2df31fddce5e645b290fe658031288c74d7 /core
parent90b5442f15cecbcf11ac5f6cea3ce612ad863363 (diff)
downloadpdfium-33db790486b89e9a84622788940fd7995e37cf5e.tar.xz
Merge to XFA: Remove more dead code from fx_basic.h
(cherry picked from commit 57207efd5f17ec63e174061ea5415afb58516fce) Original Review URL: https://codereview.chromium.org/1294683003 . TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1299263002 .
Diffstat (limited to 'core')
-rw-r--r--core/include/fxcrt/fx_basic.h18
-rw-r--r--core/src/fxcrt/fx_basic_util.cpp93
2 files changed, 5 insertions, 106 deletions
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index b31682105d..661722e1b2 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -267,28 +267,19 @@ class CFX_UTF8Decoder {
CFX_WideTextBuf m_Buffer;
};
+
class CFX_UTF8Encoder {
public:
- CFX_UTF8Encoder() { m_UTF16First = 0; }
+ CFX_UTF8Encoder() {}
void Input(FX_WCHAR unicode);
-
- void AppendStr(const CFX_ByteStringC& str) {
- m_UTF16First = 0;
- m_Buffer << str;
- }
-
+ void AppendStr(const CFX_ByteStringC& str) { m_Buffer << str; }
CFX_ByteStringC GetResult() const { return m_Buffer.GetByteString(); }
protected:
CFX_ByteTextBuf m_Buffer;
-
- FX_DWORD m_UTF16First;
};
-CFX_ByteString FX_UrlEncode(const CFX_WideString& wsUrl);
-CFX_WideString FX_UrlDecode(const CFX_ByteString& bsUrl);
-CFX_ByteString FX_EncodeURI(const CFX_WideString& wsURI);
-CFX_WideString FX_DecodeURI(const CFX_ByteString& bsURI);
+
class CFX_BasicArray {
protected:
CFX_BasicArray(int unit_size);
@@ -447,6 +438,7 @@ typedef CFX_ArrayTemplate<void*> CFX_PtrArray;
typedef CFX_ArrayTemplate<FX_FILESIZE> CFX_FileSizeArray;
typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray;
typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array;
+
template <class ObjectClass>
class CFX_ObjectArray : public CFX_BasicArray {
public:
diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp
index ed71d975c8..447e169a98 100644
--- a/core/src/fxcrt/fx_basic_util.cpp
+++ b/core/src/fxcrt/fx_basic_util.cpp
@@ -184,99 +184,6 @@ void FXSYS_vsnprintf(char* str, size_t size, const char* fmt, va_list ap) {
}
#endif // _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900
-static FX_BOOL FX_IsDigit(uint8_t ch) {
- return (ch >= '0' && ch <= '9') ? TRUE : FALSE;
-}
-static FX_BOOL FX_IsXDigit(uint8_t ch) {
- return (FX_IsDigit(ch) || (ch >= 'A' && ch <= 'F') ||
- (ch >= 'a' && ch <= 'f'))
- ? TRUE
- : FALSE;
-}
-static uint8_t FX_MakeUpper(uint8_t ch) {
- if (ch < 'a' || ch > 'z') {
- return ch;
- }
- return ch - 32;
-}
-static int FX_HexToI(uint8_t ch) {
- ch = FX_MakeUpper(ch);
- return FX_IsDigit(ch) ? (ch - '0') : (ch - 55);
-}
-static const unsigned char url_encodeTable[128] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
-};
-CFX_ByteString FX_UrlEncode(const CFX_WideString& wsUrl) {
- const char arDigits[] = "0123456789ABCDEF";
- CFX_ByteString rUrl;
- int nLength = wsUrl.GetLength();
- for (int i = 0; i < nLength; i++) {
- FX_DWORD word = wsUrl.GetAt(i);
- if (word > 0x7F || url_encodeTable[word] == 1) {
- CFX_ByteString bsUri = CFX_ByteString::FromUnicode((FX_WORD)word);
- int nByte = bsUri.GetLength();
- for (int j = 0; j < nByte; j++) {
- rUrl += '%';
- uint8_t code = bsUri.GetAt(j);
- rUrl += arDigits[code >> 4];
- rUrl += arDigits[code & 0x0F];
- }
- } else {
- rUrl += CFX_ByteString::FromUnicode((FX_WORD)word);
- }
- }
- return rUrl;
-}
-CFX_WideString FX_UrlDecode(const CFX_ByteString& bsUrl) {
- CFX_ByteString rUrl;
- int nLength = bsUrl.GetLength();
- for (int i = 0; i < nLength; i++) {
- if (i < nLength - 2 && bsUrl[i] == '%' && FX_IsXDigit(bsUrl[i + 1]) &&
- FX_IsXDigit(bsUrl[i + 2])) {
- rUrl += (FX_HexToI(bsUrl[i + 1]) << 4 | FX_HexToI(bsUrl[i + 2]));
- i += 2;
- } else {
- rUrl += bsUrl[i];
- }
- }
- return CFX_WideString::FromLocal(rUrl);
-}
-CFX_ByteString FX_EncodeURI(const CFX_WideString& wsURI) {
- const char arDigits[] = "0123456789ABCDEF";
- CFX_ByteString rURI;
- CFX_ByteString bsUri = wsURI.UTF8Encode();
- int nLength = bsUri.GetLength();
- for (int i = 0; i < nLength; i++) {
- uint8_t code = bsUri.GetAt(i);
- if (code > 0x7F || url_encodeTable[code] == 1) {
- rURI += '%';
- rURI += arDigits[code >> 4];
- rURI += arDigits[code & 0x0F];
- } else {
- rURI += code;
- }
- }
- return rURI;
-}
-CFX_WideString FX_DecodeURI(const CFX_ByteString& bsURI) {
- CFX_ByteString rURI;
- int nLength = bsURI.GetLength();
- for (int i = 0; i < nLength; i++) {
- if (i < nLength - 2 && bsURI[i] == '%' && FX_IsXDigit(bsURI[i + 1]) &&
- FX_IsXDigit(bsURI[i + 2])) {
- rURI += (FX_HexToI(bsURI[i + 1]) << 4 | FX_HexToI(bsURI[i + 2]));
- i += 2;
- } else {
- rURI += bsURI[i];
- }
- }
- return CFX_WideString::FromUTF8(rURI, rURI.GetLength());
-}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
class CFindFileData {
public: