cmPrefs.c/h Added use of kMaxVarPrId

This commit is contained in:
kpl 2012-11-01 23:21:17 -07:00
parent 67f462a501
commit fc08764718
2 changed files with 14 additions and 1 deletions

View File

@ -305,6 +305,8 @@ cmPrRC_t cmPrefsInitialize( cmPrH_t* hp, const cmChar_t* fn, cmPrefsOnChangeFunc
p->fn = cmLHeapAllocZ( p->lhH, strlen(fn)+1 );
strcpy(p->fn,fn);
p->id = kMaxVarPrId;
hp->h = p;
errLabel:
@ -1170,6 +1172,10 @@ cmPrRC_t _cmPrefsCreateJsonNode(
assert( pathCnt >= 1 );
if( id != cmInvalidId && id >= kMaxVarPrId )
return cmErrMsg(&p->err,kNodeCreateFailPrRC,"User supplied id's must be less than 0x%x.",kMaxVarPrId);
// for each path element
for(i=0; i<pathCnt; ++i)
{

View File

@ -24,6 +24,12 @@ extern "C" {
kDuplicateIdPrRC
};
enum
{
kMaxVarPrId = 0x7fffffff // User assigned variable id's given to cmPrefsCreateXXX()
// must be less than kMaxVarPrId
};
typedef void (*cmPrefsOnChangeFunc_t)( cmPrH_t h, void* cbDataPtr, unsigned id );
extern cmPrH_t cmPrNullHandle;
@ -139,7 +145,8 @@ extern "C" {
// The 'id' argument is optional. If 'id' is set to cmInvalidId then the
// variable will be automatically assigned an id. The value of the
// automatically assigned id can be found from the path string
// via cmPrefsId()
// via cmPrefsId(). If 'id' is not set to cmInvalidId then it must be less than
// kMaxVarId.
// Set kForceValuePrFl
enum { kForceValuePrFl=0x01 };