diff options
author | fluxgen <fluxgen> | 2001-12-16 23:28:22 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2001-12-16 23:28:22 (GMT) |
commit | 1982b853b5e14f4fc67c1cede269b8f1441249ed (patch) | |
tree | 209c5186388470f75a9a057a9243c9c4699d45d1 | |
parent | ee3bb66472216c9cfa55055cb30d4c61db0688d4 (diff) | |
download | fluxbox-1982b853b5e14f4fc67c1cede269b8f1441249ed.zip fluxbox-1982b853b5e14f4fc67c1cede269b8f1441249ed.tar.bz2 |
Fixed errorcheck in DrawRotString and DrawString
-rw-r--r-- | src/misc.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/misc.cc b/src/misc.cc index 37e2580..728c5ae 100644 --- a/src/misc.cc +++ b/src/misc.cc | |||
@@ -366,15 +366,19 @@ void Misc::XRotDrawString(Display *dpy, XRotFontStruct *rotfont, Drawable drawab | |||
366 | } | 366 | } |
367 | 367 | ||
368 | 368 | ||
369 | //Draw title string | ||
369 | void Misc::DrawString(Display *display, Window w, GC gc, Misc::Font *font, | 370 | void Misc::DrawString(Display *display, Window w, GC gc, Misc::Font *font, |
370 | unsigned int text_w, unsigned int size_w, | 371 | unsigned int text_w, unsigned int size_w, |
371 | unsigned int bevel_w, char *text) { | 372 | unsigned int bevel_w, char *text) { |
372 | //Draw title string | ||
373 | 373 | ||
374 | if (!text || text_w<1 || size_w < 1 || !font || !display) | ||
375 | return; | ||
376 | |||
374 | unsigned int l = text_w; | 377 | unsigned int l = text_w; |
375 | int dlen=strlen(text); | 378 | int dlen=strlen(text); |
376 | int dx=bevel_w*2; | 379 | int dx=bevel_w*2; |
377 | 380 | ||
381 | |||
378 | if (text_w > size_w) { | 382 | if (text_w > size_w) { |
379 | for (; dlen >= 0; dlen--) { | 383 | for (; dlen >= 0; dlen--) { |
380 | if (I18n::instance()->multibyte()) { | 384 | if (I18n::instance()->multibyte()) { |
@@ -426,6 +430,9 @@ void Misc::DrawRotString(Display *display, Window w, GC gc, XRotFontStruct *font | |||
426 | unsigned int size_w, unsigned int size_h, | 430 | unsigned int size_w, unsigned int size_h, |
427 | unsigned int bevel_w, char *text) { | 431 | unsigned int bevel_w, char *text) { |
428 | 432 | ||
433 | if (!text || text_w<1 || size_w < 1 || !font || !display) | ||
434 | return; | ||
435 | |||
429 | unsigned int l = text_w; | 436 | unsigned int l = text_w; |
430 | int dlen = strlen(text); | 437 | int dlen = strlen(text); |
431 | int dx = bevel_w * 2; | 438 | int dx = bevel_w * 2; |