[DebianGIS-dev] [SCM] saga branch, master, updated. 8d77db9c10c3da41cefa89b98ef6c4e858e30f83

Johan Van de Wauw johan.vandewauw at gmail.com
Wed May 5 12:38:05 UTC 2010


The following commit has been merged in the master branch:
commit 8d77db9c10c3da41cefa89b98ef6c4e858e30f83
Author: Johan Van de Wauw <johan.vandewauw at gmail.com>
Date:   Wed May 5 13:37:39 2010 +0200

    Fix bug: printf() crashes
    
    upstream commit of 2010-03-24:
    saga_api serious bug fix: csg_string::printf() used without argument
    list leads potentially to program crash

diff --git a/src/saga_core/saga_api/api_file.cpp b/src/saga_core/saga_api/api_file.cpp
index 7237b48..97ebb0c 100644
--- a/src/saga_core/saga_api/api_file.cpp
+++ b/src/saga_core/saga_api/api_file.cpp
@@ -418,7 +418,7 @@ CSG_String		SG_File_Get_Name(const SG_Char *full_Path, bool bExtension)
 	wxFileName	fn(full_Path);
 	CSG_String	s;
 
-	s.Printf(bExtension ? fn.GetFullName().c_str() : fn.GetName().c_str());
+	s = (bExtension ? fn.GetFullName().c_str() : fn.GetName().c_str());
 
 	return( s );
 }
diff --git a/src/saga_core/saga_api/dataobject.cpp b/src/saga_core/saga_api/dataobject.cpp
index 3ecd3cc..556a1a2 100644
--- a/src/saga_core/saga_api/dataobject.cpp
+++ b/src/saga_core/saga_api/dataobject.cpp
@@ -154,7 +154,7 @@ bool CSG_Data_Object::Destroy(void)
 //---------------------------------------------------------
 void CSG_Data_Object::Set_Name(const SG_Char *Name)
 {
-	m_Name.Printf(Name ? CSG_String(Name).c_str() : LNG("[DAT] new") );
+	m_Name = Name ? CSG_String(Name).c_str() : LNG("[DAT] new") ;
 }
 
 const SG_Char * CSG_Data_Object::Get_Name(void) const
