Hello community,

here is the log from the commit of package qrencode for openSUSE:Factory 
checked in at 2013-07-30 16:08:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/qrencode (Old)
 and      /work/SRC/openSUSE:Factory/.qrencode.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "qrencode"

Changes:
--------
--- /work/SRC/openSUSE:Factory/qrencode/qrencode.changes        2013-02-18 
13:59:37.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.qrencode.new/qrencode.changes   2013-07-30 
16:08:38.000000000 +0200
@@ -1,0 +2,9 @@
+Fri Jul 26 20:24:06 UTC 2013 - asterios.dra...@gmail.com
+
+- Update to 3.4.2:
+  * Memory leak bug has been fixed.
+  * Micro QR Code encoding bug has been fixed.
+  * String splitting has been improved.
+- Removed qrencode-libpng16.patch (fixed upstream).
+
+-------------------------------------------------------------------

Old:
----
  qrencode-3.4.1.tar.bz2
  qrencode-libpng16.patch

New:
----
  qrencode-3.4.2.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ qrencode.spec ++++++
--- /var/tmp/diff_new_pack.ii2t5o/_old  2013-07-30 16:08:39.000000000 +0200
+++ /var/tmp/diff_new_pack.ii2t5o/_new  2013-07-30 16:08:39.000000000 +0200
@@ -16,16 +16,16 @@
 #
 
 
+%define so_ver 3
+
 Name:           qrencode
-Version:        3.4.1
+Version:        3.4.2
 Release:        0
 Summary:        C library for encoding data in a QR Code symbol
 License:        LGPL-2.1+
-Group:          Development/Libraries/C and C++
+Group:          Productivity/Graphics/Other
 Url:            http://fukuchi.org/works/qrencode/index.en.html
-Source:         http://fukuchi.org/works/qrencode/%{name}-%{version}.tar.bz2
-# PATCH-FIX-UPSTREAM libharu-libpng16.patch -- fix build with libpng 1.6.0, 
sent to kent...@fukuchi.org
-Patch0:         qrencode-libpng16.patch
+Source0:        http://fukuchi.org/works/qrencode/%{name}-%{version}.tar.bz2
 BuildRequires:  pkg-config
 %if !0%{?sles_version}
 BuildRequires:  pkgconfig(libpng)
@@ -36,43 +36,47 @@
 
 %description
 Libqrencode is a C library for encoding data in a QR Code symbol, a kind of 2D
-symbology that can be scanned by handy terminals such as a mobile phone with 
CCD.
-The capacity of QR Code is up to 7000 digits or 4000 characters, and is highly 
robust.
+symbology that can be scanned by handy terminals such as a mobile phone with
+CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and is
+highly robust.
 
-%package -n libqrencode3
+%package -n libqrencode%{so_ver}
 Summary:        C library for encoding data in a QR Code symbol
-Group:          Development/Libraries/C and C++
+Group:          System/Libraries
 
-%description -n libqrencode3
+%description -n libqrencode%{so_ver}
 Libqrencode is a C library for encoding data in a QR Code symbol, a kind of 2D
-symbology that can be scanned by handy terminals such as a mobile phone with 
CCD.
-The capacity of QR Code is up to 7000 digits or 4000 characters, and is highly 
robust.
+symbology that can be scanned by handy terminals such as a mobile phone with
+CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and is
+highly robust.
 
 %package devel
-Summary:        C library for encoding data in a QR Code symbol
+Summary:        C library for encoding data in a QR Code symbol - Development 
files
 Group:          Development/Libraries/C and C++
-Requires:       libqrencode3 = %{version}
+Requires:       libqrencode%{so_ver} = %{version}
 
 %description devel
 Libqrencode is a C library for encoding data in a QR Code symbol, a kind of 2D
-symbology that can be scanned by handy terminals such as a mobile phone with 
CCD.
-The capacity of QR Code is up to 7000 digits or 4000 characters, and is highly 
robust.
+symbology that can be scanned by handy terminals such as a mobile phone with
+CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and is
+highly robust.
+
+This package contains the development files for libqrencode.
 
 %prep
 %setup -q
-%patch0 -p1
 
 %build
