From 3c7407beb4cca20392107545c5bc055c48f55ba8 Mon Sep 17 00:00:00 2001
From: Mathias Gumz <akira at fluxbox dot org>
Date: Tue, 22 Feb 2011 15:18:53 +0100
Subject: use FbTk::StringUtil API

---
 src/FbTk/Texture.cc | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/FbTk/Texture.cc b/src/FbTk/Texture.cc
index 51ca2db..408ff5b 100644
--- a/src/FbTk/Texture.cc
+++ b/src/FbTk/Texture.cc
@@ -22,33 +22,24 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-#include "App.hh"
 #include "Texture.hh"
-
+#include "App.hh"
+#include "StringUtil.hh"
 #include <X11/Xlib.h>
 #ifdef HAVE_CSTRING
   #include <cstring>
 #else
   #include <string.h>
 #endif
-#ifdef HAVE_CCTYPE
-  #include <cctype>
-#else
-  #include <ctype.h>
-#endif
 
 namespace FbTk {
 
 void Texture::setFromString(const char * const texture_str) {
     if (texture_str == 0)
         return;
-    int t_len = strlen(texture_str) + 1;
-    char *ts = new char[t_len];
-    strcpy(ts, texture_str);
 
-    // to lower
-    for (size_t byte_pos = 0; byte_pos < strlen(ts); ++byte_pos)
-        ts[byte_pos] = tolower(ts[byte_pos]);
+    const std::string t = FbTk::StringUtil::toLower(texture_str);
+    const char* ts = t.c_str();
 
     if (strstr(ts, "parentrelative")) {
         setType(Texture::PARENTRELATIVE);
@@ -105,8 +96,6 @@ void Texture::setFromString(const char * const texture_str) {
         if (strstr(ts, "tiled"))
             addType(Texture::TILED);
     }
-
-    delete [] ts;
 }
 
 void Texture::calcHiLoColors(int screen_num) {
-- 
cgit v0.11.2