Просмотр исходного кода

AssxmlExporter: fix crash in writing header info in VS2015.

Kim Kulling 9 лет назад
Родитель
Сommit
dec93efc92
3 измененных файлов с 17 добавлено и 17 удалено
  1. 7 7
      code/AssxmlExporter.cpp
  2. 7 7
      test/regression/ai_regression_ui.py
  3. 3 3
      test/regression/run.py

+ 7 - 7
code/AssxmlExporter.cpp

@@ -180,23 +180,22 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened)
     time_t tt = ::time(NULL);
     tm* p     = ::gmtime(&tt);
 
-    aiString name;
-
     // write header
-    ioprintf(io,
+    std::string header(
         "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
         "<ASSIMP format_id=\"1\">\n\n"
-
         "<!-- XML Model dump produced by assimp dump\n"
         "  Library version: %i.%i.%i\n"
         "  %s\n"
         "-->"
         " \n\n"
-        "<Scene flags=\"%i\" postprocessing=\"%i\">\n",
+        "<Scene flags=\"%i\" postprocessing=\"%i\">\n"
+    );
 
-        aiGetVersionMajor(),aiGetVersionMinor(),aiGetVersionRevision(),asctime(p),
+    ioprintf( io, header.c_str(),
+        aiGetVersionMajor(), aiGetVersionMinor(), aiGetVersionRevision(), asctime( p ),
         scene->mFlags,
-        0 /*globalImporter->GetEffectivePostProcessing()*/);
+        0 /*globalImporter->GetEffectivePostProcessing()*/ );
 
     // write the node graph
     WriteNode(scene->mRootNode, io, 0);
@@ -266,6 +265,7 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened)
         ioprintf(io,"\t</Light>\n");
     }
 #endif
+    aiString name;
 
     // write textures
     if (scene->mNumTextures) {

+ 7 - 7
test/regression/ai_regression_ui.py

@@ -39,7 +39,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 # ---------------------------------------------------------------------------
-from Tkinter import *
+from tkinter import *
 import sys
 import run
 import result_checker as rc
@@ -54,7 +54,7 @@ class RegDialog( object ):
         
         
     def run_reg(self):
-        print "run_reg"
+        print( "run_reg" )
         run.setEnvVar( "assimp_path", self.assimp_bin_path )
         run.run_test()
         rc.run()
@@ -62,11 +62,11 @@ class RegDialog( object ):
         return 0
 
     def reg_update(self):
-        print "ToDo!"
+        print( "ToDo!" )
         return 0
     
     def quit(self):
-        print "quit"
+        print( "quit" )
         sys.exit( 0 )
 
     def initUi(self):
@@ -78,9 +78,9 @@ class RegDialog( object ):
         self.b_run_.grid( row = 0, column = 0, sticky = W+E)
         self.b_update_.grid( row = 1, column = 0, sticky = W+E)
         self.b_quit_.grid( row = 2, column = 0, sticky = W+E)
-        self.b_run_.pack()
-        self.b_update_.pack()
-        self.b_quit_.pack()
+        #self.b_run_.pack()
+        #self.b_update_.pack()
+        #self.b_quit_.pack()
         self.b_update_.config( state=DISABLED )
         root.mainloop()
 

+ 3 - 3
test/regression/run.py

@@ -163,7 +163,7 @@ def setEnvVar( var, value ):
 
 # -------------------------------------------------------------------------------
 def getEnvVar( var ):
-    if Environment.has_key( var ):
+    if var in Environment:
         return Environment[ var ]
     else:
         print ( "Error: cannot find " + var )
@@ -217,12 +217,12 @@ def process_dir(d, outfile_results, zipin, result ):
             outfile_results.write("assimp dump    "+"-"*80+"\n")
             outfile_results.flush()
             assimp_bin_path = getEnvVar("assimp_path")
-            print( "assimp_bin_path = " + assimp_bin_pat )
+            print( "assimp_bin_path = " + assimp_bin_path )
             command = [assimp_bin_path,
                 "dump",
                 fullpath, outfile_actual, "-b", "-s", "-l" ] +\
                 pppreset.split()
-            print(command = " + command )
+            print( "command = " + str( command ) )
             r = subprocess.call(command, **shellparams)
             outfile_results.flush()