-%configure --with-tools
+%configure
 make %{?_smp_mflags}
 
 %install
 make DESTDIR=%{buildroot} install
 rm -f %{buildroot}%{_libdir}/*.la
 
-%post -n libqrencode3 -p /sbin/ldconfig
+%post -n libqrencode%{so_ver} -p /sbin/ldconfig
 
-%postun -n libqrencode3 -p /sbin/ldconfig
+%postun -n libqrencode%{so_ver} -p /sbin/ldconfig
 
 %files
 %defattr(-,root,root,-)
@@ -80,9 +84,9 @@
 %doc %{_mandir}/man1/qrencode.1.gz
 %{_bindir}/qrencode
 
-%files -n libqrencode3
+%files -n libqrencode%{so_ver}
 %defattr(-,root,root,-)
-%{_libdir}/libqrencode.so.*
+%{_libdir}/libqrencode.so.%{so_ver}*
 
 %files devel
 %defattr(-,root,root,-)

++++++ qrencode-3.4.1.tar.bz2 -> qrencode-3.4.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/ChangeLog new/qrencode-3.4.2/ChangeLog
--- old/qrencode-3.4.1/ChangeLog        2012-10-17 18:20:47.000000000 +0200
+++ new/qrencode-3.4.2/ChangeLog        2013-03-01 10:13:16.000000000 +0100
@@ -1,3 +1,44 @@
+2013.03.01 Kentaro FUKUCHI <kent...@fukuchi.org>
+       * README, NEWS:
+         - Documentation update.
+       * Version 3.4.2 has been released.
+
+2013.02.26 Kentaro FUKUCHI <kent...@fukuchi.org>
+       * split.c, tests/test_split.c:
+         - Applied Viona's bug fix patch. (Thanks to Viona)
+         - Additional switching cost between AN and Num mode has been included
+           correctly.
+         - Additional switching cost between 8 and AN/Num mode has been 
included
+           correctly.
+         - New test case has been added.
+
+2013.02.16 Kentaro FUKUCHI <kent...@fukuchi.org>
+       [3.4, master]
+       * configure.ac, README, NEWS: 
+         - Bumped version to 3.4.2.
+
+2013.02.16 Kentaro FUKUCHI <kent...@fukuchi.org>
+       * qrenc.c:
+         - Now it includes "string.h" by itself for libpng16. (Thanks to Petr)
+
+2012.11.30 Kentaro FUKUCHI <kent...@fukuchi.org>
+       * qrencode.h
+         - Doxygen documents improved.
+
+2012.11.09 Kentaro FUKUCHI <kent...@fukuchi.org>
+       * qrinput.c:
+         - Code cleanup.
+
+2012.11.08 Kentaro FUKUCHI <kent...@fukuchi.org>
+       * qrinput.c:
+         - Memory leak bug has been fixed. (issue #24) (Thanks to chisj)
+       * qrencode.c:
+         - Incorrect bit extraction bug in QRcode_encodeMaskMQR() has been 
fixed.
+           (issue #25) (Thanks to vlad417)
+       * tests/test_qrencode.c:
+         - Added NUL checks for malloc-related bugs using failmalloc.
+         - Added a new test for issue #25. (Thanks to vlad417)
+
 2012.10.17 Kentaro FUKUCHI <kent...@fukuchi.org>
        [3.4]
        * NEWS:
@@ -16,6 +57,8 @@
 2012.10.15 Kentaro FUKUCHI <kent...@fukuchi.org>
        [3.4]
        * Version 3.4.0 has been released.
+       [master]
+       * Merged 3.4.0.
 
 2012.10.13 Kentaro FUKUCHI <kent...@fukuchi.org>
        [3.4]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/NEWS new/qrencode-3.4.2/NEWS
--- old/qrencode-3.4.1/NEWS     2012-10-17 18:25:00.000000000 +0200
+++ new/qrencode-3.4.2/NEWS     2013-03-01 03:32:14.000000000 +0100
@@ -1,6 +1,16 @@
 libqrencode NEWS - Overview of changes
 ======================================
 
+Version 3.4.2 (2013.3.1)
+------------------------
+* Bug fix release. (Thanks to chisj, vlad417, Petr and Viona)  
+
+
+Release Note:
+Micro QR Code encoder had a bug that caused incorrect output (issue #25). Now
+the bug has been fixed. Memory leak bug (#24) and insufficient string splitting
+bug have been fixed.
+
 Version 3.4.1 (2012.10.17)
 --------------------------
 * Bug fix release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/README new/qrencode-3.4.2/README
--- old/qrencode-3.4.1/README   2012-10-15 08:03:28.000000000 +0200
+++ new/qrencode-3.4.2/README   2013-03-01 09:32:23.000000000 +0100
@@ -1,4 +1,4 @@
-libqrencode 3.4.1 - QR Code encoding library
+libqrencode 3.4.2 - QR Code encoding library
 
 GENERAL INFORMATION
 ===================
@@ -134,8 +134,9 @@
 Yutaka Niibe (gniibe) - various bug fix patches
 Dan Storm (Repox)     - SVG support patch
 Lennart Poettering (mezcalero)
-                      - Improved text art patch
-Yann Droneaud         - Improved input validation patch
+                      - improved text art patch
+Yann Droneaud         - improved input validation patch
+Viona                 - bug fix patch for string splitting
 Shigeyuki Hirai, Paul Janssens, wangsai, Gavan Fantom, Matthew Baker, Rob Ryan,
-Fred Steinhaeuser, Terry Burton
+Fred Steinhaeuser, Terry Burton, chisj, vlad417, Petr
  - bug report / suggestion
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/configure new/qrencode-3.4.2/configure
--- old/qrencode-3.4.1/configure        2012-10-17 14:25:52.000000000 +0200
+++ new/qrencode-3.4.2/configure        2013-03-01 09:38:11.000000000 +0100
@@ -2149,7 +2149,7 @@
 
 MAJOR_VERSION=3
 MINOR_VERSION=4
-MICRO_VERSION=1
+MICRO_VERSION=2
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/configure.ac 
new/qrencode-3.4.2/configure.ac
--- old/qrencode-3.4.1/configure.ac     2012-10-15 08:03:28.000000000 +0200
+++ new/qrencode-3.4.2/configure.ac     2013-02-17 07:16:26.000000000 +0100
@@ -2,7 +2,7 @@
 
 MAJOR_VERSION=3
 MINOR_VERSION=4
-MICRO_VERSION=1
+MICRO_VERSION=2
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
 AC_SUBST(MAJOR_VERSION)
 AC_SUBST(MINOR_VERSION)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/qrenc.c new/qrencode-3.4.2/qrenc.c
--- old/qrencode-3.4.1/qrenc.c  2012-10-15 08:03:28.000000000 +0200
+++ new/qrencode-3.4.2/qrenc.c  2013-02-17 07:16:26.000000000 +0100
@@ -26,6 +26,7 @@
 #endif
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <png.h>
 #include <getopt.h>
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/qrencode.c 
new/qrencode-3.4.2/qrencode.c
--- old/qrencode-3.4.1/qrencode.c       2012-10-15 08:03:28.000000000 +0200
+++ new/qrencode-3.4.2/qrencode.c       2012-11-26 13:48:55.000000000 +0100
@@ -584,7 +584,7 @@
        for(i=0; i<raw->dataLength + raw->eccLength; i++) {
                code = MQRraw_getCode(raw);
                if(raw->oddbits && i == raw->dataLength - 1) {
-                       bit = 1 << raw->oddbits;
+                       bit = 1 << (raw->oddbits - 1);
                        for(j=0; j<raw->oddbits; j++) {
                                p = FrameFiller_next(filler);
                                if(p == NULL) goto EXIT;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/qrencode.h 
new/qrencode-3.4.2/qrencode.h
--- old/qrencode-3.4.1/qrencode.h       2012-10-15 08:03:28.000000000 +0200
+++ new/qrencode-3.4.2/qrencode.h       2013-02-17 07:16:26.000000000 +0100
@@ -24,10 +24,10 @@
  *
  * \section encoding Encoding
  * 
- * There are two ways to encode data: <b>encoding a string</b> or 
+ * There are two methods to encode data: <b>encoding a string/data</b> or 
  * <b>encoding a structured data</b>.
  *
- * \subsection encoding-string Encoding a string
+ * \subsection encoding-string Encoding a string/data
  * You can encode a string by calling QRcode_encodeString().
  * The given string is parsed automatically and encoded. If you want to encode
  * data that can be represented as a C string style (NUL terminated), you can
@@ -36,11 +36,11 @@
  * If the input data contains Kanji (Shift-JIS) characters and you want to
  * encode them as Kanji in QR Code, you should give QR_MODE_KANJI as a hint.
  * Otherwise, all of non-alphanumeric characters are encoded as 8 bit data.
- * If you want to encode a whole string in 8 bit mode, use
+ * If you want to encode a whole string in 8 bit mode, you can use
  * QRcode_encodeString8bit() instead.
  *
- * Please note that a C string can not contain NUL character. If your data
- * contains NUL, you should chose the second way.
+ * Please note that a C string can not contain NUL characters. If your data
+ * contains NUL, you must use QRcode_encodeData().
  *
  * \subsection encoding-input Encoding a structured data
  * You can construct a structured input data manually. If the structure of the
@@ -408,11 +408,12 @@
  * @param version version of the symbol. If 0, the library chooses the minimum
  *                version for the given input data.
  * @param level error correction level.
- * @param hint tell the library how non-alphanumerical characters should be
- *             encoded. If QR_MODE_KANJI is given, kanji characters will be
- *             encoded as Shif-JIS characters. If QR_MODE_8 is given, all of
- *             non-alphanumerical characters will be encoded as is. If you want
- *             to embed UTF-8 string, choose this.
+ * @param hint tell the library how Japanese Kanji characters should be
+ *             encoded. If QR_MODE_KANJI is given, the library assumes that the
+ *             given string contains Shift-JIS characters and encodes them in
+ *             Kanji-mode. If QR_MODE_8 is given, all of non-alphanumerical
+ *             characters will be encoded as is. If you want to embed UTF-8
+ *             string, choose this. Other mode will cause EINVAL error.
  * @param casesensitive case-sensitive(1) or not(0).
  * @return an instance of QRcode class. The version of the result QRcode may
  *         be larger than the designated version. On error, NULL is returned,
@@ -483,11 +484,12 @@
  * @param string input string. It must be NUL terminated.
  * @param version version of the symbol.
  * @param level error correction level.
- * @param hint tell the library how non-alphanumerical characters should be
- *             encoded. If QR_MODE_KANJI is given, kanji characters will be
- *             encoded as Shif-JIS characters. If QR_MODE_8 is given, all of
- *             non-alphanumerical characters will be encoded as is. If you want
- *             to embed UTF-8 string, choose this.
+ * @param hint tell the library how Japanese Kanji characters should be
+ *             encoded. If QR_MODE_KANJI is given, the library assumes that the
+ *             given string contains Shift-JIS characters and encodes them in
+ *             Kanji-mode. If QR_MODE_8 is given, all of non-alphanumerical
+ *             characters will be encoded as is. If you want to embed UTF-8
+ *             string, choose this. Other mode will cause EINVAL error.
  * @param casesensitive case-sensitive(1) or not(0).
  * @return a singly-linked list of QRcode. On error, NULL is returned, and
  *         errno is set to indicate the error. See Exceptions for the details.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/qrencode.spec 
new/qrencode-3.4.2/qrencode.spec
--- old/qrencode-3.4.1/qrencode.spec    2012-10-17 14:26:42.000000000 +0200
+++ new/qrencode-3.4.2/qrencode.spec    2013-03-01 09:39:00.000000000 +0100
@@ -1,4 +1,4 @@
-%define ver 3.4.1
+%define ver 3.4.2
 %define rel 1
 
 Name:           qrencode
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/qrinput.c new/qrencode-3.4.2/qrinput.c
--- old/qrencode-3.4.1/qrinput.c        2012-10-15 00:36:13.000000000 +0200
+++ new/qrencode-3.4.2/qrinput.c        2012-11-26 13:48:55.000000000 +0100
@@ -1618,16 +1618,19 @@
                        list = list->next;
                } else {
                        bytes = QRinput_lengthOfCode(list->mode, 
input->version, maxbits - bits);
+                       p = QRinput_new2(input->version, input->level);
+                       if(p == NULL) goto ABORT;
                        if(bytes > 0) {
                                /* Splits this entry into 2 entries. */
                                ret = QRinput_splitEntry(list, bytes);
