eliminate potential trouble

dev
liuwei 2015-08-20 15:46:59 +08:00
parent d3e8cc1833
commit d1026167d4
1 changed files with 15 additions and 8 deletions

View File

@ -336,6 +336,14 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
*pLastEnd = '\0'; *pLastEnd = '\0';
} }
if (isAnnotation && pLine != pAnnoItemLine)
{
logWarning("file: "__FILE__", line: %d, " \
"the @function and annotation item " \
"must be next to each other", __LINE__);
isAnnotation = 0;
}
if (*pLine == '#' && \ if (*pLine == '#' && \
strncasecmp(pLine+1, "include", 7) == 0 && \ strncasecmp(pLine+1, "include", 7) == 0 && \
(*(pLine+8) == ' ' || *(pLine+8) == '\t')) (*(pLine+8) == ' ' || *(pLine+8) == '\t'))
@ -414,14 +422,6 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
continue; continue;
} }
if (isAnnotation && pLine != pAnnoItemLine)
{
logWarning("file: "__FILE__", line: %d, " \
"the @function and annotation item " \
"must be next to each other", __LINE__);
isAnnotation = 0;
}
trim(pLine); trim(pLine);
if (*pLine == '#' || *pLine == '\0') if (*pLine == '#' || *pLine == '\0')
{ {
@ -607,6 +607,13 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
pItem++; pItem++;
} }
if (!result && isAnnotation)
{
logWarning("file: "__FILE__", line: %d, " \
"the @function and annotation item " \
"must be next to each other", __LINE__);
}
return result; return result;
} }