Ticket #18: add some const.

This commit is contained in:
Harald Oehlmann 2016-04-06 22:55:14 +02:00
parent 5ec95153a0
commit 0fcf4cc1ab
3 changed files with 9 additions and 9 deletions

View File

@ -73,7 +73,7 @@ void to_upper(unsigned char source[]) {
} }
/* Verifies that a string only uses valid characters */ /* 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 i, j, latch;
unsigned int lt = strlen(test_string); 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 */ /* 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); unsigned int i, n = strlen(set_string);
for (i = 0; i < n; i++) { 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 */ /* 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); unsigned int i, n = strlen(set_string);
for (i = 0; i < n; i++) { 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 */ /* 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); unsigned int reader, n = strlen(data);
int writer, i; int writer, i;

View File

@ -56,10 +56,10 @@ extern "C" {
extern int ctoi(const char source); extern int ctoi(const char source);
extern char itoc(const int source); extern char itoc(const int source);
extern void to_upper(unsigned char source[]); extern void to_upper(unsigned char source[]);
extern int is_sane(char test_string[], const unsigned char source[], const int length); extern int is_sane(const 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 void lookup(const char set_string[], const char *table[], const char data, char dest[]);
extern int posn(char set_string[], const char data); extern int posn(const char set_string[], const char data);
extern void expand(struct zint_symbol *symbol, char data[]); extern void expand(struct zint_symbol *symbol, const char data[]);
extern int is_stackable(const int symbology); extern int is_stackable(const int symbology);
extern int is_extendable(const int symbology); extern int is_extendable(const int symbology);
extern int roundup(const float input); extern int roundup(const float input);

View File

@ -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. * 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 // Send the request to the render_plot method
return render_plot(symbol, width, height); return render_plot(symbol, width, height);
} }