From 0f270ee38f48fd58809155cf865e8ede068087a1 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Wed, 27 Mar 2002 15:37:19 +0000 Subject: added some headers and fixed namespace std --- src/Font.cc | 29 +++++++++++++++++++---------- src/Font.hh | 4 +++- 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Font.cc,v 1.2 2002/03/21 11:05:41 fluxgen Exp $ +//$Id: Font.cc,v 1.3 2002/03/27 15:37:19 fluxgen Exp $ + + #include "Font.hh" -#include -#include //for debug msg -using namespace std; +#include "StringUtil.hh" //use gnu extensions #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif //_GNU_SOURCE +#include +#include +#include +#include +#include + #ifdef HAVE_CONFIG_H # include "../config.h" #endif // HAVE_CONFIG_H +#ifdef HAVE_SETLOCALE +#include +#endif //HAVE_SETLOCALE namespace FbTk { @@ -133,7 +142,7 @@ XFontSet Font::createFontSet(Display *display, const char *fontname) { fontname, &missing, &nmissing, &def); if (fs && (! nmissing)) return fs; -#ifdef HAVE_SETLOCALE +#ifdef HAVE_SETLOCALE if (! fs) { if (nmissing) XFreeStringList(missing); @@ -158,9 +167,9 @@ XFontSet Font::createFontSet(Display *display, const char *fontname) { getFontSize(fontname, &pixel_size); if (! strcmp(weight, "*")) - strncpy(weight, "medium", FONT_ELEMENT_SIZE); + std::strncpy(weight, "medium", FONT_ELEMENT_SIZE); if (! strcmp(slant, "*")) - strncpy(slant, "r", FONT_ELEMENT_SIZE); + std::strncpy(slant, "r", FONT_ELEMENT_SIZE); if (pixel_size < 3) pixel_size = 3; else if (pixel_size > 97) @@ -196,9 +205,9 @@ const char *Font::getFontElement(const char *pattern, char *buf, int bufsiz, ... buf[bufsiz-1] = 0; buf[bufsiz-2] = '*'; while((v = va_arg(va, char *)) != NULL) { - p = strcasestr(pattern, v); + p = StringUtil::strcasestr(pattern, v); if (p) { - strncpy(buf, p+1, bufsiz-2); + std::strncpy(buf, p+1, bufsiz-2); p2 = strchr(buf, '-'); if (p2) *p2=0; va_end(va); @@ -206,7 +215,7 @@ const char *Font::getFontElement(const char *pattern, char *buf, int bufsiz, ... } } va_end(va); - strncpy(buf, "*", bufsiz); + std::strncpy(buf, "*", bufsiz); return NULL; } 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Font.hh,v 1.1 2002/03/21 10:51:48 fluxgen Exp $ +//$Id: Font.hh,v 1.2 2002/03/27 15:37:19 fluxgen Exp $ #ifndef FBTK_FONT_HH #define FBTK_FONT_HH +#include #include + namespace FbTk { -- cgit v0.11.2