summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-03-27 15:37:19 (GMT)
committerfluxgen <fluxgen>2002-03-27 15:37:19 (GMT)
commit0f270ee38f48fd58809155cf865e8ede068087a1 (patch)
tree4dc65afedbd841a501b11902b7b5a8e6357820ae
parentca942ddf895e2f2b92f1bc8e5c49a3e376d0ac6f (diff)
downloadfluxbox_lack-0f270ee38f48fd58809155cf865e8ede068087a1.zip
fluxbox_lack-0f270ee38f48fd58809155cf865e8ede068087a1.tar.bz2
added some headers and fixed namespace std
-rw-r--r--src/Font.cc29
-rw-r--r--src/Font.hh4
2 files changed, 22 insertions, 11 deletions
diff --git a/src/Font.cc b/src/Font.cc
index cfd7303..2430950 100644
--- a/src/Font.cc
+++ b/src/Font.cc
@@ -19,20 +19,29 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22//$Id: Font.cc,v 1.2 2002/03/21 11:05:41 fluxgen Exp $ 22//$Id: Font.cc,v 1.3 2002/03/27 15:37:19 fluxgen Exp $
23
24
23#include "Font.hh" 25#include "Font.hh"
24#include <cstdarg>
25#include <iostream> //for debug msg
26using namespace std;
27 26
27#include "StringUtil.hh"
28//use gnu extensions 28//use gnu extensions
29#ifndef _GNU_SOURCE 29#ifndef _GNU_SOURCE
30#define _GNU_SOURCE 30#define _GNU_SOURCE
31#endif //_GNU_SOURCE 31#endif //_GNU_SOURCE
32 32
33#include <cstdarg>
34#include <iostream>
35#include <cassert>
36#include <string>
37#include <cstdio>
38
33#ifdef HAVE_CONFIG_H 39#ifdef HAVE_CONFIG_H
34# include "../config.h" 40# include "../config.h"
35#endif // HAVE_CONFIG_H 41#endif // HAVE_CONFIG_H
42#ifdef HAVE_SETLOCALE
43#include <locale.h>
44#endif //HAVE_SETLOCALE
36 45
37namespace FbTk 46namespace FbTk
38{ 47{
@@ -133,7 +142,7 @@ XFontSet Font::createFontSet(Display *display, const char *fontname) {
133 fontname, &missing, &nmissing, &def); 142 fontname, &missing, &nmissing, &def);
134 if (fs && (! nmissing)) return fs; 143 if (fs && (! nmissing)) return fs;
135 144
136#ifdef HAVE_SETLOCALE 145#ifdef HAVE_SETLOCALE
137 if (! fs) { 146 if (! fs) {
138 if (nmissing) XFreeStringList(missing); 147 if (nmissing) XFreeStringList(missing);
139 148
@@ -158,9 +167,9 @@ XFontSet Font::createFontSet(Display *display, const char *fontname) {
158 getFontSize(fontname, &pixel_size); 167 getFontSize(fontname, &pixel_size);
159 168
160 if (! strcmp(weight, "*")) 169 if (! strcmp(weight, "*"))
161 strncpy(weight, "medium", FONT_ELEMENT_SIZE); 170 std::strncpy(weight, "medium", FONT_ELEMENT_SIZE);
162 if (! strcmp(slant, "*")) 171 if (! strcmp(slant, "*"))
163 strncpy(slant, "r", FONT_ELEMENT_SIZE); 172 std::strncpy(slant, "r", FONT_ELEMENT_SIZE);
164 if (pixel_size < 3) 173 if (pixel_size < 3)
165 pixel_size = 3; 174 pixel_size = 3;
166 else if (pixel_size > 97) 175 else if (pixel_size > 97)
@@ -196,9 +205,9 @@ const char *Font::getFontElement(const char *pattern, char *buf, int bufsiz, ...
196 buf[bufsiz-1] = 0; 205 buf[bufsiz-1] = 0;
197 buf[bufsiz-2] = '*'; 206 buf[bufsiz-2] = '*';
198 while((v = va_arg(va, char *)) != NULL) { 207 while((v = va_arg(va, char *)) != NULL) {
199 p = strcasestr(pattern, v); 208 p = StringUtil::strcasestr(pattern, v);
200 if (p) { 209 if (p) {
201 strncpy(buf, p+1, bufsiz-2); 210 std::strncpy(buf, p+1, bufsiz-2);
202 p2 = strchr(buf, '-'); 211 p2 = strchr(buf, '-');
203 if (p2) *p2=0; 212 if (p2) *p2=0;
204 va_end(va); 213 va_end(va);
@@ -206,7 +215,7 @@ const char *Font::getFontElement(const char *pattern, char *buf, int bufsiz, ...
206 } 215 }
207 } 216 }
208 va_end(va); 217 va_end(va);
209 strncpy(buf, "*", bufsiz); 218 std::strncpy(buf, "*", bufsiz);
210 return NULL; 219 return NULL;
211} 220}
212 221
diff --git a/src/Font.hh b/src/Font.hh
index 04318ba..afdbbdc 100644
--- a/src/Font.hh
+++ b/src/Font.hh
@@ -19,12 +19,14 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22//$Id: Font.hh,v 1.1 2002/03/21 10:51:48 fluxgen Exp $ 22//$Id: Font.hh,v 1.2 2002/03/27 15:37:19 fluxgen Exp $
23 23
24#ifndef FBTK_FONT_HH 24#ifndef FBTK_FONT_HH
25#define FBTK_FONT_HH 25#define FBTK_FONT_HH
26 26
27#include <X11/Xlib.h>
27#include <X11/Xresource.h> 28#include <X11/Xresource.h>
29
28namespace FbTk 30namespace FbTk
29{ 31{
30 32