1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-01-22 11:26:03 +00:00

latin1_process function changed

This commit is contained in:
tgotic
2011-05-16 20:03:21 +02:00
parent 3407239b80
commit d550f18d90
7 changed files with 68 additions and 80 deletions

View File

@@ -283,40 +283,41 @@ float froundup(float input)
return output;
}
int latin1_process(struct zint_symbol *symbol, unsigned char source[], unsigned char preprocessed[], int *length)
int latin1_process(unsigned char source[], unsigned char preprocessed[], int *length)
{
int j, i, next;
/* Convert Unicode to Latin-1 for those symbologies which only support Latin-1 */
j = 0;
i = 0;
do {
next = -1;
if(source[i] < 128) {
preprocessed[j] = source[i];
j++;
next = i + 1;
} else {
if(source[i] == 0xC2) {
preprocessed[j] = source[i + 1];
if (length && *length) {
do {
next = -1;
if(source[i] < 128) {
preprocessed[j] = source[i];
j++;
next = i + 2;
next = i + 1;
} else {
if(source[i] == 0xC2) {
preprocessed[j] = source[i + 1];
j++;
next = i + 2;
}
if(source[i] == 0xC3) {
preprocessed[j] = source[i + 1] + 64;
j++;
next = i + 2;
}
}
if(source[i] == 0xC3) {
preprocessed[j] = source[i + 1] + 64;
j++;
next = i + 2;
if(next == -1) {
return ZERROR_INVALID_DATA;
}
}
if(next == -1) {
strcpy(symbol->errtxt, "error: Invalid character in input string (only Latin-1 characters supported)");
return ZERROR_INVALID_DATA;
}
i = next;
} while(i < *length);
preprocessed[j] = '\0';
*length = j;
i = next;
} while(i < *length);
preprocessed[j] = '\0';
*length = j;
}
return 0;
}