Added initial values to some variables in C and C++ code to avoid potential compiler warnings.

pull/24/merge
Project Nayuki 7 years ago
parent 7e18dfe885
commit 908dbbfb31

@ -556,8 +556,8 @@ static long getPenaltyScore(const uint8_t qrcode[]) {
// Adjacent modules in row having same color // Adjacent modules in row having same color
for (int y = 0; y < qrsize; y++) { for (int y = 0; y < qrsize; y++) {
bool colorX; bool colorX = false;
for (int x = 0, runX; x < qrsize; x++) { for (int x = 0, runX = -1; x < qrsize; x++) {
if (x == 0 || getModule(qrcode, x, y) != colorX) { if (x == 0 || getModule(qrcode, x, y) != colorX) {
colorX = getModule(qrcode, x, y); colorX = getModule(qrcode, x, y);
runX = 1; runX = 1;
@ -572,8 +572,8 @@ static long getPenaltyScore(const uint8_t qrcode[]) {
} }
// Adjacent modules in column having same color // Adjacent modules in column having same color
for (int x = 0; x < qrsize; x++) { for (int x = 0; x < qrsize; x++) {
bool colorY; bool colorY = false;
for (int y = 0, runY; y < qrsize; y++) { for (int y = 0, runY = -1; y < qrsize; y++) {
if (y == 0 || getModule(qrcode, x, y) != colorY) { if (y == 0 || getModule(qrcode, x, y) != colorY) {
colorY = getModule(qrcode, x, y); colorY = getModule(qrcode, x, y);
runY = 1; runY = 1;

@ -421,8 +421,8 @@ long QrCode::getPenaltyScore() const {
// Adjacent modules in row having same color // Adjacent modules in row having same color
for (int y = 0; y < size; y++) { for (int y = 0; y < size; y++) {
bool colorX; bool colorX = false;
for (int x = 0, runX; x < size; x++) { for (int x = 0, runX = -1; x < size; x++) {
if (x == 0 || module(x, y) != colorX) { if (x == 0 || module(x, y) != colorX) {
colorX = module(x, y); colorX = module(x, y);
runX = 1; runX = 1;
@ -437,8 +437,8 @@ long QrCode::getPenaltyScore() const {
} }
// Adjacent modules in column having same color // Adjacent modules in column having same color
for (int x = 0; x < size; x++) { for (int x = 0; x < size; x++) {
bool colorY; bool colorY = false;
for (int y = 0, runY; y < size; y++) { for (int y = 0, runY = -1; y < size; y++) {
if (y == 0 || module(x, y) != colorY) { if (y == 0 || module(x, y) != colorY) {
colorY = module(x, y); colorY = module(x, y);
runY = 1; runY = 1;

Loading…
Cancel
Save