patch-internals_c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. $OpenBSD: patch-internals_c,v 1.3 2017/04/19 15:26:59 espie Exp $
  2. --- internals.c.orig Tue Jan 12 19:59:45 1993
  3. +++ internals.c Wed Apr 19 17:25:18 2017
  4. @@ -22,6 +22,9 @@
  5. # include "debug.h"
  6. # include "cdrom_globs.h"
  7. +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
  8. +# include "cdrom_freebsd.h"
  9. +#endif
  10. #ifdef sun
  11. # include "cdrom_sun.h"
  12. #endif
  13. @@ -29,13 +32,14 @@
  14. # include "cdrom_sgi.h"
  15. #endif
  16. -
  17. +static void scan_update();
  18. static XtIntervalId ivid = -1;
  19. static XtIntervalId scanivid = -1;
  20. static XtIntervalId stativid = -1;
  21. static unsigned int timer_mod = 1000 / TIMER_PERIOD;
  22. unsigned int timer_fsecs;
  23. +extern AppData app_data;
  24. int
  25. cdrom_get_curtime() {
  26. @@ -46,7 +50,7 @@ cdrom_get_curtime() {
  27. if (cdrom_open() == -1) {
  28. debug_printf(1, "cdrom_get_curtime: error from cdrom_open\n");
  29. - return;
  30. + return 0;
  31. }
  32. switch (cdrom_status()) {
  33. @@ -54,7 +58,7 @@ cdrom_get_curtime() {
  34. case CDROM_PLAYING:
  35. if (cdrom_get_curmsf(&curmsf) == -1) {
  36. debug_printf(1, "get_curtime: error reading location\n");
  37. - return;
  38. + return 0;
  39. }
  40. if (((curtrack = cdrom_get_curtrack()) == -1) ||
  41. @@ -77,13 +81,13 @@ cdrom_get_curtime() {
  42. }
  43. +static void update_track();
  44. /*
  45. * we poll the cd-rom drive every TIMER_PERIOD milliseconds to see where
  46. * it is and if it's on a new track, and update the label widget.
  47. */
  48. void
  49. cdrom_timer_on() {
  50. - static void update_track();
  51. if (cdi.state & CDROM_STATE_PLAY)
  52. ivid = XtAppAddTimeOut(appc, TIMER_PERIOD, update_track, NULL);
  53. @@ -170,7 +174,6 @@ cdrom_rewind () {
  54. struct msf track_start;
  55. struct msf start_addr, end_addr;
  56. int curtrack;
  57. - extern void scan_update();
  58. if (cdrom_get_curmsf(&start_addr) == -1) {
  59. debug_printf(1, "rew: error reading location\n");
  60. @@ -196,11 +199,11 @@ cdrom_rewind () {
  61. if (((cdi.state & CDROM_STATE_PLAY) &&
  62. ((track_start.minute * 60) + track_start.second) >=
  63. ((start_addr.minute * 60) + start_addr.second -
  64. - scanSkipInterval)) ||
  65. + app_data.scanSkipInterval)) ||
  66. ((cdi.state & CDROM_STATE_PAUSE) &&
  67. ((track_start.minute * 60) + track_start.second) >=
  68. ((start_addr.minute * 60) + start_addr.second -
  69. - pauseSkipInterval)))
  70. + app_data.pauseSkipInterval)))
  71. {
  72. start_addr = track_start;
  73. start_addr.second++; /* guarantee we never back up too far */
  74. @@ -208,9 +211,9 @@ cdrom_rewind () {
  75. else
  76. {
  77. if (cdi.state & CDROM_STATE_PAUSE) {
  78. - start_addr.second -= pauseSkipInterval;
  79. + start_addr.second -= app_data.pauseSkipInterval;
  80. } else if (cdi.state & CDROM_STATE_PLAY) {
  81. - start_addr.second -= scanSkipInterval;
  82. + start_addr.second -= app_data.scanSkipInterval;
  83. }
  84. if ((char) start_addr.second < 0)
  85. {
  86. @@ -223,9 +226,9 @@ cdrom_rewind () {
  87. else /* normal case */
  88. {
  89. if (cdi.state & CDROM_STATE_PAUSE) {
  90. - start_addr.second -= pauseSkipInterval;
  91. + start_addr.second -= app_data.pauseSkipInterval;
  92. } else if (cdi.state & CDROM_STATE_PLAY) {
  93. - start_addr.second -= scanSkipInterval;
  94. + start_addr.second -= app_data.scanSkipInterval;
  95. }
  96. if ((char) start_addr.second < 0)
  97. {
  98. @@ -274,7 +277,7 @@ cdrom_rewind () {
  99. {
  100. if (scanivid == -1)
  101. scanivid = XtAppAddTimeOut(appc,
  102. - (int)(pausePauseInterval * 1000.0),
  103. + (int)(app_data.pausePauseInterval * 1000.0),
  104. scan_update, NULL);
  105. cdi.state &= ~CDROM_STATE_PAUSE; /* allow timer to change */
  106. @@ -304,7 +307,6 @@ cdrom_ff () {
  107. struct msf start_addr, end_addr, next_start;
  108. char t;
  109. int curtrack;
  110. - extern void scan_update();
  111. if (cdrom_get_curmsf(&start_addr) == -1) {
  112. debug_printf(1, "ff: error reading location\n");
  113. @@ -332,11 +334,11 @@ cdrom_ff () {
  114. if (((cdi.state & CDROM_STATE_PLAY) &&
  115. ((next_start.minute * 60) + next_start.second) <=
  116. ((start_addr.minute * 60) + start_addr.second +
  117. - scanSkipInterval)) ||
  118. + app_data.scanSkipInterval)) ||
  119. ((cdi.state & CDROM_STATE_PAUSE) &&
  120. ((next_start.minute * 60) + next_start.second) <=
  121. ((start_addr.minute * 60) + start_addr.second +
  122. - pauseSkipInterval)))
  123. + app_data.pauseSkipInterval)))
  124. {
  125. /* start at end of current track */
  126. @@ -346,9 +348,9 @@ cdrom_ff () {
  127. else
  128. {
  129. if (cdi.state & CDROM_STATE_PAUSE) {
  130. - start_addr.second += pauseSkipInterval;
  131. + start_addr.second += app_data.pauseSkipInterval;
  132. } else if (cdi.state & CDROM_STATE_PLAY) {
  133. - start_addr.second += scanSkipInterval;
  134. + start_addr.second += app_data.scanSkipInterval;
  135. }
  136. if (start_addr.second >= 60)
  137. {
  138. @@ -360,9 +362,9 @@ cdrom_ff () {
  139. else
  140. {
  141. if (cdi.state & CDROM_STATE_PAUSE) {
  142. - start_addr.second += pauseSkipInterval;
  143. + start_addr.second += app_data.pauseSkipInterval;
  144. } else if (cdi.state & CDROM_STATE_PLAY) {
  145. - start_addr.second += scanSkipInterval;
  146. + start_addr.second += app_data.scanSkipInterval;
  147. }
  148. if (start_addr.second >= 60)
  149. {
  150. @@ -413,7 +415,7 @@ cdrom_ff () {
  151. {
  152. if (scanivid == -1)
  153. scanivid = XtAppAddTimeOut(appc,
  154. - (int)(pausePauseInterval * 1000.0),
  155. + (int)(app_data.pausePauseInterval * 1000.0),
  156. scan_update, NULL);
  157. cdi.state &= ~CDROM_STATE_PAUSE; /* allow timer to change */
  158. @@ -557,7 +559,7 @@ scan_update(data, id)
  159. cdi.state &= ~CDROM_STATE_STOP;
  160. }
  161. ivid = XtAppAddTimeOut(appc,
  162. - (int)(scanPauseInterval * 1000.0),
  163. + (int)(app_data.scanPauseInterval * 1000.0),
  164. scan_update, NULL);
  165. }
  166. else
  167. @@ -574,7 +576,7 @@ scan_update(data, id)
  168. }
  169. ivid = XtAppAddTimeOut(appc,
  170. - (int)(scanPauseInterval * 1000.0),
  171. + (int)(app_data.scanPauseInterval * 1000.0),
  172. scan_update, NULL);
  173. }
  174. else if (scanivid != -1) {
  175. @@ -662,7 +664,7 @@ update_track(data, id)
  176. cdi.state &= ~CDROM_STATE_STOP;
  177. }
  178. ivid = XtAppAddTimeOut(appc,
  179. - (int)(scanPauseInterval * 1000.0),
  180. + (int)(app_data.scanPauseInterval * 1000.0),
  181. update_track, NULL);
  182. }
  183. else
  184. @@ -679,7 +681,7 @@ update_track(data, id)
  185. }
  186. ivid = XtAppAddTimeOut(appc,
  187. - (int)(scanPauseInterval * 1000.0),
  188. + (int)(app_data.scanPauseInterval * 1000.0),
  189. update_track, NULL);
  190. }
  191. else