Ignore:
Timestamp:
Apr 29, 2008, 12:19:51 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
e936b3
Parents:
307fd1
Message:

char lengths of 255 and MAXDUMMYSTRING replaced with define MAXSTRINGSIZE in molecuilder and pcp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified molecuilder/src/config.cpp

    r307fd1 rc510a7  
    1313config::config()
    1414{
    15   mainname = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
    16   defaultpath = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
    17   pseudopotpath = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
    18   configpath = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
    19   configname = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
     15  mainname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
     16  defaultpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
     17  pseudopotpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
     18  configpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
     19  configname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
    2020  strcpy(mainname,"pcp");
    2121  strcpy(defaultpath,"not specified");
     
    414414  char *ptr = NULL;
    415415  int last = -1;
    416   for(int i=0;i<255;i++) {
     416  for(int i=0;i<MAXSTRINGSIZE;i++) {
    417417    if (filename[i] == '/')
    418418      last = i;
     
    11681168                case(string_type):
    11691169                  if (value != NULL) {
    1170                     if (maxlength == -1) maxlength = strlen((char *)value); // get maximum size of string array
     1170                    //if (maxlength == -1) maxlength = strlen((char *)value); // get maximum size of string array
     1171                    maxlength = MAXSTRINGSIZE;
    11711172                    length = maxlength > (dummy-dummy1) ? (dummy-dummy1) : maxlength; // cap at maximum
    11721173                    strncpy((char *)value, dummy1, length);  // copy as much
Note: See TracChangeset for help on using the changeset viewer.