Index: fpdfsdk/src/javascript/PublicMethods.cpp |
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp |
index 55228687bcf86bb394b1e0efcee917fb48044501..a28c5b98ae51f0511dc69ea2db1778d378e54c7c 100644 |
--- a/fpdfsdk/src/javascript/PublicMethods.cpp |
+++ b/fpdfsdk/src/javascript/PublicMethods.cpp |
@@ -222,16 +222,10 @@ CFX_WideString CJS_PublicMethods::StrLTrim(FX_LPCWSTR pStr) |
CFX_WideString CJS_PublicMethods::StrRTrim(FX_LPCWSTR pStr) |
{ |
FX_LPCWSTR p = pStr; |
- |
while (*p) p++; |
- p--; |
- if (p >= pStr) |
- { |
- while (*p && *p == L' ') p--; |
- p++; |
- return CFX_WideString(pStr,p-pStr); |
- } |
- return L""; |
+ while (p > pStr && *(p - 1) == L' ') p--; |
+ |
+ return CFX_WideString(pStr, p - pStr); |
} |
CFX_WideString CJS_PublicMethods::StrTrim(FX_LPCWSTR pStr) |
@@ -243,22 +237,16 @@ CFX_ByteString CJS_PublicMethods::StrLTrim(FX_LPCSTR pStr) |
{ |
while (*pStr && *pStr == ' ') pStr++; |
- return pStr; |
+ return pStr; |
} |
CFX_ByteString CJS_PublicMethods::StrRTrim(FX_LPCSTR pStr) |
{ |
FX_LPCSTR p = pStr; |
- |
while (*p) p++; |
- p--; |
- if (p >= pStr) |
- { |
- while (*p && *p == ' ') p--; |
- p++; |
- return CFX_ByteString(pStr,p-pStr); |
- } |
- return ""; |
+ while (p > pStr && *(p - 1) == L' ') p--; |
+ |
+ return CFX_ByteString(pStr,p-pStr); |
} |
CFX_ByteString CJS_PublicMethods::StrTrim(FX_LPCSTR pStr) |