From: <enl...@li...> - 2002-02-28 21:14:05
|
Enlightenment CVS committal Author : term Project : e17 Module : libs/ebg Dir : e17/libs/ebg/test Modified Files: e_bg_test.c Log Message: Security patch from vac <kkuehl at cisco.com>, with a small improvement. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ebg/test/e_bg_test.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_bg_test.c 23 Jan 2002 06:27:50 -0000 1.3 +++ e_bg_test.c 28 Feb 2002 21:14:02 -0000 1.4 @@ -12,6 +12,9 @@ #define WINDOW_MIN_W 150 #define WINDOW_MIN_H 150 +#define EBG_MESSAGE_SIZE 256 +#define EBG_BUF_SIZE 1024 + /* evas options */ #define FNTDIR "./fnt" #define IMAGE_CACHE_IN_MB 4 @@ -140,7 +143,7 @@ static void bg_mouse_down(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) { - char message[256]; + char message[EBG_MESSAGE_SIZE]; if(_b == 1) { @@ -157,7 +160,7 @@ { e_bg_set_layer(bg, --current_layer); } - sprintf(message, "Bg is at Layer %d", current_layer); + snprintf(message, EBG_MESSAGE_SIZE, "Bg is at Layer %d", current_layer); evas_set_text(evas, ot, message); if(current_stack_req) e_bg_stack_object_above(bg, ot); @@ -168,7 +171,7 @@ void try_bg_load_next() { - char buf[1024]; + char buf[EBG_BUF_SIZE]; if(bg) e_bg_free(bg); if(bg_current) bg_current = bg_current->next; if(!bg_current) bg_current = bg_list; @@ -176,7 +179,7 @@ bg = e_bg_load((char*)bg_current->data); if(!bg) return; - sprintf(buf, "%s", (char*)bg_current->data); + snprintf(buf, EBG_BUF_SIZE, "%s", (char*)bg_current->data); ecore_window_set_title(main_win, buf); e_bg_add_to_evas(bg, evas); e_bg_callback_add(bg, CALLBACK_MOUSE_DOWN, bg_mouse_down, NULL); @@ -190,7 +193,7 @@ void try_bg_load_prev() { - char buf[1024]; + char buf[EBG_BUF_SIZE]; if(bg) e_bg_free(bg); if(bg_current) bg_current = bg_current->prev; if(!bg_current) bg_current = bg_list->last; @@ -198,7 +201,7 @@ bg = e_bg_load((char*)bg_current->data); if(!bg) return; - sprintf(buf, "%s", (char*)bg_current->data); + snprintf(buf, EBG_BUF_SIZE, "%s", (char*)bg_current->data); ecore_window_set_title(main_win, buf); e_bg_add_to_evas(bg, evas); e_bg_callback_add(bg, CALLBACK_MOUSE_DOWN, bg_mouse_down, NULL); @@ -215,7 +218,7 @@ { Window win, ewin; Evas_Object o; - char message[256]; + char message[EBG_MESSAGE_SIZE]; double tw, th; win_w = win_h = 400; @@ -238,8 +241,8 @@ main_win = win; evas = evas_new_all(ecore_display_get(), win, 0, 0, win_w, win_h, RENDER_METHOD_ALPHA_SOFTWARE, 215, - (FONT_CACHE_IN_MB * (1024 * 1024)), - (IMAGE_CACHE_IN_MB * (1024 * 1024)), + (FONT_CACHE_IN_MB * (EBG_BUF_SIZE * EBG_BUF_SIZE)), + (IMAGE_CACHE_IN_MB * (EBG_BUF_SIZE * EBG_BUF_SIZE)), FNTDIR); ewin = evas_get_window(evas); @@ -257,7 +260,7 @@ evas_show(evas, o); /* relative layer labels */ - sprintf(message, "Layer 4"); + snprintf(message, EBG_MESSAGE_SIZE, "%s", "Layer 4"); o = evas_add_text(evas, "arial", 12, message); evas_set_color(evas, o, 0,0,0,255); tw = evas_get_text_width(evas, o); @@ -268,7 +271,7 @@ evas_set_layer(evas, o, 4); ol = o; - sprintf(message, "Layer 8"); + snprintf(message, EBG_MESSAGE_SIZE, "%s", "Layer 8"); o = evas_add_text(evas, "arial", 12, message); evas_set_color(evas, o, 0,0,0,255); tw = evas_get_text_width(evas, o); @@ -279,7 +282,7 @@ evas_set_layer(evas, o, 8); ol2 = o; - sprintf(message, "Layer -2"); + snprintf(message, EBG_MESSAGE_SIZE, "%s", "Layer -2"); o = evas_add_text(evas, "arial", 12, message); evas_set_color(evas, o, 0,0,0,255); tw = evas_get_text_width(evas, o); @@ -290,7 +293,7 @@ evas_set_layer(evas, o, -2); ol3 = o; - sprintf(message, "Layer 12"); + snprintf(message, EBG_MESSAGE_SIZE, "%s", "Layer 12"); o = evas_add_text(evas, "arial", 12, message); evas_set_color(evas, o, 0,0,0,255); tw = evas_get_text_width(evas, o); @@ -303,7 +306,7 @@ /* layer text label */ - sprintf(message, "Bg is at Layer %d", current_layer); + snprintf(message, EBG_MESSAGE_SIZE, "Bg is at Layer %d", current_layer); ot = evas_add_text(evas, "arial", 16, message); evas_set_color(evas, ot, 192,192,192,255); tw = evas_get_text_width(evas, ot); |