From 0fcf4cc1ab7df80731e3bcdf0ea76a54128bf1fc Mon Sep 17 00:00:00 2001 From: Harald Oehlmann Date: Wed, 6 Apr 2016 22:55:14 +0200 Subject: [PATCH] Ticket #18: add some const. --- backend/common.c | 8 ++++---- backend/common.h | 8 ++++---- backend/library.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/common.c b/backend/common.c index d9c7606f..0a884120 100644 --- a/backend/common.c +++ b/backend/common.c @@ -73,7 +73,7 @@ void to_upper(unsigned char source[]) { } /* Verifies that a string only uses valid characters */ -int is_sane(char test_string[], const unsigned char source[], const int length) { +int is_sane(const char test_string[], const unsigned char source[], const int length) { unsigned int i, j, latch; unsigned int lt = strlen(test_string); @@ -94,7 +94,7 @@ int is_sane(char test_string[], const unsigned char source[], const int length) } /* Returns the position of data in set_string */ -int posn(char set_string[], const char data) { +int posn(const char set_string[], const char data) { unsigned int i, n = strlen(set_string); for (i = 0; i < n; i++) { @@ -106,7 +106,7 @@ int posn(char set_string[], const char data) { } /* Replaces huge switch statements for looking up in tables */ -void lookup(char set_string[], const char *table[], const char data, char dest[]) { +void lookup(const char set_string[], const char *table[], const char data, char dest[]) { unsigned int i, n = strlen(set_string); for (i = 0; i < n; i++) { @@ -132,7 +132,7 @@ void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coo } /* Expands from a width pattern to a bit pattern */ -void expand(struct zint_symbol *symbol, char data[]) { +void expand(struct zint_symbol *symbol, const char data[]) { unsigned int reader, n = strlen(data); int writer, i; diff --git a/backend/common.h b/backend/common.h index f748a872..a328b42a 100644 --- a/backend/common.h +++ b/backend/common.h @@ -56,10 +56,10 @@ extern "C" { extern int ctoi(const char source); extern char itoc(const int source); extern void to_upper(unsigned char source[]); - extern int is_sane(char test_string[], const unsigned char source[], const int length); - extern void lookup(char set_string[], const char *table[], const char data, char dest[]); - extern int posn(char set_string[], const char data); - extern void expand(struct zint_symbol *symbol, char data[]); + extern int is_sane(const char test_string[], const unsigned char source[], const int length); + extern void lookup(const char set_string[], const char *table[], const char data, char dest[]); + extern int posn(const char set_string[], const char data); + extern void expand(struct zint_symbol *symbol, const char data[]); extern int is_stackable(const int symbology); extern int is_extendable(const int symbology); extern int roundup(const float input); diff --git a/backend/library.c b/backend/library.c index 03340f44..269c1589 100644 --- a/backend/library.c +++ b/backend/library.c @@ -1099,7 +1099,7 @@ int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, char *filename, * dimensions. The symbol->scale and symbol->height values are totally ignored in this case. * */ -int ZBarcode_Render(struct zint_symbol *symbol, float width, float height) { +int ZBarcode_Render(struct zint_symbol *symbol, const float width, const float height) { // Send the request to the render_plot method return render_plot(symbol, width, height); }