-                               if(ret < 0) goto ABORT;
+                               if(ret < 0) {
+                                       QRinput_free(p);
+                                       goto ABORT;
+                               }
                                /* First half is the tail of the current input. 
*/
                                next = list->next;
                                list->next = NULL;
                                /* Second half is the head of the next input, 
p.*/
-                               p = QRinput_new2(input->version, input->level);
-                               if(p == NULL) goto ABORT;
                                p->head = next;
                                /* Renew QRinput.tail. */
                                p->tail = input->tail;
@@ -1638,19 +1641,21 @@
                        } else {
                                /* Current entry will go to the next input. */
                                prev->next = NULL;
-                               p = QRinput_new2(input->version, input->level);
-                               if(p == NULL) goto ABORT;
                                p->head = list;
                                p->tail = input->tail;
                                input->tail = prev;
                        }
                        ret = QRinput_Struct_appendInput(s, input);
-                       if(ret < 0) goto ABORT;
+                       if(ret < 0) {
+                               QRinput_free(p);
+                               goto ABORT;
+                       }
                        input = p;
                        bits = 0;
                }
        }
-       QRinput_Struct_appendInput(s, input);
+       ret = QRinput_Struct_appendInput(s, input);
+       if(ret < 0) goto ABORT;
        if(s->size > MAX_STRUCTURED_SYMBOLS) {
                QRinput_Struct_free(s);
                errno = ERANGE;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/split.c new/qrencode-3.4.2/split.c
--- old/qrencode-3.4.1/split.c  2012-01-31 04:07:56.000000000 +0100
+++ new/qrencode-3.4.2/split.c  2013-02-26 03:52:17.000000000 +0100
@@ -140,6 +140,7 @@
                        }
                        dif = QRinput_estimateBitsModeAn(p - string) /* + 4 + 
la */
                                + QRinput_estimateBitsModeNum(q - p) + 4 + ln
+                               + (isalnum(*q)?(4 + ln):0)
                                - QRinput_estimateBitsModeAn(q - string) /* - 4 
- la */;
                        if(dif < 0) {
                                break;
@@ -192,10 +193,12 @@
        int ret;
        int run;
        int dif;
-       int la, ln;
+       int la, ln, l8;
+       int swcost;
 
        la = QRspec_lengthIndicator(QR_MODE_AN, input->version);
        ln = QRspec_lengthIndicator(QR_MODE_NUM, input->version);
+       l8 = QRspec_lengthIndicator(QR_MODE_8, input->version);
 
        p = string + 1;
        while(*p != '\0') {
@@ -208,8 +211,14 @@
                        while(isdigit(*q)) {
                                q++;
                        }
+                       if(Split_identifyMode(q, hint) == QR_MODE_8) {
+                               swcost = 4 + l8;
+                       } else {
+                               swcost = 0;
+                       }
                        dif = QRinput_estimateBitsMode8(p - string) /* + 4 + l8 
*/
                                + QRinput_estimateBitsModeNum(q - p) + 4 + ln
+                               + swcost
                                - QRinput_estimateBitsMode8(q - string) /* - 4 
- l8 */;
                        if(dif < 0) {
                                break;
@@ -221,8 +230,14 @@
                        while(isalnum(*q)) {
                                q++;
                        }
+                       if(Split_identifyMode(q, hint) == QR_MODE_8) {
+                               swcost = 4 + l8;
+                       } else {
+                               swcost = 0;
+                       }
                        dif = QRinput_estimateBitsMode8(p - string) /* + 4 + l8 
*/
                                + QRinput_estimateBitsModeAn(q - p) + 4 + la
+                               + swcost
                                - QRinput_estimateBitsMode8(q - string) /* - 4 
- l8 */;
                        if(dif < 0) {
                                break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/tests/test_qrencode.c 
new/qrencode-3.4.2/tests/test_qrencode.c
--- old/qrencode-3.4.1/tests/test_qrencode.c    2012-10-15 00:36:13.000000000 
+0200
+++ new/qrencode-3.4.2/tests/test_qrencode.c    2012-11-26 13:48:55.000000000 
+0100
@@ -19,6 +19,15 @@
        '+', '-', '.', '/', ':'
 };
 
+typedef struct {
+       char *str;
+       int version;
+       QRecLevel level;
+       QRencodeMode hint;
+       int casesensitive;
+} TestString;
+#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
+
 #define drand(__scale__) ((__scale__) * (double)rand() / ((double)RAND_MAX + 
1.0))
 
 int inputSize(QRinput *input)
@@ -245,6 +254,7 @@
        testStart("Test format information(level L,mask 0)");
        width = QRspec_getWidth(1);
        frame = QRspec_newFrame(1);
+       if(frame == NULL) goto ABORT;
        format = QRspec_getFormatInfo(1, QR_ECLEVEL_L);
        blacks = Mask_writeFormatInformation(width, frame, 1, QR_ECLEVEL_L);
        decode = 0;
@@ -294,6 +304,7 @@
 
        free(frame);
 
+ABORT:
        testEnd(0);
 }
 
