1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
$NetBSD: patch-bq,v 1.2 2011/07/03 20:15:59 dholland Exp $
- use modern C
--- server/dprx.c~ 1998-04-03 17:45:53.000000000 -0500
+++ server/dprx.c 2008-08-31 00:43:57.000000000 -0400
@@ -27,7 +27,9 @@
* Routines for printing X protocol structures. *
* *
************************************************************************/
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/Xproto.h>
@@ -60,7 +62,7 @@ dprx_stackmode_str
case BottomIf: return "BottomIf";
case Opposite: return "Opposite";
default:
- sprintf(buf, "<%d>", mode);
+ snprintf(buf, sizeof(buf), "<%d>", mode);
return buf;
}
}
@@ -83,7 +85,7 @@ dprx_notify_detail_str
case NotifyPointerRoot: return "NotifyPointerRoot";
case NotifyDetailNone: return "NotifyDetailNone";
default:
- sprintf(buf, "<%d>", detail);
+ snprintf(buf, sizeof(buf), "<%d>", detail);
return buf;
}
}
@@ -265,7 +267,7 @@ dprx_notify_mode_str
case NotifyUngrab: return "NotifyUngrab";
case NotifyWhileGrabbed: return "NotifyWhileGrabbed";
default:
- sprintf(buf, "<unknown mode(%d)>", mode);
+ snprintf(buf, sizeof(buf), "<unknown mode(%d)>", mode);
return buf;
}
}
@@ -293,7 +295,7 @@ dprx_allowevents_mode_str
case AsyncBoth: return "AsyncBoth";
case SyncBoth: return "SyncBoth";
default:
- sprintf(buf, "<unknown mode(%d)>", mode);
+ snprintf(buf, sizeof(buf), "<unknown mode(%d)>", mode);
return buf;
}
}
@@ -318,7 +320,7 @@ dprx_addrfam_str
case FamilyLocal: return "FamilyLocal";
case FamilyWild: return "FamilyWild";
default:
- sprintf(buf, "FamilyBAD(%d)", family);
+ snprintf(buf, sizeof(buf), "FamilyBAD(%d)", family);
return buf;
}
}
@@ -558,7 +560,7 @@ dprx_pixel_str
{
static char buf[32];
- sprintf(buf, "%d (%x)", pxl, pxl);
+ snprintf(buf, sizeof(buf), "%d (%x)", pxl, pxl);
return buf;
}
@@ -2213,7 +2215,7 @@ dprx_event
warn("\teventX_________ %d\n", ep->u.keyButtonPointer.eventX);
warn("\teventY_________ %d\n", ep->u.keyButtonPointer.eventY);
if (isprint(ep->u.u.detail))
- sprintf(buf, " '%c'", ep->u.u.detail);
+ snprintf(buf, sizeof(buf), " '%c'", ep->u.u.detail);
else
buf[0] = '\0';
warn("\tdetail_________ %d%s\n", ep->u.u.detail, buf);
|