From a71fccce10744362a215e818c6275a0aa87162a6 Mon Sep 17 00:00:00 2001 From: guillem Date: Sun, 27 Mar 2016 12:42:19 +0000 Subject: [PATCH] Cleaner version of fixSymbol git-svn-id: svn://kolibrios.org@6383 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/aelia/tag.h | 51 +++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/programs/cmm/aelia/tag.h b/programs/cmm/aelia/tag.h index 7bcaa61da2..83114ba864 100644 --- a/programs/cmm/aelia/tag.h +++ b/programs/cmm/aelia/tag.h @@ -178,7 +178,6 @@ char *unicode_tags[]={ // function to be called to fix the special symbols void _text::fixSpecial(dword text) { - //dword text = start; byte ch; int i , j, z; dword aux; @@ -195,28 +194,30 @@ void _text::fixSpecial(dword text) { if (ch == ';') { z = get_symbol(#str); //debugval("z: ", z); - aux = unicode_tags[z]; - strtrim(aux); - debugln(aux); - ch = ESBYTE[aux]; - while (ch) { - ESBYTE[text2] = ch; - aux++; - text2++; - ch = ESBYTE[aux]; + if (z == -1) { // not found + ch = ' '; } - ch = ESBYTE[text2]; - //debugval("i: ", i); + else { // tag found + aux = unicode_tags[z]; + strtrim(aux); + debugln(aux); + ch = ESBYTE[aux]; + // copy the special symbol found + while (ch) { + ESBYTE[text2] = ch; + aux++; + text2++; + ch = ESBYTE[aux]; + } + ch = ESBYTE[text2]; + } + // clean the old symbol while (ch != ';') { - //debugval("j: ", j); - ESBYTE[text2] = ' '; + ESBYTE[text2] = ' ';// should be (char) 0; text2++; ch = ESBYTE[text2]; } - ESBYTE[text2] = ' '; - //for (j=0;j return 0 +// function to look for the conversion of special characters +// if not found--> return -1 int get_symbol(char *str2) { int i,j; //debugln(#str2); for (i=0; unicode_tags[i]!=0; i+=2) { if (strcmp(str2, unicode_tags[i]) == 0) { - //j = strlen(unicode_tags[i+1]); - //debugval("i: ", i); - //strcat(text2, unicode_tags[i+1]); - i++; - return i; + return (i+1); } } - return ' '; + return -1; }