@@ -62,25 +62,25 @@ static int c25_common(struct zint_symbol *symbol, const unsigned char source[],
6262 char * d = dest ;
6363 unsigned char local_source [113 + 1 ]; /* Largest maximum 113 + optional check digit */
6464 const int have_checkdigit = symbol -> option_2 == 1 || symbol -> option_2 == 2 ;
65- const int raw_text = symbol -> output_options & BARCODE_RAW_TEXT ;
65+ const int content_segs = symbol -> output_options & BARCODE_CONTENT_SEGS ;
6666
6767 if (length > max ) {
6868 /* errtxt 301: 303: 305: 307: */
69- return ZEXT errtxtf (ZINT_ERROR_TOO_LONG , symbol , error_base , "Input length %1$d too long (maximum %2$d)" ,
70- length , max );
69+ return ZEXT z_errtxtf (ZINT_ERROR_TOO_LONG , symbol , error_base , "Input length %1$d too long (maximum %2$d)" ,
70+ length , max );
7171 }
72- if ((i = not_sane (NEON_F , source , length ))) {
72+ if ((i = z_not_sane (NEON_F , source , length ))) {
7373 /* Note: for all "at position" error messages, escape sequences not accounted for */
7474 /* errtxt 302: 304: 306: 308: */
75- return errtxtf (ZINT_ERROR_INVALID_DATA , symbol , error_base + 1 ,
75+ return z_errtxtf (ZINT_ERROR_INVALID_DATA , symbol , error_base + 1 ,
7676 "Invalid character at position %d in input (digits only)" , i );
7777 }
7878
7979 memcpy (local_source , source , length );
8080
8181 if (have_checkdigit ) {
8282 /* Add standard GS1 check digit */
83- local_source [length ] = gs1_check_digit (source , length );
83+ local_source [length ] = zint_gs1_check_digit (source , length );
8484 length ++ ;
8585 if (symbol -> debug & ZINT_DEBUG_PRINT ) printf ("Check digit: %c\n" , local_source [length - 1 ]);
8686 }
@@ -103,40 +103,40 @@ static int c25_common(struct zint_symbol *symbol, const unsigned char source[],
103103 memcpy (d , start_stop [1 ], start_length - 1 );
104104 d += start_length - 1 ;
105105
106- expand (symbol , dest , d - dest );
106+ z_expand (symbol , dest , d - dest );
107107
108- if ( symbol -> option_2 == 2 && ! raw_text ) {
109- /* Exclude check digit from HRT */
110- hrt_cpy_nochk ( symbol , local_source , length - 1 );
111- } else {
112- hrt_cpy_nochk ( symbol , local_source , length );
108+ /* Exclude check digit from HRT if hidden */
109+ z_hrt_cpy_nochk ( symbol , local_source , length - ( symbol -> option_2 == 2 ));
110+
111+ if ( content_segs && z_ct_cpy ( symbol , local_source , length )) {
112+ return ZINT_ERROR_MEMORY ; /* `z_ct_cpy()` only fails with OOM */
113113 }
114114
115115 return 0 ;
116116}
117117
118118/* Code 2 of 5 Standard (Code 2 of 5 Matrix) */
119- INTERNAL int c25standard (struct zint_symbol * symbol , unsigned char source [], int length ) {
119+ INTERNAL int zint_c25standard (struct zint_symbol * symbol , unsigned char source [], int length ) {
120120 /* 9 + (112 + 1) * 10 + 8 = 1147 */
121121 return c25_common (symbol , source , length , 112 , 1 /*is_matrix*/ , C25MatrixStartStop , 6 , 301 );
122122}
123123
124- /* Code 2 of 5 Industrial */
125- INTERNAL int c25ind (struct zint_symbol * symbol , unsigned char source [], int length ) {
126- /* 10 + (79 + 1) * 14 + 9 = 1139 */
127- return c25_common (symbol , source , length , 79 , 0 /*is_matrix*/ , C25IndustStartStop , 6 , 303 );
128- }
129-
130124/* Code 2 of 5 IATA */
131- INTERNAL int c25iata (struct zint_symbol * symbol , unsigned char source [], int length ) {
125+ INTERNAL int zint_c25iata (struct zint_symbol * symbol , unsigned char source [], int length ) {
132126 /* 4 + (80 + 1) * 14 + 5 = 1143 */
133127 return c25_common (symbol , source , length , 80 , 0 /*is_matrix*/ , C25IataLogicStartStop , 4 , 305 );
134128}
135129
136130/* Code 2 of 5 Data Logic */
137- INTERNAL int c25logic (struct zint_symbol * symbol , unsigned char source [], int length ) {
131+ INTERNAL int zint_c25logic (struct zint_symbol * symbol , unsigned char source [], int length ) {
138132 /* 4 + (113 + 1) * 10 + 5 = 1149 */
139133 return c25_common (symbol , source , length , 113 , 1 /*is_matrix*/ , C25IataLogicStartStop , 4 , 307 );
140134}
141135
136+ /* Code 2 of 5 Industrial */
137+ INTERNAL int zint_c25ind (struct zint_symbol * symbol , unsigned char source [], int length ) {
138+ /* 10 + (79 + 1) * 14 + 9 = 1139 */
139+ return c25_common (symbol , source , length , 79 , 0 /*is_matrix*/ , C25IndustStartStop , 6 , 303 );
140+ }
141+
142142/* vim: set ts=4 sw=4 et : */
0 commit comments