Skip to content

Commit

Permalink
Added initial values to some variables in C and C++ code to avoid pot…
Browse files Browse the repository at this point in the history
…ential compiler warnings.
  • Loading branch information
nayuki committed Dec 10, 2017
1 parent 7e18dfe commit 908dbbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions c/qrcodegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,8 @@ static long getPenaltyScore(const uint8_t qrcode[]) {

// Adjacent modules in row having same color
for (int y = 0; y < qrsize; y++) {
bool colorX;
for (int x = 0, runX; x < qrsize; x++) {
bool colorX = false;
for (int x = 0, runX = -1; x < qrsize; x++) {
if (x == 0 || getModule(qrcode, x, y) != colorX) {
colorX = getModule(qrcode, x, y);
runX = 1;
Expand All @@ -572,8 +572,8 @@ static long getPenaltyScore(const uint8_t qrcode[]) {
}
// Adjacent modules in column having same color
for (int x = 0; x < qrsize; x++) {
bool colorY;
for (int y = 0, runY; y < qrsize; y++) {
bool colorY = false;
for (int y = 0, runY = -1; y < qrsize; y++) {
if (y == 0 || getModule(qrcode, x, y) != colorY) {
colorY = getModule(qrcode, x, y);
runY = 1;
Expand Down
8 changes: 4 additions & 4 deletions cpp/QrCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ long QrCode::getPenaltyScore() const {

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

0 comments on commit 908dbbf

Please sign in to comment.