MCPcopy Create free account
hub / github.com/SIPp/sipp / isWellFormed

Method isWellFormed

src/stat.cpp:220–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218
219
220int CStat::isWellFormed(char * P_listeStr,
221 int * nombre)
222{
223 char * ptr = P_listeStr;
224 int sizeOf;
225 bool isANumber;
226
227 (*nombre) = 0;
228 sizeOf = strlen(P_listeStr);
229 // getting the number
230 if(sizeOf > 0) {
231 // is the string well formed ? [0-9] [,]
232 isANumber = false;
233 for(int i=0; i<=sizeOf; i++) {
234 switch(ptr[i]) {
235 case ',':
236 if(isANumber == false) {
237 return(0);
238 } else {
239 (*nombre)++;
240 }
241 isANumber = false;
242 break;
243 case '0':
244 case '1':
245 case '2':
246 case '3':
247 case '4':
248 case '5':
249 case '6':
250 case '7':
251 case '8':
252 case '9':
253 isANumber = true;
254 break;
255 case '\t':
256 case ' ' :
257 break;
258 case '\0':
259 if(isANumber == false) {
260 return(0);
261 } else {
262 (*nombre)++;
263 }
264 break;
265 default:
266 return(0);
267 }
268 } // enf for
269 }
270 return(1);
271}
272
273
274int CStat::createIntegerTable(char * P_listeStr,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected