mirror of
https://github.com/sfall-team/sslc.git
synced 2026-07-27 16:52:49 -07:00
Fixed compilation error in VS2010
* In C89, variables must be declared at the beginning of a block.
This commit is contained in:
+9
-8
@@ -1135,10 +1135,11 @@ static void FreeNamelistData(int* refs, int* offsets, int* transforms) {
|
||||
}
|
||||
|
||||
static void RemoveFromNamelist(char* namelist, int i, int entries, int* offsets, int* transforms, char** endptr, char* logFormat) {
|
||||
int j;
|
||||
char* namestart;
|
||||
int j, len;
|
||||
parseMessageAtNode(0, logFormat, namelist + offsets[i]);
|
||||
char* namestart = namelist + offsets[i] - 2;
|
||||
int len = *(unsigned short*)namestart + 2;
|
||||
namestart = namelist + offsets[i] - 2;
|
||||
len = *(unsigned short*)namestart + 2;
|
||||
memmove(namestart, len + namestart, *endptr - (len + namestart));
|
||||
(*(unsigned int*)namelist) -= len;
|
||||
*endptr -= len;
|
||||
@@ -1170,7 +1171,7 @@ static void ShiftName(int* name, int entries, int* transforms, int* offsets) {
|
||||
|
||||
static void CompressNamelist(Program *prog) {
|
||||
char* endptr, *namestart;
|
||||
int entries = 0, *refs, *offsets, *transforms, i, j;
|
||||
int entries = 0, *refs, *offsets, *transforms, i, j, len;
|
||||
|
||||
GetNamelistData(prog->namelist, &entries, &endptr, &refs, &offsets, &transforms);
|
||||
|
||||
@@ -1188,9 +1189,9 @@ static void CompressNamelist(Program *prog) {
|
||||
for (i = entries - 1; i >= 0; i--) {
|
||||
if (!refs[i]) {
|
||||
RemoveFromNamelist(prog->namelist, i, entries, offsets, transforms, &endptr, "Removing unused string '%s' from program namespace");
|
||||
} else if (refs[i] == 2 && optimize>=3) {
|
||||
} else if (refs[i] == 2 && optimize >= 3) {
|
||||
namestart = prog->namelist + offsets[i] - 2;
|
||||
int len = *(unsigned short*)namestart + 2;
|
||||
len = *(unsigned short*)namestart + 2;
|
||||
if (len > 4) {
|
||||
parseMessageAtNode(0, "Shortening non-visible string '%s' in program namespace", prog->namelist + offsets[i]);
|
||||
*(unsigned short*)(namestart) = 2;
|
||||
@@ -1239,13 +1240,13 @@ static void ShiftVariableDefaultValue(Variable* var, int entries, int* transform
|
||||
}
|
||||
|
||||
static void CompressStringspace(Program *prog) {
|
||||
if (!prog->stringspace) return;
|
||||
|
||||
char* endptr;
|
||||
int entries = 0, *refs, *offsets, *transforms, i, k, *stringData;
|
||||
Procedure* proc;
|
||||
Node* node;
|
||||
|
||||
if (!prog->stringspace) return;
|
||||
|
||||
GetNamelistData(prog->stringspace, &entries, &endptr, &refs, &offsets, &transforms);
|
||||
|
||||
//Then check all procedures nodes and variable default values to see where in the stringspace they point
|
||||
|
||||
@@ -973,11 +973,12 @@ void emitNode(Procedure *p, NodeList *n, LexData *data) {
|
||||
else referenceVariable(¤tProgram->variables, v);
|
||||
}
|
||||
else {
|
||||
Procedure *proc;
|
||||
type |= P_PROCEDURE;
|
||||
referenceProcedure(¤tProgram->procedures, v);
|
||||
if (data->type == T_STRING) {
|
||||
type |= P_STRINGIFY;
|
||||
Procedure *proc = ¤tProgram->procedures.procedures[v];
|
||||
proc = ¤tProgram->procedures.procedures[v];
|
||||
// Add stringified procedure name (because program has separate namelist of string constants)
|
||||
if (!proc->stringifiedName) {
|
||||
proc->stringifiedName = addString(¤tProgram->stringspace, data->stringData);
|
||||
|
||||
Reference in New Issue
Block a user