Hi.  Here is another patch for leocad from the Debian packaging work.
Please include it in a future version of the source.

-- 
Happy hacking
Petter Reinholdtsen
Get rid of these warnings from gcc version 4.4.5, and avoid duplicate
code:

common/project.cpp: In member function ‘void Project::HandleCommand(LC_COMMANDS, long unsigned int)’:
common/project.cpp:3707: warning: deprecated conversion from string constant to ‘char*’
common/project.cpp:3708: warning: deprecated conversion from string constant to ‘char*’
common/project.cpp:3709: warning: deprecated conversion from string constant to ‘char*’
common/project.cpp:3710: warning: deprecated conversion from string constant to ‘char*’
common/project.cpp:3711: warning: deprecated conversion from string constant to ‘char*’

diff --git a/common/project.cpp b/common/project.cpp
index f170e20..72e704f 100644
--- a/common/project.cpp
+++ b/common/project.cpp
@@ -3575,6 +3575,23 @@ void Project::HandleMessage(int Message, void* Data)
 	}
 }
 
+static char *imageformat2ext(unsigned int format, bool defaultext)
+{
+	char *ext = (char*)"";
+	switch (format)
+	{
+	case LC_IMAGE_BMP: ext = (char*)".bmp"; break;
+	case LC_IMAGE_GIF: ext = (char*)".gif"; break;
+	case LC_IMAGE_JPG: ext = (char*)".jpg"; break;
+	case LC_IMAGE_PNG: ext = (char*)".png"; break;
+	case LC_IMAGE_AVI: ext = (char*)".avi"; break;
+	default:
+		if (defaultext)
+			ext = (char*)".gif";
+	}
+	return ext;
+}
+
 // Handle (almost) all menu/toolbar commands here.
 void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
 {
@@ -3665,14 +3682,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
 				if (ext && (!stricmp(ext, ".lcd") || !stricmp(ext, ".dat") || !stricmp(ext, ".ldr")))
 					*ext = 0;
 
-				switch (opts.imopts.format)
-				{
-				case LC_IMAGE_BMP: strcat(opts.filename, ".bmp"); break;
-				case LC_IMAGE_GIF: strcat(opts.filename, ".gif"); break;
-				case LC_IMAGE_JPG: strcat(opts.filename, ".jpg"); break;
-				case LC_IMAGE_PNG: strcat(opts.filename, ".png"); break;
-				case LC_IMAGE_AVI: strcat(opts.filename, ".avi"); break;
-				}
+				strcat(opts.filename, imageformat2ext(opts.imopts.format, false));
 			}
 
 			if (SystemDoDialog(LC_DLG_PICTURE_SAVE, &opts))
@@ -3702,14 +3712,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
 						*ext = 0;
 				}
 
-				switch (opts.imopts.format)
-				{
-				case LC_IMAGE_BMP: ext = ".bmp"; break;
-				case LC_IMAGE_GIF: ext = ".gif"; break;
-				case LC_IMAGE_JPG: ext = ".jpg"; break;
-				case LC_IMAGE_PNG: ext = ".png"; break;
-				case LC_IMAGE_AVI: ext = ".avi"; break;
-				}
+				ext = imageformat2ext(opts.imopts.format, false);
 
 				if (m_bAnimation)
 					opts.to = lcMin(opts.to, m_nTotalFrames);
@@ -3842,14 +3845,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
 				Sys_ProfileSaveInt ("Default", "HTML Image Width", opts.imdlg.width);
 				Sys_ProfileSaveInt ("Default", "HTML Image Height", opts.imdlg.height);
 
-				switch (opts.imdlg.imopts.format)
-				{
-				case LC_IMAGE_BMP: ext = ".bmp"; break;
-				default:
-				case LC_IMAGE_GIF: ext = ".gif"; break;
-				case LC_IMAGE_JPG: ext = ".jpg"; break;
-				case LC_IMAGE_PNG: ext = ".png"; break;
-				}
+				ext = imageformat2ext(opts.imdlg.imopts.format, true);
 
 				htmlext = ".html";
 
_______________________________________________
Leocad mailing list
[email protected]
https://list.gerf.org/listinfo/leocad

Reply via email to