fix some bugs
This commit is contained in:
parent
439d21a2b4
commit
622ee76980
|
@ -143,7 +143,7 @@ Resource *LookupResource(char *Tag, char *Line)
|
|||
return Res;
|
||||
}
|
||||
|
||||
void ProcessAnnotation(Resource* Resources, size_t ResCount, char *Line, FILE *OutFile)
|
||||
void ProcessAnnotation(char *Line, FILE *OutFile)
|
||||
{
|
||||
SkipWhitespace(&Line);
|
||||
assert(*Line == '"');
|
||||
|
@ -188,10 +188,11 @@ void ProcessAnnotation(Resource* Resources, size_t ResCount, char *Line, FILE *O
|
|||
|
||||
for(LinePtr = Line; *LinePtr; ++LinePtr)
|
||||
{
|
||||
int ScanBytes;
|
||||
int ScanBytes = 0;
|
||||
int TmpQuoteID;
|
||||
|
||||
// convert Resource -> ref
|
||||
if(LinePtr[0] == ' ' && LinePtr[1] == '[' && sscanf(LinePtr+1, "[see Resources, %255[^]]]%n", RefBuf, &ScanBytes) == 1)
|
||||
if(LinePtr[0] == ' ' && LinePtr[1] == '[' && sscanf(LinePtr+1, "[see Resources, %255[^]]]%n", RefBuf, &ScanBytes) == 1 && ScanBytes)
|
||||
{
|
||||
//printf("Find Resource [%s]\n", RefBuf);
|
||||
Resource *Res = LookupResource(RefBuf, Line);
|
||||
|
@ -215,14 +216,14 @@ void ProcessAnnotation(Resource* Resources, size_t ResCount, char *Line, FILE *O
|
|||
}
|
||||
|
||||
// convert quotes
|
||||
else if(LinePtr[0] == ' ' && LinePtr[1] == '(' && sscanf(LinePtr+1, "(!quote %d)%n", &QuoteID, &ScanBytes) == 1)
|
||||
else if(LinePtr[0] == ' ' && LinePtr[1] == '(' && sscanf(LinePtr+1, "(!quote %d)%n", &TmpQuoteID, &ScanBytes) == 1 && ScanBytes)
|
||||
{
|
||||
QuoteID = TmpQuoteID;
|
||||
fprintf(OutFile, "%.*s", (int)(LinePtr - RunStart), RunStart);
|
||||
LinePtr += ScanBytes;
|
||||
RunStart = LinePtr+1;
|
||||
}
|
||||
|
||||
|
||||
// Used for getting name for Q:'s
|
||||
else if(*LinePtr == ' ')
|
||||
{
|
||||
|
@ -388,7 +389,7 @@ int ProcessFile(char *InFileName, FILE *InFile, FILE *OutFile)
|
|||
if(strncmp(LinePtr, "---", 3) == 0){
|
||||
goto Done;
|
||||
} else {
|
||||
ProcessAnnotation(Resources, ResCount, LinePtr, OutFile);
|
||||
ProcessAnnotation(LinePtr, OutFile);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
@ -467,7 +468,7 @@ OpenOutput:;
|
|||
OutFile = fdopen(OutFileDesc, "w");
|
||||
if(!OutFile)
|
||||
{
|
||||
fprintf(stderr, "Error opening %s: %s\n", Args[i], strerror(errno));
|
||||
fprintf(stderr, "Error opening %s: %s\n", OutNameBuf, strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue