]> git.tdb.fi Git - gldbg.git/blobdiff - flavors/gl/source/bufferstate.cpp
Fix several problems reported by valgrind
[gldbg.git] / flavors / gl / source / bufferstate.cpp
index c8b9f1348e1858196be5115bb3b9e48704614680..467fb932b0c4573951b3bcc7d2893b54b046c4c7 100644 (file)
@@ -1,18 +1,10 @@
-/* $Id$
-
-This file is part of gldbg
-Copyright © 2009-2010  Mikko Rasa, Mikkosoft Productions
-Distributed under the GPL
-*/
-
-#include <msp/strings/formatter.h>
 #include "arraysize.h"
 #include "arraystate.h"
 #include "bufferstate.h"
 #include "enums.h"
+#include "strformat.h"
 
 using namespace std;
-using namespace Msp;
 
 BufferContent::BufferContent():
        consistent(true),
@@ -113,7 +105,7 @@ string BufferContent::describe() const
 
                if(!result.empty())
                        result += '_';
-               result += format("%c%d%s", kind, i->size, type);
+               result += strformat("%c%d%s", kind, i->size, type);
        }
 
        return result;
@@ -145,6 +137,11 @@ BufferState::BufferState():
        data(0)
 { }
 
+BufferState::~BufferState()
+{
+       delete[] data;
+}
+
 void BufferState::set_data(unsigned sz, const void *ptr, GLenum use)
 {
        usage = use;
@@ -170,9 +167,16 @@ string BufferState::describe() const
        if(content.stride)
        {
                const char *what = (content.arrays.front().kind==GL_ELEMENT_ARRAY_BUFFER ? "indices" : "vertices");
-               return format("%s, %d %s (%d bytes), %s",
-                       content.describe(), size/content.stride, what, size, describe_enum(usage, ""));
+               return content.describe()+strformat(", %d %s (%d bytes), %s",
+                       size/content.stride, what, size, describe_enum(usage, ""));
        }
        else
-               return format("%d bytes, %s", size, describe_enum(usage, ""));
+               return strformat("%d bytes, %s", size, describe_enum(usage, ""));
 }
+
+
+BufferBindingState::BufferBindingState():
+       buffer(0),
+       offset(0),
+       size(0)
+{ }