mirror of
https://github.com/woo-j/zint.git
synced 2024-12-23 13:33:55 +03:00
libzint.so: suppress exporting INTERNAL functions to the shared library; ZINT_TEST
This commit is contained in:
parent
c524d32227
commit
bca82ecc0d
@ -19,6 +19,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
|
||||
|
||||
set(ZINT_DEBUG FALSE CACHE BOOL "Set debug compile flag")
|
||||
set(ZINT_SANITIZE FALSE CACHE BOOL "Set sanitize compile/link flags")
|
||||
set(ZINT_TEST FALSE CACHE BOOL "Set test compile flag")
|
||||
|
||||
include (SetPaths.cmake)
|
||||
|
||||
@ -38,6 +39,9 @@ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
|
||||
add_compile_options("-fsanitize=address")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=address")
|
||||
endif (ZINT_SANITIZE)
|
||||
if (ZINT_TEST)
|
||||
add_definitions("-DZINT_TEST")
|
||||
endif (ZINT_TEST)
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@ -59,7 +60,7 @@ static inline char check_digit(unsigned int count) {
|
||||
}
|
||||
|
||||
/* Code 2 of 5 Standard (Code 2 of 5 Matrix) */
|
||||
int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
int i, error_number;
|
||||
char dest[512]; /* 6 + 80 * 6 + 6 + 1 ~ 512*/
|
||||
@ -90,7 +91,7 @@ int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int l
|
||||
}
|
||||
|
||||
/* Code 2 of 5 Industrial */
|
||||
int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
int i, error_number;
|
||||
char dest[512]; /* 6 + 40 * 10 + 6 + 1 */
|
||||
@ -121,7 +122,7 @@ int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], i
|
||||
}
|
||||
|
||||
/* Code 2 of 5 IATA */
|
||||
int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int i, error_number;
|
||||
char dest[512]; /* 4 + 45 * 10 + 3 + 1 */
|
||||
|
||||
@ -151,7 +152,7 @@ int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int len
|
||||
}
|
||||
|
||||
/* Code 2 of 5 Data Logic */
|
||||
int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
int i, error_number;
|
||||
char dest[512]; /* 4 + 80 * 6 + 3 + 1 */
|
||||
@ -182,7 +183,7 @@ int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int le
|
||||
}
|
||||
|
||||
/* Code 2 of 5 Interleaved */
|
||||
int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
INTERNAL int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
|
||||
int i, j, error_number;
|
||||
char bars[7], spaces[7], mixed[14], dest[1000];
|
||||
@ -243,7 +244,7 @@ int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char sour
|
||||
}
|
||||
|
||||
/* Interleaved 2-of-5 (ITF) */
|
||||
int itf14(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int i, error_number, zeroes;
|
||||
unsigned int count;
|
||||
char localstr[16];
|
||||
@ -284,7 +285,7 @@ int itf14(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Deutshe Post Leitcode */
|
||||
int dpleit(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int dpleit(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int i, error_number;
|
||||
unsigned int count;
|
||||
char localstr[16];
|
||||
@ -321,7 +322,7 @@ int dpleit(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Deutsche Post Identcode */
|
||||
int dpident(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int dpident(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int i, error_number, zeroes;
|
||||
unsigned int count;
|
||||
char localstr[16];
|
||||
@ -355,5 +356,3 @@ int dpident(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
ustrcpy(symbol->text, (unsigned char*) localstr);
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#define GDSET "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #"
|
||||
|
||||
@ -68,7 +69,7 @@ static inline char convert_pattern(char data, int shift) {
|
||||
}
|
||||
|
||||
/* Adds Reed-Solomon error correction to auspost */
|
||||
void rs_error(char data_pattern[]) {
|
||||
static void rs_error(char data_pattern[]) {
|
||||
size_t reader, triple_writer = 0;
|
||||
char triple[31];
|
||||
unsigned char result[5];
|
||||
@ -90,7 +91,7 @@ void rs_error(char data_pattern[]) {
|
||||
}
|
||||
|
||||
/* Handles Australia Posts's 4 State Codes */
|
||||
int australia_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int australia_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* Customer Standard Barcode, Barcode 2 or Barcode 3 system determined automatically
|
||||
(i.e. the FCC doesn't need to be specified by the user) dependent
|
||||
on the length of the input string */
|
||||
@ -248,6 +249,3 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -970,7 +970,7 @@ static void populate_map() {
|
||||
AztecMap[(avoidReferenceGrid(76) * 151) + avoidReferenceGrid(77)] = 1;
|
||||
}
|
||||
|
||||
int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
int x, y, i, j, p, data_blocks, ecc_blocks, layers, total_bits;
|
||||
char binary_string[20000], bit_pattern[20045], descriptor[42];
|
||||
char adjusted_string[20000];
|
||||
@ -1582,7 +1582,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t lengt
|
||||
}
|
||||
|
||||
/* Encodes Aztec runes as specified in ISO/IEC 24778:2008 Annex A */
|
||||
int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int input_value, error_number, i, y, x;
|
||||
char binary_string[28];
|
||||
unsigned char data_codewords[3], ecc_codewords[6];
|
||||
@ -1692,4 +1692,3 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -43,7 +44,7 @@
|
||||
|
||||
#define SSET "0123456789ABCDEF"
|
||||
|
||||
int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
int i, row, column;
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
int row_size;
|
||||
@ -145,4 +146,3 @@ int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
free(bitmap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ typedef struct sCharacterSetTable
|
||||
* The result is an or of CodeA,CodeB,CodeC,CodeFNC1 in dependency of the
|
||||
* possible Code 128 character sets.
|
||||
*/
|
||||
int GetPossibleCharacterSet(unsigned char C)
|
||||
static int GetPossibleCharacterSet(unsigned char C)
|
||||
{
|
||||
if (C<='\x19') /* Dec:31 */
|
||||
return CodeA;
|
||||
@ -173,7 +173,7 @@ static void CreateCharacterSetTable(CharacterSetTable T[], unsigned char *data,c
|
||||
* one bundle into the line (up to here). This is calculated online because
|
||||
* it depends on the space in the line.
|
||||
*/
|
||||
int RemainingDigits(CharacterSetTable *T, int charCur,int emptyColumns)
|
||||
static int RemainingDigits(CharacterSetTable *T, int charCur,int emptyColumns)
|
||||
{
|
||||
int digitCount; /* Numerical digits fitting in the line */
|
||||
int runChar;
|
||||
@ -541,7 +541,7 @@ static int Rows2Columns(CharacterSetTable *T, unsigned char *data, const size_t
|
||||
|
||||
/* Print a character in character set A
|
||||
*/
|
||||
void A2C128_A(uchar **ppOutPos,uchar c)
|
||||
static void A2C128_A(uchar **ppOutPos,uchar c)
|
||||
{
|
||||
uchar * pOutPos = *ppOutPos;
|
||||
switch(c){
|
||||
@ -564,7 +564,7 @@ void A2C128_A(uchar **ppOutPos,uchar c)
|
||||
}
|
||||
/* Output c in Set B
|
||||
*/
|
||||
void A2C128_B(uchar **ppOutPos,uchar c)
|
||||
static void A2C128_B(uchar **ppOutPos,uchar c)
|
||||
{
|
||||
uchar * pOutPos = *ppOutPos;
|
||||
switch(c){
|
||||
@ -581,7 +581,7 @@ void A2C128_B(uchar **ppOutPos,uchar c)
|
||||
}
|
||||
/* Output c1, c2 in Set C
|
||||
*/
|
||||
void A2C128_C(uchar **ppOutPos,uchar c1,uchar c2)
|
||||
static void A2C128_C(uchar **ppOutPos,uchar c1,uchar c2)
|
||||
{
|
||||
uchar * pOutPos = *ppOutPos;
|
||||
switch(c1){
|
||||
@ -594,7 +594,7 @@ void A2C128_C(uchar **ppOutPos,uchar c1,uchar c2)
|
||||
}
|
||||
/* Output a character in Characterset
|
||||
*/
|
||||
void ASCIIZ128(uchar **ppOutPos, int CharacterSet,uchar c1, uchar c2)
|
||||
static void ASCIIZ128(uchar **ppOutPos, int CharacterSet,uchar c1, uchar c2)
|
||||
{
|
||||
if (CharacterSet==CodeA)
|
||||
A2C128_A(ppOutPos,c1);
|
||||
@ -605,7 +605,7 @@ void ASCIIZ128(uchar **ppOutPos, int CharacterSet,uchar c1, uchar c2)
|
||||
}
|
||||
/* XLate Table A of Codablock-F Specification and call output
|
||||
*/
|
||||
void SumASCII(uchar **ppOutPos, int Sum, int CharacterSet)
|
||||
static void SumASCII(uchar **ppOutPos, int Sum, int CharacterSet)
|
||||
{
|
||||
switch (CharacterSet){
|
||||
case CodeA:
|
||||
@ -628,7 +628,7 @@ void SumASCII(uchar **ppOutPos, int Sum, int CharacterSet)
|
||||
|
||||
/* Main function called by zint framework
|
||||
*/
|
||||
int codablock(struct zint_symbol *symbol,const unsigned char source[], const size_t length) {
|
||||
INTERNAL int codablock(struct zint_symbol *symbol,const unsigned char source[], const size_t length) {
|
||||
size_t charCur,dataLength;
|
||||
int Error;
|
||||
int rows, columns, useColumns;
|
||||
@ -1005,5 +1005,3 @@ int codablock(struct zint_symbol *symbol,const unsigned char source[], const siz
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
/* In version 0.5 this file was 1,553 lines long! */
|
||||
|
||||
@ -95,17 +96,17 @@ static const char *C93Table[47] = {
|
||||
};
|
||||
|
||||
/* Global Variables for Channel Code */
|
||||
int S[11], B[11];
|
||||
long value;
|
||||
long target_value;
|
||||
char pattern[30];
|
||||
static int S[11], B[11];
|
||||
static long value;
|
||||
static long target_value;
|
||||
static char pattern[30];
|
||||
|
||||
/* Function Prototypes */
|
||||
void NextS(int Chan, int i, int MaxS, int MaxB);
|
||||
void NextB(int Chan, int i, int MaxB, int MaxS);
|
||||
static void NextS(int Chan, int i, int MaxS, int MaxB);
|
||||
static void NextB(int Chan, int i, int MaxB, int MaxS);
|
||||
|
||||
/* *********************** CODE 11 ******************** */
|
||||
int code_11(struct zint_symbol *symbol, unsigned char source[], int length) { /* Code 11 */
|
||||
INTERNAL int code_11(struct zint_symbol *symbol, unsigned char source[], int length) { /* Code 11 */
|
||||
|
||||
unsigned int i;
|
||||
int h, c_digit, c_weight, c_count, k_digit, k_weight, k_count;
|
||||
@ -186,7 +187,7 @@ int code_11(struct zint_symbol *symbol, unsigned char source[], int length) { /*
|
||||
}
|
||||
|
||||
/* Code 39 */
|
||||
int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
INTERNAL int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
unsigned int i;
|
||||
unsigned int counter;
|
||||
int error_number;
|
||||
@ -290,7 +291,7 @@ int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length)
|
||||
}
|
||||
|
||||
/* Pharmazentral Nummer (PZN) */
|
||||
int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
int i, error_number, zeroes;
|
||||
unsigned int count, check_digit;
|
||||
@ -334,7 +335,7 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length
|
||||
}
|
||||
|
||||
/* Extended Code 39 - ISO/IEC 16388:2007 Annex A */
|
||||
int ec39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int ec39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
unsigned char buffer[150] = {0};
|
||||
unsigned int i;
|
||||
@ -366,7 +367,7 @@ int ec39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Code 93 is an advancement on Code 39 and the definition is a lot tighter */
|
||||
int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
/* SILVER includes the extra characters a, b, c and d to represent Code 93 specific
|
||||
shift characters 1, 2, 3 and 4 respectively. These characters are never used by
|
||||
@ -465,7 +466,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
licenses and fees. AIM USA, its member companies, or individual officers
|
||||
assume no liability for the use of this document." */
|
||||
|
||||
void CheckCharacter() {
|
||||
static void CheckCharacter() {
|
||||
|
||||
if (value == target_value) {
|
||||
int i;
|
||||
@ -481,7 +482,7 @@ void CheckCharacter() {
|
||||
}
|
||||
}
|
||||
|
||||
void NextB(int Chan, int i, int MaxB, int MaxS) {
|
||||
static void NextB(int Chan, int i, int MaxB, int MaxS) {
|
||||
int b;
|
||||
|
||||
b = (S[i] + B[i - 1] + S[i - 1] + B[i - 2] > 4) ? 1 : 2;
|
||||
@ -497,7 +498,7 @@ void NextB(int Chan, int i, int MaxB, int MaxS) {
|
||||
}
|
||||
}
|
||||
|
||||
void NextS(int Chan, int i, int MaxS, int MaxB) {
|
||||
static void NextS(int Chan, int i, int MaxS, int MaxB) {
|
||||
int s;
|
||||
|
||||
for (s = (i < Chan + 2) ? 1 : MaxS; s <= MaxS; s++) {
|
||||
@ -507,7 +508,7 @@ void NextS(int Chan, int i, int MaxS, int MaxB) {
|
||||
}
|
||||
|
||||
/* Channel Code - According to ANSI/AIM BC12-1998 */
|
||||
int channel_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int channel_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int channels, i;
|
||||
int error_number = 0, range = 0, zeroes;
|
||||
char hrt[9];
|
||||
@ -596,7 +597,7 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
|
||||
/* Vehicle Identification Number (VIN) */
|
||||
int vin(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) {
|
||||
INTERNAL int vin(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) {
|
||||
|
||||
/* This code verifies the check digit present in North American VIN codes */
|
||||
|
||||
@ -692,4 +693,3 @@ int vin(struct zint_symbol *symbol, const unsigned char source[], const size_t i
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
void horiz(struct zint_symbol *symbol, int row_no, int full) {
|
||||
static void horiz(struct zint_symbol *symbol, int row_no, int full) {
|
||||
int i;
|
||||
|
||||
if (full) {
|
||||
@ -53,7 +53,7 @@ void horiz(struct zint_symbol *symbol, int row_no, int full) {
|
||||
}
|
||||
}
|
||||
|
||||
void central_finder(struct zint_symbol *symbol, int start_row, int row_count, int full_rows) {
|
||||
static void central_finder(struct zint_symbol *symbol, int start_row, int row_count, int full_rows) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < row_count; i++) {
|
||||
@ -69,7 +69,7 @@ void central_finder(struct zint_symbol *symbol, int start_row, int row_count, in
|
||||
}
|
||||
}
|
||||
|
||||
void vert(struct zint_symbol *symbol, int column, int height, int top) {
|
||||
static void vert(struct zint_symbol *symbol, int column, int height, int top) {
|
||||
int i;
|
||||
|
||||
if (top) {
|
||||
@ -83,7 +83,7 @@ void vert(struct zint_symbol *symbol, int column, int height, int top) {
|
||||
}
|
||||
}
|
||||
|
||||
void spigot(struct zint_symbol *symbol, int row_no) {
|
||||
static void spigot(struct zint_symbol *symbol, int row_no) {
|
||||
int i;
|
||||
|
||||
for (i = symbol->width - 1; i > 0; i--) {
|
||||
@ -93,7 +93,7 @@ void spigot(struct zint_symbol *symbol, int row_no) {
|
||||
}
|
||||
}
|
||||
|
||||
int isedi(unsigned char input) {
|
||||
static int isedi(unsigned char input) {
|
||||
int result = 0;
|
||||
|
||||
if (input == 13) {
|
||||
@ -118,7 +118,7 @@ int isedi(unsigned char input) {
|
||||
return result;
|
||||
}
|
||||
|
||||
int dq4bi(unsigned char source[], int sourcelen, int position) {
|
||||
static int dq4bi(unsigned char source[], int sourcelen, int position) {
|
||||
int i;
|
||||
|
||||
for (i = position; isedi(source[position + i]) && ((position + i) < sourcelen); i++);
|
||||
@ -350,7 +350,7 @@ static int c1_look_ahead_test(unsigned char source[], int sourcelen, int positio
|
||||
return best_scheme;
|
||||
}
|
||||
|
||||
int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int target[], int length) {
|
||||
static int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int target[], int length) {
|
||||
int current_mode, next_mode;
|
||||
int sp, tp, gs1, i, j, p, latch;
|
||||
int c40_buffer[6], c40_p;
|
||||
@ -1172,7 +1172,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
||||
return tp;
|
||||
}
|
||||
|
||||
void block_copy(struct zint_symbol *symbol, char grid[][120], int start_row, int start_col, int height, int width, int row_offset, int col_offset) {
|
||||
static void block_copy(struct zint_symbol *symbol, char grid[][120], int start_row, int start_col, int height, int width, int row_offset, int col_offset) {
|
||||
int i, j;
|
||||
|
||||
for (i = start_row; i < (start_row + height); i++) {
|
||||
@ -1184,7 +1184,7 @@ void block_copy(struct zint_symbol *symbol, char grid[][120], int start_row, int
|
||||
}
|
||||
}
|
||||
|
||||
int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int size = 1, i, j;
|
||||
|
||||
char datagrid[136][120];
|
||||
@ -1770,5 +1770,3 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,7 +76,7 @@ static const char *C128Table[107] = {
|
||||
};
|
||||
|
||||
/* Determine appropriate mode for a given character */
|
||||
int parunmodd(const unsigned char llyth) {
|
||||
INTERNAL int parunmodd(const unsigned char llyth) {
|
||||
int modd;
|
||||
modd = 0;
|
||||
|
||||
@ -102,7 +102,7 @@ int parunmodd(const unsigned char llyth) {
|
||||
/**
|
||||
* bring together same type blocks
|
||||
*/
|
||||
void grwp(int *indexliste) {
|
||||
static void grwp(int *indexliste) {
|
||||
|
||||
/* bring together same type blocks */
|
||||
if (*(indexliste) > 1) {
|
||||
@ -131,7 +131,7 @@ void grwp(int *indexliste) {
|
||||
/**
|
||||
* Implements rules from ISO 15417 Annex E
|
||||
*/
|
||||
void dxsmooth(int *indexliste) {
|
||||
static void dxsmooth(int *indexliste) {
|
||||
int i, last, next;
|
||||
|
||||
for (i = 0; i < *(indexliste); i++) {
|
||||
@ -241,7 +241,7 @@ void dxsmooth(int *indexliste) {
|
||||
* Translate Code 128 Set A characters into barcodes.
|
||||
* This set handles all control characters NULL to US.
|
||||
*/
|
||||
void c128_set_a(unsigned char source, char dest[], int values[], int *bar_chars) {
|
||||
static void c128_set_a(unsigned char source, char dest[], int values[], int *bar_chars) {
|
||||
|
||||
if (source > 127) {
|
||||
if (source < 160) {
|
||||
@ -268,7 +268,7 @@ void c128_set_a(unsigned char source, char dest[], int values[], int *bar_chars)
|
||||
* This set handles all characters which are not part of long numbers and not
|
||||
* control characters.
|
||||
*/
|
||||
void c128_set_b(unsigned char source, char dest[], int values[], int *bar_chars) {
|
||||
static void c128_set_b(unsigned char source, char dest[], int values[], int *bar_chars) {
|
||||
if (source > 127) {
|
||||
strcat(dest, C128Table[source - 32 - 128]);
|
||||
values[(*bar_chars)] = source - 32 - 128;
|
||||
@ -282,7 +282,7 @@ void c128_set_b(unsigned char source, char dest[], int values[], int *bar_chars)
|
||||
/* Translate Code 128 Set C characters into barcodes
|
||||
* This set handles numbers in a compressed form
|
||||
*/
|
||||
void c128_set_c(unsigned char source_a, unsigned char source_b, char dest[], int values[], int *bar_chars) {
|
||||
static void c128_set_c(unsigned char source_a, unsigned char source_b, char dest[], int values[], int *bar_chars) {
|
||||
int weight;
|
||||
|
||||
weight = (10 * ctoi(source_a)) + ctoi(source_b);
|
||||
@ -292,7 +292,7 @@ void c128_set_c(unsigned char source_a, unsigned char source_b, char dest[], int
|
||||
}
|
||||
|
||||
/* Handle Code 128 and NVE-18 */
|
||||
int code_128(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
INTERNAL int code_128(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
int i, j, k, values[170] = {0}, bar_characters, read, total_sum;
|
||||
int error_number, indexchaine, indexliste, f_state;
|
||||
size_t sourcelen;
|
||||
@ -683,7 +683,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], const size_t le
|
||||
}
|
||||
|
||||
/* Handle EAN-128 (Now known as GS1-128) */
|
||||
int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
int i, j, values[170], bar_characters, read, total_sum;
|
||||
int error_number, indexchaine, indexliste;
|
||||
char set[170], mode, last_set;
|
||||
@ -994,7 +994,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t len
|
||||
}
|
||||
|
||||
/* Add check digit if encoding an NVE18 symbol */
|
||||
int nve_18(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int nve_18(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int error_number, zeroes, i, nve_check, total_sum, sourcelen;
|
||||
unsigned char ean128_equiv[25];
|
||||
|
||||
@ -1037,7 +1037,7 @@ int nve_18(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* EAN-14 - A version of EAN-128 */
|
||||
int ean_14(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int ean_14(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int i, count, check_digit;
|
||||
int error_number, zeroes;
|
||||
unsigned char ean128_equiv[20];
|
||||
@ -1077,5 +1077,3 @@ int ean_14(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
||||
#define CANDB 98
|
||||
#define CANDBB 99
|
||||
|
||||
extern int parunmodd(const unsigned char llyth);
|
||||
INTERNAL int parunmodd(const unsigned char llyth);
|
||||
|
||||
static int list[2][170];
|
||||
|
||||
@ -257,7 +257,7 @@ static void c16k_set_c(const unsigned char source_a, unsigned char source_b, uns
|
||||
(*bar_chars)++;
|
||||
}
|
||||
|
||||
int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
char width_pattern[100];
|
||||
int current_row, rows_needed, looper, first_check, second_check;
|
||||
int indexchaine, f_state;
|
||||
@ -732,6 +732,3 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t len
|
||||
symbol->width = 70;
|
||||
return errornum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
/* "!" represents Shift 1 and "&" represents Shift 2, "*" represents FNC1 */
|
||||
|
||||
int code_49(struct zint_symbol *symbol, unsigned char source[], const int length) {
|
||||
INTERNAL int code_49(struct zint_symbol *symbol, unsigned char source[], const int length) {
|
||||
int i, j, rows, M, x_count, y_count, z_count, posn_val, local_value;
|
||||
char intermediate[170] = "";
|
||||
int codewords[170], codeword_count;
|
||||
@ -344,4 +344,3 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], const int length
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -32,16 +32,15 @@
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
|
||||
/* Local replacement for strlen() with unsigned char strings */
|
||||
size_t ustrlen(const unsigned char data[]) {
|
||||
INTERNAL size_t ustrlen(const unsigned char data[]) {
|
||||
return strlen((const char*) data);
|
||||
}
|
||||
|
||||
/* Converts a character 0-9 to its equivalent integer value */
|
||||
int ctoi(const char source) {
|
||||
INTERNAL int ctoi(const char source) {
|
||||
if ((source >= '0') && (source <= '9'))
|
||||
return (source - '0');
|
||||
if ((source >= 'A') && (source <= 'F'))
|
||||
@ -51,9 +50,8 @@ int ctoi(const char source) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Convert an integer value to a string representing its binary equivalent */
|
||||
void bin_append(const int arg, const int length, char *binary) {
|
||||
INTERNAL void bin_append(const int arg, const int length, char *binary) {
|
||||
size_t posn = strlen(binary);
|
||||
|
||||
bin_append_posn(arg, length, binary, posn);
|
||||
@ -62,7 +60,7 @@ void bin_append(const int arg, const int length, char *binary) {
|
||||
}
|
||||
|
||||
/* Convert an integer value to a string representing its binary equivalent at a set position */
|
||||
void bin_append_posn(const int arg, const int length, char *binary, size_t posn) {
|
||||
INTERNAL void bin_append_posn(const int arg, const int length, char *binary, size_t posn) {
|
||||
int i;
|
||||
int start;
|
||||
|
||||
@ -77,15 +75,16 @@ void bin_append_posn(const int arg, const int length, char *binary, size_t posn)
|
||||
}
|
||||
|
||||
/* Converts an integer value to its hexadecimal character */
|
||||
char itoc(const int source) {
|
||||
INTERNAL 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[] */
|
||||
void to_upper(unsigned char source[]) {
|
||||
INTERNAL void to_upper(unsigned char source[]) {
|
||||
size_t i, src_len = ustrlen(source);
|
||||
|
||||
for (i = 0; i < src_len; i++) {
|
||||
@ -96,7 +95,7 @@ void to_upper(unsigned char source[]) {
|
||||
}
|
||||
|
||||
/* Verifies that a string only uses valid characters */
|
||||
int is_sane(const char test_string[], const unsigned char source[], const size_t length) {
|
||||
INTERNAL int is_sane(const char test_string[], const unsigned char source[], const size_t length) {
|
||||
unsigned int j;
|
||||
size_t i, lt = strlen(test_string);
|
||||
|
||||
@ -117,7 +116,7 @@ int is_sane(const char test_string[], const unsigned char source[], const size_t
|
||||
}
|
||||
|
||||
/* Replaces huge switch statements for looking up in tables */
|
||||
void lookup(const char set_string[], const char *table[], const char data, char dest[]) {
|
||||
INTERNAL void lookup(const char set_string[], const char *table[], const char data, char dest[]) {
|
||||
size_t i, n = strlen(set_string);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
@ -128,7 +127,7 @@ void lookup(const char set_string[], const char *table[], const char data, char
|
||||
}
|
||||
|
||||
/* Returns the position of data in set_string */
|
||||
int posn(const char set_string[], const char data) {
|
||||
INTERNAL int posn(const char set_string[], const char data) {
|
||||
int i, n = (int)strlen(set_string);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
@ -140,7 +139,7 @@ int posn(const char set_string[], const char data) {
|
||||
}
|
||||
|
||||
/* Returns the number of times a character occurs in a string */
|
||||
int ustrchr_cnt(const unsigned char string[], const size_t length, const unsigned char c) {
|
||||
INTERNAL int ustrchr_cnt(const unsigned char string[], const size_t length, const unsigned char c) {
|
||||
int count = 0;
|
||||
int i;
|
||||
for (i = 0; i < length; i++) {
|
||||
@ -152,22 +151,22 @@ int ustrchr_cnt(const unsigned char string[], const size_t length, const unsigne
|
||||
}
|
||||
|
||||
/* Return true (1) if a module is dark/black, otherwise false (0) */
|
||||
int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord) {
|
||||
INTERNAL int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord) {
|
||||
return (symbol->encoded_data[y_coord][x_coord / 7] >> (x_coord % 7)) & 1;
|
||||
}
|
||||
|
||||
/* Set a module to dark/black */
|
||||
void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord) {
|
||||
INTERNAL void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord) {
|
||||
symbol->encoded_data[y_coord][x_coord / 7] |= 1 << (x_coord % 7);
|
||||
}
|
||||
|
||||
/* Set (or unset) a module to white */
|
||||
void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coord) {
|
||||
INTERNAL void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coord) {
|
||||
symbol->encoded_data[y_coord][x_coord / 7] &= ~(1 << (x_coord % 7));
|
||||
}
|
||||
|
||||
/* Expands from a width pattern to a bit pattern */
|
||||
void expand(struct zint_symbol *symbol, const char data[]) {
|
||||
INTERNAL void expand(struct zint_symbol *symbol, const char data[]) {
|
||||
|
||||
size_t reader, n = strlen(data);
|
||||
int writer, i;
|
||||
@ -201,7 +200,7 @@ void expand(struct zint_symbol *symbol, const char data[]) {
|
||||
}
|
||||
|
||||
/* Indicates which symbologies can have row binding */
|
||||
int is_stackable(const int symbology) {
|
||||
INTERNAL int is_stackable(const int symbology) {
|
||||
if (symbology < BARCODE_PDF417) {
|
||||
return 1;
|
||||
}
|
||||
@ -224,7 +223,7 @@ int is_stackable(const int symbology) {
|
||||
}
|
||||
|
||||
/* Indicates which symbols can have addon (EAN-2 and EAN-5) */
|
||||
int is_extendable(const int symbology) {
|
||||
INTERNAL int is_extendable(const int symbology) {
|
||||
if (symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK) {
|
||||
return 1;
|
||||
}
|
||||
@ -251,11 +250,11 @@ int is_extendable(const int symbology) {
|
||||
}
|
||||
|
||||
/* Indicates which symbols can have composite 2D component data */
|
||||
int is_composite(int symbology) {
|
||||
INTERNAL int is_composite(int symbology) {
|
||||
return symbology >= BARCODE_EANX_CC && symbology <= BARCODE_RSS_EXPSTACK_CC;
|
||||
}
|
||||
|
||||
int istwodigits(const unsigned char source[], const size_t position) {
|
||||
INTERNAL int istwodigits(const unsigned char source[], const size_t position) {
|
||||
if ((source[position] >= '0') && (source[position] <= '9')) {
|
||||
if ((source[position + 1] >= '0') && (source[position + 1] <= '9')) {
|
||||
return 1;
|
||||
@ -266,7 +265,7 @@ int istwodigits(const unsigned char source[], const size_t position) {
|
||||
}
|
||||
|
||||
/* State machine to decode UTF-8 to Unicode codepoints (state 0 means done, state 12 means error) */
|
||||
unsigned int decode_utf8(unsigned int* state, unsigned int* codep, const unsigned char byte) {
|
||||
INTERNAL unsigned int decode_utf8(unsigned int* state, unsigned int* codep, const unsigned char byte) {
|
||||
/*
|
||||
Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
|
||||
|
||||
@ -312,7 +311,7 @@ unsigned int decode_utf8(unsigned int* state, unsigned int* codep, const unsigne
|
||||
|
||||
/* Convert UTF-8 to Unicode. If `disallow_4byte` unset, allow all values (UTF-32).
|
||||
* If `disallow_4byte` set, only allow codepoints <= U+FFFF (ie four-byte sequences not allowed) (UTF-16, no surrogates) */
|
||||
int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char source[], unsigned int vals[], size_t *length, int disallow_4byte) {
|
||||
INTERNAL int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char source[], unsigned int vals[], size_t *length, int disallow_4byte) {
|
||||
size_t bpos;
|
||||
int jpos;
|
||||
unsigned int codepoint, state = 0;
|
||||
@ -344,7 +343,7 @@ int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char source[], un
|
||||
}
|
||||
|
||||
/* Enforce minimum permissable height of rows */
|
||||
void set_minimum_height(struct zint_symbol *symbol, const int min_height) {
|
||||
INTERNAL void set_minimum_height(struct zint_symbol *symbol, const int min_height) {
|
||||
int fixed_height = 0;
|
||||
int zero_count = 0;
|
||||
int i;
|
||||
@ -369,7 +368,7 @@ void set_minimum_height(struct zint_symbol *symbol, const int min_height) {
|
||||
}
|
||||
|
||||
/* Calculate optimized encoding modes. Adapted from Project Nayuki */
|
||||
void pn_define_mode(char* mode, const unsigned int data[], const size_t length, const int debug,
|
||||
INTERNAL void pn_define_mode(char* mode, const unsigned int data[], const size_t length, const int debug,
|
||||
unsigned int state[], const char mode_types[], const int num_modes, pn_head_costs head_costs, pn_switch_cost switch_cost, pn_eod_cost eod_cost, pn_cur_cost cur_cost) {
|
||||
/*
|
||||
* Copyright (c) Project Nayuki. (MIT License)
|
||||
@ -400,12 +399,12 @@ void pn_define_mode(char* mode, const unsigned int data[], const size_t length,
|
||||
cur_costs = (unsigned int*) _alloca(num_modes * sizeof(unsigned int));
|
||||
#endif
|
||||
|
||||
/* char_modes[i * num_modes + j] represents the mode to encode the code point at index i such that the final segment ends in
|
||||
* mode_types[j] and the total number of bits is minimized over all possible choices */
|
||||
/* char_modes[i * num_modes + j] represents the mode to encode the code point at index i such that the final
|
||||
* segment ends in mode_types[j] and the total number of bits is minimized over all possible choices */
|
||||
memset(char_modes, 0, length * num_modes);
|
||||
|
||||
/* At the beginning of each iteration of the loop below, prev_costs[j] is the minimum number of 1/6 (1/GM_MULT) bits needed
|
||||
* to encode the entire string prefix of length i, and end in mode_types[j] */
|
||||
/* At the beginning of each iteration of the loop below, prev_costs[j] is the minimum number of 1/6 (1/XX_MULT)
|
||||
* bits needed to encode the entire string prefix of length i, and end in mode_types[j] */
|
||||
memcpy(prev_costs, (*head_costs)(state), num_modes * sizeof(unsigned int));
|
||||
|
||||
/* Calculate costs using dynamic programming */
|
||||
@ -460,6 +459,7 @@ void pn_define_mode(char* mode, const unsigned int data[], const size_t length,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ZINT_TEST
|
||||
/* Dumps hex-formatted codewords in symbol->errtxt (for use in testing) */
|
||||
void debug_test_codeword_dump(struct zint_symbol *symbol, unsigned char* codewords, int length) {
|
||||
int i, max = length, cnt_len = 0;
|
||||
@ -473,3 +473,4 @@ void debug_test_codeword_dump(struct zint_symbol *symbol, unsigned char* codewor
|
||||
}
|
||||
symbol->errtxt[strlen(symbol->errtxt) - 1] = '\0'; /* Zap last space */
|
||||
}
|
||||
#endif
|
||||
|
@ -51,40 +51,48 @@
|
||||
|
||||
#define ustrcpy(target,source) strcpy((char*)target,(const char*)source)
|
||||
|
||||
#if defined(__GNUC__) && !defined(ZINT_TEST)
|
||||
#define INTERNAL __attribute__ ((visibility ("hidden")))
|
||||
#else
|
||||
#define INTERNAL
|
||||
#endif /* defined(__GNUC__) && !defined(ZINT_TEST) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern size_t ustrlen(const unsigned char data[]);
|
||||
extern int ctoi(const char source);
|
||||
extern char itoc(const int 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 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 void bin_append_posn(const int arg, const int length, char *binary, size_t posn);
|
||||
extern int posn(const char set_string[], const char data);
|
||||
extern int ustrchr_cnt(const unsigned char string[], const size_t length, const unsigned char c);
|
||||
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 int istwodigits(const unsigned char source[], const size_t position);
|
||||
extern void expand(struct zint_symbol *symbol, const char data[]);
|
||||
extern void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
extern int is_stackable(const int symbology);
|
||||
extern int is_extendable(const int symbology);
|
||||
extern int is_composite(const int symbology);
|
||||
extern unsigned int decode_utf8(unsigned int* state, unsigned int* codep, const unsigned char byte);
|
||||
extern int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char source[], unsigned int vals[], size_t *length, int disallow_4byte);
|
||||
extern void set_minimum_height(struct zint_symbol *symbol, const int min_height);
|
||||
INTERNAL size_t ustrlen(const unsigned char data[]);
|
||||
INTERNAL int ctoi(const char source);
|
||||
INTERNAL char itoc(const int source);
|
||||
INTERNAL void to_upper(unsigned char source[]);
|
||||
INTERNAL int is_sane(const char test_string[], const unsigned char source[], const size_t length);
|
||||
INTERNAL void lookup(const char set_string[], const char *table[], const char data, char dest[]);
|
||||
INTERNAL void bin_append(const int arg, const int length, char *binary);
|
||||
INTERNAL void bin_append_posn(const int arg, const int length, char *binary, size_t posn);
|
||||
INTERNAL int posn(const char set_string[], const char data);
|
||||
INTERNAL int ustrchr_cnt(const unsigned char string[], const size_t length, const unsigned char c);
|
||||
INTERNAL int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
INTERNAL void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
INTERNAL int istwodigits(const unsigned char source[], const size_t position);
|
||||
INTERNAL void expand(struct zint_symbol *symbol, const char data[]);
|
||||
INTERNAL void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
INTERNAL int is_stackable(const int symbology);
|
||||
INTERNAL int is_extendable(const int symbology);
|
||||
INTERNAL int is_composite(const int symbology);
|
||||
INTERNAL unsigned int decode_utf8(unsigned int* state, unsigned int* codep, const unsigned char byte);
|
||||
INTERNAL int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char source[], unsigned int vals[], size_t *length, int disallow_4byte);
|
||||
INTERNAL void set_minimum_height(struct zint_symbol *symbol, const int min_height);
|
||||
|
||||
typedef unsigned int* (*pn_head_costs)(unsigned int state[]);
|
||||
typedef unsigned int (*pn_switch_cost)(unsigned int state[], const int k, const int j);
|
||||
typedef unsigned int (*pn_eod_cost)(unsigned int state[], const int k);
|
||||
typedef void (*pn_cur_cost)(unsigned int state[], const unsigned int data[], const size_t length, const int i, char* char_modes, unsigned int prev_costs[], unsigned int cur_costs[]);
|
||||
extern void pn_define_mode(char* mode, const unsigned int data[], const size_t length, const int debug,
|
||||
INTERNAL void pn_define_mode(char* mode, const unsigned int data[], const size_t length, const int debug,
|
||||
unsigned int state[], const char mode_types[], const int num_modes, pn_head_costs head_costs, pn_switch_cost switch_cost, pn_eod_cost eod_cost, pn_cur_cost cur_cost);
|
||||
|
||||
extern void debug_test_codeword_dump(struct zint_symbol *symbol, unsigned char* codewords, int length);
|
||||
#ifdef ZINT_TEST
|
||||
void debug_test_codeword_dump(struct zint_symbol *symbol, unsigned char* codewords, int length);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -65,12 +65,12 @@
|
||||
|
||||
#define UINT unsigned short
|
||||
|
||||
extern int eanx(struct zint_symbol *symbol, unsigned char source[], int length);
|
||||
extern int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t length);
|
||||
extern void ean_leading_zeroes(struct zint_symbol *symbol, unsigned char source[], unsigned char local_source[]);
|
||||
extern int rss14(struct zint_symbol *symbol, unsigned char source[], int length);
|
||||
extern int rsslimited(struct zint_symbol *symbol, unsigned char source[], int length);
|
||||
extern int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int length);
|
||||
INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int length);
|
||||
INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t length);
|
||||
INTERNAL void ean_leading_zeroes(struct zint_symbol *symbol, unsigned char source[], unsigned char local_source[]);
|
||||
INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int length);
|
||||
INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int length);
|
||||
INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int length);
|
||||
|
||||
static UINT pwr928[69][7];
|
||||
|
||||
@ -796,7 +796,7 @@ static int calc_padding_cca(int binary_length, int cc_width) {
|
||||
return target_bitsize;
|
||||
}
|
||||
|
||||
int calc_padding_ccb(int binary_length, int cc_width) {
|
||||
static int calc_padding_ccb(int binary_length, int cc_width) {
|
||||
int target_bitsize = 0;
|
||||
|
||||
switch (cc_width) {
|
||||
@ -895,7 +895,7 @@ int calc_padding_ccb(int binary_length, int cc_width) {
|
||||
return target_bitsize;
|
||||
}
|
||||
|
||||
int calc_padding_ccc(int binary_length, int *cc_width, int lin_width, int *ecc) {
|
||||
static int calc_padding_ccc(int binary_length, int *cc_width, int lin_width, int *ecc) {
|
||||
int target_bitsize = 0;
|
||||
int byte_length, codewords_used, ecc_level, ecc_codewords, rows;
|
||||
int codewords_total, target_codewords, target_bytesize;
|
||||
@ -1344,7 +1344,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
|
||||
return 0;
|
||||
}
|
||||
|
||||
int linear_dummy_run(unsigned char *source, int length) {
|
||||
static int linear_dummy_run(unsigned char *source, int length) {
|
||||
struct zint_symbol *dummy;
|
||||
int error_number;
|
||||
int linear_width;
|
||||
@ -1363,7 +1363,7 @@ int linear_dummy_run(unsigned char *source, int length) {
|
||||
}
|
||||
}
|
||||
|
||||
int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int error_number, cc_mode, cc_width, ecc_level;
|
||||
int j, i, k;
|
||||
unsigned int bs = 13 * length + 500 + 1; /* Allow for 8 bits + 5-bit latch per char + 500 bits overhead/padding */
|
||||
|
@ -40,7 +40,6 @@
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
@ -52,8 +51,8 @@
|
||||
#define ceilf ceil
|
||||
#endif
|
||||
#endif
|
||||
#include "reedsol.h"
|
||||
#include "common.h"
|
||||
#include "reedsol.h"
|
||||
#include "dmatrix.h"
|
||||
|
||||
/* Annex M placement alorithm low level */
|
||||
@ -1164,7 +1163,7 @@ static void add_tail(unsigned char target[], int tp, const int tail_length) {
|
||||
}
|
||||
}
|
||||
|
||||
int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], const size_t in_length) {
|
||||
static int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], const size_t in_length) {
|
||||
int i, skew = 0;
|
||||
size_t inputlen = in_length;
|
||||
unsigned char binary[2200];
|
||||
@ -1327,7 +1326,7 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con
|
||||
return error_number;
|
||||
}
|
||||
|
||||
int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) {
|
||||
INTERNAL int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) {
|
||||
int error_number;
|
||||
|
||||
if (symbol->option_1 <= 1) {
|
||||
@ -1341,5 +1340,3 @@ int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
/*
|
||||
Containes Extended Rectangular Data Matrix (DMRE)
|
||||
@ -36,19 +37,8 @@
|
||||
Contact: harald.oehlmann@eurodatacouncil.org
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifndef __IEC16022ECC200_H
|
||||
#define __IEC16022ECC200_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern int data_matrix_200(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#ifndef __DMATRIX_H
|
||||
#define __DMATRIX_H
|
||||
|
||||
#define MAXBARCODE 3116
|
||||
|
||||
@ -255,6 +245,4 @@ static const unsigned short int matrixrsblock[] = {
|
||||
/*44*/ 56, /*104x104*/ 68, /*120x120*/ 62, /*132x132*/ 62 /*144x144*/
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __DMATRIX_H */
|
||||
|
@ -104,7 +104,7 @@ static int clr_row(char *Dots, const int Hgt, const int Wid, const int y) {
|
||||
}
|
||||
|
||||
/* Dot pattern scoring routine from Annex A */
|
||||
const int score_array(char Dots[], int Hgt, int Wid) {
|
||||
static const int score_array(char Dots[], int Hgt, int Wid) {
|
||||
int x, y, worstedge, first, last, sum;
|
||||
int penalty_local = 0;
|
||||
int penalty = 0;
|
||||
@ -268,7 +268,7 @@ const int score_array(char Dots[], int Hgt, int Wid) {
|
||||
// employing Galois Field GF, where GF is prime, with a prime modulus of PM
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void rsencode(int nd, int nc, unsigned char *wd) {
|
||||
static void rsencode(int nd, int nc, unsigned char *wd) {
|
||||
int i, j, k, nw, start, step, root[GF], c[GF];
|
||||
|
||||
// Start by generating "nc" roots (antilogs):
|
||||
@ -312,7 +312,7 @@ void rsencode(int nd, int nc, unsigned char *wd) {
|
||||
}
|
||||
|
||||
/* Check if the next character is directly encodable in code set A (Annex F.II.D) */
|
||||
int datum_a(const unsigned char source[], int position, int length) {
|
||||
static int datum_a(const unsigned char source[], int position, int length) {
|
||||
int retval = 0;
|
||||
|
||||
if (position < length) {
|
||||
@ -325,7 +325,7 @@ int datum_a(const unsigned char source[], int position, int length) {
|
||||
}
|
||||
|
||||
/* Check if the next character is directly encodable in code set B (Annex F.II.D) */
|
||||
int datum_b(const unsigned char source[], int position, int length) {
|
||||
static int datum_b(const unsigned char source[], int position, int length) {
|
||||
int retval = 0;
|
||||
|
||||
if (position < length) {
|
||||
@ -352,7 +352,7 @@ int datum_b(const unsigned char source[], int position, int length) {
|
||||
}
|
||||
|
||||
/* Check if the next characters are directly encodable in code set C (Annex F.II.D) */
|
||||
int datum_c(const unsigned char source[], int position, int length) {
|
||||
static int datum_c(const unsigned char source[], int position, int length) {
|
||||
int retval = 0;
|
||||
|
||||
if (position <= length - 2) {
|
||||
@ -365,7 +365,7 @@ int datum_c(const unsigned char source[], int position, int length) {
|
||||
}
|
||||
|
||||
/* Returns how many consecutive digits lie immediately ahead (Annex F.II.A) */
|
||||
int n_digits(const unsigned char source[], int position, int length) {
|
||||
static int n_digits(const unsigned char source[], int position, int length) {
|
||||
int i;
|
||||
|
||||
for (i = position; ((source[i] >= '0') && (source[i] <= '9')) && (i < length); i++);
|
||||
@ -374,7 +374,7 @@ int n_digits(const unsigned char source[], int position, int length) {
|
||||
}
|
||||
|
||||
/* checks ahead for 10 or more digits starting "17xxxxxx10..." (Annex F.II.B) */
|
||||
int seventeen_ten(const unsigned char source[], int position, int length) {
|
||||
static int seventeen_ten(const unsigned char source[], int position, int length) {
|
||||
int found = 0;
|
||||
|
||||
if (n_digits(source, position, length) >= 10) {
|
||||
@ -390,7 +390,7 @@ int seventeen_ten(const unsigned char source[], int position, int length) {
|
||||
/* checks how many characters ahead can be reached while datum_c is true,
|
||||
* returning the resulting number of codewords (Annex F.II.E)
|
||||
*/
|
||||
int ahead_c(const unsigned char source[], int position, int length) {
|
||||
static int ahead_c(const unsigned char source[], int position, int length) {
|
||||
int count = 0;
|
||||
int i;
|
||||
|
||||
@ -402,7 +402,7 @@ int ahead_c(const unsigned char source[], int position, int length) {
|
||||
}
|
||||
|
||||
/* Annex F.II.F */
|
||||
int try_c(const unsigned char source[], int position, int length) {
|
||||
static int try_c(const unsigned char source[], int position, int length) {
|
||||
int retval = 0;
|
||||
|
||||
if (n_digits(source, position, length) > 0) {
|
||||
@ -415,7 +415,7 @@ int try_c(const unsigned char source[], int position, int length) {
|
||||
}
|
||||
|
||||
/* Annex F.II.G */
|
||||
int ahead_a(const unsigned char source[], int position, int length) {
|
||||
static int ahead_a(const unsigned char source[], int position, int length) {
|
||||
int count = 0;
|
||||
int i;
|
||||
|
||||
@ -428,7 +428,7 @@ int ahead_a(const unsigned char source[], int position, int length) {
|
||||
}
|
||||
|
||||
/* Annex F.II.H */
|
||||
int ahead_b(const unsigned char source[], int position, int length) {
|
||||
static int ahead_b(const unsigned char source[], int position, int length) {
|
||||
int count = 0;
|
||||
int i;
|
||||
|
||||
@ -441,7 +441,7 @@ int ahead_b(const unsigned char source[], int position, int length) {
|
||||
}
|
||||
|
||||
/* checks if the next character is in the range 128 to 255 (Annex F.II.I) */
|
||||
int binary(const unsigned char source[], int position) {
|
||||
static int binary(const unsigned char source[], int position) {
|
||||
int retval = 0;
|
||||
|
||||
if (source[position] >= 128) {
|
||||
@ -452,7 +452,7 @@ int binary(const unsigned char source[], int position) {
|
||||
}
|
||||
|
||||
/* Analyse input data stream and encode using algorithm from Annex F */
|
||||
int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char *codeword_array, int *binary_finish) {
|
||||
static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char *codeword_array, int *binary_finish) {
|
||||
int input_position, array_length, i;
|
||||
char encoding_mode;
|
||||
int inside_macro;
|
||||
@ -1102,7 +1102,7 @@ static size_t make_dotstream(unsigned char masked_array[], int array_length, cha
|
||||
/* Determines if a given dot is a reserved corner dot
|
||||
* to be used by one of the last six bits
|
||||
*/
|
||||
int is_corner(int column, int row, int width, int height) {
|
||||
static int is_corner(int column, int row, int width, int height) {
|
||||
int corner = 0;
|
||||
|
||||
/* Top Left */
|
||||
@ -1144,7 +1144,7 @@ int is_corner(int column, int row, int width, int height) {
|
||||
}
|
||||
|
||||
/* Place the dots in the symbol*/
|
||||
void fold_dotstream(char dot_stream[], int width, int height, char dot_array[]) {
|
||||
static void fold_dotstream(char dot_stream[], int width, int height, char dot_array[]) {
|
||||
int column, row;
|
||||
int input_position = 0;
|
||||
|
||||
@ -1209,7 +1209,7 @@ void fold_dotstream(char dot_stream[], int width, int height, char dot_array[])
|
||||
}
|
||||
}
|
||||
|
||||
void apply_mask(int mask, int data_length, unsigned char *masked_codeword_array, unsigned char *codeword_array, int ecc_length, char *dot_stream) {
|
||||
static void apply_mask(int mask, int data_length, unsigned char *masked_codeword_array, unsigned char *codeword_array, int ecc_length, char *dot_stream) {
|
||||
int weight = 0;
|
||||
int j;
|
||||
|
||||
@ -1246,7 +1246,7 @@ void apply_mask(int mask, int data_length, unsigned char *masked_codeword_array,
|
||||
rsencode(data_length + 1, ecc_length, masked_codeword_array);
|
||||
}
|
||||
|
||||
void force_corners(int width, int height, char *dot_array) {
|
||||
static void force_corners(int width, int height, char *dot_array) {
|
||||
if (width % 2) {
|
||||
// "Vertical" symbol
|
||||
dot_array[0] = '1';
|
||||
@ -1266,7 +1266,7 @@ void force_corners(int width, int height, char *dot_array) {
|
||||
}
|
||||
}
|
||||
|
||||
int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length) {
|
||||
INTERNAL int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length) {
|
||||
int i, j, k;
|
||||
size_t jc, n_dots;
|
||||
int data_length, ecc_length;
|
||||
@ -1519,4 +1519,3 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -28,18 +28,19 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "eci.h"
|
||||
#include "zint.h"
|
||||
#include "common.h"
|
||||
#ifdef _MSC_VER
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
/* Convert Unicode to other character encodings */
|
||||
int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length) {
|
||||
INTERNAL int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length) {
|
||||
int in_posn;
|
||||
int out_posn;
|
||||
int ext;
|
||||
@ -253,7 +254,7 @@ int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[]
|
||||
}
|
||||
|
||||
/* Find the lowest ECI mode which will encode a given set of Unicode text */
|
||||
int get_best_eci(unsigned char source[], size_t length) {
|
||||
INTERNAL int get_best_eci(unsigned char source[], size_t length) {
|
||||
int eci = 3;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
@ -271,5 +272,3 @@ int get_best_eci(unsigned char source[], size_t length) {
|
||||
|
||||
return 26; // If all of these fail, use Unicode!
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
/* Developed according to [MS-EMF] - v20160714, Released July 14, 2016
|
||||
* and [MS-WMF] - v20160714, Released July 14, 2016 */
|
||||
@ -41,7 +42,7 @@
|
||||
#include "common.h"
|
||||
#include "emf.h"
|
||||
|
||||
int count_rectangles(struct zint_symbol *symbol) {
|
||||
static int count_rectangles(struct zint_symbol *symbol) {
|
||||
int rectangles = 0;
|
||||
struct zint_vector_rect *rect;
|
||||
|
||||
@ -54,7 +55,7 @@ int count_rectangles(struct zint_symbol *symbol) {
|
||||
return rectangles;
|
||||
}
|
||||
|
||||
int count_circles(struct zint_symbol *symbol) {
|
||||
static int count_circles(struct zint_symbol *symbol) {
|
||||
int circles = 0;
|
||||
struct zint_vector_circle *circ;
|
||||
|
||||
@ -67,7 +68,7 @@ int count_circles(struct zint_symbol *symbol) {
|
||||
return circles;
|
||||
}
|
||||
|
||||
int count_hexagons(struct zint_symbol *symbol) {
|
||||
static int count_hexagons(struct zint_symbol *symbol) {
|
||||
int hexagons = 0;
|
||||
struct zint_vector_hexagon *hex;
|
||||
|
||||
@ -80,7 +81,7 @@ int count_hexagons(struct zint_symbol *symbol) {
|
||||
return hexagons;
|
||||
}
|
||||
|
||||
int count_strings(struct zint_symbol *symbol) {
|
||||
static int count_strings(struct zint_symbol *symbol) {
|
||||
int strings = 0;
|
||||
struct zint_vector_string *str;
|
||||
|
||||
@ -93,7 +94,7 @@ int count_strings(struct zint_symbol *symbol) {
|
||||
return strings;
|
||||
}
|
||||
|
||||
void utfle_copy(unsigned char *output, unsigned char *input, int length) {
|
||||
static void utfle_copy(unsigned char *output, unsigned char *input, int length) {
|
||||
int i;
|
||||
int o;
|
||||
|
||||
@ -117,7 +118,7 @@ void utfle_copy(unsigned char *output, unsigned char *input, int length) {
|
||||
} while (i < length);
|
||||
}
|
||||
|
||||
int bump_up(int input) {
|
||||
static int bump_up(int input) {
|
||||
/* Strings length must be a multiple of 4 bytes */
|
||||
if ((input % 2) == 1) {
|
||||
input++;
|
||||
@ -125,7 +126,7 @@ int bump_up(int input) {
|
||||
return input;
|
||||
}
|
||||
|
||||
int emf_plot(struct zint_symbol *symbol) {
|
||||
INTERNAL int emf_plot(struct zint_symbol *symbol) {
|
||||
int i,j;
|
||||
FILE *emf_file;
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
|
@ -57,7 +57,7 @@
|
||||
#include "gb2312.h"
|
||||
#include "gb18030.h"
|
||||
|
||||
extern int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
|
||||
INTERNAL int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
|
||||
|
||||
/*
|
||||
* CP936 extensions (libiconv-1.16/lib/cp936ext.h)
|
||||
@ -2795,7 +2795,7 @@ static const unsigned short gb18030_pua2charset[31*3] = {
|
||||
0xe864, 0xe864, 0xfea0,
|
||||
};
|
||||
|
||||
int gb18030_wctomb_zint(unsigned int* r1, unsigned int* r2, unsigned int wc) {
|
||||
INTERNAL int gb18030_wctomb_zint(unsigned int* r1, unsigned int* r2, unsigned int wc) {
|
||||
int ret;
|
||||
|
||||
/* Code set 0 (ASCII) */
|
||||
@ -2867,7 +2867,7 @@ int gb18030_wctomb_zint(unsigned int* r1, unsigned int* r2, unsigned int wc) {
|
||||
}
|
||||
|
||||
/* Convert UTF-8 string to GB 18030 and place in array of ints */
|
||||
int gb18030_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
INTERNAL int gb18030_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
int i, j, error_number, ret;
|
||||
unsigned int length;
|
||||
#ifndef _MSC_VER
|
||||
@ -2902,7 +2902,7 @@ int gb18030_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], s
|
||||
}
|
||||
|
||||
/* Convert UTF-8 string to single byte ECI and place in array of ints */
|
||||
int gb18030_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
INTERNAL int gb18030_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
int error_number;
|
||||
#ifndef _MSC_VER
|
||||
unsigned char single_byte[*p_length + 1];
|
||||
@ -2922,7 +2922,7 @@ int gb18030_utf8tosb(int eci, const unsigned char source[], size_t* p_length, un
|
||||
}
|
||||
|
||||
/* Copy byte input stream to array of ints, putting double-bytes that match HANXIN Chinese mode in single entry, and quad-bytes in 2 entries */
|
||||
void gb18030_cpy(const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
INTERNAL void gb18030_cpy(const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
int i, j, done;
|
||||
unsigned int length;
|
||||
unsigned char c1, c2, c3, c4;
|
||||
|
@ -37,10 +37,10 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int gb18030_wctomb_zint(unsigned int* r1, unsigned int* r2, unsigned int wc);
|
||||
int gb18030_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
int gb18030_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
void gb18030_cpy(const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
INTERNAL int gb18030_wctomb_zint(unsigned int* r1, unsigned int* r2, unsigned int wc);
|
||||
INTERNAL int gb18030_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
INTERNAL int gb18030_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
INTERNAL void gb18030_cpy(const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include "common.h"
|
||||
#include "gb2312.h"
|
||||
|
||||
extern int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
|
||||
INTERNAL int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
|
||||
|
||||
/*
|
||||
* GB2312.1980-0 (libiconv-1.16/lib/gb2312.h)
|
||||
@ -1499,7 +1499,7 @@ static const Summary16 gb2312_uni2indx_pageff[15] = {
|
||||
{ 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x002b },
|
||||
};
|
||||
|
||||
int gb2312_wctomb_zint(unsigned int* r, unsigned int wc) {
|
||||
INTERNAL int gb2312_wctomb_zint(unsigned int* r, unsigned int wc) {
|
||||
const Summary16 *summary = NULL;
|
||||
if (wc >= 0x0000 && wc < 0x0460) {
|
||||
if (wc == 0x00b7) { /* ZINT: Patched to duplicate map to 0xA1A4 */
|
||||
@ -1541,7 +1541,7 @@ int gb2312_wctomb_zint(unsigned int* r, unsigned int wc) {
|
||||
}
|
||||
|
||||
/* Convert UTF-8 string to GB 2312 (EUC-CN) and place in array of ints */
|
||||
int gb2312_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
INTERNAL int gb2312_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
int i, error_number;
|
||||
unsigned int length;
|
||||
#ifndef _MSC_VER
|
||||
@ -1570,7 +1570,7 @@ int gb2312_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], si
|
||||
}
|
||||
|
||||
/* Convert UTF-8 string to single byte ECI and place in array of ints */
|
||||
int gb2312_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
INTERNAL int gb2312_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
int error_number;
|
||||
#ifndef _MSC_VER
|
||||
unsigned char single_byte[*p_length + 1];
|
||||
@ -1590,7 +1590,7 @@ int gb2312_utf8tosb(int eci, const unsigned char source[], size_t* p_length, uns
|
||||
}
|
||||
|
||||
/* Copy byte input stream to array of ints, putting double-bytes that match GRIDMATRIX Chinese mode in single entry */
|
||||
void gb2312_cpy(const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
INTERNAL void gb2312_cpy(const unsigned char source[], size_t* p_length, unsigned int* gbdata) {
|
||||
int i, j;
|
||||
unsigned int length;
|
||||
unsigned char c1, c2;
|
||||
|
@ -37,10 +37,10 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int gb2312_wctomb_zint(unsigned int* r, unsigned int wc);
|
||||
int gb2312_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
int gb2312_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
void gb2312_cpy(const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
INTERNAL int gb2312_wctomb_zint(unsigned int* r, unsigned int wc);
|
||||
INTERNAL int gb2312_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
INTERNAL int gb2312_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
INTERNAL void gb2312_cpy(const unsigned char source[], size_t* p_length, unsigned int* gbdata);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ static int general_field_next_none(char* general_field, int i, int general_field
|
||||
|
||||
/* Attempts to apply encoding rules from sections 7.2.5.5.1 to 7.2.5.5.3
|
||||
* of ISO/IEC 24724:2011 (same as sections 5.4.1 to 5.4.3 of ISO/IEC 24723:2010) */
|
||||
int general_field_encode(char* general_field, int* p_mode, int* p_last_digit, char binary_string[]) {
|
||||
INTERNAL int general_field_encode(char* general_field, int* p_mode, int* p_last_digit, char binary_string[]) {
|
||||
int i, d1, d2;
|
||||
int mode = *p_mode;
|
||||
int last_digit = 0; /* Set to odd remaining digit at end if any */
|
||||
|
@ -39,7 +39,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
extern int general_field_encode(char* general_field, int* p_mode, int* p_last_digit, char binary_string[]);
|
||||
INTERNAL int general_field_encode(char* general_field, int* p_mode, int* p_last_digit, char binary_string[]);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -123,7 +124,7 @@ static void FlushStringTable(statestruct *pState) {
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short FindPixelOutlet(statestruct *pState, unsigned short HeadNode, unsigned char Byte) {
|
||||
static unsigned short FindPixelOutlet(statestruct *pState, unsigned short HeadNode, unsigned char Byte) {
|
||||
unsigned short Outlet;
|
||||
|
||||
Outlet = (pState->NodeAxon)[HeadNode];
|
||||
@ -176,7 +177,7 @@ static char NextCode(statestruct *pState, unsigned char * pPixelValueCur, unsign
|
||||
return 1;
|
||||
}
|
||||
|
||||
int gif_lzw(unsigned char *pOut, int OutLength, unsigned char *pIn, int InLen) {
|
||||
static int gif_lzw(unsigned char *pOut, int OutLength, unsigned char *pIn, int InLen) {
|
||||
unsigned char PixelValueCur;
|
||||
unsigned char CodeBits;
|
||||
unsigned short Pos;
|
||||
@ -260,7 +261,7 @@ int gif_lzw(unsigned char *pOut, int OutLength, unsigned char *pIn, int InLen) {
|
||||
}
|
||||
}
|
||||
|
||||
int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
char outbuf[10];
|
||||
FILE *gif_file;
|
||||
unsigned short usTemp;
|
||||
|
@ -49,7 +49,7 @@
|
||||
/* Bits multiplied by this for costs, so as to be whole integer divisible by 2 and 3 */
|
||||
#define GM_MULT 6
|
||||
|
||||
static char numeral_nondigits[] = " +-.,"; /* Non-digit numeral set, excluding EOL (carriage return/linefeed) */
|
||||
static const char numeral_nondigits[] = " +-.,"; /* Non-digit numeral set, excluding EOL (carriage return/linefeed) */
|
||||
|
||||
/* Whether in numeral or not. If in numeral, *p_numeral_end is set to position after numeral, and *p_numeral_cost is set to per-numeral cost */
|
||||
static int in_numeral(const unsigned int gbdata[], const size_t length, const int posn, unsigned int* p_numeral_end, unsigned int* p_numeral_cost) {
|
||||
@ -133,7 +133,7 @@ static unsigned int* gm_head_costs(unsigned int state[]) {
|
||||
|
||||
/* Cost of switching modes from k to j - see AIMD014 Rev. 1.63 Table 9 – Type conversion codes */
|
||||
static unsigned int gm_switch_cost(unsigned int state[], const int k, const int j) {
|
||||
static unsigned int switch_costs[GM_NUM_MODES][GM_NUM_MODES] = {
|
||||
static const unsigned int switch_costs[GM_NUM_MODES][GM_NUM_MODES] = {
|
||||
/* H N L U M B */
|
||||
/*H*/ { 0, (13 + 2) * GM_MULT, 13 * GM_MULT, 13 * GM_MULT, 13 * GM_MULT, (13 + 9) * GM_MULT },
|
||||
/*N*/ { 10 * GM_MULT, 0, 10 * GM_MULT, 10 * GM_MULT, 10 * GM_MULT, (10 + 9) * GM_MULT },
|
||||
@ -148,7 +148,7 @@ static unsigned int gm_switch_cost(unsigned int state[], const int k, const int
|
||||
|
||||
/* Final end-of-data cost - see AIMD014 Rev. 1.63 Table 9 – Type conversion codes */
|
||||
static unsigned int gm_eod_cost(unsigned int state[], const int k) {
|
||||
static unsigned int eod_costs[GM_NUM_MODES] = {
|
||||
static const unsigned int eod_costs[GM_NUM_MODES] = {
|
||||
/* H N L U M B */
|
||||
13 * GM_MULT, 10 * GM_MULT, 5 * GM_MULT, 5 * GM_MULT, 10 * GM_MULT, 4 * GM_MULT
|
||||
};
|
||||
@ -220,7 +220,7 @@ static void gm_cur_cost(unsigned int state[], const unsigned int gbdata[], const
|
||||
|
||||
/* Calculate optimized encoding modes */
|
||||
static void define_mode(char* mode, const unsigned int gbdata[], const size_t length, const int debug) {
|
||||
static char mode_types[] = { GM_CHINESE, GM_NUMBER, GM_LOWER, GM_UPPER, GM_MIXED, GM_BYTE }; /* Must be in same order as GM_H etc */
|
||||
static const char mode_types[] = { GM_CHINESE, GM_NUMBER, GM_LOWER, GM_UPPER, GM_MIXED, GM_BYTE }; /* Must be in same order as GM_H etc */
|
||||
unsigned int state[3] = { 0 /*numeral_end*/, 0 /*numeral_cost*/, 0 /*byte_count*/ };
|
||||
|
||||
pn_define_mode(mode, gbdata, length, debug, state, mode_types, GM_NUM_MODES, gm_head_costs, gm_switch_cost, gm_eod_cost, gm_cur_cost);
|
||||
@ -919,7 +919,7 @@ static void place_layer_id(char* grid, int size, int layers, int modules, int ec
|
||||
}
|
||||
}
|
||||
|
||||
int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
INTERNAL int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
int size, modules, error_number;
|
||||
int auto_layers, min_layers, layers, auto_ecc_level, min_ecc_level, ecc_level;
|
||||
int x, y, i;
|
||||
@ -1058,7 +1058,9 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t
|
||||
}
|
||||
|
||||
gm_add_ecc(binary, data_cw, layers, ecc_level, word);
|
||||
#ifdef ZINT_TEST
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, word, data_cw);
|
||||
#endif
|
||||
size = 6 + (layers * 12);
|
||||
modules = 1 + (layers * 2);
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
to be bulletproof, nor does it report very accurately what problem was found
|
||||
or where, but should prevent some of the more common encoding errors */
|
||||
|
||||
void itostr(char ai_string[], int ai_value) {
|
||||
static void itostr(char ai_string[], int ai_value) {
|
||||
int thou, hund, ten, unit;
|
||||
char temp[2];
|
||||
|
||||
@ -70,7 +70,7 @@ void itostr(char ai_string[], int ai_value) {
|
||||
strcat(ai_string, ")");
|
||||
}
|
||||
|
||||
int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const size_t src_len, char reduced[]) {
|
||||
INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const size_t src_len, char reduced[]) {
|
||||
int i, j, last_ai, ai_latch;
|
||||
char ai_string[7]; /* 6 char max "(NNNN)" */
|
||||
int bracket_level, max_bracket_level, ai_length, max_ai_length, min_ai_length;
|
||||
|
@ -358,7 +358,7 @@ static unsigned int* hx_head_costs(unsigned int state[]) {
|
||||
|
||||
/* Cost of switching modes from k to j */
|
||||
static unsigned int hx_switch_cost(unsigned int state[], const int k, const int j) {
|
||||
static unsigned int switch_costs[HX_NUM_MODES][HX_NUM_MODES] = {
|
||||
static const unsigned int switch_costs[HX_NUM_MODES][HX_NUM_MODES] = {
|
||||
/* N T B 1 2 D F */
|
||||
/*N*/ { 0, (10 + 4) * HX_MULT, (10 + 4 + 13) * HX_MULT, (10 + 4) * HX_MULT, (10 + 4) * HX_MULT, (10 + 4) * HX_MULT, 10 * HX_MULT },
|
||||
/*T*/ { (6 + 4) * HX_MULT, 0, (6 + 4 + 13) * HX_MULT, (6 + 4) * HX_MULT, (6 + 4) * HX_MULT, (6 + 4) * HX_MULT, 6 * HX_MULT },
|
||||
@ -374,7 +374,7 @@ static unsigned int hx_switch_cost(unsigned int state[], const int k, const int
|
||||
|
||||
/* Final end-of-data costs */
|
||||
static unsigned int hx_eod_cost(unsigned int state[], const int k) {
|
||||
static unsigned int eod_costs[HX_NUM_MODES] = {
|
||||
static const unsigned int eod_costs[HX_NUM_MODES] = {
|
||||
/* N T B 1 2 D F */
|
||||
10 * HX_MULT, 6 * HX_MULT, 0, 12 * HX_MULT, 12 * HX_MULT, 15 * HX_MULT, 0
|
||||
};
|
||||
@ -436,7 +436,7 @@ static void hx_cur_cost(unsigned int state[], const unsigned int gbdata[], const
|
||||
|
||||
/* Calculate optimized encoding modes */
|
||||
static void hx_define_mode(char* mode, const unsigned int gbdata[], const size_t length, const int debug) {
|
||||
static char mode_types[] = { 'n', 't', 'b', '1', '2', 'd', 'f' }; /* Must be in same order as HX_N etc */
|
||||
static const char mode_types[] = { 'n', 't', 'b', '1', '2', 'd', 'f' }; /* Must be in same order as HX_N etc */
|
||||
unsigned int state[5] = { 0 /*numeric_end*/, 0 /*numeric_cost*/, 1 /*text_submode*/, 0 /*fourbyte_end*/, 0 /*fourbyte_cost*/ };
|
||||
|
||||
pn_define_mode(mode, gbdata, length, debug, state, mode_types, HX_NUM_MODES, hx_head_costs, hx_switch_cost, hx_eod_cost, hx_cur_cost);
|
||||
@ -1370,7 +1370,7 @@ static int hx_apply_bitmask(unsigned char *grid, int size) {
|
||||
}
|
||||
|
||||
/* Han Xin Code - main */
|
||||
int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
INTERNAL int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
int est_binlen;
|
||||
int ecc_level = symbol->option_1;
|
||||
int i, j, version;
|
||||
@ -1542,7 +1542,9 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
#ifdef ZINT_TEST
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, datastream, data_codewords);
|
||||
#endif
|
||||
|
||||
hx_setup_grid(grid, size, version);
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
/* The function "USPS_MSB_Math_CRC11GenerateFrameCheckSequence"
|
||||
is Copyright (C) 2006 United States Postal Service */
|
||||
@ -209,7 +210,7 @@ static const unsigned short int AppxD_IV[130] = {
|
||||
** Outputs:
|
||||
** return unsigned short - 11 bit Frame Check Sequence (right justified)
|
||||
***************************************************************************/
|
||||
extern unsigned short USPS_MSB_Math_CRC11GenerateFrameCheckSequence(unsigned char *ByteArrayPtr) {
|
||||
static unsigned short USPS_MSB_Math_CRC11GenerateFrameCheckSequence(unsigned char *ByteArrayPtr) {
|
||||
unsigned short GeneratorPolynomial = 0x0F35;
|
||||
unsigned short FrameCheckSequence = 0x07FF;
|
||||
unsigned short Data;
|
||||
@ -243,7 +244,7 @@ extern unsigned short USPS_MSB_Math_CRC11GenerateFrameCheckSequence(unsigned cha
|
||||
return FrameCheckSequence;
|
||||
}
|
||||
|
||||
int imail(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int imail(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
char data_pattern[200];
|
||||
int error_number;
|
||||
int i, j, read;
|
||||
@ -565,4 +566,3 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
symbol->width = read - 1;
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -29,13 +29,14 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
#include "large.h"
|
||||
|
||||
void binary_add(short int accumulator[], short int input_buffer[]) { /* Binary addition */
|
||||
INTERNAL void binary_add(short int accumulator[], short int input_buffer[]) { /* Binary addition */
|
||||
int i, carry;
|
||||
carry = 0;
|
||||
|
||||
@ -92,7 +93,7 @@ void binary_add(short int accumulator[], short int input_buffer[]) { /* Binary a
|
||||
}
|
||||
}
|
||||
|
||||
void binary_subtract(short int accumulator[], short int input_buffer[]) {
|
||||
INTERNAL void binary_subtract(short int accumulator[], short int input_buffer[]) {
|
||||
/* 2's compliment subtraction */
|
||||
/* take input_buffer from accumulator and put answer in accumulator */
|
||||
int i;
|
||||
@ -115,7 +116,7 @@ void binary_subtract(short int accumulator[], short int input_buffer[]) {
|
||||
binary_add(accumulator, sub_buffer);
|
||||
}
|
||||
|
||||
void binary_multiply(short int reg[], char data[]) {
|
||||
INTERNAL void binary_multiply(short int reg[], char data[]) {
|
||||
/* Multiply the contents of reg[] by a number */
|
||||
short int temp[112] = {0};
|
||||
short int accum[112] = {0};
|
||||
@ -135,7 +136,7 @@ void binary_multiply(short int reg[], char data[]) {
|
||||
}
|
||||
}
|
||||
|
||||
void shiftdown(short int buffer[]) {
|
||||
INTERNAL void shiftdown(short int buffer[]) {
|
||||
int i;
|
||||
|
||||
buffer[102] = 0;
|
||||
@ -146,7 +147,7 @@ void shiftdown(short int buffer[]) {
|
||||
}
|
||||
}
|
||||
|
||||
void shiftup(short int buffer[]) {
|
||||
INTERNAL void shiftup(short int buffer[]) {
|
||||
int i;
|
||||
|
||||
for (i = 102; i > 0; i--) {
|
||||
@ -156,7 +157,7 @@ void shiftup(short int buffer[]) {
|
||||
buffer[0] = 0;
|
||||
}
|
||||
|
||||
short int islarger(short int accum[], short int reg[]) {
|
||||
INTERNAL short int islarger(short int accum[], short int reg[]) {
|
||||
/* Returns 1 if accum[] is larger than reg[], else 0 */
|
||||
int i, latch, larger;
|
||||
latch = 0;
|
||||
@ -178,7 +179,7 @@ short int islarger(short int accum[], short int reg[]) {
|
||||
return larger;
|
||||
}
|
||||
|
||||
void binary_load(short int reg[], char data[], const size_t src_len) {
|
||||
INTERNAL void binary_load(short int reg[], char data[], const size_t src_len) {
|
||||
size_t read;
|
||||
int i;
|
||||
short int temp[112] = {0};
|
||||
@ -208,5 +209,3 @@ void binary_load(short int reg[], char data[], const size_t src_len) {
|
||||
binary_add(reg, temp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#ifndef __LARGE_H
|
||||
#define __LARGE_H
|
||||
|
||||
@ -36,17 +37,16 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern void binary_load(short int reg[], char data[], const size_t src_len);
|
||||
extern void binary_add(short int accumulator[], short int input_buffer[]);
|
||||
extern void binary_subtract(short int accumulator[], short int input_buffer[]);
|
||||
extern void shiftdown(short int buffer[]);
|
||||
extern void shiftup(short int buffer[]);
|
||||
extern short int islarger(short int accum[], short int reg[]);
|
||||
extern void binary_multiply(short int reg[], char data[]);
|
||||
INTERNAL void binary_load(short int reg[], char data[], const size_t src_len);
|
||||
INTERNAL void binary_add(short int accumulator[], short int input_buffer[]);
|
||||
INTERNAL void binary_subtract(short int accumulator[], short int input_buffer[]);
|
||||
INTERNAL void shiftdown(short int buffer[]);
|
||||
INTERNAL void shiftup(short int buffer[]);
|
||||
INTERNAL short int islarger(short int accum[], short int reg[]);
|
||||
INTERNAL void binary_multiply(short int reg[], char data[]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LARGE_H */
|
||||
|
||||
|
@ -78,7 +78,7 @@ struct zint_symbol *ZBarcode_Create() {
|
||||
return symbol;
|
||||
}
|
||||
|
||||
extern void vector_free(struct zint_symbol *symbol); /* Free vector structures */
|
||||
INTERNAL void vector_free(struct zint_symbol *symbol); /* Free vector structures */
|
||||
|
||||
void ZBarcode_Clear(struct zint_symbol *symbol) {
|
||||
int i, j;
|
||||
@ -113,77 +113,77 @@ void ZBarcode_Delete(struct zint_symbol *symbol) {
|
||||
free(symbol);
|
||||
}
|
||||
|
||||
extern int get_best_eci(unsigned char source[], size_t length); /* Calculate suitable ECI mode */
|
||||
extern int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
|
||||
INTERNAL int get_best_eci(unsigned char source[], size_t length); /* Calculate suitable ECI mode */
|
||||
INTERNAL int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
|
||||
|
||||
|
||||
extern int eanx(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN system barcodes */
|
||||
extern int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Code 3 from 9 (or Code 39) */
|
||||
extern int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length); /* Pharmazentral Nummer (PZN) */
|
||||
extern int ec39(struct zint_symbol *symbol, unsigned char source[], int length); /* Extended Code 3 from 9 (or Code 39+) */
|
||||
extern int codabar(struct zint_symbol *symbol, unsigned char source[], int length); /* Codabar - a simple substitution cipher */
|
||||
extern int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Standard (& Matrix) */
|
||||
extern int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Industrial */
|
||||
extern int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 IATA */
|
||||
extern int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* Code 2 of 5 Interleaved */
|
||||
extern int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Data Logic */
|
||||
extern int itf14(struct zint_symbol *symbol, unsigned char source[], int length); /* ITF-14 */
|
||||
extern int dpleit(struct zint_symbol *symbol, unsigned char source[], int length); /* Deutsche Post Leitcode */
|
||||
extern int dpident(struct zint_symbol *symbol, unsigned char source[], int length); /* Deutsche Post Identcode */
|
||||
extern int c93(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 93 - a re-working of Code 39+, generates 2 check digits */
|
||||
extern int code_128(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Code 128 and NVE-18 */
|
||||
extern int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* EAN-128 (GS1-128) */
|
||||
extern int code_11(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 11 */
|
||||
extern int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length); /* MSI Plessey */
|
||||
extern int telepen(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Telepen ASCII */
|
||||
extern int telepen_num(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Telepen Numeric */
|
||||
extern int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Plessey Code */
|
||||
extern int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length); /* Pharmacode One Track */
|
||||
extern int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length); /* Flattermarken */
|
||||
extern int fim(struct zint_symbol *symbol, unsigned char source[], int length); /* Facing Identification Mark */
|
||||
extern int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length); /* Pharmacode Two Track */
|
||||
extern int post_plot(struct zint_symbol *symbol, unsigned char source[], int length); /* Postnet */
|
||||
extern int planet_plot(struct zint_symbol *symbol, unsigned char source[], int length); /* PLANET */
|
||||
extern int imail(struct zint_symbol *symbol, unsigned char source[], int length); /* Intelligent Mail (aka USPS OneCode) */
|
||||
extern int royal_plot(struct zint_symbol *symbol, unsigned char source[], int length); /* RM4SCC */
|
||||
extern int australia_post(struct zint_symbol *symbol, unsigned char source[], int length); /* Australia Post 4-state */
|
||||
extern int code16k(struct zint_symbol *symbol, unsigned char source[],const size_t length); /* Code 16k */
|
||||
extern int pdf417enc(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* PDF417 */
|
||||
extern int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_t length); /* Micro PDF417 */
|
||||
extern int maxicode(struct zint_symbol *symbol, unsigned char source[], int length); /* Maxicode */
|
||||
extern int rss14(struct zint_symbol *symbol, unsigned char source[], int length); /* RSS-14 */
|
||||
extern int rsslimited(struct zint_symbol *symbol, unsigned char source[], int length); /* RSS Limited */
|
||||
extern int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int length); /* RSS Expanded */
|
||||
extern int composite(struct zint_symbol *symbol, unsigned char source[], int length); /* Composite Symbology */
|
||||
extern int kix_code(struct zint_symbol *symbol, unsigned char source[], int length); /* TNT KIX Code */
|
||||
extern int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Aztec Code */
|
||||
extern int code32(struct zint_symbol *symbol, unsigned char source[], int length); /* Italian Pharmacode */
|
||||
extern int daft_code(struct zint_symbol *symbol, unsigned char source[], int length); /* DAFT Code */
|
||||
extern int ean_14(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN-14 */
|
||||
extern int nve_18(struct zint_symbol *symbol, unsigned char source[], int length); /* NVE-18 */
|
||||
extern int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* Micro QR Code */
|
||||
extern int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length); /* Aztec Runes */
|
||||
extern int korea_post(struct zint_symbol *symbol, unsigned char source[], int length); /* Korea Post */
|
||||
extern int japan_post(struct zint_symbol *symbol, unsigned char source[], int length); /* Japanese Post */
|
||||
extern int code_49(struct zint_symbol *symbol, unsigned char source[], const int length); /* Code 49 */
|
||||
extern int channel_code(struct zint_symbol *symbol, unsigned char source[], int length); /* Channel Code */
|
||||
extern int code_one(struct zint_symbol *symbol, unsigned char source[], int length); /* Code One */
|
||||
extern int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* Grid Matrix */
|
||||
extern int han_xin(struct zint_symbol * symbol, const unsigned char source[], size_t length); /* Han Xin */
|
||||
extern int dotcode(struct zint_symbol * symbol, const unsigned char source[], int length); /* DotCode */
|
||||
extern int codablock(struct zint_symbol * symbol, const unsigned char source[], const size_t length); /* Codablock */
|
||||
extern int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* UPNQR */
|
||||
extern int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* QR Code */
|
||||
extern int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Data Matrix (IEC16022) */
|
||||
extern int vin(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* VIN Code (Vehicle Identification Number) */
|
||||
extern int mailmark(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Royal Mail 4-state Mailmark */
|
||||
extern int ultracode(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Ultracode */
|
||||
extern int rmqr(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* rMQR */
|
||||
INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN system barcodes */
|
||||
INTERNAL int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Code 3 from 9 (or Code 39) */
|
||||
INTERNAL int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length); /* Pharmazentral Nummer (PZN) */
|
||||
INTERNAL int ec39(struct zint_symbol *symbol, unsigned char source[], int length); /* Extended Code 3 from 9 (or Code 39+) */
|
||||
INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int length); /* Codabar - a simple substitution cipher */
|
||||
INTERNAL int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Standard (& Matrix) */
|
||||
INTERNAL int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Industrial */
|
||||
INTERNAL int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 IATA */
|
||||
INTERNAL int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* Code 2 of 5 Interleaved */
|
||||
INTERNAL int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Data Logic */
|
||||
INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int length); /* ITF-14 */
|
||||
INTERNAL int dpleit(struct zint_symbol *symbol, unsigned char source[], int length); /* Deutsche Post Leitcode */
|
||||
INTERNAL int dpident(struct zint_symbol *symbol, unsigned char source[], int length); /* Deutsche Post Identcode */
|
||||
INTERNAL int c93(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 93 - a re-working of Code 39+, generates 2 check digits */
|
||||
INTERNAL int code_128(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Code 128 and NVE-18 */
|
||||
INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* EAN-128 (GS1-128) */
|
||||
INTERNAL int code_11(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 11 */
|
||||
INTERNAL int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length); /* MSI Plessey */
|
||||
INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Telepen ASCII */
|
||||
INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Telepen Numeric */
|
||||
INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Plessey Code */
|
||||
INTERNAL int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length); /* Pharmacode One Track */
|
||||
INTERNAL int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length); /* Flattermarken */
|
||||
INTERNAL int fim(struct zint_symbol *symbol, unsigned char source[], int length); /* Facing Identification Mark */
|
||||
INTERNAL int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length); /* Pharmacode Two Track */
|
||||
INTERNAL int post_plot(struct zint_symbol *symbol, unsigned char source[], int length); /* Postnet */
|
||||
INTERNAL int planet_plot(struct zint_symbol *symbol, unsigned char source[], int length); /* PLANET */
|
||||
INTERNAL int imail(struct zint_symbol *symbol, unsigned char source[], int length); /* Intelligent Mail (aka USPS OneCode) */
|
||||
INTERNAL int royal_plot(struct zint_symbol *symbol, unsigned char source[], int length); /* RM4SCC */
|
||||
INTERNAL int australia_post(struct zint_symbol *symbol, unsigned char source[], int length); /* Australia Post 4-state */
|
||||
INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[],const size_t length); /* Code 16k */
|
||||
INTERNAL int pdf417enc(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* PDF417 */
|
||||
INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_t length); /* Micro PDF417 */
|
||||
INTERNAL int maxicode(struct zint_symbol *symbol, unsigned char source[], int length); /* Maxicode */
|
||||
INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int length); /* RSS-14 */
|
||||
INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int length); /* RSS Limited */
|
||||
INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int length); /* RSS Expanded */
|
||||
INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int length); /* Composite Symbology */
|
||||
INTERNAL int kix_code(struct zint_symbol *symbol, unsigned char source[], int length); /* TNT KIX Code */
|
||||
INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Aztec Code */
|
||||
INTERNAL int code32(struct zint_symbol *symbol, unsigned char source[], int length); /* Italian Pharmacode */
|
||||
INTERNAL int daft_code(struct zint_symbol *symbol, unsigned char source[], int length); /* DAFT Code */
|
||||
INTERNAL int ean_14(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN-14 */
|
||||
INTERNAL int nve_18(struct zint_symbol *symbol, unsigned char source[], int length); /* NVE-18 */
|
||||
INTERNAL int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* Micro QR Code */
|
||||
INTERNAL int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length); /* Aztec Runes */
|
||||
INTERNAL int korea_post(struct zint_symbol *symbol, unsigned char source[], int length); /* Korea Post */
|
||||
INTERNAL int japan_post(struct zint_symbol *symbol, unsigned char source[], int length); /* Japanese Post */
|
||||
INTERNAL int code_49(struct zint_symbol *symbol, unsigned char source[], const int length); /* Code 49 */
|
||||
INTERNAL int channel_code(struct zint_symbol *symbol, unsigned char source[], int length); /* Channel Code */
|
||||
INTERNAL int code_one(struct zint_symbol *symbol, unsigned char source[], int length); /* Code One */
|
||||
INTERNAL int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* Grid Matrix */
|
||||
INTERNAL int han_xin(struct zint_symbol * symbol, const unsigned char source[], size_t length); /* Han Xin */
|
||||
INTERNAL int dotcode(struct zint_symbol * symbol, const unsigned char source[], int length); /* DotCode */
|
||||
INTERNAL int codablock(struct zint_symbol * symbol, const unsigned char source[], const size_t length); /* Codablock */
|
||||
INTERNAL int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* UPNQR */
|
||||
INTERNAL int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* QR Code */
|
||||
INTERNAL int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Data Matrix (IEC16022) */
|
||||
INTERNAL int vin(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* VIN Code (Vehicle Identification Number) */
|
||||
INTERNAL int mailmark(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Royal Mail 4-state Mailmark */
|
||||
INTERNAL int ultracode(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Ultracode */
|
||||
INTERNAL int rmqr(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* rMQR */
|
||||
|
||||
extern int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG/BMP/PCX */
|
||||
extern int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to EPS/EMF/SVG */
|
||||
INTERNAL int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG/BMP/PCX */
|
||||
INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to EPS/EMF/SVG */
|
||||
|
||||
void error_tag(char error_string[], int error_number) {
|
||||
static void error_tag(char error_string[], int error_number) {
|
||||
|
||||
if (error_number != 0) {
|
||||
char error_buffer[100];
|
||||
@ -200,7 +200,7 @@ void error_tag(char error_string[], int error_number) {
|
||||
}
|
||||
|
||||
/* Output a hexadecimal representation of the rendered symbol */
|
||||
int dump_plot(struct zint_symbol *symbol) {
|
||||
static int dump_plot(struct zint_symbol *symbol) {
|
||||
FILE *f;
|
||||
int i, r;
|
||||
char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
@ -873,7 +873,7 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
|
||||
return error_number;
|
||||
}
|
||||
|
||||
void strip_bom(unsigned char *source, int *input_length) {
|
||||
static void strip_bom(unsigned char *source, int *input_length) {
|
||||
int i;
|
||||
|
||||
if (*input_length > 3) {
|
||||
@ -887,7 +887,7 @@ void strip_bom(unsigned char *source, int *input_length) {
|
||||
}
|
||||
}
|
||||
|
||||
int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string, int *length) {
|
||||
static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string, int *length) {
|
||||
int error_number;
|
||||
int in_posn, out_posn;
|
||||
int hex1, hex2;
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
/*
|
||||
* Developed in accordance with "Royal Mail Mailmark barcode C encoding and deconding instructions"
|
||||
@ -81,7 +82,7 @@ static const unsigned short extender_group_l[26] = {
|
||||
2, 5, 7, 8, 13, 14, 15, 16, 21, 22, 23, 0, 1, 3, 4, 6, 9, 10, 11, 12, 17, 18, 19, 20, 24, 25
|
||||
};
|
||||
|
||||
int verify_character(char input, char type) {
|
||||
static int verify_character(char input, char type) {
|
||||
int val = 0;
|
||||
|
||||
switch (type) {
|
||||
@ -106,7 +107,7 @@ int verify_character(char input, char type) {
|
||||
}
|
||||
}
|
||||
|
||||
int verify_postcode(char* postcode, int type) {
|
||||
static int verify_postcode(char* postcode, int type) {
|
||||
int i;
|
||||
char pattern[11];
|
||||
|
||||
@ -122,7 +123,7 @@ int verify_postcode(char* postcode, int type) {
|
||||
}
|
||||
|
||||
/* Royal Mail Mailmark */
|
||||
int mailmark(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) {
|
||||
INTERNAL int mailmark(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) {
|
||||
|
||||
char local_source[28];
|
||||
int format;
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
/* Includes corrections thanks to Monica Swanson @ Source Technologies */
|
||||
#include "common.h"
|
||||
@ -37,10 +38,10 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int maxi_codeword[144];
|
||||
static int maxi_codeword[144];
|
||||
|
||||
/* Handles error correction of primary message */
|
||||
void maxi_do_primary_check() {
|
||||
static void maxi_do_primary_check() {
|
||||
unsigned char data[15];
|
||||
unsigned char results[15];
|
||||
int j;
|
||||
@ -61,7 +62,7 @@ void maxi_do_primary_check() {
|
||||
}
|
||||
|
||||
/* Handles error correction of odd characters in secondary */
|
||||
void maxi_do_secondary_chk_odd(int ecclen) {
|
||||
static void maxi_do_secondary_chk_odd(int ecclen) {
|
||||
unsigned char data[100];
|
||||
unsigned char results[30];
|
||||
int j;
|
||||
@ -85,7 +86,7 @@ void maxi_do_secondary_chk_odd(int ecclen) {
|
||||
}
|
||||
|
||||
/* Handles error correction of even characters in secondary */
|
||||
void maxi_do_secondary_chk_even(int ecclen) {
|
||||
static void maxi_do_secondary_chk_even(int ecclen) {
|
||||
unsigned char data[100];
|
||||
unsigned char results[30];
|
||||
int j;
|
||||
@ -109,7 +110,7 @@ void maxi_do_secondary_chk_even(int ecclen) {
|
||||
}
|
||||
|
||||
/* Moves everything up so that a shift or latch can be inserted */
|
||||
void maxi_bump(int set[], int character[], int bump_posn) {
|
||||
static void maxi_bump(int set[], int character[], int bump_posn) {
|
||||
int i;
|
||||
|
||||
for (i = 143; i > bump_posn; i--) {
|
||||
@ -119,7 +120,7 @@ void maxi_bump(int set[], int character[], int bump_posn) {
|
||||
}
|
||||
|
||||
/* If the value is present in array, return the value, else return badvalue */
|
||||
int value_in_array(int val, int arr[], int badvalue, int arrLength){
|
||||
static int value_in_array(int val, int arr[], int badvalue, int arrLength) {
|
||||
int i;
|
||||
for(i = 0; i < arrLength; i++){
|
||||
if(arr[i] == val) return val;
|
||||
@ -128,7 +129,7 @@ int value_in_array(int val, int arr[], int badvalue, int arrLength){
|
||||
}
|
||||
|
||||
/* Choose the best set from previous and next set in the range of the setval array, if no value can be found we return setval[0] */
|
||||
int bestSurroundingSet(int index, int length, int set[], int setval[], int setLength) {
|
||||
static int bestSurroundingSet(int index, int length, int set[], int setval[], int setLength) {
|
||||
int badValue = -1;
|
||||
int option1 = value_in_array(set[index - 1], setval, badValue, setLength);
|
||||
if (index + 1 < length) {
|
||||
@ -146,7 +147,7 @@ int bestSurroundingSet(int index, int length, int set[], int setval[], int setLe
|
||||
}
|
||||
|
||||
/* Format text according to Appendix A */
|
||||
int maxi_text_process(int mode, unsigned char source[], int length, int eci) {
|
||||
static int maxi_text_process(int mode, unsigned char source[], int length, int eci) {
|
||||
/* This code doesn't make use of [Lock in C], [Lock in D]
|
||||
and [Lock in E] and so is not always the most efficient at
|
||||
compressing data, but should suffice for most applications */
|
||||
@ -533,7 +534,7 @@ int maxi_text_process(int mode, unsigned char source[], int length, int eci) {
|
||||
}
|
||||
|
||||
/* Format structured primary for Mode 2 */
|
||||
void maxi_do_primary_2(char postcode[], int country, int service) {
|
||||
static void maxi_do_primary_2(char postcode[], int country, int service) {
|
||||
size_t postcode_length;
|
||||
int postcode_num, i;
|
||||
|
||||
@ -559,7 +560,7 @@ void maxi_do_primary_2(char postcode[], int country, int service) {
|
||||
}
|
||||
|
||||
/* Format structured primary for Mode 3 */
|
||||
void maxi_do_primary_3(char postcode[], int country, int service) {
|
||||
static void maxi_do_primary_3(char postcode[], int country, int service) {
|
||||
int i, h;
|
||||
|
||||
h = strlen(postcode);
|
||||
@ -589,7 +590,7 @@ void maxi_do_primary_3(char postcode[], int country, int service) {
|
||||
maxi_codeword[9] = ((service & 0x3f0) >> 4);
|
||||
}
|
||||
|
||||
int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int length) {
|
||||
INTERNAL int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int length) {
|
||||
int i, j, block, bit, mode, lp = 0;
|
||||
int bit_pattern[7], internal_error = 0, eclen;
|
||||
char postcode[12], countrystr[4], servicestr[4];
|
||||
@ -734,5 +735,3 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int
|
||||
|
||||
return internal_error;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,13 +29,15 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
|
||||
extern int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length);
|
||||
INTERNAL int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length);
|
||||
|
||||
/* Codabar table checked against EN 798:1995 */
|
||||
|
||||
#define CALCIUM "0123456789-$:/.+ABCD"
|
||||
@ -46,7 +48,7 @@ static const char *CodaTable[20] = {
|
||||
"21212111", "11212121", "11221211", "12121121", "11121221", "11122211"
|
||||
};
|
||||
|
||||
int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* "Pharmacode can represent only a single integer from 3 to 131070. Unlike other
|
||||
commonly used one-dimensional barcode schemes, pharmacode does not store the data in a
|
||||
form corresponding to the human-readable digits; the number is encoded in binary, rather
|
||||
@ -106,7 +108,7 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
return error_number;
|
||||
}
|
||||
|
||||
int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
static int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
/* This code uses the Two Track Pharamacode defined in the document at
|
||||
http://www.laetus.com/laetus.php?request=file&id=69 and using a modified
|
||||
algorithm from the One Track system. This standard accepts integet values
|
||||
@ -151,7 +153,7 @@ int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], char des
|
||||
return error_number;
|
||||
}
|
||||
|
||||
int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* Draws the patterns for two track pharmacode */
|
||||
char height_pattern[200];
|
||||
unsigned int loopey, h;
|
||||
@ -192,7 +194,7 @@ int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* The Codabar system consisting of simple substitution */
|
||||
int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
int i, error_number;
|
||||
char dest[512];
|
||||
@ -232,7 +234,7 @@ int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Italian Pharmacode */
|
||||
int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int i, zeroes, error_number, checksum, checkpart, checkdigit;
|
||||
char localstr[10], risultante[7];
|
||||
long int pharmacode, devisor;
|
||||
@ -305,5 +307,3 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -44,7 +45,7 @@
|
||||
|
||||
#define SSET "0123456789ABCDEF"
|
||||
|
||||
int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
int row, column, i, colour;
|
||||
int run_count;
|
||||
@ -170,4 +171,3 @@ int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
/* This code is adapted from "Code barre PDF 417 / PDF 417 barcode" v2.5.0
|
||||
which is Copyright (C) 2004 (Grandzebu).
|
||||
@ -81,11 +82,11 @@ static const char MicroAutosize[56] = {
|
||||
1, 14, 2, 7, 3, 25, 8, 16, 5, 17, 9, 6, 10, 11, 28, 12, 19, 13, 29, 20, 30, 21, 22, 31, 23, 32, 33, 34
|
||||
};
|
||||
|
||||
int liste[2][1000]; /* global */
|
||||
static int liste[2][1000]; /* global */
|
||||
|
||||
/* 866 */
|
||||
|
||||
int quelmode(char codeascii) {
|
||||
static int quelmode(char codeascii) {
|
||||
int mode = BYT;
|
||||
if ((codeascii == '\t') || (codeascii == '\n') || (codeascii == '\r') || ((codeascii >= ' ') && (codeascii <= '~'))) {
|
||||
mode = TEX;
|
||||
@ -99,7 +100,7 @@ int quelmode(char codeascii) {
|
||||
}
|
||||
|
||||
/* 844 */
|
||||
void regroupe(int *indexliste) {
|
||||
static void regroupe(int *indexliste) {
|
||||
|
||||
/* bring together same type blocks */
|
||||
if (*(indexliste) > 1) {
|
||||
@ -127,7 +128,7 @@ void regroupe(int *indexliste) {
|
||||
}
|
||||
|
||||
/* 478 */
|
||||
void pdfsmooth(int *indexliste) {
|
||||
static void pdfsmooth(int *indexliste) {
|
||||
int i, crnt, last, next, length;
|
||||
|
||||
for (i = 0; i < *(indexliste); i++) {
|
||||
@ -223,7 +224,7 @@ void pdfsmooth(int *indexliste) {
|
||||
}
|
||||
|
||||
/* 547 */
|
||||
void textprocess(int *chainemc, int *mclength, char chaine[], int start, int length) {
|
||||
static void textprocess(int *chainemc, int *mclength, char chaine[], int start, int length) {
|
||||
int j, indexlistet, curtable, listet[2][5000], chainet[5000], wnet;
|
||||
|
||||
wnet = 0;
|
||||
@ -414,7 +415,7 @@ void textprocess(int *chainemc, int *mclength, char chaine[], int start, int len
|
||||
}
|
||||
|
||||
/* 671 */
|
||||
void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start, int length) {
|
||||
INTERNAL void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start, int length) {
|
||||
int debug = 0;
|
||||
|
||||
if (debug) printf("\nEntering byte mode at position %d\n", start);
|
||||
@ -482,7 +483,7 @@ void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start
|
||||
}
|
||||
|
||||
/* 712 */
|
||||
void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int length) {
|
||||
static void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int length) {
|
||||
int j, loop, dummy[100], diviseur, nombre;
|
||||
char chainemod[50], chainemult[100], temp;
|
||||
|
||||
@ -837,7 +838,7 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size
|
||||
}
|
||||
|
||||
/* 345 */
|
||||
int pdf417enc(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
INTERNAL int pdf417enc(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
int codeerr, error_number;
|
||||
|
||||
error_number = 0;
|
||||
@ -890,7 +891,7 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[], const size_t l
|
||||
}
|
||||
|
||||
/* like PDF417 only much smaller! */
|
||||
int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_t length) {
|
||||
INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_t length) {
|
||||
int i, k, j, indexchaine, indexliste, mode, longueur, mccorrection[50], offset;
|
||||
int total, chainemc[2700], mclength, dummy[5], codeerr;
|
||||
char pattern[580];
|
||||
@ -1313,5 +1314,3 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_
|
||||
|
||||
return codeerr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -49,7 +50,7 @@ static const char *MSITable[10] = {
|
||||
};
|
||||
|
||||
/* Not MSI/Plessey but the older Plessey standard */
|
||||
int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
|
||||
unsigned int i;
|
||||
unsigned char *checkptr;
|
||||
@ -111,7 +112,7 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t len
|
||||
}
|
||||
|
||||
/* Plain MSI Plessey - does not calculate any check character */
|
||||
int msi_plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
static int msi_plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
|
||||
|
||||
size_t i;
|
||||
char dest[512]; /* 2 + 55 * 8 + 3 + 1 ~ 512 */
|
||||
@ -138,7 +139,7 @@ int msi_plessey(struct zint_symbol *symbol, unsigned char source[], const size_t
|
||||
|
||||
/* MSI Plessey with Modulo 10 check digit - algorithm from Barcode Island
|
||||
* http://www.barcodeisland.com/ */
|
||||
int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
static int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
|
||||
unsigned long i, wright, dau, pedwar, pump, n;
|
||||
@ -205,7 +206,7 @@ int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int le
|
||||
|
||||
/* MSI Plessey with two Modulo 10 check digits - algorithm from
|
||||
* Barcode Island http://www.barcodeisland.com/ */
|
||||
int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len) {
|
||||
static int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len) {
|
||||
|
||||
|
||||
unsigned long i, n, wright, dau, pedwar, pump, chwech;
|
||||
@ -309,7 +310,7 @@ int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], cons
|
||||
|
||||
/* Calculate a Modulo 11 check digit using the system discussed on Wikipedia -
|
||||
see http://en.wikipedia.org/wiki/Talk:MSI_Barcode */
|
||||
int msi_plessey_mod11(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len) {
|
||||
static int msi_plessey_mod11(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len) {
|
||||
/* uses the IBM weight system */
|
||||
int i, weight, x, check;
|
||||
int error_number;
|
||||
@ -367,7 +368,7 @@ int msi_plessey_mod11(struct zint_symbol *symbol, unsigned char source[], const
|
||||
|
||||
/* Combining the Barcode Island and Wikipedia code
|
||||
* Verified against http://www.bokai.com/BarcodeJSP/applet/BarcodeSampleApplet.htm */
|
||||
int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len) {
|
||||
static int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len) {
|
||||
/* Weighted using the IBM system */
|
||||
unsigned long i, weight, x, check, wright, dau, pedwar, pump;
|
||||
size_t h;
|
||||
@ -462,7 +463,7 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons
|
||||
return error_number;
|
||||
}
|
||||
|
||||
int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int error_number;
|
||||
|
||||
error_number = is_sane(NEON, source, length);
|
||||
@ -491,4 +492,3 @@ int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef _MSC_VER
|
||||
@ -71,7 +72,7 @@ static void writepng_error_handler(png_structp png_ptr, png_const_charp msg) {
|
||||
longjmp(graphic->jmpbuf, 1);
|
||||
}
|
||||
|
||||
int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
INTERNAL int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
struct mainprog_info_type wpng_info;
|
||||
struct mainprog_info_type *graphic;
|
||||
png_structp png_ptr;
|
||||
@ -189,5 +190,3 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
return 0;
|
||||
}
|
||||
#endif /* NO_PNG */
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ static const char *JapanTable[19] = {
|
||||
};
|
||||
|
||||
/* Handles the PostNet system used for Zip codes in the US */
|
||||
int postnet(struct zint_symbol *symbol, unsigned char source[], char dest[], int length) {
|
||||
static int postnet(struct zint_symbol *symbol, unsigned char source[], char dest[], int length) {
|
||||
unsigned int i, sum, check_digit;
|
||||
int error_number;
|
||||
|
||||
@ -121,7 +121,7 @@ int postnet(struct zint_symbol *symbol, unsigned char source[], char dest[], int
|
||||
}
|
||||
|
||||
/* Puts PostNet barcodes into the pattern matrix */
|
||||
int post_plot(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int post_plot(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
char height_pattern[256]; /* 5 + 38 * 5 + 5 + 5 + 1 ~ 256 */
|
||||
unsigned int loopey, h;
|
||||
int writer;
|
||||
@ -152,7 +152,7 @@ int post_plot(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Handles the PLANET system used for item tracking in the US */
|
||||
int planet(struct zint_symbol *symbol, unsigned char source[], char dest[], int length) {
|
||||
static int planet(struct zint_symbol *symbol, unsigned char source[], char dest[], int length) {
|
||||
unsigned int i, sum, check_digit;
|
||||
int error_number;
|
||||
|
||||
@ -187,7 +187,7 @@ int planet(struct zint_symbol *symbol, unsigned char source[], char dest[], int
|
||||
}
|
||||
|
||||
/* Puts PLANET barcodes into the pattern matrix */
|
||||
int planet_plot(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int planet_plot(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
char height_pattern[256]; /* 5 + 38 * 5 + 5 + 5 + 1 ~ 256 */
|
||||
unsigned int loopey, h;
|
||||
int writer;
|
||||
@ -217,7 +217,7 @@ int planet_plot(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
|
||||
/* Korean Postal Authority */
|
||||
int korea_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int korea_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int total, loop, check, zeroes, error_number;
|
||||
char localstr[8], dest[80];
|
||||
|
||||
@ -257,7 +257,7 @@ int korea_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
/* The simplest barcode symbology ever! Supported by MS Word, so here it is!
|
||||
glyphs from http://en.wikipedia.org/wiki/Facing_Identification_Mark */
|
||||
int fim(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int fim(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
|
||||
char dest[16] = {0};
|
||||
@ -295,7 +295,7 @@ int fim(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Handles the 4 State barcodes used in the UK by Royal Mail */
|
||||
char rm4scc(char source[], unsigned char dest[], int length) {
|
||||
static char rm4scc(char source[], unsigned char dest[], int length) {
|
||||
unsigned int i;
|
||||
int top, bottom, row, column, check_digit;
|
||||
char values[3], set_copy[] = KRSET;
|
||||
@ -332,7 +332,7 @@ char rm4scc(char source[], unsigned char dest[], int length) {
|
||||
}
|
||||
|
||||
/* Puts RM4SCC into the data matrix */
|
||||
int royal_plot(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int royal_plot(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
char height_pattern[210];
|
||||
unsigned int loopey, h;
|
||||
int writer;
|
||||
@ -378,7 +378,7 @@ int royal_plot(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* Handles Dutch Post TNT KIX symbols
|
||||
The same as RM4SCC but without check digit
|
||||
Specification at http://www.tntpost.nl/zakelijk/klantenservice/downloads/kIX_code/download.aspx */
|
||||
int kix_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int kix_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
char height_pattern[75], localstr[20];
|
||||
unsigned int loopey;
|
||||
int writer, i, h;
|
||||
@ -428,7 +428,7 @@ int kix_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Handles DAFT Code symbols */
|
||||
int daft_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int daft_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
char height_pattern[100];
|
||||
unsigned int loopey, h;
|
||||
int writer, i, error_number;
|
||||
@ -485,7 +485,7 @@ int daft_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
}
|
||||
|
||||
/* Flattermarken - Not really a barcode symbology! */
|
||||
int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int loop, error_number;
|
||||
char dest[512]; /* 90 * 4 + 1 ~ */
|
||||
|
||||
@ -510,7 +510,7 @@ int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length
|
||||
}
|
||||
|
||||
/* Japanese Postal Code (Kasutama Barcode) */
|
||||
int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
INTERNAL int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
int error_number, h;
|
||||
char pattern[69];
|
||||
int writer, loopey, inter_posn, i, sum, check;
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <locale.h>
|
||||
#include <string.h>
|
||||
@ -37,7 +38,7 @@
|
||||
#include <math.h>
|
||||
#include "common.h"
|
||||
|
||||
int ps_plot(struct zint_symbol *symbol) {
|
||||
INTERNAL int ps_plot(struct zint_symbol *symbol) {
|
||||
FILE *feps;
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
float red_ink, green_ink, blue_ink, red_paper, green_paper, blue_paper;
|
||||
|
35
backend/qr.c
35
backend/qr.c
@ -39,10 +39,9 @@
|
||||
#include "sjis.h"
|
||||
#include "qr.h"
|
||||
#include "reedsol.h"
|
||||
#include <stdlib.h> /* abs */
|
||||
#include <assert.h>
|
||||
|
||||
extern int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
|
||||
INTERNAL int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
|
||||
|
||||
/* Returns true if input glyph is in the Alphanumeric set */
|
||||
static int is_alpha(const unsigned int glyph, const int gs1) {
|
||||
@ -140,7 +139,7 @@ static int in_alpha(const unsigned int jisdata[], const size_t length, const int
|
||||
#define QR_B 2 /* Byte */
|
||||
#define QR_K 3 /* Kanji */
|
||||
|
||||
static char mode_types[] = { 'N', 'A', 'B', 'K', }; /* Must be in same order as QR_N etc */
|
||||
static const char mode_types[] = { 'N', 'A', 'B', 'K', }; /* Must be in same order as QR_N etc */
|
||||
|
||||
#define QR_NUM_MODES 4
|
||||
|
||||
@ -159,7 +158,7 @@ static char mode_types[] = { 'N', 'A', 'B', 'K', }; /* Must be in same order as
|
||||
|
||||
/* Initial mode costs */
|
||||
static unsigned int* qr_head_costs(unsigned int state[]) {
|
||||
static int head_costs[7][QR_NUM_MODES] = {
|
||||
static const int head_costs[7][QR_NUM_MODES] = {
|
||||
/* N A B K */
|
||||
{ (10 + 4) * QR_MULT, (9 + 4) * QR_MULT, (8 + 4) * QR_MULT, (8 + 4) * QR_MULT, }, /* QR */
|
||||
{ (12 + 4) * QR_MULT, (11 + 4) * QR_MULT, (16 + 4) * QR_MULT, (10 + 4) * QR_MULT, },
|
||||
@ -260,7 +259,7 @@ static int mode_bits(const int version) {
|
||||
|
||||
/* Return character count indicator bits based on version and mode */
|
||||
static int cci_bits(const int version, const int mode) {
|
||||
static int cci_bits[7][QR_NUM_MODES] = {
|
||||
static const int cci_bits[7][QR_NUM_MODES] = {
|
||||
/* N A B K */
|
||||
{ 10, 9, 8, 8, }, /* QRCODE */
|
||||
{ 12, 11, 16, 10, },
|
||||
@ -1523,7 +1522,7 @@ static int getBinaryLength(const int version, char inputMode[], const unsigned i
|
||||
return count;
|
||||
}
|
||||
|
||||
int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
INTERNAL int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
int i, j, est_binlen;
|
||||
int ecc_level, autosize, version, max_cw, target_codewords, blocks, size;
|
||||
int bitmask, gs1;
|
||||
@ -1715,7 +1714,9 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
#endif
|
||||
|
||||
qr_binary(datastream, version, target_codewords, mode, jisdata, length, gs1, symbol->eci, est_binlen, symbol->debug);
|
||||
#ifdef ZINT_TEST
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, datastream, target_codewords);
|
||||
#endif
|
||||
add_ecc(fullstream, datastream, version, target_codewords, blocks, symbol->debug);
|
||||
|
||||
size = qr_sizes[version - 1];
|
||||
@ -1827,8 +1828,9 @@ static void micro_qr_m1(struct zint_symbol *symbol, char binary_data[]) {
|
||||
data_blocks[2] += 0x80 >> j;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ZINT_TEST
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords);
|
||||
#endif
|
||||
|
||||
/* Calculate Reed-Solomon error codewords */
|
||||
rs_init_gf(0x11d);
|
||||
@ -1907,8 +1909,9 @@ static void micro_qr_m2(struct zint_symbol *symbol, char binary_data[], const in
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ZINT_TEST
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords);
|
||||
#endif
|
||||
|
||||
/* Calculate Reed-Solomon error codewords */
|
||||
rs_init_gf(0x11d);
|
||||
@ -2021,8 +2024,9 @@ static void micro_qr_m3(struct zint_symbol *symbol, char binary_data[], const in
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ZINT_TEST
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords);
|
||||
#endif
|
||||
|
||||
/* Calculate Reed-Solomon error codewords */
|
||||
rs_init_gf(0x11d);
|
||||
@ -2110,8 +2114,9 @@ static void micro_qr_m4(struct zint_symbol *symbol, char binary_data[], const in
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ZINT_TEST
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords);
|
||||
#endif
|
||||
|
||||
/* Calculate Reed-Solomon error codewords */
|
||||
rs_init_gf(0x11d);
|
||||
@ -2328,7 +2333,7 @@ static int micro_apply_bitmask(unsigned char *grid,const int size) {
|
||||
return best_pattern;
|
||||
}
|
||||
|
||||
int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
INTERNAL int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
size_t i;
|
||||
int j, size;
|
||||
char full_stream[200];
|
||||
@ -2624,7 +2629,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
}
|
||||
|
||||
/* For UPNQR the symbol size and error correction capacity is fixed */
|
||||
int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
INTERNAL int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
int i, j, est_binlen;
|
||||
int ecc_level, version, target_codewords, blocks, size;
|
||||
int bitmask, error_number;
|
||||
@ -2695,7 +2700,9 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt
|
||||
#endif
|
||||
|
||||
qr_binary(datastream, version, target_codewords, mode, jisdata, length, 0, symbol->eci, est_binlen, symbol->debug);
|
||||
#ifdef ZINT_TEST
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, datastream, target_codewords);
|
||||
#endif
|
||||
add_ecc(fullstream, datastream, version, target_codewords, blocks, symbol->debug);
|
||||
|
||||
size = qr_sizes[version - 1];
|
||||
@ -2848,7 +2855,7 @@ static void setup_rmqr_grid(unsigned char* grid,const int h_size,const int v_siz
|
||||
}
|
||||
|
||||
/* rMQR according to 2018 draft standard */
|
||||
int rmqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
INTERNAL int rmqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
int i, j, est_binlen;
|
||||
int ecc_level, autosize, version, max_cw, target_codewords, blocks, h_size, v_size;
|
||||
int gs1;
|
||||
@ -3006,7 +3013,9 @@ int rmqr(struct zint_symbol *symbol, const unsigned char source[], size_t length
|
||||
#endif
|
||||
|
||||
qr_binary(datastream, RMQR_VERSION + version, target_codewords, mode, jisdata, length, gs1, 0 /*eci*/, est_binlen, symbol->debug);
|
||||
#ifdef ZINT_TEST
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, datastream, target_codewords);
|
||||
#endif
|
||||
add_ecc(fullstream, datastream, RMQR_VERSION + version, target_codewords, blocks, symbol->debug);
|
||||
|
||||
h_size = rmqr_width[version];
|
||||
|
@ -49,14 +49,14 @@
|
||||
#define SSET "0123456789ABCDEF"
|
||||
|
||||
#ifndef NO_PNG
|
||||
extern int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
INTERNAL int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
#endif /* NO_PNG */
|
||||
extern int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
extern int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
extern int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
extern int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
|
||||
void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
static void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
/* Place pixelbuffer into symbol */
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
int row, column, i;
|
||||
@ -90,7 +90,7 @@ void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
}
|
||||
}
|
||||
|
||||
int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int image_width, char *pixelbuf, int rotate_angle, int image_type) {
|
||||
static int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int image_width, char *pixelbuf, int rotate_angle, int image_type) {
|
||||
int error_number;
|
||||
int row, column;
|
||||
|
||||
@ -208,7 +208,7 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int
|
||||
return error_number;
|
||||
}
|
||||
|
||||
void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int image_width, int image_height) {
|
||||
static void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int image_width, int image_height) {
|
||||
/* Draw a rectangle */
|
||||
int i, j, png_ypos;
|
||||
|
||||
@ -223,7 +223,7 @@ void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int image_
|
||||
}
|
||||
}
|
||||
|
||||
void draw_circle(char *pixelbuf, int image_width, int image_height, int x0, int y0, float radius, char fill) {
|
||||
static void draw_circle(char *pixelbuf, int image_width, int image_height, int x0, int y0, float radius, char fill) {
|
||||
int x, y;
|
||||
int radius_i = (int) radius;
|
||||
|
||||
@ -239,7 +239,7 @@ void draw_circle(char *pixelbuf, int image_width, int image_height, int x0, int
|
||||
}
|
||||
}
|
||||
|
||||
void draw_bullseye(char *pixelbuf, int image_width, int image_height, int xoffset, int yoffset, int scaler) {
|
||||
static void draw_bullseye(char *pixelbuf, int image_width, int image_height, int xoffset, int yoffset, int scaler) {
|
||||
/* Central bullseye in Maxicode symbols */
|
||||
float x = 14.5 * scaler;
|
||||
float y = 15.0 * scaler;
|
||||
@ -256,7 +256,7 @@ void draw_bullseye(char *pixelbuf, int image_width, int image_height, int xoffse
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (0.602 * scaler) + 1, '0');
|
||||
}
|
||||
|
||||
void draw_hexagon(char *pixelbuf, int image_width, char *scaled_hexagon, int hexagon_size, int xposn, int yposn) {
|
||||
static void draw_hexagon(char *pixelbuf, int image_width, char *scaled_hexagon, int hexagon_size, int xposn, int yposn) {
|
||||
/* Put a hexagon into the pixel buffer */
|
||||
int i, j;
|
||||
|
||||
@ -269,7 +269,7 @@ void draw_hexagon(char *pixelbuf, int image_width, char *scaled_hexagon, int hex
|
||||
}
|
||||
}
|
||||
|
||||
void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int textflags, int image_width, int image_height) {
|
||||
static void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int textflags, int image_width, int image_height) {
|
||||
/* Put a letter into a position */
|
||||
int skip;
|
||||
|
||||
@ -387,7 +387,7 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
|
||||
}
|
||||
|
||||
/* Plot a string into the pixel buffer */
|
||||
void draw_string(char *pixbuf, char input_string[], int xposn, int yposn, int textflags, int image_width, int image_height) {
|
||||
static void draw_string(char *pixbuf, char input_string[], int xposn, int yposn, int textflags, int image_width, int image_height) {
|
||||
int i, string_length, string_left_hand, letter_width = 7;
|
||||
|
||||
switch (textflags) {
|
||||
@ -413,7 +413,7 @@ void draw_string(char *pixbuf, char input_string[], int xposn, int yposn, int te
|
||||
|
||||
}
|
||||
|
||||
void plot_hexline(char *scaled_hexagon, int hexagon_size, float start_x, float start_y, float end_x, float end_y) {
|
||||
static void plot_hexline(char *scaled_hexagon, int hexagon_size, float start_x, float start_y, float end_x, float end_y) {
|
||||
/* Draw a straight line from start to end */
|
||||
int i;
|
||||
float inc_x, inc_y;
|
||||
@ -430,7 +430,7 @@ void plot_hexline(char *scaled_hexagon, int hexagon_size, float start_x, float s
|
||||
}
|
||||
}
|
||||
|
||||
void plot_hexagon(char *scaled_hexagon, int hexagon_size) {
|
||||
static void plot_hexagon(char *scaled_hexagon, int hexagon_size) {
|
||||
/* Create a hexagon shape and fill it */
|
||||
int line, i;
|
||||
|
||||
@ -486,7 +486,7 @@ void plot_hexagon(char *scaled_hexagon, int hexagon_size) {
|
||||
}
|
||||
}
|
||||
|
||||
int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_type) {
|
||||
static int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_type) {
|
||||
/* Plot a MaxiCode symbol with hexagons and bullseye */
|
||||
int i, row, column, xposn;
|
||||
int image_height, image_width;
|
||||
@ -566,7 +566,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
|
||||
}
|
||||
|
||||
/* Convert UTF-8 to Latin1 Codepage for the interpretation line */
|
||||
void to_latin1(unsigned char source[], unsigned char preprocessed[]) {
|
||||
static void to_latin1(unsigned char source[], unsigned char preprocessed[]) {
|
||||
int j, i, input_length;
|
||||
|
||||
input_length = ustrlen(source);
|
||||
@ -604,7 +604,7 @@ void to_latin1(unsigned char source[], unsigned char preprocessed[]) {
|
||||
return;
|
||||
}
|
||||
|
||||
int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_type) {
|
||||
static int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_type) {
|
||||
float scaler = 2 * symbol->scale;
|
||||
char *scaled_pixelbuf;
|
||||
int r, i;
|
||||
@ -654,7 +654,7 @@ int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_typ
|
||||
return error_number;
|
||||
}
|
||||
|
||||
int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_type) {
|
||||
static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_type) {
|
||||
int textdone, main_width, comp_offset, large_bar_count;
|
||||
char textpart[10], addon[6];
|
||||
float addon_text_posn, preset_height, large_bar_height;
|
||||
@ -1118,7 +1118,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
||||
return error_number;
|
||||
}
|
||||
|
||||
int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type) {
|
||||
INTERNAL int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type) {
|
||||
int error;
|
||||
|
||||
#ifdef NO_PNG
|
||||
@ -1139,5 +1139,3 @@ int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type) {
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
// It is not written with high efficiency in mind, so is probably
|
||||
// not suitable for real-time encoding. The aim was to keep it
|
||||
@ -48,12 +49,10 @@
|
||||
// malloc/free can be avoided by using static arrays of a suitable
|
||||
// size.
|
||||
|
||||
#include <stdio.h> // only needed for debug (main)
|
||||
#ifdef _MSC_VER
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include "common.h"
|
||||
#include "reedsol.h"
|
||||
static int logmod; // 2**symsize - 1
|
||||
static int rlen;
|
||||
@ -70,7 +69,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(const int poly) {
|
||||
INTERNAL void rs_init_gf(const int poly) {
|
||||
int m, b, p, v;
|
||||
|
||||
// Find the top bit, and hence the symbol size
|
||||
@ -105,7 +104,7 @@ void rs_init_gf(const int poly) {
|
||||
// (x + 2**i)*(x + 2**(i+1))*... [nsym terms]
|
||||
// For ECC200, index is 1.
|
||||
|
||||
void rs_init_code(const int nsym, int index) {
|
||||
INTERNAL void rs_init_code(const int nsym, int index) {
|
||||
int i, k;
|
||||
|
||||
rspoly = (int *) malloc(sizeof (int) * (nsym + 1));
|
||||
@ -125,7 +124,7 @@ void rs_init_code(const int nsym, int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void rs_encode(const size_t len,const unsigned char *data, unsigned char *res) {
|
||||
INTERNAL void rs_encode(const size_t len,const unsigned char *data, unsigned char *res) {
|
||||
int i, k;
|
||||
for (i = 0; i < rlen; i++)
|
||||
res[i] = 0;
|
||||
@ -145,7 +144,7 @@ void rs_encode(const size_t len,const unsigned char *data, unsigned char *res) {
|
||||
}
|
||||
|
||||
/* The same as above but for larger bitlengths - Aztec code compatible */
|
||||
void rs_encode_long(const int len, const unsigned int *data, unsigned int *res) {
|
||||
INTERNAL void rs_encode_long(const int len, const unsigned int *data, unsigned int *res) {
|
||||
int i, k;
|
||||
for (i = 0; i < rlen; i++)
|
||||
res[i] = 0;
|
||||
@ -165,10 +164,9 @@ void rs_encode_long(const int len, const unsigned int *data, unsigned int *res)
|
||||
}
|
||||
|
||||
/* Free memory */
|
||||
void rs_free(void) {
|
||||
INTERNAL void rs_free(void) {
|
||||
free(logt);
|
||||
free(alog);
|
||||
free(rspoly);
|
||||
rspoly = NULL;
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#ifndef __REEDSOL_H
|
||||
#define __REEDSOL_H
|
||||
@ -37,15 +38,14 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern void rs_init_gf(const int poly);
|
||||
extern void rs_init_code(const int nsym,int index);
|
||||
extern void rs_encode(const size_t len,const unsigned char *data, unsigned char *res);
|
||||
extern void rs_encode_long(const int len,const unsigned int *data, unsigned int *res);
|
||||
extern void rs_free(void);
|
||||
INTERNAL void rs_init_gf(const int poly);
|
||||
INTERNAL void rs_init_code(const int nsym,int index);
|
||||
INTERNAL void rs_encode(const size_t len,const unsigned char *data, unsigned char *res);
|
||||
INTERNAL void rs_encode_long(const int len,const unsigned int *data, unsigned int *res);
|
||||
INTERNAL void rs_free(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __REEDSOL_H */
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
||||
* combins(n,r): returns the number of Combinations of r selected from n:
|
||||
* Combinations = n! / ((n - r)! * r!)
|
||||
**********************************************************************/
|
||||
int combins(int n, int r) {
|
||||
static int combins(int n, int r) {
|
||||
int i, j;
|
||||
int maxDenom, minDenom;
|
||||
int val;
|
||||
@ -120,7 +120,7 @@ int combins(int n, int r) {
|
||||
* Return:
|
||||
* static int widths[] = element widths
|
||||
**********************************************************************/
|
||||
void getRSSwidths(int val, int n, int elements, int maxWidth, int noNarrow) {
|
||||
static void getRSSwidths(int val, int n, int elements, int maxWidth, int noNarrow) {
|
||||
int bar;
|
||||
int elmWidth;
|
||||
int mxwElement;
|
||||
@ -161,7 +161,7 @@ void getRSSwidths(int val, int n, int elements, int maxWidth, int noNarrow) {
|
||||
}
|
||||
|
||||
/* GS1 DataBar-14 */
|
||||
int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
int error_number = 0, i, j, mask;
|
||||
short int accum[112], left_reg[112], right_reg[112], x_reg[112], y_reg[112];
|
||||
int data_character[4], data_group[4], v_odd[4], v_even[4];
|
||||
@ -732,7 +732,7 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
}
|
||||
|
||||
/* GS1 DataBar Limited */
|
||||
int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
int error_number = 0, i, mask;
|
||||
short int accum[112], left_reg[112], right_reg[112], x_reg[112], y_reg[112];
|
||||
int left_group, right_group, left_odd, left_even, right_odd, right_even;
|
||||
@ -1058,7 +1058,7 @@ int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
}
|
||||
|
||||
/* Handles all data encodation from section 7.2.5 of ISO/IEC 24724 */
|
||||
int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_string[]) {
|
||||
static int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_string[]) {
|
||||
int encoding_method, i, j, read_posn, last_digit, debug = symbol->debug, mode = NUMERIC;
|
||||
int symbol_characters, characters_per_row;
|
||||
#ifndef _MSC_VER
|
||||
@ -1510,7 +1510,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
}
|
||||
|
||||
/* GS1 DataBar Expanded */
|
||||
int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
int i, j, k, p, data_chars, vs[21], group[21], v_odd[21], v_even[21];
|
||||
char substring[21][14], latch;
|
||||
int char_widths[21][8], checksum, check_widths[8], c_group;
|
||||
@ -1957,5 +1957,3 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include "common.h"
|
||||
#include "sjis.h"
|
||||
|
||||
extern int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
|
||||
INTERNAL int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
|
||||
|
||||
/*
|
||||
* JISX0201.1976-0 (libiconv-1.16/lib/jisx0201.h)
|
||||
@ -1481,7 +1481,7 @@ static int jisx0208_wctomb(unsigned int* r, unsigned int wc) {
|
||||
*/
|
||||
|
||||
/* Returns 1 or 2 on success, 0 if no mapping */
|
||||
int sjis_wctomb_zint(unsigned int* r, unsigned int wc) {
|
||||
INTERNAL int sjis_wctomb_zint(unsigned int* r, unsigned int wc) {
|
||||
int ret;
|
||||
|
||||
/* Try JIS X 0201-1976. */
|
||||
@ -1512,7 +1512,7 @@ int sjis_wctomb_zint(unsigned int* r, unsigned int wc) {
|
||||
}
|
||||
|
||||
/* Convert UTF-8 string to Shift JIS and place in array of ints */
|
||||
int sjis_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* jisdata) {
|
||||
INTERNAL int sjis_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* jisdata) {
|
||||
int i, error_number;
|
||||
unsigned int length;
|
||||
#ifndef _MSC_VER
|
||||
@ -1537,7 +1537,7 @@ int sjis_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size
|
||||
}
|
||||
|
||||
/* Convert UTF-8 string to single byte ECI and place in array of ints */
|
||||
int sjis_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* jisdata) {
|
||||
INTERNAL int sjis_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* jisdata) {
|
||||
int error_number;
|
||||
#ifndef _MSC_VER
|
||||
unsigned char single_byte[*p_length + 1];
|
||||
@ -1557,7 +1557,7 @@ int sjis_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsig
|
||||
}
|
||||
|
||||
/* Copy byte input stream to array of ints, putting double-bytes that match QR Kanji mode in single entry */
|
||||
void sjis_cpy(const unsigned char source[], size_t* p_length, unsigned int* jisdata) {
|
||||
INTERNAL void sjis_cpy(const unsigned char source[], size_t* p_length, unsigned int* jisdata) {
|
||||
int i, j;
|
||||
unsigned int jis, length;
|
||||
unsigned char c;
|
||||
|
@ -37,10 +37,10 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int sjis_wctomb_zint(unsigned int* r, unsigned int wc);
|
||||
int sjis_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* jisdata);
|
||||
int sjis_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* jisdata);
|
||||
void sjis_cpy(const unsigned char source[], size_t* p_length, unsigned int* jisdata);
|
||||
INTERNAL int sjis_wctomb_zint(unsigned int* r, unsigned int wc);
|
||||
INTERNAL int sjis_utf8tomb(struct zint_symbol *symbol, const unsigned char source[], size_t* p_length, unsigned int* jisdata);
|
||||
INTERNAL int sjis_utf8tosb(int eci, const unsigned char source[], size_t* p_length, unsigned int* jisdata);
|
||||
INTERNAL void sjis_cpy(const unsigned char source[], size_t* p_length, unsigned int* jisdata);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
void make_html_friendly(unsigned char * string, char * html_version) {
|
||||
static void make_html_friendly(unsigned char * string, char * html_version) {
|
||||
/* Converts text to use HTML entity codes */
|
||||
|
||||
int i, html_pos;
|
||||
@ -86,7 +86,7 @@ void make_html_friendly(unsigned char * string, char * html_version) {
|
||||
}
|
||||
}
|
||||
|
||||
int svg_plot(struct zint_symbol *symbol) {
|
||||
INTERNAL int svg_plot(struct zint_symbol *symbol) {
|
||||
FILE *fsvg;
|
||||
int error_number = 0;
|
||||
const char *locale = NULL;
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#define SODIUM "0123456789X"
|
||||
|
||||
@ -56,7 +57,7 @@ static char *TeleTable[] = {
|
||||
"3113111113", "11311111111111", "331111111111", "111113111113", "31111111111111", "111311111113", "131111111113"
|
||||
};
|
||||
|
||||
int telepen(struct zint_symbol *symbol, unsigned char source[], const size_t src_len) {
|
||||
INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], const size_t src_len) {
|
||||
unsigned int i, count, check_digit;
|
||||
int error_number;
|
||||
char dest[512]; /*14 + 30 * 14 + 14 + 14 + 1 ~ 512 */
|
||||
@ -103,7 +104,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], const size_t src
|
||||
return error_number;
|
||||
}
|
||||
|
||||
int telepen_num(struct zint_symbol *symbol, unsigned char source[], const size_t src_len) {
|
||||
INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], const size_t src_len) {
|
||||
unsigned int count, check_digit, glyph;
|
||||
int error_number;
|
||||
size_t i,temp_length = src_len;
|
||||
@ -165,4 +166,3 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], const size_t
|
||||
ustrcpy(symbol->text, temp);
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/"
|
||||
|
||||
set(ZINT_DEBUG FALSE CACHE BOOL "Set debug compile flag")
|
||||
set(ZINT_SANITIZE FALSE CACHE BOOL "Set sanitize compile/link flags")
|
||||
set(ZINT_TEST FALSE CACHE BOOL "Set test compile flag")
|
||||
|
||||
find_package (LibZint 2.7.0 REQUIRED)
|
||||
find_package(PNG)
|
||||
@ -29,6 +30,9 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
add_compile_options("-fsanitize=address")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=address")
|
||||
endif (ZINT_SANITIZE)
|
||||
if (ZINT_TEST)
|
||||
add_definitions("-DZINT_TEST")
|
||||
endif (ZINT_TEST)
|
||||
endif ()
|
||||
|
||||
add_library(testcommon
|
||||
|
@ -1,15 +1,25 @@
|
||||
Zint backend test suite
|
||||
-----------------------
|
||||
|
||||
To make:
|
||||
To make, first make libzint with ZINT_TEST defined:
|
||||
|
||||
cd <project-dir>
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DZINT_TEST:BOOL:1 ..
|
||||
make
|
||||
|
||||
Then make the tests:
|
||||
|
||||
cd <project-dir>
|
||||
cd backend/tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake -DZINT_TEST:BOOL:1 ..
|
||||
make
|
||||
|
||||
(ZINT_TEST is needed to export INTERNAL functions for use and testing.)
|
||||
|
||||
To run all tests:
|
||||
|
||||
make test
|
||||
@ -50,4 +60,8 @@ To undo sanitize/debug, remake each after setting:
|
||||
cmake -DZINT_SANITIZE:BOOL=0 ..
|
||||
cmake -DZINT_DEBUG:BOOL=0 ..
|
||||
|
||||
Note that sanitize is not safe to use in production, as it's a security risk.
|
||||
To get a clean libzint, set the above and also:
|
||||
|
||||
cmake -DZINT_TEST:BOOL=0 ..
|
||||
|
||||
(The tests will now fail to link.)
|
||||
|
@ -37,9 +37,7 @@
|
||||
#define TESTCOMMON_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <zint.h>
|
||||
#include "../common.h"
|
||||
|
||||
extern int assertionFailed;
|
||||
|
@ -29,6 +29,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -42,15 +43,7 @@
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
int tbump_up(int input) {
|
||||
/* Strings length must be a multiple of 4 bytes */
|
||||
if ((input % 2) == 1) {
|
||||
input++;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
int i;
|
||||
int rows_per_strip, strip_count;
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
|
||||
int ultracode(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) {
|
||||
INTERNAL int ultracode(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) {
|
||||
|
||||
|
||||
strcpy(symbol->errtxt, "1000: Ultracode has not been implemented - yet!");
|
||||
|
@ -28,6 +28,7 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#define SODIUM "0123456789+"
|
||||
#define EAN2 102
|
||||
@ -80,7 +81,7 @@ static const char *EANsetB[10] = {
|
||||
};
|
||||
|
||||
/* Calculate the correct check digit for a UPC barcode */
|
||||
char upc_check(char source[]) {
|
||||
static char upc_check(char source[]) {
|
||||
unsigned int i, count, check_digit;
|
||||
|
||||
count = 0;
|
||||
@ -101,7 +102,7 @@ char upc_check(char source[]) {
|
||||
}
|
||||
|
||||
/* UPC A is usually used for 12 digit numbers, but this function takes a source of any length */
|
||||
void upca_draw(char source[], char dest[]) {
|
||||
static void upca_draw(char source[], char dest[]) {
|
||||
unsigned int i, half_way;
|
||||
|
||||
half_way = strlen(source) / 2;
|
||||
@ -124,7 +125,7 @@ void upca_draw(char source[], char dest[]) {
|
||||
}
|
||||
|
||||
/* Make a UPC A barcode when we haven't been given the check digit */
|
||||
int upca(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
static int upca(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
int length;
|
||||
char gtin[15];
|
||||
|
||||
@ -148,7 +149,7 @@ int upca(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
}
|
||||
|
||||
/* UPC E is a zero-compressed version of UPC A */
|
||||
int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
static int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
unsigned int i, num_system;
|
||||
char emode, equivalent[12], check_digit, parity[8], temp[9];
|
||||
char hrt[9];
|
||||
@ -302,7 +303,7 @@ int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
}
|
||||
|
||||
/* EAN-2 and EAN-5 add-on codes */
|
||||
void add_on(unsigned char source[], char dest[], int mode) {
|
||||
static void add_on(unsigned char source[], char dest[], int mode) {
|
||||
char parity[6];
|
||||
unsigned int i, code_type;
|
||||
|
||||
@ -362,7 +363,7 @@ void add_on(unsigned char source[], char dest[], int mode) {
|
||||
/* ************************ EAN-13 ****************** */
|
||||
|
||||
/* Calculate the correct check digit for a EAN-13 barcode */
|
||||
char ean_check(char source[]) {
|
||||
static char ean_check(char source[]) {
|
||||
int i;
|
||||
unsigned int h, count, check_digit;
|
||||
|
||||
@ -383,7 +384,7 @@ char ean_check(char source[]) {
|
||||
return itoc(check_digit);
|
||||
}
|
||||
|
||||
int ean13(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
static int ean13(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
unsigned int length, i, half_way;
|
||||
char parity[6];
|
||||
char gtin[15];
|
||||
@ -437,7 +438,7 @@ int ean13(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
}
|
||||
|
||||
/* Make an EAN-8 barcode when we haven't been given the check digit */
|
||||
int ean8(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
static int ean8(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
/* EAN-8 is basically the same as UPC-A but with fewer digits */
|
||||
int length;
|
||||
char gtin[10];
|
||||
@ -463,7 +464,7 @@ int ean8(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||
}
|
||||
|
||||
/* For ISBN(13) only */
|
||||
char isbn13_check(unsigned char source[]) {
|
||||
static char isbn13_check(unsigned char source[]) {
|
||||
unsigned int i, weight, sum, check, h;
|
||||
|
||||
sum = 0;
|
||||
@ -483,7 +484,7 @@ char isbn13_check(unsigned char source[]) {
|
||||
}
|
||||
|
||||
/* For ISBN(10) and SBN only */
|
||||
char isbn_check(unsigned char source[]) {
|
||||
static char isbn_check(unsigned char source[]) {
|
||||
unsigned int i, weight, sum, check, h;
|
||||
char check_char;
|
||||
|
||||
@ -564,7 +565,7 @@ static int isbn(struct zint_symbol *symbol, unsigned char source[], const size_t
|
||||
}
|
||||
|
||||
/* Add leading zeroes to EAN and UPC strings */
|
||||
void ean_leading_zeroes(struct zint_symbol *symbol, unsigned char source[], unsigned char local_source[]) {
|
||||
INTERNAL void ean_leading_zeroes(struct zint_symbol *symbol, unsigned char source[], unsigned char local_source[]) {
|
||||
unsigned char first_part[20], second_part[20], zfirst_part[20], zsecond_part[20];
|
||||
int with_addon = 0;
|
||||
int first_len = 0, second_len = 0, zfirst_len = 0, zsecond_len = 0, i, h;
|
||||
@ -693,7 +694,7 @@ void ean_leading_zeroes(struct zint_symbol *symbol, unsigned char source[], unsi
|
||||
}
|
||||
|
||||
/* splits string to parts before and after '+' parts */
|
||||
int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
unsigned char first_part[20] = {0}, second_part[20] = {0}, dest[1000] = {0};
|
||||
unsigned char local_source[20] = {0};
|
||||
unsigned int latch, reader, writer, with_addon;
|
||||
@ -912,4 +913,3 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -43,11 +43,11 @@
|
||||
|
||||
#define SSET "0123456789ABCDEF"
|
||||
|
||||
extern int ps_plot(struct zint_symbol *symbol);
|
||||
extern int svg_plot(struct zint_symbol *symbol);
|
||||
extern int emf_plot(struct zint_symbol *symbol);
|
||||
INTERNAL int ps_plot(struct zint_symbol *symbol);
|
||||
INTERNAL int svg_plot(struct zint_symbol *symbol);
|
||||
INTERNAL int emf_plot(struct zint_symbol *symbol);
|
||||
|
||||
struct zint_vector_rect *vector_plot_create_rect(float x, float y, float width, float height) {
|
||||
static struct zint_vector_rect *vector_plot_create_rect(float x, float y, float width, float height) {
|
||||
struct zint_vector_rect *rect;
|
||||
|
||||
rect = (struct zint_vector_rect*) malloc(sizeof (struct zint_vector_rect));
|
||||
@ -63,7 +63,7 @@ struct zint_vector_rect *vector_plot_create_rect(float x, float y, float width,
|
||||
return rect;
|
||||
}
|
||||
|
||||
int vector_plot_add_rect(struct zint_symbol *symbol, struct zint_vector_rect *rect, struct zint_vector_rect **last_rect) {
|
||||
static int vector_plot_add_rect(struct zint_symbol *symbol, struct zint_vector_rect *rect, struct zint_vector_rect **last_rect) {
|
||||
if (!rect) return ZINT_ERROR_MEMORY;
|
||||
if (*last_rect)
|
||||
(*last_rect)->next = rect;
|
||||
@ -74,7 +74,7 @@ int vector_plot_add_rect(struct zint_symbol *symbol, struct zint_vector_rect *re
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct zint_vector_hexagon *vector_plot_create_hexagon(float x, float y, float diameter) {
|
||||
static struct zint_vector_hexagon *vector_plot_create_hexagon(float x, float y, float diameter) {
|
||||
struct zint_vector_hexagon *hexagon;
|
||||
|
||||
hexagon = (struct zint_vector_hexagon*) malloc(sizeof (struct zint_vector_hexagon));
|
||||
@ -87,7 +87,7 @@ struct zint_vector_hexagon *vector_plot_create_hexagon(float x, float y, float d
|
||||
return hexagon;
|
||||
}
|
||||
|
||||
int vector_plot_add_hexagon(struct zint_symbol *symbol, struct zint_vector_hexagon *hexagon, struct zint_vector_hexagon **last_hexagon) {
|
||||
static int vector_plot_add_hexagon(struct zint_symbol *symbol, struct zint_vector_hexagon *hexagon, struct zint_vector_hexagon **last_hexagon) {
|
||||
if (!hexagon) return ZINT_ERROR_MEMORY;
|
||||
if (*last_hexagon)
|
||||
(*last_hexagon)->next = hexagon;
|
||||
@ -98,7 +98,7 @@ int vector_plot_add_hexagon(struct zint_symbol *symbol, struct zint_vector_hexag
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct zint_vector_circle *vector_plot_create_circle(float x, float y, float diameter, int colour) {
|
||||
static struct zint_vector_circle *vector_plot_create_circle(float x, float y, float diameter, int colour) {
|
||||
struct zint_vector_circle *circle;
|
||||
|
||||
circle = (struct zint_vector_circle *) malloc(sizeof (struct zint_vector_circle));
|
||||
@ -112,7 +112,7 @@ struct zint_vector_circle *vector_plot_create_circle(float x, float y, float dia
|
||||
return circle;
|
||||
}
|
||||
|
||||
int vector_plot_add_circle(struct zint_symbol *symbol, struct zint_vector_circle *circle, struct zint_vector_circle **last_circle) {
|
||||
static int vector_plot_add_circle(struct zint_symbol *symbol, struct zint_vector_circle *circle, struct zint_vector_circle **last_circle) {
|
||||
if (!circle) return ZINT_ERROR_MEMORY;
|
||||
if (*last_circle)
|
||||
(*last_circle)->next = circle;
|
||||
@ -123,7 +123,7 @@ int vector_plot_add_circle(struct zint_symbol *symbol, struct zint_vector_circle
|
||||
return 1;
|
||||
}
|
||||
|
||||
int vector_plot_add_string(struct zint_symbol *symbol,
|
||||
static int vector_plot_add_string(struct zint_symbol *symbol,
|
||||
unsigned char *text, float x, float y, float fsize, float width,
|
||||
struct zint_vector_string **last_string) {
|
||||
struct zint_vector_string *string;
|
||||
@ -147,7 +147,7 @@ int vector_plot_add_string(struct zint_symbol *symbol,
|
||||
return 1;
|
||||
}
|
||||
|
||||
void vector_free(struct zint_symbol *symbol) {
|
||||
INTERNAL void vector_free(struct zint_symbol *symbol) {
|
||||
if (symbol->vector != NULL) {
|
||||
struct zint_vector_rect *rect;
|
||||
struct zint_vector_hexagon *hex;
|
||||
@ -193,7 +193,7 @@ void vector_free(struct zint_symbol *symbol) {
|
||||
}
|
||||
}
|
||||
|
||||
void vector_scale(struct zint_symbol *symbol) {
|
||||
static void vector_scale(struct zint_symbol *symbol) {
|
||||
struct zint_vector_rect *rect;
|
||||
struct zint_vector_hexagon *hex;
|
||||
struct zint_vector_circle *circle;
|
||||
@ -239,7 +239,7 @@ void vector_scale(struct zint_symbol *symbol) {
|
||||
return;
|
||||
}
|
||||
|
||||
void vector_reduce_rectangles(struct zint_symbol *symbol) {
|
||||
static void vector_reduce_rectangles(struct zint_symbol *symbol) {
|
||||
// Looks for vertically aligned rectangles and merges them together
|
||||
struct zint_vector_rect *rect, *target, *prev;
|
||||
|
||||
@ -266,7 +266,7 @@ void vector_reduce_rectangles(struct zint_symbol *symbol) {
|
||||
return;
|
||||
}
|
||||
|
||||
int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type) {
|
||||
INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type) {
|
||||
int error_number;
|
||||
struct zint_vector *vector;
|
||||
struct zint_vector_rect *rectangle, *rect, *last_rectangle = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user