https://github.com/libsdl-org/Maelstrom/commit/9ac241f09b178b4467f3fe24017eee568751a39d
From 9ac241f09b178b4467f3fe24017eee568751a39d Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 6 Nov 2012 00:44:21 -0800
Subject: [PATCH] Switched from fprintf to SDL_Log() which is more portable
---
screenlib/UIBaseElement.cpp | 6 +++---
screenlib/UIContainer.cpp | 2 +-
screenlib/UIElement.cpp | 8 ++++----
screenlib/UIElementButton.cpp | 2 +-
screenlib/UIManager.cpp | 10 +++++-----
screenlib/UITemplates.cpp | 2 +-
6 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/screenlib/UIBaseElement.cpp b/screenlib/UIBaseElement.cpp
index 8c7abfb7..167bed93 100644
--- a/screenlib/UIBaseElement.cpp
+++ b/screenlib/UIBaseElement.cpp
@@ -245,13 +245,13 @@ UIBaseElement::LoadElements(rapidxml::xml_node<> *node, const UITemplates *templ
UIBaseElement *element = CreateElement(node->name());
if (!element) {
- fprintf(stderr, "Warning: Couldn't find handler for element %s\n", node->name());
+ SDL_Log("Warning: Couldn't find handler for element %s", node->name());
continue;
}
if (!element->Load(node, templates) ||
!element->FinishLoading()) {
- fprintf(stderr, "Warning: Couldn't load element %s: %s\n", node->name(), element->Error());
+ SDL_Log("Warning: Couldn't load element %s: %s", node->name(), element->Error());
delete element;
} else {
AddElement(element);
@@ -280,7 +280,7 @@ UIBaseElement::LoadDrawLevel(rapidxml::xml_node<> *node, const char *name, DRAWL
return true;
}
}
- fprintf(stderr, "Warning: Unknown draw level: %s\n", attr->value());
+ SDL_Log("Warning: Unknown draw level: %s", attr->value());
return false;
}
return false;
diff --git a/screenlib/UIContainer.cpp b/screenlib/UIContainer.cpp
index daa87bc3..44d5b290 100644
--- a/screenlib/UIContainer.cpp
+++ b/screenlib/UIContainer.cpp
@@ -48,7 +48,7 @@ UIContainer::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
attr = node->first_attribute("layout", 0, false);
if (attr) {
if (!ParseLayoutType(attr->value())) {
- fprintf(stderr, "Warning: Unknown layout type '%s'\n", attr->value());
+ SDL_Log("Warning: Unknown layout type '%s'", attr->value());
return false;
}
}
diff --git a/screenlib/UIElement.cpp b/screenlib/UIElement.cpp
index 3dce4db3..3b4a3f3f 100644
--- a/screenlib/UIElement.cpp
+++ b/screenlib/UIElement.cpp
@@ -132,7 +132,7 @@ UIElement::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
attr = node->first_attribute("font", 0, false);
if (attr) {
if (!ParseFont(attr->value())) {
- fprintf(stderr, "Warning: Couldn't parse font '%s'\n", attr->value());
+ SDL_Log("Warning: Couldn't parse font '%s'", attr->value());
return false;
}
}
@@ -147,7 +147,7 @@ UIElement::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
child = node->first_node("TextArea", 0, false);
if (child) {
if (!m_textArea.Load(child)) {
- fprintf(stderr, "Warning: Couldn't load TextArea\n");
+ SDL_Log("Warning: Couldn't load TextArea");
return false;
}
}
@@ -176,7 +176,7 @@ UIElement::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
attr = node->first_attribute("image", 0, false);
if (attr) {
if (!SetImage(attr->value())) {
- fprintf(stderr, "Warning: Couldn't load image '%s'\n", attr->value());
+ SDL_Log("Warning: Couldn't load image '%s'", attr->value());
return false;
}
}
@@ -184,7 +184,7 @@ UIElement::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
child = node->first_node("ImageArea", 0, false);
if (child) {
if (!m_imageArea.Load(child)) {
- fprintf(stderr, "Warning: Couldn't load ImageArea\n");
+ SDL_Log("Warning: Couldn't load ImageArea");
return false;
}
}
diff --git a/screenlib/UIElementButton.cpp b/screenlib/UIElementButton.cpp
index 787c963f..2b2693ef 100644
--- a/screenlib/UIElementButton.cpp
+++ b/screenlib/UIElementButton.cpp
@@ -116,7 +116,7 @@ UIElementButton::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
image->SetLocked(true);
m_stateImages[i] = image;
} else {
- fprintf(stderr, "Warning: Couldn't load image '%s'\n", attr->value());
+ SDL_Log("Warning: Couldn't load image '%s'", attr->value());
return false;
}
}
diff --git a/screenlib/UIManager.cpp b/screenlib/UIManager.cpp
index 5426fe68..bea4187d 100644
--- a/screenlib/UIManager.cpp
+++ b/screenlib/UIManager.cpp
@@ -87,7 +87,7 @@ UIManager::LoadTemplates(const char *file)
return true;
}
}
- fprintf(stderr, "Couldn't load template %s\n", file);
+ SDL_Log("Couldn't load template %s", file);
return false;
}
@@ -111,7 +111,7 @@ UIManager::LoadPanel(const char *name)
}
}
if (!loaded) {
- fprintf(stderr, "Couldn't load panel %s\n", name);
+ SDL_Log("Couldn't load panel %s", name);
return NULL;
}
@@ -120,7 +120,7 @@ UIManager::LoadPanel(const char *name)
panel = CreatePanel(node->name(), name);
if (!panel) {
- fprintf(stderr, "Warning: Couldn't create panel %s in %s\n",
+ SDL_Log("Warning: Couldn't create panel %s in %s",
node->name(), file);
SDL_free(buffer);
return NULL;
@@ -132,7 +132,7 @@ UIManager::LoadPanel(const char *name)
delegate = CreatePanelDelegate(panel, attr->value());
if (!delegate) {
- fprintf(stderr, "Warning: Couldn't find delegate '%s'\n", attr->value());
+ SDL_Log("Warning: Couldn't find delegate '%s'", attr->value());
SDL_free(buffer);
delete panel;
return NULL;
@@ -142,7 +142,7 @@ UIManager::LoadPanel(const char *name)
if (!panel->Load(node, GetTemplates()) ||
!panel->FinishLoading()) {
- fprintf(stderr, "Warning: Couldn't load %s: %s\n",
+ SDL_Log("Warning: Couldn't load %s: %s",
file, panel->Error());
SDL_free(buffer);
delete panel;
diff --git a/screenlib/UITemplates.cpp b/screenlib/UITemplates.cpp
index 394961d7..b9676e9b 100644
--- a/screenlib/UITemplates.cpp
+++ b/screenlib/UITemplates.cpp
@@ -84,7 +84,7 @@ UITemplates::Load(const char *file)
key->name = attr->value();
hash_insert(m_hashTable, key, node);
} else {
- fprintf(stderr, "Warning: UITemplate %s missing 'templateName'\n", node->name());
+ SDL_Log("Warning: UITemplate %s missing 'templateName'", node->name());
}
}
return true;