goat3d

changeset 94:21319e71117f

[libs] fixed a few warnings in openctm [goatview] starting animation loading
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 18 May 2014 19:58:47 +0300
parents 07c0ec4a410d
children da100bf13f7f
files goatview/src/goatview.cc goatview/src/main.cc libs/openctm/openctm.c libs/openctm/stream.c src/goat3d_readxml.cc
diffstat 5 files changed, 23 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/goatview/src/goatview.cc	Sun May 18 06:20:20 2014 +0300
     1.2 +++ b/goatview/src/goatview.cc	Sun May 18 19:58:47 2014 +0300
     1.3 @@ -233,12 +233,26 @@
     1.4  	statusBar()->showMessage("opening scene file");
     1.5  	if(!load_scene(fname.c_str())) {
     1.6  		statusBar()->showMessage("failed to load scene file");
     1.7 +		return;
     1.8  	}
     1.9 +	statusBar()->showMessage("Successfully loaded scene: " + QString(fname));
    1.10  }
    1.11  
    1.12  void GoatView::open_anim()
    1.13  {
    1.14 -	statusBar()->showMessage("opening animation...");
    1.15 +	std::string fname = QFileDialog::getOpenFileName(this, "Open animation file", "",
    1.16 +		"Goat3D Animation (*.goatanm);;All Files (*)").toStdString();
    1.17 +	if(fname.empty()) {
    1.18 +		statusBar()->showMessage("Abot: No file selected!");
    1.19 +		return;
    1.20 +	}
    1.21 +
    1.22 +	statusBar()->showMessage("opening animation file");
    1.23 +	if(!load_anim(fname.c_str())) {
    1.24 +		statusBar()->showMessage("failed to load animation file");
    1.25 +		return;
    1.26 +	}
    1.27 +	statusBar()->showMessage("Successfully loaded animation: " + QString(fname));
    1.28  }
    1.29  
    1.30  
     2.1 --- a/goatview/src/main.cc	Sun May 18 06:20:20 2014 +0300
     2.2 +++ b/goatview/src/main.cc	Sun May 18 19:58:47 2014 +0300
     2.3 @@ -16,7 +16,7 @@
     2.4  
     2.5  	argparse.addPositionalArgument("scene", "scene file to open");
     2.6  	argparse.addOption(QCommandLineOption("a", "add animation file"));
     2.7 -	argparse.process(app);
     2.8 +	argparse.parse(app.arguments());
     2.9  
    2.10  	const QStringList &args = argparse.positionalArguments();
    2.11  	if(!args.isEmpty()) {
     3.1 --- a/libs/openctm/openctm.c	Sun May 18 06:20:20 2014 +0300
     3.2 +++ b/libs/openctm/openctm.c	Sun May 18 19:58:47 2014 +0300
     3.3 @@ -913,7 +913,7 @@
     3.4    // Get length of string (if empty, do nothing)
     3.5    if(!aFileComment)
     3.6      return;
     3.7 -  len = strlen(aFileComment);
     3.8 +  len = (int)strlen(aFileComment);
     3.9    if(!len)
    3.10      return;
    3.11  
    3.12 @@ -1005,7 +1005,7 @@
    3.13    if(aName)
    3.14    {
    3.15      // Get length of string (if empty, do nothing)
    3.16 -    len = strlen(aName);
    3.17 +    len = (CTMuint)strlen(aName);
    3.18      if(len)
    3.19      {
    3.20        // Copy the string
    3.21 @@ -1024,7 +1024,7 @@
    3.22    if(aFileName)
    3.23    {
    3.24      // Get length of string (if empty, do nothing)
    3.25 -    len = strlen(aFileName);
    3.26 +    len = (CTMuint)strlen(aFileName);
    3.27      if(len)
    3.28      {
    3.29        // Copy the string
     4.1 --- a/libs/openctm/stream.c	Sun May 18 06:20:20 2014 +0300
     4.2 +++ b/libs/openctm/stream.c	Sun May 18 19:58:47 2014 +0300
     4.3 @@ -155,7 +155,7 @@
     4.4  
     4.5    // Get string length
     4.6    if(aValue)
     4.7 -    len = strlen(aValue);
     4.8 +    len = (CTMuint)strlen(aValue);
     4.9    else
    4.10      len = 0;
    4.11  
    4.12 @@ -194,7 +194,7 @@
    4.13      self->mError = CTM_OUT_OF_MEMORY;
    4.14      return CTM_FALSE;
    4.15    }
    4.16 -  _ctmStreamRead(self, (void *) packed, packedSize);
    4.17 +  _ctmStreamRead(self, (void *) packed, (CTMuint)packedSize);
    4.18  
    4.19    // Allocate memory for interleaved array
    4.20    tmp = (unsigned char *) malloc(aCount * aSize * 4);
    4.21 @@ -374,7 +374,7 @@
    4.22      self->mError = CTM_OUT_OF_MEMORY;
    4.23      return CTM_FALSE;
    4.24    }
    4.25 -  _ctmStreamRead(self, (void *) packed, packedSize);
    4.26 +  _ctmStreamRead(self, (void *) packed, (CTMuint)packedSize);
    4.27  
    4.28    // Allocate memory for interleaved array
    4.29    tmp = (unsigned char *) malloc(aCount * aSize * 4);
     5.1 --- a/src/goat3d_readxml.cc	Sun May 18 06:20:20 2014 +0300
     5.2 +++ b/src/goat3d_readxml.cc	Sun May 18 19:58:47 2014 +0300
     5.3 @@ -175,7 +175,7 @@
     5.4  
     5.5  static const char *read_material_attrib(MaterialAttrib *attr, XMLElement *xml_attr)
     5.6  {
     5.7 -	const char *name;
     5.8 +	const char *name = 0;
     5.9  
    5.10  	XMLElement *elem;
    5.11  	if((elem = xml_attr->FirstChildElement("name"))) {