Permalink
Browse files

Some code cleanups.

  • Loading branch information...
1 parent fe2e1e8 commit dc3de7576e4480a562c59a647ed002eb4931d342 @fukuchi fukuchi committed Oct 23, 2011
Showing with 14 additions and 6 deletions.
  1. +10 −0 ChangeLog
  2. +0 −2 mask.c
  3. +0 −2 mmask.c
  4. +0 −2 tests/common.h
  5. +2 −0 tests/test_mask.c
  6. +2 −0 tests/test_qrencode.c
View
@@ -1,3 +1,13 @@
+2011.10.23 Kentaro FUKUCHI <kentaro@fukuchi.org>
+ * mask.c, mmask.c, tests/common.h:
+ - Eliminated unused valiables.
+ * tests/test_qrencode.c:
+ - Some assertions added.
+
+2011.10.18 Kentaro FUKUCHI <kentaro@fukuchi.org>
+ * test/test_mask.c:
+ - To call QRspec_clearCache() at exit.
+
2011.10.17 Kentaro FUKUCHI <kentaro@fukuchi.org>
* configure.ac:
- Now the latest PNG library is chosen when the configure script is
View
2 mask.c
@@ -298,7 +298,6 @@ unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level)
int i;
unsigned char *mask, *bestMask;
int minDemerit = INT_MAX;
- int bestMaskNum = 0;
int blacks;
int bratio;
int demerit;
@@ -320,7 +319,6 @@ unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level)
// printf("(%d,%d,%d,%d)=%d\n", n1, n2, n3 ,n4, demerit);
if(demerit < minDemerit) {
minDemerit = demerit;
- bestMaskNum = i;
free(bestMask);
bestMask = mask;
mask = (unsigned char *)malloc(w2);
View
@@ -150,7 +150,6 @@ unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level)
int i;
unsigned char *mask, *bestMask;
int maxScore = 0;
- int bestMaskNum = 0;
int score;
int width;
@@ -167,7 +166,6 @@ unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level)
score = MMask_evaluateSymbol(width, mask);
if(score > maxScore) {
maxScore = score;
- bestMaskNum = i;
free(bestMask);
bestMask = mask;
mask = (unsigned char *)malloc(width * width);
View
@@ -27,12 +27,10 @@ const char *modeStr[5] = {"nm", "an", "8", "kj", "st"};
void printQRinput(QRinput *input)
{
QRinput_List *list;
- unsigned char *p;
int i;
list = input->head;
while(list != NULL) {
- p = list->data;
for(i=0; i<list->size; i++) {
printf("0x%02x,", list->data[i]);
}
View
@@ -402,5 +402,7 @@ int main(void)
report();
+ QRspec_clearCache();
+
return 0;
}
View
@@ -687,6 +687,7 @@ void test_formatInfo(void)
testStart("Test format info in QR code.");
qrcode = QRcode_encodeString("AC-42", 1, QR_ECLEVEL_H, QR_MODE_8, 1);
ret = QRcode_decodeFormat(qrcode, &level, &mask);
+ assert_zero(ret, "Failed to decode.\n");
assert_equal(level, QR_ECLEVEL_H, "Decoded format is wrong.\n");
if(qrcode != NULL) QRcode_free(qrcode);
@@ -708,6 +709,7 @@ void test_formatInfoMQR(void)
MQRformat[i].level,
QR_MODE_8, 1);
ret = QRcode_decodeFormatMQR(qrcode, &version, &level, &mask);
+ assert_zero(ret, "Failed to decode.\n");
assert_equal(MQRformat[i].version, version, "Decoded verion is wrong.\n");
assert_equal(MQRformat[i].level, level, "Decoded level is wrong.\n");
QRcode_free(qrcode);

0 comments on commit dc3de75

Please sign in to comment.