ini_file_reader support annotation function
parent
757ae81e35
commit
de1be00ccb
3
HISTORY
3
HISTORY
|
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
Version 1.21 2015-08-25
|
||||||
|
* ini_file_reader support annotation function
|
||||||
|
|
||||||
Version 1.20 2015-08-06
|
Version 1.20 2015-08-06
|
||||||
* add GEO function get_line_distance_km
|
* add GEO function get_line_distance_km
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
%define LibFastcommonDevel libfastcommon-devel
|
%define LibFastcommonDevel libfastcommon-devel
|
||||||
|
|
||||||
Name: libfastcommon
|
Name: libfastcommon
|
||||||
Version: 1.0.20
|
Version: 1.0.21
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: c common functions library extracted from my open source projects FastDFS
|
Summary: c common functions library extracted from my open source projects FastDFS
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
|
||||||
|
|
@ -323,6 +323,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
|
||||||
result = 0;
|
result = 0;
|
||||||
pAnnoItemLine = NULL;
|
pAnnoItemLine = NULL;
|
||||||
isAnnotation = 0;
|
isAnnotation = 0;
|
||||||
|
*pFuncName = '\0';
|
||||||
pLastEnd = content - 1;
|
pLastEnd = content - 1;
|
||||||
pSection = pContext->current_section;
|
pSection = pContext->current_section;
|
||||||
pItem = pSection->items + pSection->count;
|
pItem = pSection->items + pSection->count;
|
||||||
|
|
@ -339,8 +340,8 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
|
||||||
if (isAnnotation && pLine != pAnnoItemLine)
|
if (isAnnotation && pLine != pAnnoItemLine)
|
||||||
{
|
{
|
||||||
logWarning("file: "__FILE__", line: %d, " \
|
logWarning("file: "__FILE__", line: %d, " \
|
||||||
"the @function and annotation item " \
|
"the @function annotation line " \
|
||||||
"must be next to each other", __LINE__);
|
"must follow by key=value line!", __LINE__);
|
||||||
isAnnotation = 0;
|
isAnnotation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -417,8 +418,17 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
|
||||||
memcpy(pFuncName, pLine + 11, nNameLen);
|
memcpy(pFuncName, pLine + 11, nNameLen);
|
||||||
pFuncName[nNameLen] = '\0';
|
pFuncName[nNameLen] = '\0';
|
||||||
trim(pFuncName);
|
trim(pFuncName);
|
||||||
|
if ((int)strlen(pFuncName) > 0)
|
||||||
|
{
|
||||||
isAnnotation = 1;
|
isAnnotation = 1;
|
||||||
pAnnoItemLine = pLastEnd + 1;
|
pAnnoItemLine = pLastEnd + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logWarning("file: "__FILE__", line: %d, " \
|
||||||
|
"the function name of annotation line is empty", \
|
||||||
|
__LINE__);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -541,7 +551,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
|
||||||
pAnnoMap = g_annotataionMap;
|
pAnnoMap = g_annotataionMap;
|
||||||
while (pAnnoMap->func_name)
|
while (pAnnoMap->func_name)
|
||||||
{
|
{
|
||||||
if (strcasecmp(pFuncName, pAnnoMap->func_name) == 0)
|
if (strcmp(pFuncName, pAnnoMap->func_name) == 0)
|
||||||
{
|
{
|
||||||
if (pAnnoMap->func_init)
|
if (pAnnoMap->func_init)
|
||||||
{
|
{
|
||||||
|
|
@ -560,9 +570,9 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
|
||||||
if (nItemCnt == -1)
|
if (nItemCnt == -1)
|
||||||
{
|
{
|
||||||
logWarning("file: "__FILE__", line: %d, " \
|
logWarning("file: "__FILE__", line: %d, " \
|
||||||
"not found corresponding annotation func (%s)" \
|
"not found corresponding annotation function: %s, " \
|
||||||
" and (%s) will use the item value (%s).", __LINE__,
|
"\"%s\" will use the item value \"%s\"", __LINE__,
|
||||||
pItem->name, pFuncName, pItem->value);
|
pFuncName, pItem->name, pItem->value);
|
||||||
pSection->count++;
|
pSection->count++;
|
||||||
pItem++;
|
pItem++;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -570,16 +580,16 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
|
||||||
else if (nItemCnt == 0)
|
else if (nItemCnt == 0)
|
||||||
{
|
{
|
||||||
logWarning("file: "__FILE__", line: %d, " \
|
logWarning("file: "__FILE__", line: %d, " \
|
||||||
"annotation func(%s) execute failed and"
|
"annotation function %s execute fail, " \
|
||||||
"(%s) will use the item value (%s)", __LINE__,
|
"\"%s\" will use the item value \"%s\"", __LINE__,
|
||||||
pItem->name, pFuncName, pItem->value);
|
pFuncName, pItem->name, pItem->value);
|
||||||
pSection->count++;
|
pSection->count++;
|
||||||
pItem++;
|
pItem++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pItemName = pItem->name;
|
pItemName = pItem->name;
|
||||||
nNameLen = strlen(pItemName) + 1;
|
nNameLen = strlen(pItemName);
|
||||||
for (i = 0; i < nItemCnt; i++)
|
for (i = 0; i < nItemCnt; i++)
|
||||||
{
|
{
|
||||||
nValueLen = strlen(pItemValues[i]);
|
nValueLen = strlen(pItemValues[i]);
|
||||||
|
|
@ -603,15 +613,16 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pSection->count++;
|
pSection->count++;
|
||||||
pItem++;
|
pItem++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result && isAnnotation)
|
if (result == 0 && isAnnotation)
|
||||||
{
|
{
|
||||||
logWarning("file: "__FILE__", line: %d, " \
|
logWarning("file: "__FILE__", line: %d, " \
|
||||||
"the @function and annotation item " \
|
"the @function annotation line " \
|
||||||
"must be next to each other", __LINE__);
|
"must follow by key=value line!", __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue