summaryrefslogtreecommitdiffstats
path: root/core/ustring.cpp
diff options
context:
space:
mode:
authorHein-Pieter van Braam <hp@tmm.cx>2017-09-01 22:33:39 +0200
committerHein-Pieter van Braam <hp@tmm.cx>2017-09-02 01:59:26 +0200
commit9c63ab99f0a505b0f60079bb30cc453b4415fddc (patch)
tree7014cb6e8c2e71a0583656f76d3d37d719a74fb0 /core/ustring.cpp
parentdac150108ab3c1f41d5fd86cc6853f883064caaf (diff)
downloadredot-engine-9c63ab99f0a505b0f60079bb30cc453b4415fddc.tar.gz
Fix use of unitialized variables
The second in my quest to make Godot 3.x compile with -Werror on GCC7
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 7f073b4e02..8273ed144b 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3655,12 +3655,12 @@ String String::sprintf(const Array &values, bool *error) const {
CharType *self = (CharType *)c_str();
bool in_format = false;
int value_index = 0;
- int min_chars;
- int min_decimals;
- bool in_decimals;
- bool pad_with_zeroes;
- bool left_justified;
- bool show_sign;
+ int min_chars = 0;
+ int min_decimals = 0;
+ bool in_decimals = false;
+ bool pad_with_zeroes = false;
+ bool left_justified = false;
+ bool show_sign = false;
*error = true;
@@ -3687,12 +3687,12 @@ String String::sprintf(const Array &values, bool *error) const {
}
int64_t value = values[value_index];
- int base;
+ int base = 16;
bool capitalize = false;
switch (c) {
case 'd': base = 10; break;
case 'o': base = 8; break;
- case 'x': base = 16; break;
+ case 'x': break;
case 'X':
base = 16;
capitalize = true;
@@ -3842,7 +3842,7 @@ String String::sprintf(const Array &values, bool *error) const {
}
break;
}
- case '.': { // Float separtor.
+ case '.': { // Float separator.
if (in_decimals) {
return "too many decimal points in format";
}
@@ -3851,7 +3851,7 @@ String String::sprintf(const Array &values, bool *error) const {
break;
}
- case '*': { // Dyanmic width, based on value.
+ case '*': { // Dynamic width, based on value.
if (value_index >= values.size()) {
return "not enough arguments for format string";
}