Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3119 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Dec 6, 2004, 11:43:15 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/images: seg-fault shouldn't occure anymore from strings

Location:
orxonox/branches/images/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/images/importer/material.cc

    r3115 r3119  
    168168  if (verbose >= 3)
    169169    printf("setting Material Name to %s.\n", mtlName);
    170   name = new char [strlen(mtlName)];
     170  name = new char [strlen(mtlName)+1];
    171171  strcpy(name, mtlName);
    172172  //  printf ("adding new Material: %s, %p\n", this->getName(), this);
  • orxonox/branches/images/importer/object.cc

    r3116 r3119  
    359359  objFileName = new char[strlen(name)+1];
    360360  strcpy (objFileName, name);
    361   objFileName[strlen(name)] = '\0';
    362361  this->readFromObjFile ();
    363362  return true;
     
    370369bool Object::readFromObjFile (void)
    371370{
    372   char* fileName = new char [strlen(objPath)+strlen(objFileName)+2];
     371  char* fileName = new char [strlen(objPath)+strlen(objFileName)+1];
    373372  fileName[0]='\0';
    374373  if (objFileName != NULL && !strcmp(objFileName, ""))
     
    376375  strcat(fileName, objPath);
    377376  strcat(fileName, objFileName);
    378   printf ("%s. %d\n", fileName, strlen(fileName));
    379377
    380378  ifstream* OBJ_FILE = new ifstream(fileName);
     
    457455  if (strcmp(currentGroup->name, "default"))
    458456    {
    459       currentGroup->name = new char [strlen(groupString)];
     457      currentGroup->name = new char [strlen(groupString)+1];
    460458      strcpy(currentGroup->name, groupString);
    461459    }
     
    700698  initFace (currentGroup->currentFace);
    701699 
    702   currentGroup->currentFace->materialString = new char[strlen(matString)];
     700  currentGroup->currentFace->materialString = new char[strlen(matString)+1];
    703701  strcpy (currentGroup->currentFace->materialString, matString);
    704702 
Note: See TracChangeset for help on using the changeset viewer.