Merge pull request #54 from icu-units/compilerwarnings

Fix compiler warnings
This commit is contained in:
Hugo van der Merwe 2020-08-06 02:27:34 +02:00 committed by GitHub
commit fa74d335c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 15 deletions

View file

@ -1583,7 +1583,7 @@ bool GeneratorHelpers::perUnit(const MacroProps& macros, UnicodeString& sb, UErr
}
}
bool GeneratorHelpers::usage(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
bool GeneratorHelpers::usage(const MacroProps& macros, UnicodeString& sb, UErrorCode&) {
if (macros.usage.fLength > 0) {
sb.append(u"usage/", -1);
sb.append(UnicodeString(macros.usage.fUsage, -1, US_INV));

View file

@ -88,20 +88,6 @@ void U_I18N_API Factor::applySiPrefix(UMeasureSIPrefix siPrefix) {
}
void U_I18N_API Factor::substituteConstants() {
// These values are a hard-coded subset of unitConstants in the units
// resources file. A unit test checks that all constants in the resource
// file are at least recognised by the code. Derived constants' values or
// hard-coded derivations are not checked.
// double constantsValues[CONSTANTS_COUNT];
static const double constantsValues[CONSTANTS_COUNT] = {
[CONSTANT_FT2M] = 0.3048, //
[CONSTANT_PI] = 411557987.0 / 131002976.0, //
[CONSTANT_GRAVITY] = 9.80665, //
[CONSTANT_G] = 6.67408E-11, //
[CONSTANT_GAL_IMP2M3] = 0.00454609, //
[CONSTANT_LB2KG] = 0.45359237, //
};
for (int i = 0; i < CONSTANTS_COUNT; i++) {
if (this->constants[i] == 0) {
continue;

View file

@ -32,6 +32,19 @@ enum Constants {
CONSTANTS_COUNT
};
// These values are a hard-coded subset of unitConstants in the units
// resources file. A unit test checks that all constants in the resource
// file are at least recognised by the code. Derived constants' values or
// hard-coded derivations are not checked.
static const double constantsValues[CONSTANTS_COUNT] = {
0.3048, // CONSTANT_FT2M
411557987.0 / 131002976.0, // CONSTANT_PI
9.80665, // CONSTANT_GRAVITY
6.67408E-11, // CONSTANT_G
0.00454609, // CONSTANT_GAL_IMP2M3
0.45359237, // CONSTANT_LB2KG
};
typedef enum Signum {
NEGATIVE = -1,
POSITIVE = 1,