mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-09-26 21:15:53 +08:00
[utils]: Update iniparser
Change-Id: Id29dc65a732aa62f4614f1d602545c04e7de054b Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -493,6 +493,28 @@ int iniparser_getint(const dictionary * d, const char * key, int notfound)
|
|||||||
return (int)iniparser_getlongint(d, key, notfound);
|
return (int)iniparser_getlongint(d, key, notfound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
@brief Get the string associated to a key, convert to a double
|
||||||
|
@param d Dictionary to search
|
||||||
|
@param key Key string to look for
|
||||||
|
@param notfound Value to return in case of error
|
||||||
|
@return double
|
||||||
|
|
||||||
|
This function queries a dictionary for a key. A key as read from an
|
||||||
|
ini file is given as "section:key". If the key cannot be found,
|
||||||
|
the notfound value is returned.
|
||||||
|
*/
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
double iniparser_getdouble(const dictionary * d, const char * key, double notfound)
|
||||||
|
{
|
||||||
|
const char * str ;
|
||||||
|
|
||||||
|
str = iniparser_getstring(d, key, INI_INVALID_KEY);
|
||||||
|
if (str == INI_INVALID_KEY) return notfound ;
|
||||||
|
return atof(str);
|
||||||
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@brief Get the string associated to a key, convert to a boolean
|
@brief Get the string associated to a key, convert to a boolean
|
||||||
@@ -696,7 +718,7 @@ dictionary * iniparser_load(const char * ininame)
|
|||||||
char line [ASCIILINESZ + 1] ;
|
char line [ASCIILINESZ + 1] ;
|
||||||
char section [ASCIILINESZ + 1] ;
|
char section [ASCIILINESZ + 1] ;
|
||||||
char key [ASCIILINESZ + 1] ;
|
char key [ASCIILINESZ + 1] ;
|
||||||
char tmp [(ASCIILINESZ * 2) + 1] ;
|
char tmp [(ASCIILINESZ * 2) + 2] ;
|
||||||
char val [ASCIILINESZ + 1] ;
|
char val [ASCIILINESZ + 1] ;
|
||||||
|
|
||||||
int last = 0 ;
|
int last = 0 ;
|
||||||
|
@@ -230,6 +230,21 @@ int iniparser_getint(const dictionary * d, const char * key, int notfound);
|
|||||||
long int iniparser_getlongint(const dictionary * d, const char * key, long int notfound);
|
long int iniparser_getlongint(const dictionary * d, const char * key, long int notfound);
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
@brief Get the string associated to a key, convert to a double
|
||||||
|
@param d Dictionary to search
|
||||||
|
@param key Key string to look for
|
||||||
|
@param notfound Value to return in case of error
|
||||||
|
@return double
|
||||||
|
|
||||||
|
This function queries a dictionary for a key. A key as read from an
|
||||||
|
ini file is given as "section:key". If the key cannot be found,
|
||||||
|
the notfound value is returned.
|
||||||
|
*/
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
double iniparser_getdouble(const dictionary * d, const char * key, double notfound);
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@brief Get the string associated to a key, convert to a boolean
|
@brief Get the string associated to a key, convert to a boolean
|
||||||
|
Reference in New Issue
Block a user