From 13a68eedd48b9f8fb934ed95ae83946ca47a554e Mon Sep 17 00:00:00 2001 From: Thomas Pircher Date: Wed, 30 Sep 2009 00:00:00 +0100 Subject: [PATCH] 2009-09-30 * pycrc.py: fixed a bug that caused the result of the Python table-driven code not being evaluated at all. Closes issue 2870630. Thanks to Ildar Muslukhov. --- ChangeLog | 10 ++++++++++ crc_opt.py | 2 +- doc/pycrc.xml | 7 ++++--- pycrc.py | 16 ++++++++-------- test/test.sh | 2 +- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe0a6d5..eb0286a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +# +# Version 0.7.2, 2009-09-30 +# + +2009-09-30 Thomas Pircher + + * pycrc.py: fixed a bug that caused the result of the Python table-driven + code not being evaluated at all. + Closes issue 2870630. Thanks to Ildar Muslukhov. + # # Version 0.7.1, 2009-04-05 # diff --git a/crc_opt.py b/crc_opt.py index fd47422..fb8b6f4 100644 --- a/crc_opt.py +++ b/crc_opt.py @@ -53,7 +53,7 @@ class Options(object): Program details """ ProgramName = "pycrc" - Version = "0.7.1" + Version = "0.7.2" VersionStr = "%s v%s" % (ProgramName, Version) WebAddress = "http://www.tty1.net/pycrc/" diff --git a/doc/pycrc.xml b/doc/pycrc.xml index 488f8f8..9d9ecf9 100644 --- a/doc/pycrc.xml +++ b/doc/pycrc.xml @@ -29,7 +29,7 @@ &program_name; - a parametrisable Cyclic Redundancy Check (CRC) calculation utility and C source code generator written in Python + pycrc is a free, easy to use Cyclic Redundancy Check (CRC) calculator and source code generator. @@ -40,6 +40,7 @@ &author_firstname; &author_surname; &author_email; + Author of pycrc and of this manual page &date; @@ -55,8 +56,8 @@ &program_name; provides a parametrised CRC reference implementation written in Python and a source code generator for C. - Different variants of the CRC algorithm are supported and range from a fast but space-consuming implementation to slower - but smaller code suitable especially for embedded applications. + The generated C source code can be optimized for simplicity, speed or tight memory constraints for embedded platforms. + The following operations are implemented: diff --git a/pycrc.py b/pycrc.py index 8c42756..863fdfe 100755 --- a/pycrc.py +++ b/pycrc.py @@ -89,28 +89,28 @@ def check_string(opt): if opt.Algorithm & opt.Algo_Bit_by_Bit: bbb_crc = alg.bit_by_bit(opt.CheckString) if crc != None and bbb_crc != crc: - error = True; + error = True crc = bbb_crc if opt.Algorithm & opt.Algo_Bit_by_Bit_Fast: bbf_crc = alg.bit_by_bit_fast(opt.CheckString) if crc != None and bbf_crc != crc: - error = True; + error = True crc = bbf_crc if opt.Algorithm & opt.Algo_Table_Driven: opt.TableIdxWidth = 8 # FIXME cowardly refusing to use less bits for the table tbl_crc = alg.table_driven(opt.CheckString) if crc != None and tbl_crc != crc: - error = True; - crc - tbl_crc + error = True + crc = tbl_crc if error: - sys.stderr.write("Error: different checksums:\n"); + sys.stderr.write("Error: different checksums:\n") if opt.Algorithm & opt.Algo_Bit_by_Bit: - sys.stderr.write(" bit-by-bit: 0x%x\n" % bbb_crc); + sys.stderr.write(" bit-by-bit: 0x%x\n" % bbb_crc) if opt.Algorithm & opt.Algo_Bit_by_Bit_Fast: - sys.stderr.write(" bit-by-bit-fast: 0x%x\n" % bbf_crc); + sys.stderr.write(" bit-by-bit-fast: 0x%x\n" % bbf_crc) if opt.Algorithm & opt.Algo_Table_Driven: - sys.stderr.write(" table_driven: 0x%x\n" % tbl_crc); + sys.stderr.write(" table_driven: 0x%x\n" % tbl_crc) sys.exit(1) return crc diff --git a/test/test.sh b/test/test.sh index 3904fce..e89d7f7 100755 --- a/test/test.sh +++ b/test/test.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e PYCRC=`dirname $0`/../pycrc.py