Skip to content

Commit

Permalink
2009-09-30
Browse files Browse the repository at this point in the history
    * 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.
  • Loading branch information
tpircher-zz committed Nov 1, 2011
1 parent 24dc5fb commit 13a68ee
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
@@ -1,3 +1,13 @@
#
# Version 0.7.2, 2009-09-30
#

2009-09-30 Thomas Pircher <tehpeh@gmx.net>

* 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
#
Expand Down
2 changes: 1 addition & 1 deletion crc_opt.py
Expand Up @@ -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/"

Expand Down
7 changes: 4 additions & 3 deletions doc/pycrc.xml
Expand Up @@ -29,7 +29,7 @@

<refnamediv>
<refname>&program_name;</refname>
<refpurpose>a parametrisable Cyclic Redundancy Check (CRC) calculation utility and C source code generator written in Python</refpurpose>
<refpurpose>pycrc is a free, easy to use Cyclic Redundancy Check (CRC) calculator and source code generator.</refpurpose>
</refnamediv>

<refentryinfo>
Expand All @@ -40,6 +40,7 @@
<firstname>&author_firstname;</firstname>
<surname>&author_surname;</surname>
<email>&author_email;</email>
<contrib>Author of pycrc and of this manual page</contrib>
</author>
<date>&date;</date>
</refentryinfo>
Expand All @@ -55,8 +56,8 @@
<para>
<ulink url="http://www.tty1.net/pycrc/">&program_name;</ulink>
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:
<itemizedlist>
<listitem>
Expand Down
16 changes: 8 additions & 8 deletions pycrc.py
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/test.sh
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e

PYCRC=`dirname $0`/../pycrc.py
Expand Down

0 comments on commit 13a68ee

Please sign in to comment.