mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Free bitmap structure, add clear option, correct KIX Code and fix spelling mistake.
This commit is contained in:
parent
f200517593
commit
b24cf09fe7
@ -23,7 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
|
||||
const int ustrlen(unsigned char data[]) {
|
||||
int ustrlen(unsigned char data[]) {
|
||||
/* Local replacement for strlen() with unsigned char strings */
|
||||
int i;
|
||||
for (i=0;data[i];i++);
|
||||
|
@ -41,7 +41,7 @@ extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern const int ustrlen(unsigned char source[]);
|
||||
extern int ustrlen(unsigned char source[]);
|
||||
extern void ustrcpy(unsigned char target[], unsigned char source[]);
|
||||
extern void concat(char dest[], char source[]);
|
||||
extern void uconcat(unsigned char dest[], unsigned char source[]);
|
||||
|
@ -67,11 +67,30 @@ struct zint_symbol *ZBarcode_Create()
|
||||
return symbol;
|
||||
}
|
||||
|
||||
|
||||
int ZBarcode_Delete(struct zint_symbol *symbol)
|
||||
void ZBarcode_Clear(struct zint_symbol *symbol)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for(i = 0; i < symbol->rows; i++) {
|
||||
for(j = 0; j < symbol->width; j++) {
|
||||
unset_module(symbol, i, j);
|
||||
}
|
||||
}
|
||||
symbol->rows = 0;
|
||||
symbol->width = 0;
|
||||
symbol->text[0] = '\0';
|
||||
symbol->errtxt[0] = '\0';
|
||||
if (symbol->bitmap != NULL)
|
||||
free(symbol->bitmap);
|
||||
symbol->bitmap_width = 0;
|
||||
symbol->bitmap_height = 0;
|
||||
}
|
||||
|
||||
void ZBarcode_Delete(struct zint_symbol *symbol)
|
||||
{
|
||||
if (symbol->bitmap != NULL)
|
||||
free(symbol->bitmap);
|
||||
free(symbol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int eanx(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN system barcodes */
|
||||
|
@ -366,7 +366,7 @@ int kix_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
char height_pattern[50], localstr[13];
|
||||
unsigned int loopey;
|
||||
int writer, i, h;
|
||||
int error_number, zeroes;
|
||||
int error_number, /* zeroes; */
|
||||
strcpy(height_pattern, "");
|
||||
|
||||
error_number = 0;
|
||||
@ -383,9 +383,10 @@ int kix_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
|
||||
/* Add leading zeroes */
|
||||
zeroes = 11 - length;
|
||||
/* zeroes = 11 - length;
|
||||
memset(localstr, '0', zeroes);
|
||||
strcpy(localstr + zeroes, (char *)source);
|
||||
strcpy(localstr + zeroes, (char *)source);*/
|
||||
strcpy(localstr, (char *)source);
|
||||
|
||||
/* Encode data */
|
||||
for (i = 0; i < 11; i++) {
|
||||
|
@ -178,7 +178,8 @@ struct zint_symbol {
|
||||
#endif
|
||||
|
||||
ZINT_EXTERN struct zint_symbol *ZBarcode_Create(void);
|
||||
ZINT_EXTERN int ZBarcode_Delete(struct zint_symbol *symbol);
|
||||
ZINT_EXTERN void ZBarcode_Clear(struct zint_symbol *symbol);
|
||||
ZINT_EXTERN void ZBarcode_Delete(struct zint_symbol *symbol);
|
||||
|
||||
ZINT_EXTERN int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *input, int length);
|
||||
ZINT_EXTERN int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename);
|
||||
@ -187,7 +188,7 @@ ZINT_EXTERN int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, unsigned c
|
||||
ZINT_EXTERN int ZBarcode_Encode_File_and_Print(struct zint_symbol *symbol, char *filename, int rotate_angle);
|
||||
|
||||
ZINT_EXTERN int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle);
|
||||
ZINT_EXTERN int ZBarcide_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle);
|
||||
ZINT_EXTERN int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle);
|
||||
ZINT_EXTERN int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, char *filename, int rotate_angle);
|
||||
|
||||
ZINT_EXTERN int ZBarcode_ValidID(int symbol_id);
|
||||
|
Loading…
Reference in New Issue
Block a user