diff --git a/src/osgPlugins/ply/plyfile.cpp b/src/osgPlugins/ply/plyfile.cpp index ac90d0238..c59caa95d 100644 --- a/src/osgPlugins/ply/plyfile.cpp +++ b/src/osgPlugins/ply/plyfile.cpp @@ -300,30 +300,16 @@ PlyFile *ply_open_for_writing( float *version ) { - PlyFile *plyfile; - char *name; - FILE *fp; - - - /* tack on the extension .ply, if necessary */ - name = (char *) myalloc (sizeof (char) * - (static_cast(strlen (filename)) + 5)); - strcpy (name, filename); - if (strlen (name) < 4 || - strcmp (name + strlen (name) - 4, ".ply") != 0) - strcat (name, ".ply"); - /* open the file for writing */ - fp = osgDB::fopen (name, "wb"); - free (name); //wjs remove memory leak// + FILE *fp = osgDB::fopen (filename, "wb"); if (fp == NULL) { return (NULL); } /* create the actual PlyFile structure */ - plyfile = ply_write (fp, nelems, elem_names, file_type); + PlyFile *plyfile = ply_write (fp, nelems, elem_names, file_type); // If the plyfile could not load return NULL if (plyfile == NULL) @@ -946,21 +932,9 @@ PlyFile *ply_open_for_reading( { FILE *fp; PlyFile *plyfile; - char *name; - - /* tack on the extension .ply, if necessary */ - - name = (char *) myalloc (sizeof (char) * - (static_cast(strlen (filename) + 5))); - strcpy (name, filename); - if (strlen (name) < 4 || - strcmp (name + strlen (name) - 4, ".ply") != 0) - strcat (name, ".ply"); /* open the file for reading */ - - fp = osgDB::fopen (name, "rb"); - free(name); + fp = osgDB::fopen (filename, "rb"); if (fp == NULL) return (NULL); @@ -970,7 +944,7 @@ PlyFile *ply_open_for_reading( if(!plyfile) { - std::cout<<"Ply File Error : Could not read file"<