[Scummvm-cvs-logs] SF.net SVN: scummvm: [24328] scummvm/trunk/engines/scumm/he

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Oct 15 04:00:42 CEST 2006


Revision: 24328
          http://svn.sourceforge.net/scummvm/?rev=24328&view=rev
Author:   fingolfin
Date:     2006-10-14 19:00:37 -0700 (Sat, 14 Oct 2006)

Log Message:
-----------
Moved get_resource_id_quoted around a bit and added another FIXME comment

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/he/resource_he.cpp
    scummvm/trunk/engines/scumm/he/resource_he.h

Modified: scummvm/trunk/engines/scumm/he/resource_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/resource_he.cpp	2006-10-15 01:51:02 UTC (rev 24327)
+++ scummvm/trunk/engines/scumm/he/resource_he.cpp	2006-10-15 02:00:37 UTC (rev 24328)
@@ -245,6 +245,20 @@
 	return type;
 }
 
+/* return the resource id quoted if it's a string, otherwise just return it */
+char *Win32ResExtractor::WinResource::get_resource_id_quoted() {
+	// FIXME: Using a static var here is EVIL and in fact, broken when
+	// used multiple times in a row, e.g. in a single call to printf()
+	// or debug()... which is in fact how we use this function... :-)
+	static char tmp[WINRES_ID_MAXLEN+2];
+
+	if (numeric_id || id[0] == '\0')
+		return id;
+
+	sprintf(tmp, "'%s'", id);
+	return tmp;
+}
+
 int Win32ResExtractor::extract_resources(WinLibrary *fi, WinResource *wr,
                             WinResource *type_wr, WinResource *name_wr,
 							WinResource *lang_wr, byte **data) {
@@ -271,9 +285,9 @@
 		type = res_type_id_to_string(id);
 
 	debugC(DEBUG_RESOURCE, "extractCursor(). Found cursor name: %s%s%s [size=%d]",
-	  get_resource_id_quoted(name_wr),
+	  name_wr->get_resource_id_quoted(),
 	  (lang_wr->id[0] != '\0' ? " language: " : ""),
-	  get_resource_id_quoted(lang_wr), size);
+	  lang_wr->get_resource_id_quoted(), size);
 
 	return size;
 }
@@ -536,17 +550,6 @@
 	return size;
 }
 
-/* return the resource id quoted if it's a string, otherwise just return it */
-char *Win32ResExtractor::get_resource_id_quoted(WinResource *wr) {
-	static char tmp[WINRES_ID_MAXLEN+2];
-
-	if (wr->numeric_id || wr->id[0] == '\0')
-		return wr->id;
-
-	sprintf(tmp, "'%s'", wr->id);
-	return tmp;
-}
-
 bool Win32ResExtractor::compare_resource_id(WinResource *wr, const char *id) {
 	if (wr->numeric_id) {
 		int32 cmp1, cmp2;

Modified: scummvm/trunk/engines/scumm/he/resource_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/resource_he.h	2006-10-15 01:51:02 UTC (rev 24327)
+++ scummvm/trunk/engines/scumm/he/resource_he.h	2006-10-15 02:00:37 UTC (rev 24328)
@@ -189,6 +189,8 @@
 		int level;
 		bool numeric_id;
 		bool is_directory;
+		
+		char *get_resource_id_quoted();
 	};
 
 
@@ -482,7 +484,6 @@
 	WinResource *list_pe_resources(WinLibrary *, Win32ImageResourceDirectory *, int, int *);
 	int calc_vma_size(WinLibrary *);
 	int do_resources_recurs(WinLibrary *, WinResource *, WinResource *, WinResource *, WinResource *, const char *, char *, char *, int, byte **);
-	char *get_resource_id_quoted(WinResource *);
 	WinResource *find_with_resource_array(WinLibrary *, WinResource *, const char *);
 
 	bool check_offset(byte *, int, const char *, void *, int);


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