summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2018-10-20 00:17:47 +0200
committerChristian Persch <chpe@src.gnome.org>2018-10-20 00:17:47 +0200
commit90000c9d5c1d0928e02da0a799bb81676589e073 (patch)
tree1baa5e58fe4c74325a8a6a03c98662f35131f2ee
parent75e154f89565af475ef4c9c9a01a805eadb9405e (diff)
spectre-gs: Remove support for old ghostscript
Now that we require a recent ghostscript, we can remove the support for older versions.
-rw-r--r--libspectre/spectre-device.c9
-rw-r--r--libspectre/spectre-gs.c21
2 files changed, 8 insertions, 22 deletions
diff --git a/libspectre/spectre-device.c b/libspectre/spectre-device.c
index 3aa41f5..691b99a 100644
--- a/libspectre/spectre-device.c
+++ b/libspectre/spectre-device.c
@@ -284,14 +284,11 @@ spectre_device_render (SpectreDevice *device,
char *dsp_format, *dsp_handle;
char *width_points = NULL;
char *height_points = NULL;
- long gs_version;
gs = spectre_gs_new ();
if (!gs)
return SPECTRE_STATUS_NO_MEMORY;
- gs_version = spectre_gs_get_version();
-
if (!spectre_gs_create_instance (gs, device)) {
spectre_gs_cleanup (gs, CLEANUP_DELETE_INSTANCE);
spectre_gs_free (gs);
@@ -379,7 +376,7 @@ spectre_device_render (SpectreDevice *device,
}
set = _spectre_strdup_printf ("<< /Orientation %d >> setpagedevice .locksafe",
- gs_version >= 908 ? SPECTRE_ORIENTATION_PORTRAIT : rc->orientation);
+ SPECTRE_ORIENTATION_PORTRAIT);
if (!spectre_gs_send_string (gs, set)) {
free (set);
spectre_gs_free (gs);
@@ -394,8 +391,8 @@ spectre_device_render (SpectreDevice *device,
*page_data = device->user_image;
*row_length = device->row_length;
- if (gs_version >= 908)
- rotate_image_to_orientation (page_data, row_length, width, height, rc->orientation);
+
+ rotate_image_to_orientation (page_data, row_length, width, height, rc->orientation);
spectre_gs_free (gs);
diff --git a/libspectre/spectre-gs.c b/libspectre/spectre-gs.c
index f586321..ad372f3 100644
--- a/libspectre/spectre-gs.c
+++ b/libspectre/spectre-gs.c
@@ -34,17 +34,6 @@
*/
#define GS_MIN_VERSION (924)
-/* e_ macros have been removed from Ghostscript in 9.18. */
-#ifndef e_Fatal
-#define e_Fatal gs_error_Fatal
-#endif
-#ifndef e_NeedInput
-#define e_NeedInput gs_error_NeedInput
-#endif
-#ifndef e_ExecStackUnderflow
-#define e_ExecStackUnderflow gs_error_ExecStackUnderflow
-#endif
-
#define BUFFER_SIZE 32768
struct SpectreGS {
@@ -59,12 +48,12 @@ critic_error_code (int code)
if (code <= -100) {
switch (code) {
- case e_Fatal:
+ case gs_error_Fatal:
fprintf (stderr, "(libspectre) ghostscript reports: fatal internal error %d", code);
return TRUE;
break;
- case e_ExecStackUnderflow:
+ case gs_error_ExecStackUnderflow:
fprintf (stderr, "(libspectre) ghostscript reports: stack overflow %d", code);
return TRUE;
break;
@@ -125,9 +114,9 @@ spectre_gs_process (SpectreGS *gs,
set = _spectre_strdup_printf ("%d %d translate\n", -x, -y);
error = gsapi_run_string_continue (ghostscript_instance, set, strlen (set),
0, &exit_code);
- error = error == e_NeedInput ? 0 : error;
+ error = error == gs_error_NeedInput ? 0 : error;
free (set);
- if (error != e_NeedInput && critic_error_code (error)) {
+ if (error != gs_error_NeedInput && critic_error_code (error)) {
fclose (fd);
return FALSE;
}
@@ -142,7 +131,7 @@ spectre_gs_process (SpectreGS *gs,
read = fread (buf, sizeof (char), to_read, fd);
error = gsapi_run_string_continue (ghostscript_instance,
buf, read, 0, &exit_code);
- error = error == e_NeedInput ? 0 : error;
+ error = error == gs_error_NeedInput ? 0 : error;
left -= read;
}