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."

This commit is contained in:
Robert Osfield
2014-01-24 16:01:59 +00:00
parent eb56080277
commit 8ae57c2797

View File

@@ -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<int>(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<int>(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"<<std::endl;
std::cout<<"Ply File Error : Could not read file " << filename <<std::endl;
return NULL;
}