Browse Source

cmPrefs.c/h Added use of kMaxVarPrId

master
kpl 12 years ago
parent
commit
fc08764718
2 changed files with 14 additions and 1 deletions
  1. 6
    0
      cmPrefs.c
  2. 8
    1
      cmPrefs.h

+ 6
- 0
cmPrefs.c View File

305
   p->fn = cmLHeapAllocZ( p->lhH, strlen(fn)+1 );
305
   p->fn = cmLHeapAllocZ( p->lhH, strlen(fn)+1 );
306
   strcpy(p->fn,fn);
306
   strcpy(p->fn,fn);
307
 
307
 
308
+  p->id = kMaxVarPrId;
309
+
308
   hp->h = p;
310
   hp->h = p;
309
 
311
 
310
  errLabel:
312
  errLabel:
1169
   int             i;
1171
   int             i;
1170
 
1172
 
1171
   assert( pathCnt >= 1 );
1173
   assert( pathCnt >= 1 );
1174
+
1175
+  if( id != cmInvalidId && id >= kMaxVarPrId )
1176
+    return cmErrMsg(&p->err,kNodeCreateFailPrRC,"User supplied id's must be less than 0x%x.",kMaxVarPrId);
1177
+
1172
   
1178
   
1173
   // for each path element
1179
   // for each path element
1174
   for(i=0; i<pathCnt; ++i)
1180
   for(i=0; i<pathCnt; ++i)

+ 8
- 1
cmPrefs.h View File

24
     kDuplicateIdPrRC
24
     kDuplicateIdPrRC
25
   };
25
   };
26
 
26
 
27
+  enum
28
+  {
29
+    kMaxVarPrId = 0x7fffffff // User assigned variable id's given to cmPrefsCreateXXX()
30
+                             // must be less than kMaxVarPrId
31
+  };
32
+
27
   typedef void (*cmPrefsOnChangeFunc_t)( cmPrH_t h, void* cbDataPtr, unsigned id ); 
33
   typedef void (*cmPrefsOnChangeFunc_t)( cmPrH_t h, void* cbDataPtr, unsigned id ); 
28
 
34
 
29
   extern cmPrH_t cmPrNullHandle;
35
   extern cmPrH_t cmPrNullHandle;
139
   // The 'id' argument is optional.  If 'id' is set to cmInvalidId then the
145
   // The 'id' argument is optional.  If 'id' is set to cmInvalidId then the
140
   // variable will be automatically assigned an id.  The value of the
146
   // variable will be automatically assigned an id.  The value of the
141
   // automatically assigned id can be found from the path string
147
   // automatically assigned id can be found from the path string
142
-  // via cmPrefsId()
148
+  // via cmPrefsId().  If 'id' is not set to cmInvalidId then it must be less than 
149
+  // kMaxVarId.
143
 
150
 
144
   // Set kForceValuePrFl 
151
   // Set kForceValuePrFl 
145
   enum { kForceValuePrFl=0x01 };
152
   enum { kForceValuePrFl=0x01 };

Loading…
Cancel
Save