ref: 34656f9e5dcbeb5ca36dc812141ddd7a233da43d
parent: c61c11221859da2f7a7180d62cc1f9b4d8244a81
author: stag019 <[email protected]>
date: Fri Dec 27 19:35:05 EST 2013
Fix a bug where the first charmap entry wasn't added correctly.
--- a/src/asm/charmap.c
+++ b/src/asm/charmap.c
@@ -75,6 +75,11 @@
charmap = &globalCharmap;
}
+ if(nPass == 2)
+ {
+ return charmap -> count;
+ }
+
if(charmap -> count > MAXCHARMAPS || strlen(input) > CHARMAPLENGTH)
{
return -1;
@@ -84,7 +89,7 @@
if(input_length > 1)
{
i = 0;
- while(i < charmap -> count)
+ while(i < charmap -> count + 1)
{
if(input_length > strlen(charmap -> input[i]))
{
@@ -97,7 +102,7 @@
}
i++;
}
- while(i < charmap -> count)
+ while(i < charmap -> count + 1)
{
memcpy(temp2i, charmap -> input[i], CHARMAPLENGTH + 1);
memcpy(charmap -> input[i], temp1i, CHARMAPLENGTH + 1);
@@ -107,13 +112,13 @@
temp1o = temp2o;
i++;
}
- memcpy(charmap -> input[charmap -> count], temp1i, CHARMAPLENGTH + 1);
- charmap -> output[charmap -> count] = temp1o;
+ memcpy(charmap -> input[charmap -> count + 1], temp1i, CHARMAPLENGTH + 1);
+ charmap -> output[charmap -> count + 1] = temp1o;
}
else
{
- memcpy(charmap -> input[charmap -> count - 1], input, CHARMAPLENGTH + 1);
- charmap -> output[charmap -> count - 1] = output;
+ memcpy(charmap -> input[charmap -> count], input, CHARMAPLENGTH + 1);
+ charmap -> output[charmap -> count] = output;
}
return ++charmap -> count;
}