Revision: 7585
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7585&view=rev
Author:   rtv
Date:     2009-04-07 23:00:21 +0000 (Tue, 07 Apr 2009)

Log Message:
-----------
big hunting

Modified Paths:
--------------
    code/stage/trunk/libstage/glcolorstack.cc
    code/stage/trunk/libstage/worldfile.cc

Modified: code/stage/trunk/libstage/glcolorstack.cc
===================================================================
--- code/stage/trunk/libstage/glcolorstack.cc   2009-04-07 20:41:40 UTC (rev 
7584)
+++ code/stage/trunk/libstage/glcolorstack.cc   2009-04-07 23:00:21 UTC (rev 
7585)
@@ -9,14 +9,12 @@
 
 GlColorStack::~GlColorStack()
 {
-
 }
 
 void GlColorStack::Push( GLdouble col[4] )
 {
-       size_t sz =  4 * sizeof(col[0]);
-       GLdouble *keep = (GLdouble*)malloc( sz );
-       memcpy( keep, col, sz );
+  GLdouble *keep = new GLdouble[4];
+  memcpy( keep, col, 4*sizeof(GLdouble) );
 
        g_queue_push_head( colorstack, keep );
 
@@ -71,6 +69,6 @@
        {
                GLdouble *col = (GLdouble*)g_queue_pop_head( colorstack );
                glColor4dv( col );
-               free( col );
+               delete[] col;
        }
 }

Modified: code/stage/trunk/libstage/worldfile.cc
===================================================================
--- code/stage/trunk/libstage/worldfile.cc      2009-04-07 20:41:40 UTC (rev 
7584)
+++ code/stage/trunk/libstage/worldfile.cc      2009-04-07 23:00:21 UTC (rev 
7585)
@@ -127,7 +127,7 @@
   // accordingly if found:
   char *stagepath = getenv("STAGEPATH");
   char *token = strtok(stagepath, ":");
-  char *fullpath = (char*) malloc(PATH_MAX);
+  char* fullpath = new char[PATH_MAX];
   char *tmp = strdup(filename);
   char *base = basename(tmp);
   while (token != NULL) {
@@ -509,7 +509,7 @@
       // we need to make a copy of the filename.
       // There's no bounds-checking, but what the heck.
       char *tmp = strdup(this->filename);
-      fullpath = (char*) malloc(PATH_MAX);
+      fullpath = new char[PATH_MAX];
       memset(fullpath, 0, PATH_MAX);
       strcat( fullpath, dirname(tmp));
       strcat( fullpath, "/" );
@@ -523,7 +523,7 @@
       // we need to make a copy of the filename.
       // There's no bounds-checking, but what the heck.
       char *tmp = strdup(this->filename);
-      fullpath = (char*) malloc(PATH_MAX);
+      fullpath = new char[PATH_MAX];
       getcwd(fullpath, PATH_MAX);
       strcat( fullpath, "/" );
       strcat( fullpath, dirname(tmp));
@@ -542,7 +542,8 @@
     {
       PRINT_ERR2("unable to open include file %s : %s",
                 fullpath, strerror(errno));
-      free(fullpath);
+      //free(fullpath);
+               delete[] fullpath;
       return false;
     }
 
@@ -556,7 +557,8 @@
     {
                fclose( infile );
       //DumpTokens();
-      free(fullpath);
+      //free(fullpath);
+               delete[] fullpath;
       return false;
     }
 
@@ -568,7 +570,7 @@
   while ( ch != '\n' )
     ch = fgetc(file);
 
-  free(fullpath);
+  delete[] fullpath;
   return true;
 }
 
@@ -1628,7 +1630,7 @@
       // we need to make a copy of the filename.
       // There's no bounds-checking, but what the heck.
       char *tmp = strdup(this->filename);
-      char *fullpath = (char*) malloc(PATH_MAX);
+               char* fullpath = new char[PATH_MAX];
       memset(fullpath, 0, PATH_MAX);
       strcat( fullpath, dirname(tmp));
       strcat( fullpath, "/" );
@@ -1644,7 +1646,7 @@
       // we need to make a copy of the filename.
       // There's no bounds-checking, but what the heck.
       char *tmp = strdup(this->filename);
-      char *fullpath = (char*) malloc(PATH_MAX);
+               char* fullpath = new char[PATH_MAX];
       getcwd(fullpath, PATH_MAX);
       strcat( fullpath, "/" );
       strcat( fullpath, dirname(tmp));


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to