summaryrefslogtreecommitdiff
path: root/src/blitter
diff options
context:
space:
mode:
Diffstat (limited to 'src/blitter')
-rw-r--r--src/blitter/factory.hpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/blitter/factory.hpp b/src/blitter/factory.hpp
index 30a70570b..c7776f4a4 100644
--- a/src/blitter/factory.hpp
+++ b/src/blitter/factory.hpp
@@ -22,10 +22,10 @@
*/
class BlitterFactory {
private:
- const char *name; ///< The name of the blitter factory.
- const char *description; ///< The description of the blitter.
+ const std::string name; ///< The name of the blitter factory.
+ const std::string description; ///< The description of the blitter.
- typedef std::map<const char *, BlitterFactory *, StringCompare> Blitters; ///< Map of blitter factories.
+ typedef std::map<std::string, BlitterFactory *> Blitters; ///< Map of blitter factories.
/**
* Get the map with currently known blitters.
@@ -58,7 +58,7 @@ protected:
* @pre There is no blitter registered with this name.
*/
BlitterFactory(const char *name, const char *description, bool usable = true) :
- name(stredup(name)), description(stredup(description))
+ name(name), description(description)
{
if (usable) {
/*
@@ -78,9 +78,6 @@ public:
{
GetBlitters().erase(this->name);
if (GetBlitters().empty()) delete &GetBlitters();
-
- free(this->name);
- free(this->description);
}
/**
@@ -88,7 +85,7 @@ public:
* @param name the blitter to select.
* @post Sets the blitter so GetCurrentBlitter() returns it too.
*/
- static Blitter *SelectBlitter(const char *name)
+ static Blitter *SelectBlitter(const std::string &name)
{
BlitterFactory *b = GetBlitterFactory(name);
if (b == nullptr) return nullptr;
@@ -97,7 +94,7 @@ public:
delete *GetActiveBlitter();
*GetActiveBlitter() = newb;
- DEBUG(driver, 1, "Successfully %s blitter '%s'", StrEmpty(name) ? "probed" : "loaded", newb->GetName());
+ DEBUG(driver, 1, "Successfully %s blitter '%s'", name.empty() ? "probed" : "loaded", newb->GetName());
return newb;
}
@@ -106,7 +103,7 @@ public:
* @param name the blitter factory to select.
* @return The blitter factory, or nullptr when there isn't one with the wanted name.
*/
- static BlitterFactory *GetBlitterFactory(const char *name)
+ static BlitterFactory *GetBlitterFactory(const std::string &name)
{
#if defined(DEDICATED)
const char *default_blitter = "null";
@@ -116,12 +113,12 @@ public:
const char *default_blitter = "8bpp-optimized";
#endif
if (GetBlitters().size() == 0) return nullptr;
- const char *bname = (StrEmpty(name)) ? default_blitter : name;
+ const char *bname = name.empty() ? default_blitter : name.c_str();
Blitters::iterator it = GetBlitters().begin();
for (; it != GetBlitters().end(); it++) {
BlitterFactory *b = (*it).second;
- if (strcasecmp(bname, b->name) == 0) {
+ if (strcasecmp(bname, b->name.c_str()) == 0) {
return b;
}
}
@@ -148,7 +145,7 @@ public:
Blitters::iterator it = GetBlitters().begin();
for (; it != GetBlitters().end(); it++) {
BlitterFactory *b = (*it).second;
- p += seprintf(p, last, "%18s: %s\n", b->name, b->GetDescription());
+ p += seprintf(p, last, "%18s: %s\n", b->name.c_str(), b->GetDescription().c_str());
}
p += seprintf(p, last, "\n");
@@ -158,7 +155,7 @@ public:
/**
* Get the long, human readable, name for the Blitter-class.
*/
- const char *GetName() const
+ const std::string &GetName() const
{
return this->name;
}
@@ -166,7 +163,7 @@ public:
/**
* Get a nice description of the blitter-class.
*/
- const char *GetDescription() const
+ const std::string &GetDescription() const
{
return this->description;
}
@@ -177,7 +174,7 @@ public:
virtual Blitter *CreateInstance() = 0;
};
-extern char *_ini_blitter;
+extern std::string _ini_blitter;
extern bool _blitter_autodetected;
#endif /* BLITTER_FACTORY_HPP */