mirror of
https://git.code.sf.net/p/zint/code
synced 2025-12-18 02:17:06 +00:00
Improvements from Oxy patch
Original email reads... It does not contain any fundamental changes or new functions but a lot of improvements which I have done over time (added several const/static specifiers, replaced repeated if-conditions by if-else, removed some warnings).
This commit is contained in:
@@ -68,7 +68,7 @@ static int *logt = NULL, *alog = NULL, *rspoly = NULL;
|
||||
// polynomial. e.g. for ECC200 (8-bit symbols) the polynomial is
|
||||
// a**8 + a**5 + a**3 + a**2 + 1, which translates to 0x12d.
|
||||
|
||||
void rs_init_gf(int poly) {
|
||||
void rs_init_gf(const int poly) {
|
||||
int m, b, p, v;
|
||||
|
||||
// Find the top bit, and hence the symbol size
|
||||
@@ -100,7 +100,7 @@ void rs_init_gf(int poly) {
|
||||
// (x + 2**i)*(x + 2**(i+1))*... [nsym terms]
|
||||
// For ECC200, index is 1.
|
||||
|
||||
void rs_init_code(int nsym, int index) {
|
||||
void rs_init_code(const int nsym,int index) {
|
||||
int i, k;
|
||||
|
||||
rspoly = (int *) malloc(sizeof (int) * (nsym + 1));
|
||||
@@ -120,7 +120,7 @@ void rs_init_code(int nsym, int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void rs_encode(int len, unsigned char *data, unsigned char *res) {
|
||||
void rs_encode(const int len,const unsigned char *data, unsigned char *res) {
|
||||
int i, k, m;
|
||||
for (i = 0; i < rlen; i++)
|
||||
res[i] = 0;
|
||||
@@ -140,7 +140,7 @@ void rs_encode(int len, unsigned char *data, unsigned char *res) {
|
||||
}
|
||||
|
||||
/* The same as above but for larger bitlengths - Aztec code compatible */
|
||||
void rs_encode_long(int len, unsigned int *data, unsigned int *res) {
|
||||
void rs_encode_long(const int len,const unsigned int *data, unsigned int *res) {
|
||||
int i, k, m;
|
||||
for (i = 0; i < rlen; i++)
|
||||
res[i] = 0;
|
||||
|
||||
Reference in New Issue
Block a user