X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmArgMgr.cxx;h=03d8841622c91e47cd6c47c6810156ad06960b57;hb=c1a305b54c1a9dd1bfe2173940ba84ccd1b4bb27;hp=cd15136d1d485c43161638dd5646e027257ea0a0;hpb=a401c209a120a44b355e53180a5a9a8d1a3cdc4c;p=gdcm.git diff --git a/src/gdcmArgMgr.cxx b/src/gdcmArgMgr.cxx index cd15136d..03d88416 100644 --- a/src/gdcmArgMgr.cxx +++ b/src/gdcmArgMgr.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmArgMgr.cxx,v $ Language: C++ - Date: $Date: 2007/09/28 11:03:53 $ - Version: $Revision: 1.25 $ + Date: $Date: 2008/05/14 10:45:11 $ + Version: $Revision: 1.28 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -43,7 +43,7 @@ namespace GDCM_NAME_SPACE * @param argv pointers array on the arguments passed to main() */ ArgMgr::ArgMgr(int argc, char **argv) - : ArgUsed(NULL), ArgLab(NULL), ArgStr(NULL), ArgCount(0), Appel(NULL) + : ArgParamOut (NULL), ArgUsed(NULL), ArgLab(NULL), ArgStr(NULL), ArgCount(0), Appel(NULL) { int i; int nblettre; @@ -764,7 +764,7 @@ char *ArgMgr::Majuscule (const char *chaine ) char *ptr, *ptr2, *ptr3; ptr2 = (char *)malloc(strlen(chaine)*sizeof(char)+1); ptr3=ptr2; - for ( ptr = (char *)chaine ; *ptr!='\0' ; ptr ++ ) + for ( ptr = const_cast(chaine) ; *ptr!='\0' ; ptr ++ ) { *ptr3 = toupper ( * ptr ); ptr3++; } @@ -800,12 +800,12 @@ int ArgMgr::FiltreLong ( const char *arg ) const char *ArgMgr::LoadedParam ( const char *param, FILE *fd ) { int carlu; - char *car = (char *)param; + char *car = const_cast(param); int quote = false; int nbcar = 0; /* remove spaces at the beginning****/ - while ( isspace(carlu=fgetc (fd)) ); + while ( isspace(carlu=fgetc (fd)) ) {} if (carlu==EOF) return 0; /* Search for a " */ @@ -846,14 +846,14 @@ const char *ArgMgr::LoadedParam ( const char *param, FILE *fd ) +------------------------------------------------------------------------*/ int ArgMgr::ArgLoadFromFile ( const char *filename ) { - int nbl = 0; + size_t nbl = 0; char param[ARG_LONG_MAX+1]; FILE *fch; fch = fopen ( filename, ID_RFILE_TEXT ); while ( LoadedParam (param, fch ) ) { - int n = strlen(param); + size_t n = strlen(param); if ( param[0]=='@' ) { nbl += ArgLoadFromFile ( ¶m[1] ); @@ -868,7 +868,7 @@ int ArgMgr::ArgLoadFromFile ( const char *filename ) } } fclose ( fch ); - return nbl; + return static_cast< int >( nbl ); } /*------------------------------------------------------------------------ @@ -881,12 +881,12 @@ void ArgMgr::ArgStdArgs() char *logfile; FILE *fd; - if ( (ArgParamOut=ArgMgrValue((char*)ARG_LABEL_PARAMOUT))==0 ) + if ( (ArgParamOut=ArgMgrValue(const_cast(ARG_LABEL_PARAMOUT)))==0 ) ArgParamOut = ARG_DEFAULT_PARAMOUT; - if ( (logfile = ArgMgrValue((char*)ARG_LABEL_LOGFILE))!=0) + if ( (logfile = ArgMgrValue(const_cast(ARG_LABEL_LOGFILE)))!=0) { if ( *logfile == '\0' ) - logfile = (char *)ARG_DEFAULT_LOGFILE; + logfile = const_cast(ARG_DEFAULT_LOGFILE); fd = fopen ( logfile, "a+" ); if ( fd ) {