SHA256
1
0
forked from pool/xfig
xfig/xfig.3.2.5-zoom.dif

71 lines
2.9 KiB
Plaintext

--- main.c
+++ main.c 2008-05-14 19:08:15.853469188 +0200
@@ -1533,7 +1533,7 @@ notablet:
if (event.type == KeyPress
&& XtWindow(canvas_sw) == ((XKeyPressedEvent *)&event)->window) {
KeySym key = XLookupKeysym((XKeyPressedEvent *)&event, 0);
- if (XK_F1 <= key && key <= XK_F35) {
+ if (XK_F1 >= key && key <= XK_F35) {
XtDispatchEvent(&event);
} else {
canvas_selected(canvas_sw, &event, NULL, NULL);
--- w_rulers.c
+++ w_rulers.c 2008-05-14 19:05:40.041361341 +0200
@@ -1166,7 +1166,7 @@ void reset_topruler(void)
register int i,k;
register tick_info* tk;
register Pixmap p = topruler_pm;
- char number[6];
+ char number[60];
int X0,len;
int tickmod, tickskip;
@@ -1183,7 +1183,7 @@ void reset_topruler(void)
tickmod = 1;
/* see how big a label is to adjust spacing, if necessary */
- sprintf(number, "%d%s", (X0+(int)((TOPRULER_WD/zoomscale)))/tickmod, cur_fig_units);
+ snprintf(number, sizeof(number)-1, "%d%s", (X0+(int)((TOPRULER_WD/zoomscale)))/tickmod, cur_fig_units);
len = XTextWidth(roman_font, number, strlen(number));
while (skipx < (len + 5)/zoomscale) {
skip *= 2;
@@ -1197,11 +1197,11 @@ void reset_topruler(void)
/* string */
if (i % skipx == 0) {
if ((i/10) % tickmod == 0)
- sprintf(number, "%d%s", i/tickmod, cur_fig_units);
+ snprintf(number, sizeof(number)-1, "%d%s", i/tickmod, cur_fig_units);
else if (i % tickmod == 0)
- sprintf(number, "%d", i/tickmod);
+ snprintf(number, sizeof(number)-1, "%d", i/tickmod);
else
- sprintf(number, precstr, (float)(1.0 * i / tickmod));
+ snprintf(number, sizeof(number)-1, precstr, (float)(1.0 * i / tickmod));
/* get length of string to position it */
len = XTextWidth(roman_font, number, strlen(number));
/* we center on the number only, letting the minus sign hang out */
@@ -1425,7 +1425,7 @@ void reset_sideruler(void)
register int i,k;
register tick_info* tk;
register Pixmap p = sideruler_pm;
- char number[6],len;
+ char number[60],len;
int Y0;
int tickmod, tickskip;
@@ -1456,11 +1456,11 @@ void reset_sideruler(void)
/* string */
if (i % skipx == 0) {
if ((i/10) % tickmod == 0)
- sprintf(number, "%d%s", i/tickmod, cur_fig_units);
+ snprintf(number, sizeof(number)-1, "%d%s", i/tickmod, cur_fig_units);
else if (i % tickmod == 0)
- sprintf(number, "%d", i/tickmod);
+ snprintf(number, sizeof(number)-1, "%d", i/tickmod);
else
- sprintf(number, precstr, (float)(1.0 * i / tickmod));
+ snprintf(number, sizeof(number)-1, precstr, (float)(1.0 * i / tickmod));
/* get length of string to position it */
len = XTextWidth(roman_font, number, strlen(number));
/* vertically centered on inch/cm mark */