Fix inline enum (#2393)
This commit is contained in:
parent
4954778f68
commit
3d812f8d0c
1 changed files with 10 additions and 10 deletions
|
@ -241,7 +241,7 @@ int main(int argc, char* argv[])
|
||||||
for (int i = 0; i < linesCount; i++)
|
for (int i = 0; i < linesCount; i++)
|
||||||
{
|
{
|
||||||
// Read enum line
|
// Read enum line
|
||||||
if (IsTextEqual(lines[i], "typedef enum {", 14))
|
if (IsTextEqual(lines[i], "typedef enum {", 14) && lines[i][TextLength(lines[i])-1] != ';') // ignore inline enums
|
||||||
{
|
{
|
||||||
// Keep the line position in the array of lines,
|
// Keep the line position in the array of lines,
|
||||||
// so, we can scan that position and following lines
|
// so, we can scan that position and following lines
|
||||||
|
@ -401,17 +401,17 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
if (linePtr[c + 1] == ' ') c += 2;
|
if (linePtr[c + 1] == ' ') c += 2;
|
||||||
else c++;
|
else c++;
|
||||||
|
|
||||||
// Parse integer value
|
// Parse integer value
|
||||||
int n = 0;
|
int n = 0;
|
||||||
char integer[16] = { 0 };
|
char integer[16] = { 0 };
|
||||||
|
|
||||||
while ((linePtr[c] != ',') && (linePtr[c] != ' ') && (linePtr[c] != '\0'))
|
while ((linePtr[c] != ',') && (linePtr[c] != ' ') && (linePtr[c] != '\0'))
|
||||||
{
|
{
|
||||||
integer[n] = linePtr[c];
|
integer[n] = linePtr[c];
|
||||||
c++; n++;
|
c++; n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (integer[1] == 'x') enums[i].valueInteger[enums[i].valueCount] = (int)strtol(integer, NULL, 16);
|
if (integer[1] == 'x') enums[i].valueInteger[enums[i].valueCount] = (int)strtol(integer, NULL, 16);
|
||||||
else enums[i].valueInteger[enums[i].valueCount] = atoi(integer);
|
else enums[i].valueInteger[enums[i].valueCount] = atoi(integer);
|
||||||
}
|
}
|
||||||
|
@ -869,22 +869,22 @@ static bool IsTextEqual(const char *text1, const char *text2, unsigned int count
|
||||||
static char *EscapeBackslashes(char *text)
|
static char *EscapeBackslashes(char *text)
|
||||||
{
|
{
|
||||||
static char buffer[256] = { 0 };
|
static char buffer[256] = { 0 };
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (int i = 0; (text[i] != '\0') && (i < 255); i++, count++)
|
for (int i = 0; (text[i] != '\0') && (i < 255); i++, count++)
|
||||||
{
|
{
|
||||||
buffer[count] = text[i];
|
buffer[count] = text[i];
|
||||||
|
|
||||||
if (text[i] == '\\')
|
if (text[i] == '\\')
|
||||||
{
|
{
|
||||||
buffer[count + 1] = '\\';
|
buffer[count + 1] = '\\';
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[count] = '\0';
|
buffer[count] = '\0';
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue