cmPrefs.c/h Added use of kMaxVarPrId
This commit is contained in:
parent
67f462a501
commit
fc08764718
@ -305,6 +305,8 @@ cmPrRC_t cmPrefsInitialize( cmPrH_t* hp, const cmChar_t* fn, cmPrefsOnChangeFunc
|
|||||||
p->fn = cmLHeapAllocZ( p->lhH, strlen(fn)+1 );
|
p->fn = cmLHeapAllocZ( p->lhH, strlen(fn)+1 );
|
||||||
strcpy(p->fn,fn);
|
strcpy(p->fn,fn);
|
||||||
|
|
||||||
|
p->id = kMaxVarPrId;
|
||||||
|
|
||||||
hp->h = p;
|
hp->h = p;
|
||||||
|
|
||||||
errLabel:
|
errLabel:
|
||||||
@ -1169,6 +1171,10 @@ cmPrRC_t _cmPrefsCreateJsonNode(
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
assert( pathCnt >= 1 );
|
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 each path element
|
||||||
for(i=0; i<pathCnt; ++i)
|
for(i=0; i<pathCnt; ++i)
|
||||||
|
@ -24,6 +24,12 @@ extern "C" {
|
|||||||
kDuplicateIdPrRC
|
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 );
|
typedef void (*cmPrefsOnChangeFunc_t)( cmPrH_t h, void* cbDataPtr, unsigned id );
|
||||||
|
|
||||||
extern cmPrH_t cmPrNullHandle;
|
extern cmPrH_t cmPrNullHandle;
|
||||||
@ -139,7 +145,8 @@ extern "C" {
|
|||||||
// The 'id' argument is optional. If 'id' is set to cmInvalidId then the
|
// The 'id' argument is optional. If 'id' is set to cmInvalidId then the
|
||||||
// variable will be automatically assigned an id. The value of the
|
// variable will be automatically assigned an id. The value of the
|
||||||
// automatically assigned id can be found from the path string
|
// 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
|
// Set kForceValuePrFl
|
||||||
enum { kForceValuePrFl=0x01 };
|
enum { kForceValuePrFl=0x01 };
|
||||||
|
Loading…
Reference in New Issue
Block a user