backported

This commit is contained in:
oxygenic 2017-07-21 15:16:23 +02:00 committed by Robin Stuart
parent d8330f5d96
commit 91f66ec57d
4 changed files with 11 additions and 10 deletions

View File

@ -46,14 +46,6 @@ int ctoi(const char source) {
return (source - 'A' + 10); return (source - 'A' + 10);
} }
/* Converts an integer value to its hexadecimal character */
char itoc(const int source) {
if ((source >= 0) && (source <= 9)) {
return ('0' + source);
} else {
return ('A' + (source - 10));
}
}
/* Convert an integer value to a string representing its binary equivalent */ /* Convert an integer value to a string representing its binary equivalent */
void bin_append(const int arg, const int length, char *binary) { void bin_append(const int arg, const int length, char *binary) {
@ -74,6 +66,14 @@ void bin_append(const int arg, const int length, char *binary) {
return; return;
} }
/* Converts an integer value to its hexadecimal character */
char itoc(const int source) {
if ((source >= 0) && (source <= 9)) {
return ('0' + source);
} else {
return ('A' + (source - 10));
}
}
/* Converts lower case characters to upper case in a string source[] */ /* Converts lower case characters to upper case in a string source[] */
void to_upper(unsigned char source[]) { void to_upper(unsigned char source[]) {
size_t i, src_len = ustrlen(source); size_t i, src_len = ustrlen(source);

View File

@ -57,10 +57,10 @@ extern "C" {
extern size_t ustrlen(const unsigned char source[]); extern size_t ustrlen(const unsigned char source[]);
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 bin_append(const int arg, const int length, char *binary);
extern void to_upper(unsigned char source[]); extern void to_upper(unsigned char source[]);
extern int is_sane(const char test_string[], const unsigned char source[], const size_t length); extern int is_sane(const char test_string[], const unsigned char source[], const size_t length);
extern void lookup(const 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 void bin_append(const int arg, const int length, char *binary);
extern int posn(const char set_string[], const char data); extern int posn(const char set_string[], const char data);
extern int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord); extern int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
extern void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord); extern void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);

View File

@ -51,6 +51,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#include <math.h> #include <math.h>
#include <assert.h> #include <assert.h>
#ifdef _MSC_VER #ifdef _MSC_VER

View File

@ -1313,7 +1313,7 @@ static void applyOptimisation(const int version,char inputMode[], const size_t i
free(blockMode); free(blockMode);
} }
static int blockLength(const size_t start,const char inputMode[],const size_t inputLength) { static size_t blockLength(const size_t start,const char inputMode[],const size_t inputLength) {
/* Find the length of the block starting from 'start' */ /* Find the length of the block starting from 'start' */
size_t i; size_t i;
int count; int count;