summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-05-10 15:21:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-05-10 15:21:08 +0200
commita0d546cdcad435bdabd007b4921043716be6e2b5 (patch)
treea451e5e31d781c9b46289ed2ea05f4d7426d850f /vcl
parentHarmless missing break in switch (diff)
downloadcore-a0d546cdcad435bdabd007b4921043716be6e2b5.tar.gz
core-a0d546cdcad435bdabd007b4921043716be6e2b5.zip
mbErrors is never read
In the original 5624be5a3520a16d57724064e16df3722d728010 "CWS-TOOLING: integrate CWS graphite01" it used to be read in debug-only code that meanwhile got removed. (And getIntValue can now be a non-member function, as noted by loplugin:staticmethods.) Change-Id: I758268064181d44c90f5c4d1841fb09f4c532669
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/graphite_features.hxx2
-rw-r--r--vcl/source/glyphs/graphite_features.cxx99
2 files changed, 46 insertions, 55 deletions
diff --git a/vcl/inc/graphite_features.hxx b/vcl/inc/graphite_features.hxx
index 97bd1861eaef..1ce5cb08e608 100644
--- a/vcl/inc/graphite_features.hxx
+++ b/vcl/inc/graphite_features.hxx
@@ -54,10 +54,8 @@ namespace grutils
void setLang(const gr_face * face, const OString & lang);
static bool isCharId(const OString & id, size_t offset, size_t length);
static gr_uint32 getCharId(const OString & id, size_t offset, size_t length);
- short getIntValue(const OString & id, size_t offset, size_t length);
size_t mnNumSettings;
FeatId maLang;
- bool mbErrors;
sal_uInt32 mnHash;
gr_feature_val * mpSettings;
};
diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx
index b212fefe88de..fab008ce174a 100644
--- a/vcl/source/glyphs/graphite_features.cxx
+++ b/vcl/source/glyphs/graphite_features.cxx
@@ -32,20 +32,62 @@
#include <graphite_features.hxx>
using namespace grutils;
+
+namespace {
+
+short getIntValue(const OString & id, size_t offset, size_t length)
+{
+ short value = 0;
+ int sign = 1;
+ for (size_t i = 0; i < length; i++)
+ {
+ switch (id[offset + i])
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ value *= 10;
+ if (sign < 0)
+ {
+ value = -(id[offset + i] - '0');
+ sign = 1;
+ }
+ value += (id[offset + i] - '0');
+ break;
+ case '-':
+ if (i == 0)
+ sign = -1;
+ break;
+ default:
+ break;
+ }
+ }
+ return value;
+}
+
+}
+
// These mustn't conflict with font name lists which use ; and ,
const char GrFeatureParser::FEAT_PREFIX = ':';
const char GrFeatureParser::FEAT_SEPARATOR = '&';
const char GrFeatureParser::FEAT_ID_VALUE_SEPARATOR = '=';
GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString& lang)
- : mnNumSettings(0), mbErrors(false), mpSettings(nullptr)
+ : mnNumSettings(0), mpSettings(nullptr)
{
maLang.label[0] = maLang.label[1] = maLang.label[2] = maLang.label[3] = '\0';
setLang(pFace, lang);
}
GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString& features, const OString& lang)
- : mnNumSettings(0), mbErrors(false), mpSettings(nullptr)
+ : mnNumSettings(0), mpSettings(nullptr)
{
sal_Int32 nEquals = 0;
sal_Int32 nFeatEnd = 0;
@@ -57,7 +99,6 @@ GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString& features,
nEquals = features.indexOf(FEAT_ID_VALUE_SEPARATOR, pos);
if (nEquals == -1)
{
- mbErrors = true;
break;
}
// check for a lang=xxx specification
@@ -70,9 +111,7 @@ GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString& features,
{
nFeatEnd = features.getLength();
}
- if (nFeatEnd - pos > 3)
- mbErrors = true;
- else
+ if (nFeatEnd - pos <= 3)
{
FeatId aLang = maLang;
aLang.num = 0;
@@ -105,8 +144,7 @@ GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString& features,
break;
}
}
- if (i == gr_face_n_languages(pFace)) mbErrors = true;
- else
+ if (i != gr_face_n_languages(pFace))
{
mnHash = maLang.num;
mpSettings = gr_face_featureval_for_lang(pFace, maLang.num);
@@ -138,8 +176,6 @@ GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString& features,
mnHash = (mnHash << 16) ^ ((featId << 8) | featValue);
mnNumSettings++;
}
- else
- mbErrors = true;
}
pos = nFeatEnd + 1;
}
@@ -232,47 +268,4 @@ gr_uint32 GrFeatureParser::getCharId(const OString & id, size_t offset, size_t l
return charId.num;
}
-short GrFeatureParser::getIntValue(const OString & id, size_t offset, size_t length)
-{
- short value = 0;
- int sign = 1;
- for (size_t i = 0; i < length; i++)
- {
- switch (id[offset + i])
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- value *= 10;
- if (sign < 0)
- {
- value = -(id[offset + i] - '0');
- sign = 1;
- }
- value += (id[offset + i] - '0');
- break;
- case '-':
- if (i == 0)
- sign = -1;
- else
- {
- mbErrors = true;
- break;
- }
- break;
- default:
- mbErrors = true;
- break;
- }
- }
- return value;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */