X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmArgMgr.cxx;h=32e3765ef519e0d623c9b9ad911003b087e294fb;hb=a98b52385287bd4c6855758bdaa1d1ce2b7333be;hp=79ef553c6ee482dc23064859eebe2a71dd9ae98f;hpb=2d3b99ded7b569f8624ae85b99126821098a429a;p=gdcm.git diff --git a/src/gdcmArgMgr.cxx b/src/gdcmArgMgr.cxx index 79ef553c..32e3765e 100644 --- a/src/gdcmArgMgr.cxx +++ b/src/gdcmArgMgr.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmArgMgr.cxx,v $ Language: C++ - Date: $Date: 2005/08/28 16:56:05 $ - Version: $Revision: 1.13 $ + Date: $Date: 2005/12/22 14:46:06 $ + Version: $Revision: 1.16 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -122,12 +122,13 @@ ArgMgr::~ArgMgr() */ int ArgMgr::ArgMgrDefined( const char *param ) { - int i, trouve ; + int i; + 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 ) ; + trouve = ( strcmp( ArgLab[i], temp )==0 ) ; if ( trouve ) { ArgUsed[i] = true ; @@ -404,7 +405,10 @@ char **ArgMgr::ArgMgrGetListOfString ( const char *label, int *number ) 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); @@ -434,14 +438,17 @@ int *ArgMgr::ArgMgrGetListOfInt ( const char *label, int *number ) 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 ) { @@ -476,9 +483,12 @@ float *ArgMgr::ArgMgrGetListOfFloat ( const char *label, int *number ) taille= *number; liste = (float *) calloc (1,sizeof(float)*taille ); if ( !liste ) + { + *number = 0; return 0; + } elem = liste; - *number = 1; + //*number = 1; while ( taille>0 ) {