]> Creatis software - gdcm.git/blobdiff - src/gdcmArgMgr.cxx
Fix mistypings
[gdcm.git] / src / gdcmArgMgr.cxx
index 697ecf1a5637dbd597c195993dad8200eb88138c..03d8841622c91e47cd6c47c6810156ad06960b57 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmArgMgr.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/06/22 08:11:23 $
-  Version:   $Revision: 1.10 $
+  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
 #include <ctype.h>
 #include <string.h>  // For strlen
 
+// No strcasecmp in WIN32 world, but stricmp
+// http://www.opengroup.org/onlinepubs/007908799/xsh/strcasecmp.html
+#ifdef _WIN32
+#define strcasecmp stricmp
+#endif
+
 #include <string.h>  // For strtok and strlen
 #include <stdlib.h>  // For strtol and strtod
 
 #include "gdcmArgMgr.h"
 
-namespace gdcm 
+namespace GDCM_NAME_SPACE 
 {
 //-------------------------------------------------------------------------
 // Constructor / Destructor
@@ -37,12 +43,13 @@ namespace gdcm
  * @param argv  pointers array on the arguments passed to main()  
  */
  ArgMgr::ArgMgr(int argc, char **argv)
+ : ArgParamOut (NULL), ArgUsed(NULL), ArgLab(NULL), ArgStr(NULL), ArgCount(0), Appel(NULL)
  {
    int i;
-   int nblettre;
-   ArgUsed = NULL;
-   Appel   = NULL;
-  
+   int nblettre;   
+   ArgLab = new char *[ARGMAXCOUNT];
+   ArgStr = new char *[ARGMAXCOUNT];
+   
    /* Read the parameters of the command line *************************/
    for ( ArgCount=0, nblettre=1 , i=0; i<argc; i++) 
    {
@@ -70,7 +77,7 @@ namespace gdcm
       }
    }
 
-   /* Fills an array with the alreadu used parameters ****/
+   /* Fills an array with the already used parameters ****/
    ArgUsed = (char *)calloc (1, ArgCount );
 
    /* Builds the full string with all the parameters  **************/
@@ -88,13 +95,19 @@ namespace gdcm
       char * egaloufin = ArgLab[i] ;
       while ( (*egaloufin != '\0') && (*egaloufin != '=') ) 
          egaloufin ++ ;
-      if ( *egaloufin ) *(egaloufin++) = '\0';
+      if ( *egaloufin )
+          *(egaloufin++) = '\0';
       ArgStr[i]= egaloufin;
    }
 
    /* Set labels to upper-case (labels are not case sensitive ) *********/
+   //char *secu;
    for ( i=0; i<ArgCount; i++)
+   {
+      //secu = ArgLab[i];
       ArgLab[i] = Majuscule ( ArgLab[i] ) ;
+      //free (secu); //we still need it in the caller pgm.
+   }
 
   /* Standard arguments are managed by ArgStdArgs **********************/
    ArgStdArgs(); 
@@ -108,45 +121,50 @@ ArgMgr::~ArgMgr()
    for(int i=0;i<ArgCount;i++)
       if ( ArgLab[i] )
          free(ArgLab[i]);
+   delete ArgLab;   
+   delete ArgStr;  
    if ( ArgUsed )
       free(ArgUsed);
    if ( Appel )
       free(Appel);
 }
  
 /**
  * \brief  checks if a parameter exists in the command line
  * @param param  label name
- * @return   true if parameter 'label' exists
- *           Actually, it returns 0 if label is not found
+ * @return   0 if label is not found
  *           else, returns the number of the spot it was found last time.
  */
 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 )
     {
+      free (temp);
       ArgUsed[i] = true ;           
       for ( int j=1; j<i; j++)
       {                     
          if ( (!ArgUsed[j])&&(!strcmp(ArgLab[i],ArgLab[j])) )
-            ArgUsed[j] = true ;
+            ArgUsed[j] = i ;
       }
       return i ;
-    }
+    }   
   }
-  return false ;
+  free (temp);
+  return 0 ;
 }
 
 /**
  * \brief  Gets the parameter value, read on the command line
  * @param param   name of the searched parameter label
- * @return   Value, as a characters string, of the parameter
+ * @return   Value, as a char array, of the parameter
  *            whose label is given.
  */
 char *ArgMgr::ArgMgrValue ( const char *param )
