[Scummvm-cvs-logs] SF.net SVN: scummvm: [28635] tools/branches/gsoc2007-toolsgui/tools_gui.cpp

lightcast at users.sourceforge.net lightcast at users.sourceforge.net
Thu Aug 16 09:03:20 CEST 2007


Revision: 28635
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28635&view=rev
Author:   lightcast
Date:     2007-08-16 00:03:20 -0700 (Thu, 16 Aug 2007)

Log Message:
-----------
Fixed a bug that occurred on Unicode versions of wxWidgets.  When the end of the wxInputStream is reached the function GetC() would return an undefined value.  Since this value was not a valid ASCII value it would cause an assert failure.  Now we check to make sure we read a valid character before displaying it.

Modified Paths:
--------------
    tools/branches/gsoc2007-toolsgui/tools_gui.cpp

Modified: tools/branches/gsoc2007-toolsgui/tools_gui.cpp
===================================================================
--- tools/branches/gsoc2007-toolsgui/tools_gui.cpp	2007-08-16 06:37:51 UTC (rev 28634)
+++ tools/branches/gsoc2007-toolsgui/tools_gui.cpp	2007-08-16 07:03:20 UTC (rev 28635)
@@ -98,7 +98,7 @@
 void LocationDialog::prompt() {
 	if (this->_isFileChooser) {
 		wxFileDialog *dialog = dynamic_cast<wxFileDialog*>(_dialog);
-	
+
 		if (dialog->ShowModal() == wxID_OK) {
 			wxArrayString filenames;
 			dialog->GetPaths(filenames);
@@ -606,7 +606,7 @@
 void CompressionPanel::OnCompressionInputBrowse(wxCommandEvent &event) {
 	LocationDialog *dialog = new LocationDialog(this->_inputPanel->_text, this->_inputPanel->_isFileChooser, wxT("*.*"));
 	dialog->prompt();
-	
+
 	dialog->_dialog->Destroy();
 	delete dialog;
 }
@@ -614,7 +614,7 @@
 void CompressionPanel::OnCompressionOutputBrowse(wxCommandEvent &event) {
 	LocationDialog *dialog = new LocationDialog(this->_outputPanel->_text, this->_outputPanel->_isFileChooser, wxT("*.*"));
 	dialog->prompt();
-	
+
 	dialog->_dialog->Destroy();
 	delete dialog;
 }
@@ -689,7 +689,7 @@
 					}
 				} else { /* ABR */
 					commandString += wxT("--abr ");
-					
+
 					if (avgBitrate.IsSameAs(kValidBitrateNames[0])) {
 						commandString += kDefaultMP3ABRAvgBitrate;
 					} else {
@@ -748,7 +748,7 @@
 				commandString += wxT("-b ");
 				commandString += blocksize;
 				commandString += wxT(" ");
-				
+
 				if (isVerify) {
 					commandString += wxT("--verify ");
 				}
@@ -773,7 +773,9 @@
 
 			while (!command->GetInputStream()->Eof()) {
 				wxChar outputChar = command->GetInputStream()->GetC();
-				this->_toolOutput->AppendText(outputChar);
+				if (command->GetInputStream()->LastRead() != 0) {
+					this->_toolOutput->AppendText(outputChar);
+				}
 			}
 
 			this->_toolOutput->AppendText(wxT("\n------------------------------\n"));
@@ -927,7 +929,7 @@
 void ExtractionPanel::OnExtractionOutputBrowse(wxCommandEvent &event) {
 	LocationDialog *dialog = new LocationDialog(this->_outputPanel->_text, this->_outputPanel->_isFileChooser, wxT("*.*"));
 	dialog->prompt();
-	
+
 	dialog->_dialog->Destroy();
 	delete dialog;
 }
@@ -939,7 +941,7 @@
 	bool done = false;
 	size_t start = 1;
 	size_t end;
-	
+
 	wxString selectedTool = kExtractionToolFilenames[this->_extractionToolChooserPanel->_choice->GetSelection()];
 	wxString input1Path = this->_input1Panel->_text->GetValue();
 	wxString input2Path = this->_input2Panel->_text->GetValue();
@@ -951,7 +953,7 @@
 	wxString kyraFilename = this->_extractionOptionsPanel->_kyraFilename->GetValue();
 	bool kyraSingleFile = this->_extractionOptionsPanel->_kyraSingleFile->IsChecked();
 	bool parallactionSmall = this->_extractionOptionsPanel->_parallactionSmall->IsChecked();
-	
+
 	if (!input1Path.IsEmpty()) {
 		while (!done) {
 			end = input1Path.find(wxT('"'), start);
@@ -975,11 +977,11 @@
 			if (kyraAllFiles) {
 				commandString += wxT("-x ");
 			}
-			
+
 			if (kyraAmiga) {
 				commandString += wxT("-a ");
 			}
-			
+
 			if (kyraSingleFile) {
 				commandString += wxT("-o ");
 				commandString += kyraFilename;
@@ -991,7 +993,7 @@
 			}
 
 			commandString += inputFiles.Item(x);
-			
+
 			if (!input2Path.IsEmpty()) {
 				commandString += wxT(" ");
 				commandString += input2Path;
@@ -1009,7 +1011,9 @@
 
 			while (!command->GetInputStream()->Eof()) {
 				wxChar outputChar = command->GetInputStream()->GetC();
-				this->_toolOutput->AppendText(outputChar);
+				if (command->GetInputStream()->LastRead() != 0) {
+					this->_toolOutput->AppendText(outputChar);
+				}
 			}
 
 			this->_toolOutput->AppendText(wxT("\n------------------------------\n"));
@@ -1018,7 +1022,7 @@
 			this->_toolOutput->AppendText(wxT("\n"));
 		}
 	}
-	
+
 	this->_startButton->Enable(true);
 }
 


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




More information about the Scummvm-git-logs mailing list