Gentoo Archives: gentoo-commits

From: "Joe Peterson (lavajoe)" <lavajoe@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-gfx/xv/files: xv-3.10a-fix-wait-20070520.patch
Date: Tue, 06 May 2008 22:31:28
Message-Id: E1JtVh0-0000OY-1h@stork.gentoo.org
1 lavajoe 08/05/06 22:31:26
2
3 Added: xv-3.10a-fix-wait-20070520.patch
4 Log:
5 Fix -wait option (bug #149270)
6 (Portage version: 2.1.4.4)
7
8 Revision Changes Path
9 1.1 media-gfx/xv/files/xv-3.10a-fix-wait-20070520.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-gfx/xv/files/xv-3.10a-fix-wait-20070520.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-gfx/xv/files/xv-3.10a-fix-wait-20070520.patch?rev=1.1&content-type=text/plain
13
14 Index: xv-3.10a-fix-wait-20070520.patch
15 ===================================================================
16 diff -Nur xv-3.10a_old/xvevent.c xv-3.10a/xvevent.c
17 --- xv-3.10a_old/xvevent.c 2008-05-06 12:44:41.000000000 -0600
18 +++ xv-3.10a/xvevent.c 2008-05-06 15:55:59.000000000 -0600
19 @@ -82,7 +82,7 @@
20 int retval,done,waiting;
21 #ifdef USE_TICKS
22 clock_t waitsec_ticks=0L, orgtime_ticks=0L, curtime_ticks;
23 - clock_t elapsed_ticks=0L, remaining_interval;
24 + clock_t elapsed_ticks=0L, remaining_interval, clock_ticks_per_sec;
25 #else
26 time_t orgtime=0L, curtime;
27 #endif
28 @@ -126,7 +126,8 @@
29 all pending events (ie, drawing the image the first time)
30 have been dealt with: START WAITING */
31 #ifdef USE_TICKS
32 - waitsec_ticks = (clock_t)(waitsec * CLK_TCK);
33 + clock_ticks_per_sec = sysconf(_SC_CLK_TCK);
34 + waitsec_ticks = (clock_t)(waitsec * clock_ticks_per_sec);
35 orgtime_ticks = times(NULL); /* unclear if NULL valid, but OK on Linux */
36 #else
37 orgtime = time(NULL);
38 @@ -168,11 +169,14 @@
39 } else
40 elapsed_ticks = curtime_ticks - orgtime_ticks;
41 remaining_interval = waitsec_ticks - elapsed_ticks;
42 - if (remaining_interval >= (clock_t)(1 * CLK_TCK))
43 + if (remaining_interval > clock_ticks_per_sec)
44 sleep(1);
45 else {
46 - /* less than one second remaining: do delay in msec, then return */
47 - Timer((remaining_interval * 1000L) / CLK_TCK); /* can't overflow */
48 + if (remaining_interval > 0) {
49 + /* less than one second remaining: do delay in msec, then return */
50 + Timer((remaining_interval * 1000L) / clock_ticks_per_sec); /* can't overflow */
51 + }
52 +
53 return waitloop? NEXTLOOP : NEXTQUIT;
54 }
55 #else
56
57
58
59 --
60 gentoo-commits@l.g.o mailing list