@@ -160,9 +178,9 @@ char *ArgMgr::ArgMgrValue ( const char *param )
 
 /**
  * \brief  Search for the first not yet used label
- * @return Pointer to a char array holding the first non used label
+ * @return Pointer to the char array holding the first non used label
  */
-char *ArgMgr::ArgMgrUnused ( )
+const char *ArgMgr::ArgMgrUnused ( )
 {
    int i ;
    for ( i=ArgCount-1; i>0; i-- )
@@ -182,7 +200,7 @@ char *ArgMgr::ArgMgrUnused ( )
  */
 int ArgMgr::ArgMgrPrintUnusedLabels ()
 {
-   char *label;
+   const char *label;
    int i=0;
    while ( (label=ArgMgrUnused())!=0 )
    {
@@ -214,10 +232,10 @@ int ArgMgr::ArgMgrUsage(const char **usage )
  * Saves a char. array in a parameter file
  *         whose name is given on command line by : PARAMOUT=???
  *         or, as a default, by ARG_DEFAULT_PARAMOUT
- * @param param  char. array that defines the parameter:
+ * @param param  char. array that defines the parameter
  * @return   Entier correspondant au rang dans la liste de labels
  */
-int ArgMgr::ArgMgrSave ( char *param )
+int ArgMgr::ArgMgrSave ( const char *param )
 {
    static int   deja = 0;
    FILE         *fd;
@@ -242,7 +260,7 @@ int ArgMgr::ArgMgrSave ( char *param )
 /**
  * \brief  Gets an int value passed as an argument to a program
  *         (use default value if not found)
- *  EXEMPLE:     int dimx = ArgMgrGetInt ( "DIMX", 256 );
+ *         EXAMPLE:     int dimx = ArgMgrGetInt ( "DIMX", 256 );
  * @param label   label name 
  * @param defaultVal default value
  * @return parameter value
@@ -257,7 +275,7 @@ int ArgMgr::ArgMgrGetInt(const char *label, int defaultVal)
 /**
  * \brief  Gets a float value passed as an argument to a program
  *         (use default value if not found)
- *  EXEMPLE:     float scale = ArgMgrGetFloat ( "SCALE", 0.33 );
+ *         EXAMPLE:     float scale = ArgMgrGetFloat ( "SCALE", 0.33 );
  * @param param   label name 
  * @param defaultVal default value
  * @return parameter value
@@ -272,11 +290,12 @@ float ArgMgr::ArgMgrGetFloat(const char *param, float defaultVal)
 /**
  * \brief  Gets a 'string' value passed as an argument to a program
  *         (use default value if not found)
+ *         EXAMPLE :  char *imageName = ArgMgrGetString( "NAME", "test.dcm" );
  * @param param   label name 
  * @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))
@@ -286,7 +305,7 @@ char *ArgMgr::ArgMgrGetString(const char *param, char *defaultVal)
 /**
  * \brief  Gets a value amongst a set of values
  *         (use default value if not found) 
- *         EXEMPLE:     int nlab = ArgMgrGetLabel("CONFIRM","NO\\YES", 0); 
+ *         EXAMPLE:     int nlab = ArgMgrGetLabel("CONFIRM","NO\\YES", 0); 
  * @param param   label name 
  * @param liste  character Chain describing the various values.
  *               Value are separated by '\\'.
@@ -294,22 +313,23 @@ char *ArgMgr::ArgMgrGetString(const char *param, char *defaultVal)
  * @param val  number of default value
  * @return   int : range of value amongst the values list
  */
-int ArgMgr::ArgMgrGetLabel (const char *param, char *liste, int val )
+int ArgMgr::ArgMgrGetLabel (const char *param, const 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;
@@ -320,23 +340,24 @@ int ArgMgr::ArgMgrGetLabel (const char *param, char *liste, int val )
 
 /**
  * \brief  Demands a value amongst a set of values (abort if not found)
- *         EXEMPLE:     int nlab = ArgMgrWantLabel("CONFIRM","NO\\YES", usage); 
+ *         EXaMPLE:     int nlab = ArgMgrWantLabel("CONFIRM","NO\\YES", usage); 
  * @param param   label name 
  * @param liste  character Chain describing the various values.
  *               Labels are separated by  '\\'.
  *               No case sensitive.
+ *               WARNING this will be changed (not const)
  * @param usage Usage program (displayed if label not found)
  * @return   int : range of value amongst the values list
  */
 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;
    }
@@ -347,7 +368,7 @@ int ArgMgr::ArgMgrWantLabel (const char *param, char *liste, const char **usage
 /**
  * \brief  Demands an int value passed as an argument to a program
  *         If not found usage is displayed and the prog aborted
- *  EXEMPLE:     int dimx = ArgMgrWantInt ( "DIMX", usage );
+ *  EXAMPLE:     int dimx = ArgMgrWantInt ( "DIMX", usage );
  * @param label   label name 
  * @param usage Usage program (displayed if label not found)
  * @return parameter value
@@ -362,7 +383,7 @@ int ArgMgr::ArgMgrWantInt (const char *label, const char **usage)
 /**
  * \brief  Demands a float value passed as an argument to a program
  *         If not found usage is displayed and the prog aborted
- *  EXEMPLE:     float scale = ArgMgrWantFloat ( "SCALE", usage );
+ *  EXAMPLE:     float scale = ArgMgrWantFloat ( "SCALE", usage );
  * @param label   label name 
  * @param usage Usage program (displayed if label not found)
  * @return parameter value
@@ -377,7 +398,7 @@ float ArgMgr::ArgMgrWantFloat (const char *label, const char **usage)
 /**
  * \brief  Demands a 'string' value passed as an argument to a program
  *         If not found usage is displayed and the prog aborted
- *  EXEMPLE:     char *code = ArgMgrWantString ( "CODE", usage );
+ *  EXAMPLE:     char *code = ArgMgrWantString ( "CODE", usage );
  * @param label   Parameter label
  * @param usage Usage program (displayed if label not found)
  * @return parameter value
@@ -390,11 +411,11 @@ char *ArgMgr::ArgMgrWantString(const char *label, const char **usage)
 }
 
 /**
- * \brief  decodage des elements d'un argument 'ensemble de STRING' de lgr qcq
+ * \brief  decodes and returns an array of 'STRING'
+ *  EXAMPLE:     char **codes = ArgMgrGetListOfString ( "CODES", &nbOfCodes ); 
  * @param label   label name 
- * @param number  nb of found elements
- * @return   Pointer to the array
- *     Pointer NULL if error
+ * @param number  nb of found 'STRINGs'
+ * @return   Pointer to the 'STRING' array; NULL if error
  */
 char **ArgMgr::ArgMgrGetListOfString ( const char *label, int *number )
 {
@@ -404,7 +425,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);
@@ -421,11 +445,11 @@ char **ArgMgr::ArgMgrGetListOfString ( const char *label, int *number )
 }
 
 /**
- * \brief  decodage des elements d'un argument 'liste d'INTEGER' de lgr qcq
+ * \brief  decodes and returns an array of 'INT'
+ *  EXAMPLE:     int *points = ArgMgrGetListOfInt ( "POINTS", &nbOfPoints );  
  * @param label   label name 
- * @param number  nb of found elements
- * @return   Pointer to the array
- *     Pointer NULL if error
+ * @param number  nb of found INT
+ * @return   Pointer to the INT array; NULL if error
  */
 int *ArgMgr::ArgMgrGetListOfInt ( const char *label, int *number )
 {
@@ -434,14 +458,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 ) 
   {
@@ -459,11 +486,10 @@ return liste;
 }
 
 /**
- * \brief  decodage des elements d'un argument 'liste de FLOAT' de lgr qcq
+ * \brief  decodes and returns an array of 'FLOAT'
  * @param label   label name 
- * @param number  taille de la liste  trouvee
- * @return   Pointer vers le tableau de lgr 'taille'
- *     NULL if error
+ * @param number  number of found FLOATs
+ * @return   Pointer to the FLOAT array; NULL if error
  */
 float *ArgMgr::ArgMgrGetListOfFloat ( const char *label, int *number )
 {
@@ -477,9 +503,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 ) 
   {
@@ -496,6 +525,66 @@ float *ArgMgr::ArgMgrGetListOfFloat ( const char *label, int *number )
 return liste;
 }
 
+/**
+ * \brief  decodes and returns an array of 'INT pairs', passed in decimal
+ * @param param   label name 
+ * @param number   nb of found pairs
+ * @return        pointer to the array of 'INT pairs'; NULL if fail
+ */
+int *ArgMgr::ArgMgrGetIntEnum ( const char *param, int *number )
+{
+   char *value = ArgMgrValue(param);
+   int *liste;
+   if (!value) 
+   {
+      *number = 0; 
+      return 0;
+   }
+   liste = IdStrIntEnum(value, number);
+   return liste;
+}
+
+/**
+ * \brief  decodes and returns an array of 'INT16 pairs', passed in hexadecimal
+ * @param param   label name 
+ * @param number   nb of found pairs
+ * @return        pointer to the array of 'INT16 pairs'; NULL if fail
+ */
+uint16_t *ArgMgr::ArgMgrGetXInt16Enum ( const char *param, int *number )
+{
+   char *value = ArgMgrValue(param);
+   uint16_t *liste;
+   if (!value) 
+   {
+      *number = 0; 
+      return 0;
+   }
+   liste = IdStrXInt16Enum(value, number);
+   return liste;
+}
+/**
+ * \brief  decodes and returns an array of 'FLOAT pairs'
+ * @param param   label name 
+ * @param number   nb of found pairs
+ * @return        pointer to the array of 'FLOAT pairs'; NULL if fail
+
+ */
+float *ArgMgr::ArgMgrGetFloatEnum ( const char *param, int *number )
+{
+   char  *value = ArgMgrValue(param);
+   float *liste;
+   if (!value) 
+   {
+      *number = 0; 
+      return 0;
+   }
+   liste = IdStrFloatEnum(value, number);
+   return liste;
+}
+
+// ------------------------ Those are 'service functions' ---------------------
+// ------------------------       internal use only       ---------------------
+
 /**
  * \brief     Counts the nb of occurrences of a given charact within a 'string' 
  * @param chaine     Pointer to the 'string'
@@ -513,10 +602,10 @@ int ArgMgr::IdStrCountChar (char *chaine, int caract)
 }
 
 /**
- * \brief     returns an array of set of 'INT pairs'
- * @param value   char array decribing a set of 'INT pairs' (deb1,fin1, deb2,fin2, ...)
- * @param number   nb of found pairs
- * @return        array of set of 'INT pairs'
+ * \brief     returns an array of 'INT pairs'
+ * @param value  char array decribing a set of 'INT pairs' (f1-l1, f2-l2, ...)
+ * @param number nb of found INT pairs
+ * @return       pointer to the array of 'INT pairs'
  */
 int *ArgMgr::IdStrIntEnum ( char* value, int *number)
 {
@@ -560,12 +649,61 @@ int *ArgMgr::IdStrIntEnum ( char* value, int *number)
    }
    return liste;
 }
+
 /**
- * \brief     returns an array a set of 'FLOAT pairs'
- * @param value   char array decribing a set of 'FLOAT pairs' (deb1,fin1, deb2,fin2, ...)
- * @param number   nb of found pairs
- * @return        array of set of 'FLOAT pairs'
+ * \brief     returns an array of set of 'INT16 pairs', passed in Hexadecimal
+ * @param value  char array decribing a set of 'INT16 pairs' (f1-l1, f2-l2, ...)
+ *               coded in hexadecimal e.g. 0x0008,0x00ac
+ * @param number nb of found pairs
+ * @return        array of set of 'INT16 pairs'
+ */
+uint16_t *ArgMgr::IdStrXInt16Enum ( char *value, int *number)
+{
+   uint16_t *liste;
+   int taille;
+   int i;
+
+   *number = IdStrCountChar(value,',')+1; /* nb Elements = nb Commas +1 */
+   taille= *number;
+   liste = (uint16_t *) calloc (1,sizeof(uint16_t)*2*taille );
+   if ( !liste )
+   {
+      return 0;
+   }
+   i=0;
+   while ( taille>0 ) 
+   {
+      liste[i] = (uint16_t) strtol ( value, &value, 16 );
+      if ( *value == '\0' ) 
+      {
+         liste[i+1]=liste[i];
+         return liste;
+      }
+      if ( *(value++) != '-' ) 
+      {
+         liste[i+1]=liste[i];
+         value--;
+       }
+       else
+       {
+          liste[i+1] = (uint16_t) strtol ( value, &value, 16 );
+       }
+       if ( *value == '\0' )
+          return liste;
+       if ( *(value++) != ',' )
+       {
+          free (liste);
+          return 0;
+       }
+       taille --; i+=2;
+   }
+   return liste;
+} 
+/**
+ * \brief     returns an array of 'FLOAT pairs'
+ * @param value  char array decribing a set of 'FLOAT pairs' (f1-l1, f2-l2, ...)
+ * @param number nb of found pairs
+ * @return       pointer to the array of 'FLOAT pairs'; NULL if fail
  */
 float *ArgMgr::IdStrFloatEnum (char *value, int *number)
 {
@@ -607,40 +745,6 @@ float *ArgMgr::IdStrFloatEnum (char *value, int *number)
    return liste;
 }
 
-/**
- * \brief  decodage des elements d'un argument 'paires d'int' de lgr quelconque
- * @param param   label name 
- * @param number  taille de l'ensemble de paires trouvee
- * @return   Pointer vers le tableau de taille '2*nbElem'
- *     Pointer NULL si erreur
- */
-int *ArgMgr::ArgMgrGetIntEnum ( const char *param, int *number )
-{
-   char *value = ArgMgrValue(param);
-   int *liste;
-   if (!value) 
-      return 0;
-   liste = IdStrIntEnum(value, number);
-   return liste;
-}
-
-/**
- * \brief  decodage des elements d'un argument 'paires de float' de lgr quelconque
- * @param param   label name 
- * @param number  taille de l'ensemble de paires trouvee
- * @return   Pointer vers le tableau de taille '2*nbElem'
- *     Pointer NULL si erreur
- */
-float *ArgMgr::ArgMgrGetFloatEnum ( const char *param, int *number )
-{
-   char  *value = ArgMgrValue(param);
-   float *liste;
-   if (!value) 
-      return 0;
-   liste = IdStrFloatEnum(value, number);
-   return liste;
-}
-
 //-----------------------------------------------------------------------------
 // Protected
 
@@ -660,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<char *>(chaine) ; *ptr!='\0' ; ptr ++ ) 
    {  
        *ptr3 = toupper ( * ptr ); ptr3++; 
    }
@@ -677,7 +781,7 @@ char *ArgMgr::Majuscule (const char *chaine )
 * Valeur retournee . : false if OK.                                       *
 *                      true if KO.                                        *
 **************************************************************************/
-int ArgMgr::FiltreLong ( char *arg  )
+int ArgMgr::FiltreLong ( const char *arg  )
 {
   int  n = 0 ;
   while ( (n++<ARG_LONG_MAX) && (*(arg++) != '\0') ) ;
@@ -696,12 +800,12 @@ int ArgMgr::FiltreLong ( char *arg  )
 const char *ArgMgr::LoadedParam ( const char *param, FILE *fd )
 {
   int    carlu;
-  char  *car = (char *)param;
+  char  *car = const_cast<char *>(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 " */
@@ -740,16 +844,16 @@ const char *ArgMgr::LoadedParam ( const char *param, FILE *fd )
  |              Role     : parameter File name
  |
  +------------------------------------------------------------------------*/
-int ArgMgr::ArgLoadFromFile ( char *filename )
+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 ( &param[1] );
@@ -764,7 +868,7 @@ int ArgMgr::ArgLoadFromFile ( char *filename )
     }
   }
   fclose ( fch );
-  return nbl;
+  return static_cast< int >( nbl );
 }
 
 /*------------------------------------------------------------------------
@@ -777,12 +881,12 @@ void ArgMgr::ArgStdArgs()
   char *logfile;
   FILE *fd;
 
-  if ( (ArgParamOut=ArgMgrValue((char*)ARG_LABEL_PARAMOUT))==0 )
+  if ( (ArgParamOut=ArgMgrValue(const_cast<char*>(ARG_LABEL_PARAMOUT)))==0 )
     ArgParamOut = ARG_DEFAULT_PARAMOUT;
-  if ( (logfile = ArgMgrValue((char*)ARG_LABEL_LOGFILE))!=0) 
+  if ( (logfile = ArgMgrValue(const_cast<char*>(ARG_LABEL_LOGFILE)))!=0) 
   {
     if ( *logfile == '\0' )
-       logfile = (char *)ARG_DEFAULT_LOGFILE;
+       logfile = const_cast<char *>(ARG_DEFAULT_LOGFILE);
     fd = fopen ( logfile, "a+" );
     if ( fd ) 
     {