From 8ae57c2797baebd2f7ecc2392eb822150827c6e5 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 24 Jan 2014 16:01:59 +0000 Subject: [PATCH] From Marc Helbling, "I am sending a small fix in the PLY pseudo-loader; the extension was checked in plyfile.cpp thus preventing the loading of any .PLY file (extension in uppercase). The extension filtering is already handled by ReaderWriter::acceptsExtension in a case unsensitive way." --- src/osgPlugins/ply/plyfile.cpp | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) 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"<