Program: gdcm
Module: $RCSfile: gdcmArgMgr.cxx,v $
Language: C++
- Date: $Date: 2005/09/08 14:00:39 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2006/01/26 15:52:56 $
+ Version: $Revision: 1.17 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
bool trouve;
char *temp;
temp = Majuscule ( param ) ;
- for ( trouve = false, i = ArgCount-1; i>0; i-- )
+ for ( i = ArgCount-1; i>0; i-- )
{
trouve = ( strcmp( ArgLab[i], temp )==0 ) ;
if ( trouve )
* @param defaultVal default value
* @return parameter value
*/
-char *ArgMgr::ArgMgrGetString(const char *param, char *defaultVal)
+const char *ArgMgr::ArgMgrGetString(const char *param, const char *defaultVal)
{
return ( (ArgMgrDefined(param))
? (ArgMgrValue(param))
int ArgMgr::ArgMgrGetLabel (const char *param, char *liste, int val )
{
char *lab;
- char *vallab;
+ const char *vallab;
int i = 1;
char *tmp;
tmp = (char *) malloc(strlen(liste)+1);
strcpy(tmp,liste);
- if ( (vallab = ArgMgrGetString(param,(char *)NULL)) != 0 )
+ if ( (vallab = ArgMgrGetString(param,(const char *)NULL)) != 0 )
{
for ( lab = strtok (tmp,"\\");
lab != 0;
lab = strtok(0L,"\\"), i++ )
{
- if ( strcmp(maj(lab),maj(vallab))==0)
+ // strcmp ignoring case
+ if( strcasecmp(lab, vallab) == 0)
return i;
}
val=0;
int ArgMgr::ArgMgrWantLabel (const char *param, char *liste, const char **usage )
{
char *lab;
- char *vallab;
+ const char *vallab;
int i = 1;
if ( (vallab = ArgMgrGetString(param,0)) != 0 )
{
for ( lab = strtok (liste,"\\"); lab != 0; lab = strtok(0L,"\\"), i++ )
- if ( strcmp(maj(lab),maj(vallab))==0)
+ if ( strcasecmp(lab,vallab)==0)
return i;
return 0;
}
char **elem;
char *chainecur;
if (!value)
+ {
+ *number = 0;
return 0;
+ }
*number = IdStrCountChar(value,',')+1; /* nb Elements = nb Commas +1 */
taille = *number;
liste = (char **) malloc (sizeof(char*) * taille + strlen(value)+1);
int *elem;
int taille;
if (!value)
+ {
+ *number = 0;
return 0;
- *number = IdStrCountChar(value,',')+1; /* nb Elements = nb Commas +1 */
+ }
+ *number = IdStrCountChar(value,',')+1; /* nb Elements = nb Commas +1 */
taille= *number;
liste = (int *) calloc (1,sizeof(int)*taille );
if ( !liste )
return 0;
elem = liste;
- *number = 1;
+ //*number = 1;
while ( taille>0 )
{
taille= *number;
liste = (float *) calloc (1,sizeof(float)*taille );
if ( !liste )
+ {
+ *number = 0;
return 0;
+ }
elem = liste;
- *number = 1;
+ //*number = 1;
while ( taille>0 )
{