@@ -336,11 +347,13 @@
 
        testStart("Test encode (1-M)");
        stream = QRinput_new();
+       if(stream == NULL) goto ABORT;
        QRinput_append(stream, QR_MODE_NUM, 8, (unsigned char *)num);
        for(mask=0; mask<8; mask++) {
                QRinput_setVersion(stream, 1);
                QRinput_setErrorCorrectionLevel(stream, QR_ECLEVEL_M);
                qrcode = QRcode_encodeMask(stream, mask);
+               if(qrcode == NULL) goto ABORT;
                w = qrcode->width;
                frame = qrcode->data;
                for(y=0; y<w; y++) {
@@ -354,6 +367,7 @@
                QRcode_free(qrcode);
        }
        QRinput_free(stream);
+ABORT:
        testEnd(err);
 }
 
@@ -813,6 +827,38 @@
        testFinish();
 }
 
+void test_oddBitCalcMQR(void)
+{
+       /* test issue #25 (odd bits calculation bug) */
+       /* test pattern contributed by vlad417 */
+       TestString tests[] = {
+               {"46194", 1, QR_ECLEVEL_L, QR_MODE_8, 1},
+               {"WBA5Y47YPQQ", 3, QR_ECLEVEL_L, QR_MODE_8, 1}
+       };
+       QRcode *qrcode;
+       QRdata *qrdata;
+       int i;
+
+       testStart("Odd bits calculation bug checking (MQR).");
+
+       for(i=0; i<_countof(tests); i++) {
+               qrcode = QRcode_encodeStringMQR(tests[i].str,
+                                                                               
tests[i].version,
+                                                                               
tests[i].level,
+                                                                               
tests[i].hint,
+                                                                               
tests[i].casesensitive);
+               assert_nonnull(qrcode, "Failed to encode: %s\n", tests[i].str);
+               if(qrcode == NULL) continue;
+               qrdata = QRcode_decodeMQR(qrcode);
+               assert_nonnull(qrdata, "Failed to decode.\n");
+               assert_zero(strcmp((char *)qrdata->data, tests[i].str), 
"Decoded data (%s) mismatched (%s)\n", (char *)qrdata->data, tests[i].str);
+               if(qrdata != NULL) QRdata_free(qrdata);
+               QRcode_free(qrcode);
+       }
+
+       testFinish();
+}
+
 void test_mqrencode(void)
 {
        char *str = "MICROQR";
@@ -910,6 +956,7 @@
        test_formatInfoMQR();
        test_encodeTooLongMQR();
        test_decodeShortMQR();
+       test_oddBitCalcMQR();
        test_mqrencode();
        test_apiversion();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qrencode-3.4.1/tests/test_split.c 
new/qrencode-3.4.2/tests/test_split.c
--- old/qrencode-3.4.1/tests/test_split.c       2012-10-15 00:36:13.000000000 
+0200
+++ new/qrencode-3.4.2/tests/test_split.c       2013-02-27 05:59:13.000000000 
+0100
@@ -394,6 +394,138 @@
        QRinput_free(input);
 }
 
