From: Matze B. <mat...@us...> - 2002-09-16 22:51:38
|
Update of /cvsroot/planeshift/planeshift/src/tools/texparse In directory usw-pr-cvs1:/tmp/cvs-serv4257/src/tools/texparse Modified Files: texparse.cpp texparse.h Log Message: more fixes Index: texparse.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/tools/texparse/texparse.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texparse.cpp 29 Aug 2002 01:29:13 -0000 1.2 --- texparse.cpp 16 Sep 2002 22:51:34 -0000 1.3 *************** *** 46,53 **** psTxPrtParse::psTxPrtParse() { - loader = NULL; object_reg = NULL; - ImageLoader = NULL; - VFS = NULL; colormask = NULL; --- 46,50 ---- *************** *** 63,70 **** psTxPrtParse::~psTxPrtParse() { - if(loader) loader->DecRef(); - if(ImageLoader) ImageLoader->DecRef(); - if(VFS) VFS->DecRef(); - if(colormask) { delete [] colormask; colormask = NULL;} if(region) { delete [] region; region = NULL;} --- 60,63 ---- *************** *** 92,96 **** // Get the translated path ! iDataBuffer *xname = VFS->ExpandPath( cmdline->GetName() ); // Add the VFS "/this" extension to the front --- 85,89 ---- // Get the translated path ! csRef<iDataBuffer> xname = VFS->ExpandPath( cmdline->GetName() ); // Add the VFS "/this" extension to the front *************** *** 100,104 **** strcpy(filename, "/this"); strcat(filename, (const char*)xname->GetData() ); - xname->DecRef(); // Check if the file exists as the VFS sees it --- 93,96 ---- *************** *** 340,344 **** // Load the image ! iImage* image = LoadImage(filename, CS_IMGFMT_TRUECOLOR); // Determine image height --- 332,336 ---- // Load the image ! csRef<iImage> image = LoadImage(filename, CS_IMGFMT_TRUECOLOR); // Determine image height *************** *** 408,412 **** } ! iImage* psTxPrtParse::LoadImage(const char* name, int Format) { // Check if we have a pointer to the ImageLoader plugin --- 400,404 ---- } ! csPtr<iImage> psTxPrtParse::LoadImage(const char* name, int Format) { // Check if we have a pointer to the ImageLoader plugin *************** *** 422,427 **** // Create an image file and buffer // Then read the file into the buffer ! iImage *ifile = NULL; ! iDataBuffer *buf = VFS->ReadFile(name); // Check to see if for some reason the buffer was not --- 414,419 ---- // Create an image file and buffer // Then read the file into the buffer ! csRef<iImage> ifile; ! csRef<iDataBuffer> buf = VFS->ReadFile(name); // Check to see if for some reason the buffer was not *************** *** 429,435 **** if(!buf || !buf->GetSize() ) { - if(buf) - buf->DecRef(); - fprintf(stderr, "Could not open image file '%s' on VFS!", name); } --- 421,424 ---- *************** *** 439,443 **** // format ifile = ImageLoader->Load(buf->GetUint8(), buf->GetSize(), Format); - buf->DecRef(); if(!ifile) --- 428,431 ---- *************** *** 452,460 **** // Give the image a VFS compatible name. ! iDataBuffer *xname = VFS->ExpandPath(name); ifile->SetName(**xname); - xname->DecRef(); ! return ifile; } --- 440,448 ---- // Give the image a VFS compatible name. ! csRef<iDataBuffer> xname = VFS->ExpandPath(name); ifile->SetName(**xname); ! ifile->IncRef (); ! return csPtr<iImage> (ifile); } Index: texparse.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/tools/texparse/texparse.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texparse.h 30 Aug 2002 03:34:59 -0000 1.2 --- texparse.h 16 Sep 2002 22:51:35 -0000 1.3 *************** *** 39,43 **** // Protected Functions csRGBcolor TransColor(char const *arg); ! iImage * LoadImage(const char *fname, int Format); int VerifyCmdLine(); void CreateScanLines(); --- 39,43 ---- // Protected Functions csRGBcolor TransColor(char const *arg); ! csPtr<iImage> LoadImage(const char *fname, int Format); int VerifyCmdLine(); void CreateScanLines(); *************** *** 47,53 **** // Protected Variables iObjectRegistry * object_reg; ! iImageIO * ImageLoader; ! iLoader * loader; ! iVFS * VFS; csRGBcolor * colormask; --- 47,53 ---- // Protected Variables iObjectRegistry * object_reg; ! csRef<iImageIO> ImageLoader; ! csRef<iLoader> loader; ! csRef<iVFS> VFS; csRGBcolor * colormask; |