aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2013-09-15 02:57:12 +0200
committerWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2013-09-15 02:57:12 +0200
commitedd45b2d961876fe2105a1a27fa53b7c2044ed5b (patch)
tree5029f0e3421b7720081706d435a8177449c9df95
parentadc7a12773fa9062ef74ecc33d75de046b533a34 (diff)
downloadcodesamples-edd45b2d961876fe2105a1a27fa53b7c2044ed5b.tar.gz
codesamples-edd45b2d961876fe2105a1a27fa53b7c2044ed5b.tar.bz2
type for counter changed to not overflow before loop conditional is reached
-rw-r--r--samples/X11/x11atomstuffer/x11atomstuffer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/samples/X11/x11atomstuffer/x11atomstuffer.c b/samples/X11/x11atomstuffer/x11atomstuffer.c
index d2f338f..70ed425 100644
--- a/samples/X11/x11atomstuffer/x11atomstuffer.c
+++ b/samples/X11/x11atomstuffer/x11atomstuffer.c
@@ -15,6 +15,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <stdint.h>
#include <time.h>
#include <unistd.h>
@@ -29,7 +30,8 @@ char const doitkey[] = "wastemyX11server";
int main(int argc, char *argv[])
{
- unsigned int i;
+ uint64_t i;
+ unsigned int r = getpid() ^ time(NULL);
if( argc < 2 || strcmp(argv[1], doitkey) ) {
fprintf(stderr,
@@ -57,11 +59,9 @@ int main(int argc, char *argv[])
}
Xscreen = DefaultScreen(Xdisplay);
- unsigned int r = getpid() ^ time(NULL);
-
for(i=0; i < 0xffffffff; i++) {
char atomstr[33];
- snprintf(atomstr,32, "_wasted_0x%08x_0x%08x", r, i);
+ snprintf(atomstr,32, "_wasted_0x%08x_0x%08x", r, (unsigned int)i);
XInternAtom(Xdisplay, atomstr, False);
if( !(i % 0x00010000 ) ) {
fprintf(stderr, "%s\n", atomstr);