A few more small changes to charmap.c.

This commit is contained in:
stag019
2014-10-31 19:01:21 -04:00
parent 004bc2e50e
commit af70f03933

View File

@@ -54,10 +54,14 @@ readUTF8Char(char *destination, char *source)
{ {
size = 2; size = 2;
} }
else else if(first != '\0')
{ {
size = 1; size = 1;
} }
else
{
size = 0;
}
strncpy(destination, source, size); strncpy(destination, source, size);
destination[size] = 0; destination[size] = 0;
return size; return size;
@@ -145,7 +149,7 @@ charmap_Convert(char **input)
struct Charmap *charmap; struct Charmap *charmap;
char outchar[CHARMAPLENGTH + 1]; char outchar[CHARMAPLENGTH + 1];
char *input_temp, *buffer; char *buffer;
int i, j, length; int i, j, length;
if(pCurrentSection && pCurrentSection -> charmap) if(pCurrentSection && pCurrentSection -> charmap)
@@ -157,7 +161,6 @@ charmap_Convert(char **input)
charmap = &globalCharmap; charmap = &globalCharmap;
} }
input_temp = *input;
if((buffer = (char *) malloc(strlen(*input))) == NULL) if((buffer = (char *) malloc(strlen(*input))) == NULL)
{ {
fatalerror("Not enough memory for buffer"); fatalerror("Not enough memory for buffer");
@@ -195,7 +198,6 @@ charmap_Convert(char **input)
} }
*input += j; *input += j;
} }
*input = input_temp;
*input = buffer; *input = buffer;
return length; return length;
} }