diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2011-02-22 14:18:53 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2011-02-22 14:18:53 (GMT) |
commit | 3c7407beb4cca20392107545c5bc055c48f55ba8 (patch) | |
tree | de7528ca70cc6b896e160abda93e66f763e88402 /src/FbTk | |
parent | 84a81a1ac1cd24830fc68c7fc46aa10b6f01e6af (diff) | |
download | fluxbox_paul-3c7407beb4cca20392107545c5bc055c48f55ba8.zip fluxbox_paul-3c7407beb4cca20392107545c5bc055c48f55ba8.tar.bz2 |
use FbTk::StringUtil API
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/Texture.cc | 19 |
1 files 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 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | #include "App.hh" | ||
26 | #include "Texture.hh" | 25 | #include "Texture.hh" |
27 | 26 | #include "App.hh" | |
27 | #include "StringUtil.hh" | ||
28 | #include <X11/Xlib.h> | 28 | #include <X11/Xlib.h> |
29 | #ifdef HAVE_CSTRING | 29 | #ifdef HAVE_CSTRING |
30 | #include <cstring> | 30 | #include <cstring> |
31 | #else | 31 | #else |
32 | #include <string.h> | 32 | #include <string.h> |
33 | #endif | 33 | #endif |
34 | #ifdef HAVE_CCTYPE | ||
35 | #include <cctype> | ||
36 | #else | ||
37 | #include <ctype.h> | ||
38 | #endif | ||
39 | 34 | ||
40 | namespace FbTk { | 35 | namespace FbTk { |
41 | 36 | ||
42 | void Texture::setFromString(const char * const texture_str) { | 37 | void Texture::setFromString(const char * const texture_str) { |
43 | if (texture_str == 0) | 38 | if (texture_str == 0) |
44 | return; | 39 | return; |
45 | int t_len = strlen(texture_str) + 1; | ||
46 | char *ts = new char[t_len]; | ||
47 | strcpy(ts, texture_str); | ||
48 | 40 | ||
49 | // to lower | 41 | const std::string t = FbTk::StringUtil::toLower(texture_str); |
50 | for (size_t byte_pos = 0; byte_pos < strlen(ts); ++byte_pos) | 42 | const char* ts = t.c_str(); |
51 | ts[byte_pos] = tolower(ts[byte_pos]); | ||
52 | 43 | ||
53 | if (strstr(ts, "parentrelative")) { | 44 | if (strstr(ts, "parentrelative")) { |
54 | setType(Texture::PARENTRELATIVE); | 45 | setType(Texture::PARENTRELATIVE); |
@@ -105,8 +96,6 @@ void Texture::setFromString(const char * const texture_str) { | |||
105 | if (strstr(ts, "tiled")) | 96 | if (strstr(ts, "tiled")) |
106 | addType(Texture::TILED); | 97 | addType(Texture::TILED); |
107 | } | 98 | } |
108 | |||
109 | delete [] ts; | ||
110 | } | 99 | } |
111 | 100 | ||
112 | void Texture::calcHiLoColors(int screen_num) { | 101 | void Texture::calcHiLoColors(int screen_num) { |