From 4fdf15c394b403963d4c52044fa56c4574c7a7f7 Mon Sep 17 00:00:00 2001 From: Jakub Kucharski Date: Tue, 23 Aug 2016 13:19:07 +0200 Subject: [PATCH 1/2] goo: add GooString::hasJustUnicodeMarker(void) --- goo/GooString.cc | 2 +- goo/GooString.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/goo/GooString.cc b/goo/GooString.cc index de9c93c..8ebe0cf 100644 --- a/goo/GooString.cc +++ b/goo/GooString.cc @@ -908,7 +908,7 @@ GBool GooString::endsWith(const char *suffix) const { return strcmp(s + length - suffixLen, suffix) == 0; } -GBool GooString::hasUnicodeMarker(void) +GBool GooString::hasUnicodeMarker(void) const { return length > 1 && (s[0] & 0xff) == 0xfe && (s[1] & 0xff) == 0xff; } diff --git a/goo/GooString.h b/goo/GooString.h index 5ff01ef..324fbe6 100644 --- a/goo/GooString.h +++ b/goo/GooString.h @@ -160,7 +160,8 @@ public: // Return true if string ends with suffix GBool endsWith(const char *suffix) const; - GBool hasUnicodeMarker(void); + GBool hasUnicodeMarker(void) const; + GBool hasJustUnicodeMarker(void) const { return length == 2 && hasUnicodeMarker(); } // Sanitizes the string so that it does // not contain any ( ) < > [ ] { } / % -- 2.9.3