diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-03-22 21:32:12 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-03-22 21:32:12 +0100 |
commit | 2595ad876024d6df4249dcdac39501d2fdf9e0c9 (patch) | |
tree | 1b8bc7efa9f04965ba2410ed4050a87f375a7db2 /vcl | |
parent | f5c93d4149e7ae967e98dbce72528a04a204ca95 (diff) |
Use rtl::isAscii* instead of ctype.h is* (and fix passing plain char)
Change-Id: I10c0433d314808cb1c51c3bde4f826bce7c8a97b
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/ipdf/pdfdocument.cxx | 22 | ||||
-rw-r--r-- | vcl/source/filter/ixbm/xbmread.cxx | 7 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 2 |
3 files changed, 19 insertions, 12 deletions
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index fe60765ed5eb..72996ecd652c 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -19,6 +19,7 @@ #include <comphelper/scopeguard.hxx> #include <comphelper/string.hxx> #include <filter/msfilter/mscodec.hxx> +#include <rtl/character.hxx> #include <rtl/strbuf.hxx> #include <rtl/string.hxx> #include <sal/log.hxx> @@ -994,7 +995,7 @@ bool PDFDocument::Tokenize(SvStream& rStream, TokenizeMode eMode, std::vector< s } default: { - if (isdigit(ch) || ch == '-') + if (rtl::isAsciiDigit(static_cast<unsigned char>(ch)) || ch == '-') { // Numbering object: an integer or a real. auto pNumberElement = new PDFNumberElement(); @@ -1015,7 +1016,7 @@ bool PDFDocument::Tokenize(SvStream& rStream, TokenizeMode eMode, std::vector< s m_pXRefStream = it->second; } } - else if (isalpha(ch)) + else if (rtl::isAsciiAlpha(static_cast<unsigned char>(ch))) { // Possible keyword, like "obj". rStream.SeekRel(-1); @@ -1166,7 +1167,7 @@ bool PDFDocument::Tokenize(SvStream& rStream, TokenizeMode eMode, std::vector< s } else { - if (!isspace(ch)) + if (!rtl::isAsciiWhiteSpace(static_cast<unsigned char>(ch))) { SAL_WARN("vcl.filter", "PDFDocument::Tokenize: unexpected character: " << ch << " at byte position " << rStream.Tell()); return false; @@ -1261,7 +1262,7 @@ OString PDFDocument::ReadKeyword(SvStream& rStream) rStream.ReadChar(ch); if (rStream.IsEof()) return OString(); - while (isalpha(ch)) + while (rtl::isAsciiAlpha(static_cast<unsigned char>(ch))) { aBuf.append(ch); rStream.ReadChar(ch); @@ -1682,7 +1683,7 @@ void PDFDocument::SkipWhitespace(SvStream& rStream) if (rStream.IsEof()) break; - if (!isspace(ch)) + if (!rtl::isAsciiWhiteSpace(static_cast<unsigned char>(ch))) { rStream.SeekRel(-1); return; @@ -1833,7 +1834,7 @@ std::vector<PDFObjectElement*> PDFDocument::GetSignatureWidgets() int PDFDocument::AsHex(char ch) { int nRet = 0; - if (isdigit(ch)) + if (rtl::isAsciiDigit(static_cast<unsigned char>(ch))) nRet = ch - '0'; else { @@ -1921,14 +1922,16 @@ bool PDFNumberElement::Read(SvStream& rStream) { return false; } - if (!isdigit(ch) && ch != '-' && ch != '.') + if (!rtl::isAsciiDigit(static_cast<unsigned char>(ch)) && ch != '-' + && ch != '.') { rStream.SeekRel(-1); return false; } while (!rStream.IsEof()) { - if (!isdigit(ch) && ch != '-' && ch != '.') + if (!rtl::isAsciiDigit(static_cast<unsigned char>(ch)) && ch != '-' + && ch != '.') { rStream.SeekRel(-1); m_nLength = rStream.Tell() - m_nOffset; @@ -2780,7 +2783,8 @@ bool PDFNameElement::Read(SvStream& rStream) rStream.ReadChar(ch); while (!rStream.IsEof()) { - if (isspace(ch) || ch == '/' || ch == '[' || ch == ']' || ch == '<' || ch == '>' || ch == '(') + if (rtl::isAsciiWhiteSpace(static_cast<unsigned char>(ch)) || ch == '/' + || ch == '[' || ch == ']' || ch == '<' || ch == '>' || ch == '(') { rStream.SeekRel(-1); m_aValue = aBuf.makeStringAndClear(); diff --git a/vcl/source/filter/ixbm/xbmread.cxx b/vcl/source/filter/ixbm/xbmread.cxx index d3d21c4229c7..b0dd915c5b41 100644 --- a/vcl/source/filter/ixbm/xbmread.cxx +++ b/vcl/source/filter/ixbm/xbmread.cxx @@ -17,8 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <ctype.h> +#include <sal/config.h> + #include <comphelper/string.hxx> +#include <rtl/character.hxx> + #include "xbmread.hxx" enum XBMFormat @@ -223,7 +226,7 @@ bool XBMReader::ParseData( SvStream* pInStm, const OString& aLastLine, XBMFormat const unsigned char cChar = aToken[n]; const short nTable = pHexTable[ cChar ]; - if( isxdigit( cChar ) || !nTable ) + if( rtl::isAsciiHexDigit( cChar ) || !nTable ) { nValue = ( nValue << 4 ) + nTable; nDigits++; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 160829fa9566..ef7a11140b5e 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5949,7 +5949,7 @@ bad_data: } do { PRUint32 decimal = 0; - while (len > 0 && isdigit(*from)) { + while (len > 0 && rtl::isAsciiDigit(static_cast<unsigned char>(*from))) { PRUint32 addend = (*from++ - '0'); --len; if (decimal > max_decimal) /* overflow */ |