From a0810586e4b58cd58ed21bddb3b6886ee58b335c Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 8 Nov 2010 23:37:54 +0100 Subject: [PATCH] Remove parts of patches from http://gitorious.org/xaw3d which we already have We already have some parts of the patches from http://gitorious.org/xaw3d in some other patches (mostly in the patches we took from Debian). Remove those bits from Xaw3d-1.5E-secure.patch and Xaw3d-1.5E-thumb.patch, so that the rest can be applied without conflicts. --- Xaw3d-1.5E-secure.patch | 462 ---------------------------------------- Xaw3d-1.5E-thumb.patch | 22 -- 2 files changed, 484 deletions(-) diff --git a/Xaw3d-1.5E-secure.patch b/Xaw3d-1.5E-secure.patch index aa72c2c..68878d4 100644 --- a/Xaw3d-1.5E-secure.patch +++ b/Xaw3d-1.5E-secure.patch @@ -19,23 +19,6 @@ Subject: [PATCH] Xaw3d-1.5E-secure.patch 12 files changed, 206 insertions(+), 61 deletions(-) create mode 100644 xc/lib/Xaw3d/XawAlloc.h -diff --git a/xc/lib/Xaw3d/AsciiSrcP.h b/xc/lib/Xaw3d/AsciiSrcP.h -index dcb33ff..30ba992 100644 ---- a/xc/lib/Xaw3d/AsciiSrcP.h -+++ b/xc/lib/Xaw3d/AsciiSrcP.h -@@ -85,7 +85,11 @@ SOFTWARE. - #ifdef L_tmpnam - #define TMPSIZ L_tmpnam - #else --#define TMPSIZ 32 /* bytes to allocate for tmpnam */ -+#ifdef PATH_MAX -+#define TMPSIZ PATH_MAX -+#else -+#define TMPSIZ 1024 /* bytes to allocate for tmpnam */ -+#endif - #endif - - #define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */ diff --git a/xc/lib/Xaw3d/Layout.c b/xc/lib/Xaw3d/Layout.c index 44d391a..dd4b253 100644 --- a/xc/lib/Xaw3d/Layout.c @@ -72,451 +55,6 @@ index 44d391a..dd4b253 100644 return 0.0; } return Evaluate (l, box, nexpr, natural); -diff --git a/xc/lib/Xaw3d/MenuButton.c b/xc/lib/Xaw3d/MenuButton.c -index b96a027..493ff76 100644 ---- a/xc/lib/Xaw3d/MenuButton.c -+++ b/xc/lib/Xaw3d/MenuButton.c -@@ -53,6 +53,8 @@ in this Software without prior written authorization from the X Consortium. - #include - #include - -+#include "XawAlloc.h" -+ - static void ClassInitialize(); - static void PopupMenu(); - -@@ -179,9 +181,16 @@ Cardinal * num_params; - - if (menu == NULL) { - char error_buf[BUFSIZ]; -- (void) sprintf(error_buf, "MenuButton: %s %s.", -- "Could not find menu widget named", mbw->menu_button.menu_name); -- XtAppWarning(XtWidgetToApplicationContext(w), error_buf); -+ char *err1 = "MenuButton: Could not find menu widget named "; -+ char *perr; -+ int len; -+ -+ len = strlen(err1) + strlen(mbw->menu_button.menu_name) + 1 + 1; -+ perr = XtStackAlloc(len, error_buf); -+ if (perr == NULL) return; -+ sprintf(perr, "%s%s.", err1, mbw->menu_button.menu_name); -+ XtAppWarning(XtWidgetToApplicationContext(w), perr); -+ XtStackFree(perr, error_buf); - return; - } - if (!XtIsRealized(menu)) -diff --git a/xc/lib/Xaw3d/MultiSrcP.h b/xc/lib/Xaw3d/MultiSrcP.h -index 6996361..9c98a1d 100644 ---- a/xc/lib/Xaw3d/MultiSrcP.h -+++ b/xc/lib/Xaw3d/MultiSrcP.h -@@ -113,7 +113,11 @@ SOFTWARE. - #ifdef L_tmpnam - #define TMPSIZ L_tmpnam - #else --#define TMPSIZ 32 /* bytes to allocate for tmpnam */ -+#ifdef PATH_MAX -+#define TMPSIZ PATH_MAX -+#else -+#define TMPSIZ 1024 /* bytes to allocate for tmpnam */ -+#endif - #endif - - #define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */ -diff --git a/xc/lib/Xaw3d/Simple.c b/xc/lib/Xaw3d/Simple.c -index 29cbbc8..8051030 100644 ---- a/xc/lib/Xaw3d/Simple.c -+++ b/xc/lib/Xaw3d/Simple.c -@@ -56,6 +56,8 @@ SOFTWARE. - #include - #include - -+#include "XawAlloc.h" -+ - #define offset(field) XtOffsetOf(SimpleRec, simple.field) - - static XtResource resources[] = { -@@ -148,11 +150,17 @@ static void ClassPartInitialize(class) - - if (c->simple_class.change_sensitive == NULL) { - char buf[BUFSIZ]; -- -- (void) sprintf(buf, -- "%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.", -- c->core_class.class_name); -- XtWarning(buf); -+ char *pbuf; -+ char *msg1 = " Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited."; -+ int len; -+ -+ len = strlen(msg1) + strlen(c->core_class.class_name) + 1; -+ pbuf = XtStackAlloc(len, buf); -+ if (pbuf != NULL) { -+ sprintf(pbuf, "%s%s", c->core_class.class_name, msg1); -+ XtWarning(pbuf); -+ XtStackFree(pbuf, buf); -+ } - c->simple_class.change_sensitive = ChangeSensitive; - } - -diff --git a/xc/lib/Xaw3d/SimpleMenu.c b/xc/lib/Xaw3d/SimpleMenu.c -index 87a3170..2bf439d 100644 ---- a/xc/lib/Xaw3d/SimpleMenu.c -+++ b/xc/lib/Xaw3d/SimpleMenu.c -@@ -51,6 +51,8 @@ in this Software without prior written authorization from the X Consortium. - #include - #include - -+#include "XawAlloc.h" -+ - #define streq(a, b) ( strcmp((a), (b)) == 0 ) - - #define offset(field) XtOffsetOf(SimpleMenuRec, simple_menu.field) -@@ -755,9 +757,17 @@ Cardinal * num_params; - - if ( (menu = FindMenu(w, params[0])) == NULL) { - char error_buf[BUFSIZ]; -- (void) sprintf(error_buf, "%s '%s'", -- "Xaw - SimpleMenuWidget: could not find menu named: ", params[0]); -- XtAppWarning(XtWidgetToApplicationContext(w), error_buf); -+ char *err1 = "Xaw - SimpleMenuWidget: could not find menu named: "; -+ char *perr; -+ int len; -+ -+ len = strlen(err1) + strlen(params[0]) + 2 + 1; -+ perr = XtStackAlloc(len, error_buf); -+ if (perr == NULL) -+ return; -+ sprintf(perr, "%s'%s'", err1, params[0]); -+ XtAppWarning(XtWidgetToApplicationContext(w), perr); -+ XtStackFree(perr, error_buf); - return; - } - -diff --git a/xc/lib/Xaw3d/SmeBSB.c b/xc/lib/Xaw3d/SmeBSB.c -index 64251e4..abf811f 100644 ---- a/xc/lib/Xaw3d/SmeBSB.c -+++ b/xc/lib/Xaw3d/SmeBSB.c -@@ -51,6 +51,7 @@ in this Software without prior written authorization from the X Consortium. - #include - #include - #include -+#include "XawAlloc.h" - - /* needed for abs() */ - #ifndef X_NOT_STDC_ENV -@@ -712,6 +713,8 @@ Boolean is_left; - int x, y; - unsigned int width, height, bw; - char buf[BUFSIZ]; -+ char *pbuf; -+ int len; - - if (is_left) { - width = height = 0; -@@ -720,18 +723,24 @@ Boolean is_left; - if (!XGetGeometry(XtDisplayOfObject(w), - entry->sme_bsb.left_bitmap, &root, &x, &y, - &width, &height, &bw, &entry->sme_bsb.left_depth)) { -- (void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".", -- "Could not get Left Bitmap", -- "geometry information for menu entry", -- XtName(w)); -- XtAppError(XtWidgetToApplicationContext(w), buf); -+ char *err1 = "Xaw SmeBSB Object: Could not get Left Bitmap geometry information for menu entry "; -+ len = strlen(err1) + strlen(XtName(w)) + 3 + 1; -+ pbuf = XtStackAlloc(len, buf); -+ if (pbuf == NULL) return; -+ sprintf(pbuf, "%s\"%s\".", err1, XtName(w)); -+ XtAppError(XtWidgetToApplicationContext(w), pbuf); -+ XtStackFree(pbuf, buf); - } - #ifdef NEVER - if (entry->sme_bsb.left_depth != 1) { -- (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.", -- "Left Bitmap of entry", XtName(w), -- "is not one bit deep"); -- XtAppError(XtWidgetToApplicationContext(w), buf); -+ char *err1 = "Xaw SmeBSB Object: Left Bitmap of entry "; -+ char *err2 = " is not one bit deep."; -+ len = strlen(err1) + strlen(err2) + strlen(XtName(w)) + 2 + 1; -+ pbuf = XtStackAlloc(len, buf); -+ if (pbuf == NULL) return; -+ sprintf(pbuf, "%s\"%s\"%s", err1, XtName(w), err2); -+ XtAppError(XtWidgetToApplicationContext(w), pbuf); -+ XtStackFree(pbuf, buf); - } - #endif - } -@@ -745,18 +754,24 @@ Boolean is_left; - if (!XGetGeometry(XtDisplayOfObject(w), - entry->sme_bsb.right_bitmap, &root, &x, &y, - &width, &height, &bw, &entry->sme_bsb.right_depth)) { -- (void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".", -- "Could not get Right Bitmap", -- "geometry information for menu entry", -- XtName(w)); -- XtAppError(XtWidgetToApplicationContext(w), buf); -+ char *err1 = "Xaw SmeBSB Object: Could not get Right Bitmap geometry information for menu entry "; -+ len = strlen(err1) + strlen(XtName(w)) + 3 + 1; -+ pbuf = XtStackAlloc(len, buf); -+ if (pbuf == NULL) return; -+ sprintf(pbuf, "%s\"%s\".", err1, XtName(w)); -+ XtAppError(XtWidgetToApplicationContext(w), pbuf); -+ XtStackFree(pbuf, buf); - } - #ifdef NEVER - if (entry->sme_bsb.right_depth != 1) { -- (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.", -- "Right Bitmap of entry", XtName(w), -- "is not one bit deep"); -- XtAppError(XtWidgetToApplicationContext(w), buf); -+ char *err1 = "Xaw SmeBSB Object: Right Bitmap of entry "; -+ char *err2 = " is not one bit deep."; -+ len = strlen(err1) + strlen(err2) + strlen(XtName(w)) + 2 + 1; -+ pbuf = XtStackAlloc(len, buf); -+ if (pbuf == NULL) return; -+ sprintf(pbuf, "%s\"%s\"%s", err1, XtName(w), err2); -+ XtAppError(XtWidgetToApplicationContext(w), pbuf); -+ XtStackFree(pbuf, buf); - } - #endif - } -diff --git a/xc/lib/Xaw3d/Text.c b/xc/lib/Xaw3d/Text.c -index 3c48a4c..32a3f8d 100644 ---- a/xc/lib/Xaw3d/Text.c -+++ b/xc/lib/Xaw3d/Text.c -@@ -76,6 +76,8 @@ SOFTWARE. - #include /* for isprint() */ - #include /* for abs() */ - -+#include "XawAlloc.h" -+ - #ifndef MAX_LEN_CT - #define MAX_LEN_CT 6 /* for sequence: ESC $ ( A \xx \xx */ - #endif -@@ -520,7 +522,8 @@ Cardinal *num_args; /* unused */ - { - TextWidget ctx = (TextWidget) new; - char error_buf[BUFSIZ]; -- int s; -+ char *perr; -+ int s, len; - - ctx->text.threeD = XtVaCreateWidget("threeD", threeDWidgetClass, new, - XtNx, 0, XtNy, 0, -@@ -569,10 +572,17 @@ Cardinal *num_args; /* unused */ - if (ctx->text.scroll_vert != XawtextScrollNever) - if ( (ctx->text.resize == XawtextResizeHeight) || - (ctx->text.resize == XawtextResizeBoth) ) { -- (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name, -- "Vertical scrolling not allowed with height resize.\n", -- "Vertical scrolling has been DEACTIVATED."); -- XtAppWarning(XtWidgetToApplicationContext(new), error_buf); -+ char *err1 = "Xaw Text Widget "; -+ char *err2 = ":\nVertical scrolling not allowed with height resize.\n"; -+ char *err3 = "Vertical scrolling has been DEACTIVATED."; -+ len = strlen(err1) + strlen(err2) + strlen(err3) + -+ strlen(ctx->core.name) + 1; -+ perr = XtStackAlloc(len, error_buf); -+ if (perr != NULL) { -+ (void) sprintf(perr, "%s%s%s%s", err1, ctx->core.name, err2, err3); -+ XtAppWarning(XtWidgetToApplicationContext(new), perr); -+ XtStackFree(perr, error_buf); -+ } - ctx->text.scroll_vert = XawtextScrollNever; - } - else if (ctx->text.scroll_vert == XawtextScrollAlways) -@@ -580,18 +590,32 @@ Cardinal *num_args; /* unused */ - - if (ctx->text.scroll_horiz != XawtextScrollNever) - if (ctx->text.wrap != XawtextWrapNever) { -- (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name, -- "Horizontal scrolling not allowed with wrapping active.\n", -- "Horizontal scrolling has been DEACTIVATED."); -- XtAppWarning(XtWidgetToApplicationContext(new), error_buf); -+ char *err1 = "Xaw Text Widget "; -+ char *err2 = ":\nHorizontal scrolling not allowed with wrapping active."; -+ char *err3 = "\nHorizontal scrolling has been DEACTIVATED."; -+ len = strlen(err1) + strlen(err2) + strlen(err3) + -+ strlen(ctx->core.name) + 1; -+ perr = XtStackAlloc(len, error_buf); -+ if (perr != NULL) { -+ (void) sprintf(perr, "%s%s%s%s", err1, ctx->core.name, err2, err3); -+ XtAppWarning(XtWidgetToApplicationContext(new), perr); -+ XtStackFree(perr, error_buf); -+ } - ctx->text.scroll_horiz = XawtextScrollNever; - } - else if ( (ctx->text.resize == XawtextResizeWidth) || - (ctx->text.resize == XawtextResizeBoth) ) { -- (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name, -- "Horizontal scrolling not allowed with width resize.\n", -- "Horizontal scrolling has been DEACTIVATED."); -- XtAppWarning(XtWidgetToApplicationContext(new), error_buf); -+ char *err1 = "Xaw Text Widget "; -+ char *err2 = ":\nHorizontal scrolling not allowed with width resize.\n"; -+ char *err3 = "Horizontal scrolling has been DEACTIVATED."; -+ len = strlen(err1) + strlen(err2) + strlen(err3) + -+ strlen(ctx->core.name) + 1; -+ perr = XtStackAlloc(len, error_buf); -+ if (perr != NULL) { -+ (void) sprintf(perr, "%s%s%s%s", err1, ctx->core.name, err2, err3); -+ XtAppWarning(XtWidgetToApplicationContext(new), perr); -+ XtStackFree(perr, error_buf); -+ } - ctx->text.scroll_horiz = XawtextScrollNever; - } - else if (ctx->text.scroll_horiz == XawtextScrollAlways) -diff --git a/xc/lib/Xaw3d/TextPop.c b/xc/lib/Xaw3d/TextPop.c -index 260b4dc..cf01b4f 100644 ---- a/xc/lib/Xaw3d/TextPop.c -+++ b/xc/lib/Xaw3d/TextPop.c -@@ -66,6 +66,8 @@ in this Software without prior written authorization from the X Consortium. - #include /* for O_RDONLY */ - #include - -+#include "XawAlloc.h" -+ - #ifdef X_NOT_STDC_ENV - extern int errno; - #endif -@@ -809,6 +811,8 @@ DoSearch(search) - struct SearchAndReplace * search; - { - char msg[BUFSIZ]; -+ char *pmsg; -+ int len; - Widget tw = XtParent(search->search_popup); - XawTextPosition pos; - XawTextScanDirection dir; -@@ -835,9 +839,20 @@ struct SearchAndReplace * search; - /* The Raw string in find.ptr may be WC I can't use here, so I re - call - GetString to get a tame version. */ - -- if (pos == XawTextSearchError) -- (void) sprintf( msg, "Could not find string ``%s''.", GetString( search->search_text ) ); -- else { -+ if (pos == XawTextSearchError) { -+ char *msg1 = "Could not find string ``"; -+ char *msg2 = "''."; -+ len = strlen(msg1) + strlen(msg2) + -+ strlen(GetString( search->search_text )) + 1; -+ pmsg = XtStackAlloc(len, msg); -+ if (pmsg != NULL) { -+ (void) sprintf( pmsg, "%s%s%s", msg1, GetString( search->search_text ), -+ msg2); -+ } else { -+ pmsg = msg; -+ (void) sprintf( pmsg, "Could not find string"); -+ } -+ } else { - if (dir == XawsdRight) - XawTextSetInsertionPoint( tw, pos + text.length); - else -@@ -849,7 +864,8 @@ struct SearchAndReplace * search; - } - - XawTextUnsetSelection(tw); -- SetSearchLabels(search, msg, "", TRUE); -+ SetSearchLabels(search, pmsg, "", TRUE); -+ XtStackFree(pmsg, msg); - return(FALSE); - } - -@@ -982,13 +998,26 @@ Boolean once_only, show_current; - if ( (new_pos == XawTextSearchError) ) { - if (count == 0) { - char msg[BUFSIZ]; -+ char *pmsg; -+ int len; -+ char *msg1 = "*** Error: Could not find string ``"; -+ char *msg2 = "''. ***"; - - /* The Raw string in find.ptr may be WC I can't use here, - so I call GetString to get a tame version.*/ - -- (void) sprintf( msg, "%s %s %s", "*** Error: Could not find string ``", -- GetString( search->search_text ), "''. ***"); -- SetSearchLabels(search, msg, "", TRUE); -+ len = strlen(msg1) + strlen(msg2) + -+ strlen(GetString( search->search_text )) + 1; -+ pmsg = XtStackAlloc(len, msg); -+ if (pmsg != NULL) { -+ (void) sprintf( pmsg, "%s%s%s", msg1, -+ GetString( search->search_text ), msg2); -+ } else { -+ pmsg = msg; -+ (void) sprintf(pmsg, "*** Error: Could not find string ***"); -+ } -+ SetSearchLabels(search, pmsg, "", TRUE); -+ XtStackFree(pmsg, msg); - return(FALSE); - } - else -@@ -1011,9 +1040,22 @@ Boolean once_only, show_current; - - if (XawTextReplace(tw, pos, end_pos, &replace) != XawEditDone) { - char msg[BUFSIZ]; -- -- (void) sprintf( msg, "'%s' with '%s'. ***", find.ptr, replace.ptr); -+ char *pmsg; -+ int len; -+ char *msg1 = "' with '"; -+ char *msg2 = "'. ***"; -+ -+ len = 1 + strlen(msg1) + strlen(msg2) + strlen(find.ptr) + -+ strlen(replace.ptr) + 1; -+ pmsg = XtStackAlloc(len, msg); -+ if (pmsg != NULL) { -+ (void) sprintf( pmsg, "`%s%s%s%s", find.ptr, msg1, replace.ptr, msg2); -+ } else { -+ pmsg = msg; -+ (void) sprintf(pmsg, "string ***"); -+ } - SetSearchLabels(search, "*** Error while replacing", msg, TRUE); -+ XtStackFree(pmsg, msg); - return(FALSE); - } - -@@ -1164,13 +1206,20 @@ XtArgVal value; - { - Widget temp_widget; - char buf[BUFSIZ]; -+ char *pbuf; -+ int len; - -- (void) sprintf(buf, "%s.%s", FORM_NAME, name); -+ len = strlen(FORM_NAME) + strlen(name) + 2; -+ pbuf = XtStackAlloc(len, buf); -+ if (pbuf == NULL) return FALSE; -+ (void) sprintf(pbuf, "%s.%s", FORM_NAME, name); - -- if ( (temp_widget = XtNameToWidget(shell, buf)) != NULL) { -+ if ( (temp_widget = XtNameToWidget(shell, pbuf)) != NULL) { - SetResource(temp_widget, res_name, value); -+ XtStackFree(pbuf, buf); - return(TRUE); - } -+ XtStackFree(pbuf, buf); - return(FALSE); - } - -diff --git a/xc/lib/Xaw3d/XawAlloc.h b/xc/lib/Xaw3d/XawAlloc.h -new file mode 100644 -index 0000000..ed0fe90 ---- /dev/null -+++ b/xc/lib/Xaw3d/XawAlloc.h -@@ -0,0 +1,10 @@ -+/* $XFree86: xc/lib/Xaw/XawAlloc.h,v 1.1.2.1 1998/05/16 09:05:23 dawes Exp $ */ -+ -+#define XtStackAlloc(size, stack_cache_array) \ -+ ((size) <= sizeof(stack_cache_array) \ -+ ? (XtPointer)(stack_cache_array) \ -+ : XtMalloc((unsigned)(size))) -+ -+#define XtStackFree(pointer, stack_cache_array) \ -+ if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); else -+ diff --git a/xc/lib/Xaw3d/XawI18n.h b/xc/lib/Xaw3d/XawI18n.h index 1b0ee5d..b0176bf 100644 --- a/xc/lib/Xaw3d/XawI18n.h diff --git a/Xaw3d-1.5E-thumb.patch b/Xaw3d-1.5E-thumb.patch index 9027384..22b76eb 100644 --- a/Xaw3d-1.5E-thumb.patch +++ b/Xaw3d-1.5E-thumb.patch @@ -240,19 +240,6 @@ index babd492..adbbc77 100644 /* ||| need to look at position changes */ -diff --git a/xc/lib/Xaw3d/Panner.c b/xc/lib/Xaw3d/Panner.c -index 2d2f482..f0d9ed8 100644 ---- a/xc/lib/Xaw3d/Panner.c -+++ b/xc/lib/Xaw3d/Panner.c -@@ -36,7 +36,7 @@ in this Software without prior written authorization from the X Consortium. - #include /* for Min */ - #include - #include /* for isascii() etc. */ --#include /* for atof() */ -+#include /* for atof() */ - - extern Bool XmuDistinguishablePixels(); /* not defined in any Xmu headers */ - diff --git a/xc/lib/Xaw3d/Scrollbar.c b/xc/lib/Xaw3d/Scrollbar.c index c105688..0566733 100644 --- a/xc/lib/Xaw3d/Scrollbar.c @@ -1377,15 +1364,6 @@ index 5344f97..14e808d 100644 (*swclass->threeD_class.shadowdraw) ((Widget) w, (XEvent *)0, (Region)0, w->threeD.relief, FALSE); -@@ -315,7 +315,7 @@ XtIntervalId *id; /* unused */ - if (w->strip_chart.points != NULL) { - w->strip_chart.points[0].x = w->strip_chart.interval + s; - XDrawPoints(XtDisplay(w), XtWindow(w), w->strip_chart.hiGC, -- w->strip_chart.points, w->strip_chart.scale, -+ w->strip_chart.points, (w->strip_chart.scale - 1), - CoordModePrevious); - } - @@ -346,6 +346,7 @@ int left, width; int next = w->strip_chart.interval; int scale = w->strip_chart.scale;