Răsfoiți Sursa

Fixes in gameplay-encoder for Linux

seanpaultaylor 13 ani în urmă
părinte
comite
e65c242ca1

+ 1 - 1
gameplay-encoder/src/Animation.cpp

@@ -26,7 +26,7 @@ void Animation::writeBinary(FILE* file)
     Object::writeBinary(file);
     Object::writeBinary(file);
     // Animation writes its ID because it is not listed in the ref table.
     // Animation writes its ID because it is not listed in the ref table.
     write(getId(), file);
     write(getId(), file);
-    write(_channels.size(), file);
+    write((unsigned int)_channels.size(), file);
     for (std::vector<AnimationChannel*>::iterator i = _channels.begin(); i != _channels.end(); ++i)
     for (std::vector<AnimationChannel*>::iterator i = _channels.begin(); i != _channels.end(); ++i)
     {
     {
         (*i)->writeBinary(file);
         (*i)->writeBinary(file);

+ 2 - 2
gameplay-encoder/src/AnimationChannel.cpp

@@ -28,10 +28,10 @@ void AnimationChannel::writeBinary(FILE* file)
     Object::writeBinary(file);
     Object::writeBinary(file);
     write(_targetId, file);
     write(_targetId, file);
     write(_targetAttrib, file);
     write(_targetAttrib, file);
-    write(_keytimes.size(), file);
+    write((unsigned int)_keytimes.size(), file);
     for (std::vector<float>::const_iterator i = _keytimes.begin(); i != _keytimes.end(); ++i)
     for (std::vector<float>::const_iterator i = _keytimes.begin(); i != _keytimes.end(); ++i)
     {
     {
-        write((unsigned long)*i, file);
+        write((unsigned int)*i, file);
     }
     }
     write(_keyValues, file);
     write(_keyValues, file);
     write(_tangentsIn, file);
     write(_tangentsIn, file);

+ 1 - 1
gameplay-encoder/src/Animations.cpp

@@ -27,7 +27,7 @@ const char* Animations::getElementName(void) const
 void Animations::writeBinary(FILE* file)
 void Animations::writeBinary(FILE* file)
 {
 {
     Object::writeBinary(file);
     Object::writeBinary(file);
-    write(_animations.size(), file);
+    write((unsigned int)_animations.size(), file);
     for (std::vector<Animation*>::iterator i = _animations.begin(); i != _animations.end(); ++i)
     for (std::vector<Animation*>::iterator i = _animations.begin(); i != _animations.end(); ++i)
     {
     {
         (*i)->writeBinary(file);
         (*i)->writeBinary(file);

+ 1 - 7
gameplay-encoder/src/FileIO.cpp

@@ -31,12 +31,6 @@ void write(unsigned int value, FILE* file)
     assert(r == 1);
     assert(r == 1);
 }
 }
 
 
-void write(unsigned long value, FILE* file)
-{
-    size_t r = fwrite(&value, sizeof(unsigned long), 1, file);
-    assert(r == 1);
-}
-
 void write(unsigned short value, FILE* file)
 void write(unsigned short value, FILE* file)
 {
 {
     size_t r = fwrite(&value, sizeof(unsigned short), 1, file);
     size_t r = fwrite(&value, sizeof(unsigned short), 1, file);
@@ -63,7 +57,7 @@ void write(const float* values, int length, FILE* file)
 void write(const std::string& str, FILE* file)
 void write(const std::string& str, FILE* file)
 {
 {
     // Write the length of the string
     // Write the length of the string
-    write(str.size(), file);
+    write((unsigned int)str.size(), file);
     
     
     if (str.size() > 0)
     if (str.size() > 0)
     {
     {

+ 2 - 3
gameplay-encoder/src/FileIO.h

@@ -64,7 +64,6 @@ void write(unsigned char value, FILE* file);
 void write(char value, FILE* file);
 void write(char value, FILE* file);
 void write(const char* str, FILE* file);
 void write(const char* str, FILE* file);
 void write(unsigned int value, FILE* file);
 void write(unsigned int value, FILE* file);
-void write(unsigned long value, FILE* file);
 void write(unsigned short value, FILE* file);
 void write(unsigned short value, FILE* file);
 void write(bool value, FILE* file);
 void write(bool value, FILE* file);
 void write(float value, FILE* file);
 void write(float value, FILE* file);
@@ -87,7 +86,7 @@ template <class T>
 void write(std::list<T> list, FILE* file)
 void write(std::list<T> list, FILE* file)
 {
 {
     // First write the size of the list
     // First write the size of the list
-    write(list.size(), file);
+    write((unsigned int)list.size(), file);
     // Then write each element
     // Then write each element
     typename std::list<T>::const_iterator i;
     typename std::list<T>::const_iterator i;
     for (i = list.begin(); i != list.end(); ++i)
     for (i = list.begin(); i != list.end(); ++i)
@@ -106,7 +105,7 @@ template <class T>
 void write(std::vector<T> vector, FILE* file)
 void write(std::vector<T> vector, FILE* file)
 {
 {
     // First write the size of the vector
     // First write the size of the vector
-    write(vector.size(), file);
+    write((unsigned int)vector.size(), file);
     // Then write each element
     // Then write each element
     typename std::vector<T>::const_iterator i;
     typename std::vector<T>::const_iterator i;
     for (i = vector.begin(); i != vector.end(); ++i)
     for (i = vector.begin(); i != vector.end(); ++i)

+ 2 - 2
gameplay-encoder/src/GPBFile.cpp

@@ -89,14 +89,14 @@ bool GPBFile::saveBinary(const std::string& filepath)
     _refTable.writeBinary(_file);
     _refTable.writeBinary(_file);
 
 
     // meshes
     // meshes
-    write(_geometry.size(), _file);
+    write((unsigned int)_geometry.size(), _file);
     for (std::list<Mesh*>::const_iterator i = _geometry.begin(); i != _geometry.end(); ++i)
     for (std::list<Mesh*>::const_iterator i = _geometry.begin(); i != _geometry.end(); ++i)
     {
     {
         (*i)->writeBinary(_file);
         (*i)->writeBinary(_file);
     }
     }
 
 
     // Objects
     // Objects
-    write(_objects.size(), _file);
+    write((unsigned int)_objects.size(), _file);
     for (std::list<Object*>::const_iterator i = _objects.begin(); i != _objects.end(); ++i)
     for (std::list<Object*>::const_iterator i = _objects.begin(); i != _objects.end(); ++i)
     {
     {
         (*i)->writeBinary(_file);
         (*i)->writeBinary(_file);

+ 2 - 2
gameplay-encoder/src/Mesh.cpp

@@ -27,7 +27,7 @@ void Mesh::writeBinary(FILE* file)
 {
 {
     Object::writeBinary(file);
     Object::writeBinary(file);
     // vertex formats
     // vertex formats
-    write(_vertexFormat.size(), file);
+    write((unsigned int)_vertexFormat.size(), file);
     for (std::vector<VertexElement>::iterator i = _vertexFormat.begin(); i != _vertexFormat.end(); ++i)
     for (std::vector<VertexElement>::iterator i = _vertexFormat.begin(); i != _vertexFormat.end(); ++i)
     {
     {
         i->writeBinary(file);
         i->writeBinary(file);
@@ -45,7 +45,7 @@ void Mesh::writeBinaryVertices(FILE* file)
         // Assumes that all vertices are the same size.
         // Assumes that all vertices are the same size.
         // Write the number of bytes for the vertex data
         // Write the number of bytes for the vertex data
         const Vertex& vertex = vertices.front();
         const Vertex& vertex = vertices.front();
-        write(vertices.size() * vertex.byteSize(), file); // (vertex count) * (vertex size)
+        write((unsigned int)(vertices.size() * vertex.byteSize()), file); // (vertex count) * (vertex size)
 
 
         // for each vertex
         // for each vertex
         for (std::vector<Vertex>::const_iterator i = vertices.begin(); i != vertices.end(); ++i)
         for (std::vector<Vertex>::const_iterator i = vertices.begin(); i != vertices.end(); ++i)

+ 2 - 2
gameplay-encoder/src/MeshSkin.cpp

@@ -36,12 +36,12 @@ void MeshSkin::writeBinary(FILE* file)
 {
 {
     Object::writeBinary(file);
     Object::writeBinary(file);
     write(_bindShape, 16, file);
     write(_bindShape, 16, file);
-    write(_joints.size(), file);
+    write((unsigned int)_joints.size(), file);
     for (std::vector<Node*>::const_iterator i = _joints.begin(); i != _joints.end(); ++i)
     for (std::vector<Node*>::const_iterator i = _joints.begin(); i != _joints.end(); ++i)
     {
     {
         (*i)->writeBinaryXref(file);
         (*i)->writeBinaryXref(file);
     }
     }
-    write(_bindPoses.size() * 16, file);
+    write((unsigned int)_bindPoses.size() * 16, file);
     for (std::vector<Matrix>::const_iterator i = _bindPoses.begin(); i != _bindPoses.end(); ++i)
     for (std::vector<Matrix>::const_iterator i = _bindPoses.begin(); i != _bindPoses.end(); ++i)
     {
     {
         write(i->m, 16, file);
         write(i->m, 16, file);

+ 2 - 2
gameplay-encoder/src/Object.h

@@ -109,7 +109,7 @@ public:
     static void writeBinaryObjects(std::list<T> list, FILE* file)
     static void writeBinaryObjects(std::list<T> list, FILE* file)
     {
     {
         // First write the size of the list
         // First write the size of the list
-        write(list.size(), file);
+        write((unsigned int)list.size(), file);
         // Then write each element
         // Then write each element
         typename std::list<T>::const_iterator i;
         typename std::list<T>::const_iterator i;
         for (i = list.begin(); i != list.end(); ++i)
         for (i = list.begin(); i != list.end(); ++i)
@@ -125,7 +125,7 @@ public:
     static void writeBinaryObjects(std::vector<T> vector, FILE* file)
     static void writeBinaryObjects(std::vector<T> vector, FILE* file)
     {
     {
         // First write the size of the vector
         // First write the size of the vector
-        write(vector.size(), file);
+        write((unsigned int)vector.size(), file);
         // Then write each element
         // Then write each element
         typename std::vector<T>::const_iterator i;
         typename std::vector<T>::const_iterator i;
         for (i = vector.begin(); i != vector.end(); ++i)
         for (i = vector.begin(); i != vector.end(); ++i)

+ 1 - 1
gameplay-encoder/src/ReferenceTable.cpp

@@ -30,7 +30,7 @@ Object* ReferenceTable::get(const std::string& xref)
 
 
 void ReferenceTable::writeBinary(FILE* file)
 void ReferenceTable::writeBinary(FILE* file)
 {
 {
-    write(_table.size(), file);
+    write((unsigned int)_table.size(), file);
     for ( std::map<std::string, Reference>::iterator i=_table.begin() ; i != _table.end(); ++i)
     for ( std::map<std::string, Reference>::iterator i=_table.begin() ; i != _table.end(); ++i)
     {
     {
         i->second.writeBinary(file);
         i->second.writeBinary(file);