aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he
diff options
context:
space:
mode:
authorMax Horn2006-10-15 02:00:37 +0000
committerMax Horn2006-10-15 02:00:37 +0000
commita9b0a055c82ca7f8afd510f8719c3418f336c976 (patch)
tree8a28a6f1d5be948a512d0fac89fa17fcc48cfd0d /engines/scumm/he
parent548cb2fbadece7d45a6b4a606385d953f46ffb6a (diff)
downloadscummvm-rg350-a9b0a055c82ca7f8afd510f8719c3418f336c976.tar.gz
scummvm-rg350-a9b0a055c82ca7f8afd510f8719c3418f336c976.tar.bz2
scummvm-rg350-a9b0a055c82ca7f8afd510f8719c3418f336c976.zip
Moved get_resource_id_quoted around a bit and added another FIXME comment
svn-id: r24328
Diffstat (limited to 'engines/scumm/he')
-rw-r--r--engines/scumm/he/resource_he.cpp29
-rw-r--r--engines/scumm/he/resource_he.h3
2 files changed, 18 insertions, 14 deletions
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index 1ac91c9516..de566ac928 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -245,6 +245,20 @@ const char *Win32ResExtractor::res_type_string_to_id(const char *type) {
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 @@ int Win32ResExtractor::extract_resources(WinLibrary *fi, WinResource *wr,
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 @@ int Win32ResExtractor::do_resources_recurs(WinLibrary *fi, WinResource *base,
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;
diff --git a/engines/scumm/he/resource_he.h b/engines/scumm/he/resource_he.h
index 634d5d9494..768e7b1fff 100644
--- a/engines/scumm/he/resource_he.h
+++ b/engines/scumm/he/resource_he.h
@@ -189,6 +189,8 @@ class Win32ResExtractor : public ResExtractor {
int level;
bool numeric_id;
bool is_directory;
+
+ char *get_resource_id_quoted();
};
@@ -482,7 +484,6 @@ class Win32ResExtractor : public ResExtractor {
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);