Files
haikuports/app-text/gocr/patches/gocr-0.50.patchset
Sergei Reznikov 0cd96b78c3 gocr: added recipe and patch for version 0.50
* removed previous non-working recipe
2015-03-29 15:17:38 +03:00

98 lines
4.1 KiB
Plaintext

From de2d5c3bd349402fbbf5d31fdb2ca43ea2a77146 Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Sun, 29 Mar 2015 14:15:42 +0300
Subject: Haiku fixes
diff --git a/configure.in b/configure.in
index d2fe591..bcdf326 100644
--- a/configure.in
+++ b/configure.in
@@ -41,8 +41,8 @@ if test "$with_netpbm" != "no"; then
# netpbm-9 : libpnm + pnm.h (+ p[bgp]m.h)
# pnm_readpaminit (netpbm-10)
# pnm_readpnminit (netpbm-9,10)
-# ToDo: how to check that -lm is needed?
-LDFLAGS="-lm $LDFLAGS"
+AC_CHECK_LIBM
+LDFLAGS="$LIBM $LDFLAGS"
AC_SEARCH_LIBS(pnm_readpnminit,[netpbm pnm],[check_netpbm_h="pam.h pnm.h"],
[ echo " * * * try option --with-netpbm=PATH"])
fi
diff --git a/src/barcode.c b/src/barcode.c
index 1c0d666..dfd7219 100644
--- a/src/barcode.c
+++ b/src/barcode.c
@@ -1177,8 +1177,9 @@ int detect_barcode(job_t *job)
/* j is the num of bars found above, some inner bars are not counted */
/* ToDo: better iterative add next nearest bars from sorted list near bars? */
{
- int row, col;
+ int row, col, cpos, nc, nr, dm_d;
char *dm_bitmap=NULL;
+ char *code=0;
// store pattern without finder pattern into dm_bitmap
dm_bitmap=(char *)malloc(4*(bx1-regx)*(by1-regy));
@@ -1226,7 +1227,6 @@ int detect_barcode(job_t *job)
}
}
- char *code=0; int cpos=0;
box2->c=PICTURE; /* BARCODE */
code=NULL;
code=(char *)malloc(6*4*bx1*by1/8+128); /* maxlen: &#%3d; = 6 */
@@ -1248,7 +1248,8 @@ int detect_barcode(job_t *job)
/* ToDo: decode and print/store barcode bars=j */
x = +0; // col += 2
y = +4; // row -= 2
- int nc=2*(bx1-regx), nr=2*(by1-regy),
+ nc=2*(bx1-regx);
+ nr=2*(by1-regy);
// dm_mode=0, // ECC200-mode: 0=ASCII+digitpair, 230=C40
dm_d=+1; // direction right/down
for (j=0;j<(bx1-regx)*(by1-regy)/2;j++) { // each byte
@@ -1466,6 +1467,12 @@ int detect_barcode(job_t *job)
qr_mode=0, qr_mask=0, qr_version=0, qr_ecclevel=0;
int an2, ad1, ad2, // allignment parts, rest distance, main distance
num_rawbits;
+ int num_data_bytes, num_ecc_bytes; // data bytes include header bits
+ int b1, b2;
+ int dl=0, el=0, i_ecc=num_data_bytes, i_data=0; // data and ecc length
+ int next_wbits=1023; // bits of the next dataword
+ unsigned char qr_ecc[256]; // buffer for generated ecc data
+ unsigned char *ptext=NULL; // pointer to char tuple of next word
if(job->cfg.verbose)
fprintf(stderr,"#\n# barcode.c detect_barcode search qrcode ");
@@ -1773,7 +1780,6 @@ int detect_barcode(job_t *job)
qrbytes=(unsigned char *)malloc(x*x/8); // enough space for data bits + ecc
nbits=0; // num valid data bits 0..x*x-- of all data blocks
bbits=0; // 8 bits
- int num_data_bytes, num_ecc_bytes; // data bytes include header bits
interleave= qrConst[qr_version-1][6+2*qr_ecclevel+0] // 1-40 0123=LMQH
+ qrConst[qr_version-1][6+2*qr_ecclevel+1];
// raw_bytes, raw_bits_mod, ecc0 .. ecc3
@@ -1853,9 +1859,6 @@ int detect_barcode(job_t *job)
// v2 H m1=34=3*11+1=114bit
// L m1=77=3*25+2=257bit
// v3 e2=Q m1= raw=34+36ecc=70(ok)rest7
- int b1, b2;
- int dl=0, el=0, i_ecc=num_data_bytes, i_data=0; // data and ecc length
- unsigned char qr_ecc[256]; // buffer for generated ecc data
b1 = qrConst[qr_version-1][6+2*qr_ecclevel+0];
b2 = qrConst[qr_version-1][6+2*qr_ecclevel+1];
// for b1 and b2 we have different datasize ???
@@ -1887,8 +1890,6 @@ int detect_barcode(job_t *job)
nchars=0; // num chars (nwords*cpw+rest) expected
dchars=0; // num chars decoded
wbits=0; // data bits of local word
- int next_wbits=1023; // bits of the next dataword
- unsigned char *ptext=NULL; // pointer to char tuple of next word
// get bits and words from deinterleaved byte stream
g_debug(fprintf(stderr,"\n# qrcode bytes: %02x %02x %02x ...\n# qr new_block ",
255&(int)qrbytes[0], 255&(int)qrbytes[1], 255&(int)qrbytes[2]);)
--
2.2.2