diff --git a/wrap/ply/plylib.cpp b/wrap/ply/plylib.cpp index cd288706..958b5f1a 100644 --- a/wrap/ply/plylib.cpp +++ b/wrap/ply/plylib.cpp @@ -1059,7 +1059,8 @@ int PlyFile::OpenRead( const char * filename ) goto error; } - header[0] = 0; + header.clear(); + header.reserve(1536); // ********* Parsing header *********** @@ -1069,7 +1070,8 @@ int PlyFile::OpenRead( const char * filename ) error = E_UNESPECTEDEOF; goto error; } - strcat(header,buf); + header.append(buf); + if( strncmp(buf,HEADER,strlen(HEADER)) ) { error = E_NOTHEADER; @@ -1084,7 +1086,8 @@ int PlyFile::OpenRead( const char * filename ) error = E_UNESPECTEDEOF; goto error; } - strcat(header,buf); + header.append(buf); + token = strtok(buf,SEP); if(token==0) { @@ -1131,7 +1134,7 @@ int PlyFile::OpenRead( const char * filename ) error = E_UNESPECTEDEOF; goto error; } - strcat(header,buf); + header.append(buf); token = strtok(buf,SEP); if(token==0) diff --git a/wrap/ply/plylib.h b/wrap/ply/plylib.h index 7e98d63a..8a346826 100644 --- a/wrap/ply/plylib.h +++ b/wrap/ply/plylib.h @@ -295,12 +295,12 @@ public: // Lettura du un elemento int Read( void * mem ); - std::vector elements; // Vettore degli elementi - std::vector comments; // Vettore dei commenti + std::vector elements; // Vettore degli elementi + std::vector comments; // Vettore dei commenti static const char * typenames[9]; static const char * newtypenames[9]; - inline const char * GetHeader() const { return header; } + inline const char * GetHeader() const { return header.c_str(); } protected: GZFILE gzfp; @@ -309,7 +309,7 @@ protected: int error; // Errore corrente (vedi enum) int format; // Formato del file (vedi enum ) - char header[4096]; // Testo dell'header + std::string header; // Testo dell'header PlyElement * cure; // Elemento da leggere