patch-Ghostview_c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. $OpenBSD: patch-Ghostview_c,v 1.1 2002/04/26 01:44:08 espie Exp $
  2. --- Ghostview.c.orig Sat Jul 24 04:29:12 1993
  3. +++ Ghostview.c Fri Apr 26 02:49:35 2002
  4. @@ -30,6 +30,9 @@
  5. #include <X11/Xos.h>
  6. #include "GhostviewP.h"
  7. #include <ctype.h>
  8. +#include <stdlib.h>
  9. +#include <sys/types.h>
  10. +#include <sys/wait.h>
  11. #ifndef XlibSpecificationRelease
  12. typedef char *XPointer;
  13. @@ -74,8 +77,8 @@ extern int errno;
  14. #define GV_BUFSIZ 1024
  15. #endif /* VMS */
  16. -static void ComputeXdpi();
  17. -static void ComputeYdpi();
  18. +static void ComputeXdpi(Widget, int, XrmValue *);
  19. +static void ComputeYdpi(Widget, int, XrmValue *);
  20. static XtResource resources[] = {
  21. #define offset(field) XtOffsetOf(GhostviewRec, ghostview.field)
  22. @@ -131,27 +134,32 @@ static XtResource resources[] = {
  23. #undef offset
  24. };
  25. -static void Message();
  26. -static void Notify();
  27. -static void Input();
  28. -static void Output();
  29. -
  30. -static void ClassInitialize();
  31. -static void ClassPartInitialize();
  32. -static void Initialize();
  33. -static void Realize();
  34. -static void Destroy();
  35. -static void Resize();
  36. -static Boolean SetValues();
  37. -static XtGeometryResult QueryGeometry();
  38. -
  39. -static void Layout();
  40. -static Boolean ComputeSize();
  41. -static void ChangeSize();
  42. -static Boolean Setup();
  43. -static void StartInterpreter();
  44. -static void StopInterpreter();
  45. -static void InterpreterFailed();
  46. +static void Message(Widget, XEvent *, String *, Cardinal *);
  47. +static void Notify(Widget, XEvent *, String *, Cardinal *);
  48. +static void Input(XtPointer, int *, XtInputId *);
  49. +static void Output(XtPointer, int *, XtInputId *);
  50. +
  51. +static void ClassInitialize(void);
  52. +static void ClassPartInitialize(WidgetClass);
  53. +static void Initialize(Widget, Widget, ArgList, Cardinal *);
  54. +static void Realize(Widget, Mask *, XSetWindowAttributes *);
  55. +static void Destroy(Widget);
  56. +static void Resize(Widget);
  57. +static Boolean SetValues(Widget, Widget, Widget);
  58. +static XtGeometryResult QueryGeometry(Widget, XtWidgetGeometry *, XtWidgetGeometry *);
  59. +
  60. +static void Layout(Widget, Boolean, Boolean);
  61. +static Boolean ComputeSize(Widget, Boolean, Boolean, Dimension *, Dimension *);
  62. +static void ChangeSize(Widget, Dimension, Dimension);
  63. +static Boolean Setup(Widget);
  64. +static void StartInterpreter(Widget);
  65. +static void StopInterpreter(Widget);
  66. +static void InterpreterFailed(Widget);
  67. +
  68. +Boolean XmuCvtStringToPageOrientation(Display *, XrmValue *, Cardinal *,
  69. + XrmValue *, XrmValue *, XtPointer *);
  70. +Boolean XmuCvtStringToPalette(Display *, XrmValue *, Cardinal *,
  71. + XrmValue *, XrmValue *, XtPointer *);
  72. static XtActionsRec actions[] =
  73. {
  74. @@ -1043,8 +1051,8 @@ Setup(w)
  75. gvw->ghostview.gs_width = gvw->core.width;
  76. gvw->ghostview.gs_height = gvw->core.height;
  77. - sprintf(buf, "%d %d %d %d %d %d %g %g %d %d %d %d",
  78. - bpixmap, gvw->ghostview.orientation,
  79. + sprintf(buf, "%ld %d %d %d %d %d %g %g %d %d %d %d",
  80. + (long)bpixmap, gvw->ghostview.orientation,
  81. gvw->ghostview.llx, gvw->ghostview.lly,
  82. gvw->ghostview.urx, gvw->ghostview.ury,
  83. gvw->ghostview.xdpi, gvw->ghostview.ydpi,
  84. @@ -1055,11 +1063,11 @@ Setup(w)
  85. XA_STRING, 8, PropModeReplace,
  86. (unsigned char *)buf, strlen(buf));
  87. - sprintf(buf, "%s %d %d",
  88. + sprintf(buf, "%s %ld %ld",
  89. gvw->ghostview.palette == XtPaletteMonochrome ? "Monochrome" :
  90. gvw->ghostview.palette == XtPaletteGrayscale ? "Grayscale" :
  91. gvw->ghostview.palette == XtPaletteColor ? "Color" : "?",
  92. - gvw->ghostview.foreground, gvw->core.background_pixel);
  93. + (long)gvw->ghostview.foreground, (long)gvw->core.background_pixel);
  94. XChangeProperty(XtDisplay(w), XtWindow(w),
  95. XmuInternAtom(XtDisplay(w), gvc->ghostview_class.gv_colors),
  96. XA_STRING, 8, PropModeReplace,
  97. @@ -1168,7 +1176,7 @@ StartInterpreter(w)
  98. close(std_out[1]);
  99. dup2(std_err[1], 2);
  100. close(std_err[1]);
  101. - sprintf(buf, "%d", XtWindow(w));
  102. + sprintf(buf, "%ld", (long int)(XtWindow(w)));
  103. setenv("GHOSTVIEW", buf, True);
  104. setenv("DISPLAY", XDisplayString(XtDisplay(w)), True);
  105. if (gvw->ghostview.filename == NULL) {