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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user