Fixed and tweaked some pieces of C library code.

This commit is contained in:
Project Nayuki 2017-04-17 19:15:40 +00:00
parent 261d57607b
commit f49bee7a2d
2 changed files with 4 additions and 2 deletions

View File

@ -23,7 +23,6 @@
*/ */
#include <assert.h> #include <assert.h>
#include <stdint.h>
#include <string.h> #include <string.h>
#include "qrcodegen.h" #include "qrcodegen.h"
@ -45,6 +44,7 @@ static uint8_t finiteFieldMultiply(uint8_t x, uint8_t y);
/*---- Function implementations ----*/ /*---- Function implementations ----*/
// Public function - see documentation comment in header file.
bool qrcodegen_isAlphanumeric(const char *text) { bool qrcodegen_isAlphanumeric(const char *text) {
for (; *text != '\0'; text++) { for (; *text != '\0'; text++) {
char c = *text; char c = *text;
@ -70,6 +70,7 @@ bool qrcodegen_isAlphanumeric(const char *text) {
} }
// Public function - see documentation comment in header file.
bool qrcodegen_isNumeric(const char *text) { bool qrcodegen_isNumeric(const char *text) {
for (; *text != '\0'; text++) { for (; *text != '\0'; text++) {
char c = *text; char c = *text;
@ -147,7 +148,7 @@ static void initializeFunctionalModules(int version, uint8_t qrcode[]) {
} }
// Fill numerous alignment patterns // Fill numerous alignment patterns
uint8_t alignPatPos[7] = {}; uint8_t alignPatPos[7] = {0};
int numAlign = getAlignmentPatternPositions(version, alignPatPos); int numAlign = getAlignmentPatternPositions(version, alignPatPos);
for (int i = 0; i < numAlign; i++) { for (int i = 0; i < numAlign; i++) {
for (int j = 0; j < numAlign; j++) { for (int j = 0; j < numAlign; j++) {

View File

@ -25,6 +25,7 @@
#pragma once #pragma once
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
/* /*