@@ -167,7 +167,7 @@ void CSG_Data_Object::Set_File_Name(const SG_Char *File_Name)
 {
 	if( File_Name )
 	{
-		m_File_Name.Printf(File_Name);
+		m_File_Name = File_Name;
 
 		m_Name	= SG_File_Get_Name(File_Name, false);
 
diff --git a/src/saga_core/saga_api/grid.cpp b/src/saga_core/saga_api/grid.cpp
index 3d45403..c208cfc 100644
--- a/src/saga_core/saga_api/grid.cpp
+++ b/src/saga_core/saga_api/grid.cpp
@@ -360,7 +360,7 @@ void CSG_Grid::_Set_Properties(TSG_Data_Type Type, int NX, int NY, double Cellsi
 //---------------------------------------------------------
 void CSG_Grid::Set_Description(const SG_Char *String)
 {
-	m_Description.Printf(String ? String : SG_T(""));
+	m_Description = String ? String : SG_T("");
 }
 
 const SG_Char * CSG_Grid::Get_Description(void) const
@@ -371,7 +371,7 @@ const SG_Char * CSG_Grid::Get_Description(void) const
 //---------------------------------------------------------
 void CSG_Grid::Set_Unit(const SG_Char *String)
 {
-	m_Unit.Printf(String ? String : SG_T(""));
+	m_Unit = String ? String : SG_T("");
 }
 
 const SG_Char * CSG_Grid::Get_Unit(void) const
diff --git a/src/saga_core/saga_api/grid_io.cpp b/src/saga_core/saga_api/grid_io.cpp
index 29cdbb1..914a3c9 100644
--- a/src/saga_core/saga_api/grid_io.cpp
+++ b/src/saga_core/saga_api/grid_io.cpp
@@ -786,7 +786,7 @@ int CSG_Grid::_Load_Native_Get_Key(CSG_File &Stream, CSG_String &Value)
 
 	if( Stream.Read_Line(sLine) && (i = sLine.Find('=')) > 0 )
 	{
-		Value.Printf(sLine.AfterFirst('='));
+		Value = sLine.AfterFirst('=');
 		Value.Trim();
 
 		sLine.Remove(i);
diff --git a/src/saga_core/saga_api/grid_memory.cpp b/src/saga_core/saga_api/grid_memory.cpp
index 7dcbc0e..be86f3c 100644
--- a/src/saga_core/saga_api/grid_memory.cpp
+++ b/src/saga_core/saga_api/grid_memory.cpp
@@ -84,7 +84,7 @@ void				SG_Grid_Cache_Set_Directory(const SG_Char *Directory)
 {
 	if( SG_Dir_Exists(Directory) )
 	{
-		gSG_Grid_Cache_Directory.Printf(Directory);
+		gSG_Grid_Cache_Directory = Directory;
 	}
 }
 
@@ -584,7 +584,7 @@ bool CSG_Grid::_Cache_Create(const SG_Char *FilePath, TSG_Data_Type File_Type, l
 {
 	if( m_System.is_Valid() && m_Type != SG_DATATYPE_Undefined && m_Memory_Type == GRID_MEMORY_Normal )
 	{
-		Cache_Path.Printf(FilePath);
+		Cache_Path =FilePath;
 
 		if( m_Type == File_Type
 		&&	(	Cache_Stream.Open(Cache_Path, SG_FILE_RWA, true)
diff --git a/src/saga_core/saga_api/module.cpp b/src/saga_core/saga_api/module.cpp
index 6b09b46..5dd2d05 100644
--- a/src/saga_core/saga_api/module.cpp
+++ b/src/saga_core/saga_api/module.cpp
@@ -160,7 +160,7 @@ void CSG_Module::Set_Author(const SG_Char *String)
 {
 	if( String )
 	{
-		m_Author.Printf(String);
+		m_Author = String;
 	}
 	else
 	{
diff --git a/src/saga_core/saga_api/parameter_data.cpp b/src/saga_core/saga_api/parameter_data.cpp
index e8b3d83..7a90f32 100644
--- a/src/saga_core/saga_api/parameter_data.cpp
+++ b/src/saga_core/saga_api/parameter_data.cpp
@@ -853,7 +853,7 @@ bool CSG_Parameter_String::Set_Value(void *Value)
 	{
 		if( m_String.Cmp((SG_Char *)Value) )
 		{
-			m_String.Printf((SG_Char *)Value);
+			m_String = (SG_Char *)Value;
 
 			return( true );
 		}
@@ -877,7 +877,7 @@ const SG_Char * CSG_Parameter_String::asString(void)
 //---------------------------------------------------------
 void CSG_Parameter_String::On_Assign(CSG_Parameter_Data *pSource)
 {
-	m_String.Printf(((CSG_Parameter_String *)pSource)->m_String.c_str());
+	m_String =((CSG_Parameter_String *)pSource)->m_String.c_str();
 
 	bPassword	= ((CSG_Parameter_String *)pSource)->bPassword;
 }
diff --git a/src/saga_core/saga_api/parameters.cpp b/src/saga_core/saga_api/parameters.cpp
index 4cce99e..9a84302 100644
--- a/src/saga_core/saga_api/parameters.cpp
+++ b/src/saga_core/saga_api/parameters.cpp
@@ -165,7 +165,7 @@ void CSG_Parameters::Set_Identifier(const SG_Char *String)
 {
 	if( String )
 	{
-		m_Identifier.Printf(String);
+		m_Identifier =String;
 	}
 	else
 	{
@@ -183,7 +183,7 @@ void CSG_Parameters::Set_Name(const SG_Char *String)
 {
 	if( String )
 	{
-		m_Name.Printf(String);
+		m_Name = String;
 	}
 	else
 	{
diff --git a/src/saga_core/saga_api/table_io.cpp b/src/saga_core/saga_api/table_io.cpp
index 0413044..ce43ac4 100644
--- a/src/saga_core/saga_api/table_io.cpp
+++ b/src/saga_core/saga_api/table_io.cpp
@@ -241,7 +241,7 @@ bool CSG_Table::_Load_Text(const CSG_String &File_Name, bool bHeadline, const SG
 
 	while( (i = sLine.Find(Separator)) >= 0 )
 	{
-		sField.Printf(bHeadline ? sLine.Left(i) : SG_T("FIELD_%02d"), Table.Get_Field_Count() + 1);
+		sField = bHeadline ? sLine.Left(i) : CSG_String::Format(SG_T("FIELD_%02d"), Table.Get_Field_Count() + 1);
 
 		if( sField[0] == SG_T('\"') && sField[(int)(sField.Length() - 1)] == SG_T('\"') )	// remove quota
 		{
diff --git a/src/saga_core/saga_api/table_value.h b/src/saga_core/saga_api/table_value.h
index b440846..ad47899 100644
--- a/src/saga_core/saga_api/table_value.h
+++ b/src/saga_core/saga_api/table_value.h
@@ -137,7 +137,7 @@ public:
 	{
 		if( Value && m_Value.Cmp(Value) )
 		{
-			m_Value.Printf(Value);
+			m_Value = Value;
 
 			return( true );
 		}

-- 
Saga GIS



More information about the Pkg-grass-devel mailing list