+void test_splitAnNAn(void)
+{
+       QRinput *input1, *input2, *input3;
+       int s1, s2, s3;
+       char *strall = "326A80A9C5004C0875571F8B71C311F2F86";
+       char *str1 = "326A80A9C5004C";
+       char *str2 = "0875571";
+       char *str3 = "F8B71C311F2F86";
+
+       testStart("Split test: An-N-An switching cost test");
+       input1 = QRinput_new2(0, QR_ECLEVEL_L);
+       Split_splitStringToQRinput(strall, input1, QR_MODE_8, 0);
+
+       input2 = QRinput_new();
+       QRinput_append(input2, QR_MODE_AN, 35, (unsigned char *)strall);
+
+       input3 = QRinput_new();
+       QRinput_append(input3, QR_MODE_AN, 14, (unsigned char *)str1);
+       QRinput_append(input3, QR_MODE_NUM, 7, (unsigned char *)str2);
+       QRinput_append(input3, QR_MODE_AN, 14, (unsigned char *)str3);
+
+       s1 = inputSize(input1);
+       s2 = inputSize(input2);
+       s3 = inputSize(input3);
+
+       assert_equal(s1, s2, "Incorrect split");
+       assert_exp(s2 < s3, "Incorrect estimation");
+       testFinish();
+       QRinput_free(input1);
+       QRinput_free(input2);
+       QRinput_free(input3);
+}
+
+void test_splitAn8An(void)
+{
+       QRinput *input1, *input2, *input3;
+       int s1, s2, s3;
+       char *strall = "ABCDabcdefABCD";
+       char *str1 = "ABCD";
+       char *str2 = "abcdef";
+       char *str3 = "ABCD";
+
+       testStart("Split test: An-8-An switching cost test");
+       input1 = QRinput_new2(0, QR_ECLEVEL_L);
+       Split_splitStringToQRinput(strall, input1, QR_MODE_8, 1);
+
+       input2 = QRinput_new();
+       QRinput_append(input2, QR_MODE_8, 14, (unsigned char *)strall);
+
+       input3 = QRinput_new();
+       QRinput_append(input3, QR_MODE_AN,  4, (unsigned char *)str1);
+       QRinput_append(input3, QR_MODE_8, 6, (unsigned char *)str2);
+       QRinput_append(input3, QR_MODE_AN,  4, (unsigned char *)str3);
+
+       s1 = inputSize(input1);
+       s2 = inputSize(input2);
+       s3 = inputSize(input3);
+
+       assert_equal(s1, s2, "Incorrect split");
+       assert_exp(s2 < s3, "Incorrect estimation");
+       testFinish();
+       QRinput_free(input1);
+       QRinput_free(input2);
+       QRinput_free(input3);
+}
+
+void test_split8An8(void)
+{
+       QRinput *input1, *input2, *input3;
+       int s1, s2, s3;
+       char *strall = "abcABCDEFGHabc";
+       char *str1 = "abc";
+       char *str2 = "ABCDEFGH";
+       char *str3 = "abc";
+
+       testStart("Split test: 8-An-8 switching cost test");
+       input1 = QRinput_new2(0, QR_ECLEVEL_L);
+       Split_splitStringToQRinput(strall, input1, QR_MODE_8, 1);
+
+       input2 = QRinput_new();
+       QRinput_append(input2, QR_MODE_8, 14, (unsigned char *)strall);
+
+       input3 = QRinput_new();
+       QRinput_append(input3, QR_MODE_8,  3, (unsigned char *)str1);
+       QRinput_append(input3, QR_MODE_AN, 8, (unsigned char *)str2);
+       QRinput_append(input3, QR_MODE_8,  3, (unsigned char *)str3);
+
+       s1 = inputSize(input1);
+       s2 = inputSize(input2);
+       s3 = inputSize(input3);
+
+       assert_equal(s1, s2, "Incorrect split");
+       assert_exp(s2 < s3, "Incorrect estimation");
+       testFinish();
+       QRinput_free(input1);
+       QRinput_free(input2);
+       QRinput_free(input3);
+}
+
+void test_split8N8(void)
+{
+       QRinput *input1, *input2, *input3;
+       int s1, s2, s3;
+       char *strall = "abc1234abc";
+       char *str1 = "abc";
+       char *str2 = "1234";
+       char *str3 = "abc";
+
+       testStart("Split test: 8-N-8 switching cost test");
+       input1 = QRinput_new2(0, QR_ECLEVEL_L);
+       Split_splitStringToQRinput(strall, input1, QR_MODE_8, 1);
+
+       input2 = QRinput_new();
+       QRinput_append(input2, QR_MODE_8, 10, (unsigned char *)strall);
+
+       input3 = QRinput_new();
+       QRinput_append(input3, QR_MODE_8,   3, (unsigned char *)str1);
+       QRinput_append(input3, QR_MODE_NUM, 4, (unsigned char *)str2);
+       QRinput_append(input3, QR_MODE_8,   3, (unsigned char *)str3);
+
+       s1 = inputSize(input1);
+       s2 = inputSize(input2);
+       s3 = inputSize(input3);
+
+       assert_equal(s1, s2, "Incorrect split");
+       assert_exp(s2 < s3, "Incorrect estimation");
+       testFinish();
+       QRinput_free(input1);
+       QRinput_free(input2);
+       QRinput_free(input3);
+}
+
 int main(void)
 {
        test_split1();
@@ -407,6 +539,10 @@
        test_split3c();
        test_toupper();
        test_splitNum8();
+       test_splitAnNAn();
+       test_splitAn8An();
+       test_split8An8();
+       test_split8N8();
 
        report();
 

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to