Review some warnings

This commit is contained in:
Ray 2022-08-02 21:17:19 +02:00
parent 50663f0890
commit 1a35f73d84

View file

@ -393,7 +393,7 @@ int main(int argc, char* argv[])
int defineNameEnd = j-1; int defineNameEnd = j-1;
// Skip duplicates // Skip duplicates
int nameLen = defineNameEnd - defineNameStart + 1; unsigned int nameLen = defineNameEnd - defineNameStart + 1;
bool isDuplicate = false; bool isDuplicate = false;
for (int k = 0; k < defineIndex; k++) for (int k = 0; k < defineIndex; k++)
{ {
@ -413,7 +413,7 @@ int main(int argc, char* argv[])
while ((linePtr[j] == ' ') || (linePtr[j] == '\t')) j++; // Skip spaces and tabs after name while ((linePtr[j] == ' ') || (linePtr[j] == '\t')) j++; // Skip spaces and tabs after name
int defineValueStart = j; int defineValueStart = j;
if ((linePtr[j] == '\0') || (linePtr == "/")) defines[defineIndex].type = GUARD; if ((linePtr[j] == '\0') || (linePtr[j] == '/')) defines[defineIndex].type = GUARD;
if (linePtr[j] == '"') defines[defineIndex].type = STRING; if (linePtr[j] == '"') defines[defineIndex].type = STRING;
else if (linePtr[j] == '\'') defines[defineIndex].type = CHAR; else if (linePtr[j] == '\'') defines[defineIndex].type = CHAR;
else if (IsTextEqual(linePtr+j, "CLITERAL(Color)", 15)) defines[defineIndex].type = COLOR; else if (IsTextEqual(linePtr+j, "CLITERAL(Color)", 15)) defines[defineIndex].type = COLOR;
@ -476,11 +476,11 @@ int main(int argc, char* argv[])
// Parse defines of type UNKNOWN to find calculated numbers // Parse defines of type UNKNOWN to find calculated numbers
if (defines[defineIndex].type == UNKNOWN) if (defines[defineIndex].type == UNKNOWN)
{ {
DefineType largestType = UNKNOWN; int largestType = UNKNOWN;
bool isMath = true; bool isMath = true;
char *valuePtr = defines[defineIndex].value; char *valuePtr = defines[defineIndex].value;
for (int c = 0; c < TextLength(valuePtr); c++) for (unsigned int c = 0; c < TextLength(valuePtr); c++)
{ {
char ch = valuePtr[c]; char ch = valuePtr[c];
@ -525,7 +525,7 @@ int main(int argc, char* argv[])
if (isNumber) if (isNumber)
{ {
// Found a valid number -> update largestType // Found a valid number -> update largestType
DefineType numberType; int numberType;
if (isFloat) numberType = valuePtr[c - 1] == 'f' ? FLOAT_MATH : DOUBLE_MATH; if (isFloat) numberType = valuePtr[c - 1] == 'f' ? FLOAT_MATH : DOUBLE_MATH;
else numberType = valuePtr[c - 1] == 'L' ? LONG_MATH : INT_MATH; else numberType = valuePtr[c - 1] == 'L' ? LONG_MATH : INT_MATH;
@ -537,9 +537,7 @@ int main(int argc, char* argv[])
break; break;
} }
} }
else // Read string operand
// Read string operand
else
{ {
int operandStart = c; int operandStart = c;
while (!((ch == '\0') || while (!((ch == '\0') ||
@ -646,15 +644,16 @@ int main(int argc, char* argv[])
// Split field names containing multiple fields (like Matrix) // Split field names containing multiple fields (like Matrix)
int additionalFields = 0; int additionalFields = 0;
int originalIndex = structs[i].fieldCount - 1; int originalIndex = structs[i].fieldCount - 1;
for (int c = 0; c < TextLength(structs[i].fieldName[originalIndex]); c++) for (unsigned int c = 0; c < TextLength(structs[i].fieldName[originalIndex]); c++)
{ {
if (structs[i].fieldName[originalIndex][c] == ',') additionalFields++; if (structs[i].fieldName[originalIndex][c] == ',') additionalFields++;
} }
if (additionalFields > 0) if (additionalFields > 0)
{ {
int originalLength = -1; int originalLength = -1;
int lastStart; int lastStart;
for (int c = 0; c < TextLength(structs[i].fieldName[originalIndex]) + 1; c++) for (unsigned int c = 0; c < TextLength(structs[i].fieldName[originalIndex]) + 1; c++)
{ {
char v = structs[i].fieldName[originalIndex][c]; char v = structs[i].fieldName[originalIndex][c];
bool isEndOfString = (v == '\0'); bool isEndOfString = (v == '\0');
@ -693,11 +692,13 @@ int main(int argc, char* argv[])
// Split field types containing multiple fields (like MemNode) // Split field types containing multiple fields (like MemNode)
additionalFields = 0; additionalFields = 0;
originalIndex = structs[i].fieldCount - 1; originalIndex = structs[i].fieldCount - 1;
for (int c = 0; c < TextLength(structs[i].fieldType[originalIndex]); c++) for (unsigned int c = 0; c < TextLength(structs[i].fieldType[originalIndex]); c++)
{ {
if (structs[i].fieldType[originalIndex][c] == ',') additionalFields++; if (structs[i].fieldType[originalIndex][c] == ',') additionalFields++;
} }
if (additionalFields > 0) {
if (additionalFields > 0)
{
// Copy original name to last additional field // Copy original name to last additional field
structs[i].fieldCount += additionalFields; structs[i].fieldCount += additionalFields;
MemoryCopy(structs[i].fieldName[originalIndex + additionalFields], &structs[i].fieldName[originalIndex][0], TextLength(structs[i].fieldName[originalIndex])); MemoryCopy(structs[i].fieldName[originalIndex + additionalFields], &structs[i].fieldName[originalIndex][0], TextLength(structs[i].fieldName[originalIndex]));
@ -901,7 +902,7 @@ int main(int argc, char* argv[])
char *linePtr = lines[callbackLines[i]]; char *linePtr = lines[callbackLines[i]];
// Skip "typedef " // Skip "typedef "
int c = 8; unsigned int c = 8;
// Return type // Return type
int retTypeStart = c; int retTypeStart = c;
@ -924,7 +925,7 @@ int main(int argc, char* argv[])
// Params // Params
int paramStart = c; int paramStart = c;
for (c; c < MAX_LINE_LENGTH; c++) for (; c < MAX_LINE_LENGTH; c++)
{ {
if ((linePtr[c] == ',') || (linePtr[c] == ')')) if ((linePtr[c] == ',') || (linePtr[c] == ')'))
{ {