Commit 6ffa47a7 authored by Jonas Smedegaard's avatar Jonas Smedegaard

Imported Upstream version 9.10~dfsg

parent 8bb328e8
......@@ -30,6 +30,23 @@ setundercolorremoval
% CPSI doesn't define "Localization" resource.
/Localization /Category undefineresource
% Quality Logic test 09-59.ps tries to set each listed /OutputDevice.
% This can cause problems with some devices (eg mswinpr2 on Windows)
% so for the CET files we define the OutputDevice resource as
% being empty. We need to redefine /.definecategory as that definition
% gets destroyed at the end of gs_res.ps
/OutputDevice /Category undefineresource
/.definecategory % <name> -mark- <key1> ... <valuen> .definecategory -
{ counttomark 2 idiv 2 add % .Instances, Category
/Generic /Category findresource dup maxlength 3 -1 roll add
dict .copydict begin
counttomark 2 idiv { def } repeat pop % pop the mark
currentdict end /Category defineresource pop
} bind def
/OutputDevice mark /InstanceType /dicttype .definecategory
% Redefine Font category to return -1 (unknown) VM usage
% in all cases to avoid differences between hosts.
/Font /Category findresource
......
......@@ -29,7 +29,7 @@
% Interpreter library version number
% NOTE: the interpreter code requires that the first non-comment token
% in this file be an integer, and that it match the compiled-in version!
909
910
% Check the interpreter revision.
dup revision ne
......@@ -1909,7 +1909,7 @@ put % Policies in pagedevice
% so that .getuseciecolor has the correct value (see gs_setpd.ps)
/setpagedevice where {
pop systemdict /UseCIEColor known {
mark /UseCIEColor UseCIEColor .dicttomark setpagedevice
mark /UseCIEColor UseCIEColor /..StartupGlobal //true .dicttomark setpagedevice
} if
} if
......@@ -2040,7 +2040,9 @@ readonly def
% properties and pagedevice .LockSafetyParams in agreement even
% after a restore that changes the value to false.
currentglobal currentpagedevice gcheck setglobal % use correct VM space
<< /.LockSafetyParamsGlobal //true >> setpagedevice
<< /.LockSafetyParams //true
/..StartupGlobal //true
>> setpagedevice
setglobal
//SAFETY /safe //true .forceput % overrides readonly
} .bind executeonly odef
......@@ -2055,9 +2057,23 @@ readonly def
>> setuserparams
}
if
.locksafeglobal
.locksafe
} .bind executeonly odef
%% See /.locksafeglobal above.
%%
/.setsafeglobal {
SAFETY /safe get not {
<<
/PermitFileReading [ ]
/PermitFileWriting [ ]
/PermitFileControl [ ]
>> setuserparams
}
if
.locksafeglobal
} bind executeonly odef
/deletefile {
dup { deletefile } stopped {
pop //deletefile $error /errorname get signalerror
......@@ -2081,7 +2097,7 @@ readonly def
} .bind executeonly odef
% If we are running in SAFER mode, lock things down
SAFER { .setsafe } if
SAFER { .setsafeglobal } if
% If we delayed binding, make it possible to do it later.
/.bindnow {
......@@ -2162,6 +2178,13 @@ $error /.nosetlocal //false put
(END GLOBAL) VMDEBUG
%% .savelocalstate is part of Display PostScript (if included). Part of the function of
%% the .savelocalstate routine is to store the 'initial saved gstate' (savedinitialgstate)
%% in systemdict. The code in dps1.c, gstate_check_space, disallows writing or creating
%% gstates in global VM in certain conditions. If we execute setpagedevice before we
%% reach this point, we must ensure that we do so using /..StartupGlobal so that
%% the dictionary is defined in global VM, because the gstate contains a pointer to the
%% device dictionary, and if that is allocated in local VM we will fail the gstate check.
/.savelocalstate where {
% If we might create new contexts, save away copies of all dictionaries
% referenced from systemdict that are stored in local VM,
......
......@@ -794,7 +794,6 @@ counttomark 2 idiv
/ControlLanguage mark /InstanceType /dicttype .definecategory
/HWOptions mark /InstanceType /dicttype .definecategory
/Localization mark /InstanceType /dicttype .definecategory
/OutputDevice mark /InstanceType /dicttype .definecategory
/PDL mark /InstanceType /dicttype .definecategory
% CIDFont, CIDMap, and CMap are defined in gs_cidfn.ps
% FontSet is defined in gs_cff.ps
......@@ -803,6 +802,27 @@ counttomark 2 idiv
(END MISC) VMDEBUG
% Define the OutputDevice category.
/OutputDevice mark
/InstanceType /dicttype
/.Instances mark
%% devicedict is not created yet so here we employ a technique similar to
%% that used to create it, in order to get the device names. We run a loop
%% executing .getdevice with incremental numbers until we get an error.
%% The devicedict creation only stops on a rangecheck, we stop on any error.
%% We need to use .internalstopped, not stopped or we get an invalidacces
%% later in this file. Instances of /OutputDevice are dictionaries, and the
%% only required key is a /PageSize. The array of 4 numbers are minimum to
%% maximum and are matches for the Adobe Acrobat Distiller values.
0
{
{dup .getdevice .devicename cvn 1 dict dup /PageSize [1 1 14400 14400] put [exch readonly 0 -1] 3 -1 roll 1 add} loop
} .internalstopped pop
%% Remove the count, and the duplicate, from the stack
pop pop
.dicttomark
.definecategory
% Define the ColorSpace category.
/.defaultcsnames mark
......
......@@ -675,11 +675,10 @@ SETPDDEBUG { (Result of putting.) = pstack flush } if
% solution is to make sure the VM mode is global during
% startup (to satisfy gs_dps.ps) and local thereafter
% (to satisfy the WordPerfect bug).
dup dup length 1 eq exch /.LockSafetyParamsGlobal known and {
currentglobal exch true setglobal
dup /.LockSafetyParamsGlobal get
1 index /.LockSafetyParamsGlobal undef
1 index /.LockSafetyParams 3 -1 roll put
dup /..StartupGlobal known
{
currentglobal exch true setglobal
dup /..StartupGlobal undef
} {
% ensure that we are always in local VM mode to avoid
% mismatches. This is because we always create child
......
......@@ -555,19 +555,21 @@ currentdict /token_nofail_dict .undef
} bind def
/endobj { % <object#> <generation#> <object> endobj <object>
2 index type /integertype ne 2 index type /integertype ne or {
3 {
dup
dup index type /integertype eq
exch 1 add index type /integertype eq or {
1 sub { pop } repeat //null
{
2 index type /integertype ne 2 index type /integertype ne or {
count 3 gt {
( **** Warning: obj definition followed by multiple tokens, attempting to recover.\n) pdfformaterror
pop
} {
//null
( **** Warning: ignoring obj followed by multiple tokens.\n) pdfformaterror
exit
} {
1 add
} ifelse
} loop
} if
} {
exit
} ifelse
} loop
3 1 roll
% Read the xref entry if we haven't yet done so.
% This is only needed for generation # checking.
......
......@@ -643,7 +643,7 @@ def
/DataSource DataSource mark
/Intent 1
/AsyncRead //true
.dicttomark .reusablestreamdecode def
.dicttomark {.reusablestreamdecode} stopped {pop} if def
PDFfile exch setfileposition
currentdict end currentdict end
5 dict begin
......@@ -1653,7 +1653,7 @@ currentdict /last-ditch-bpc-csp undef
/DataSource DataSource mark
/Intent 1
/AsyncRead //true
.dicttomark .reusablestreamdecode def
.dicttomark {.reusablestreamdecode} stopped {pop} if def
PDFfile exch setfileposition
currentdict end currentdict end
5 dict begin
......
This diff is collapsed.
......@@ -210,6 +210,11 @@
% move the file to this position and read startxref and position
PDFfile exch setfileposition PDFfile token
pop pop PDFfile token pop
dup type /integertype eq not {
pop
% startxref not followed by integer. We will search the end of the file for trailer.
PDFfilelen
} if
} {
% startxref not found. We will search the end of the file for trailer.
pop pop PDFfilelen
......@@ -223,12 +228,13 @@
dup 0 eq {
pop
( **** Error: Trailer is not found.\n) pdfformaterror
} if
}{
% get the trailer
PDFfile exch setfileposition % set to the specified trailer location
/dictlevelcount 0 def
PDFfile traileropdict .pdfrun % read trailer info
/Trailer exch def
} ifelse
} bind def
% This routine will determine if there is stuff after the %%EOF. There is
......
This diff is collapsed.
This diff is collapsed.
......@@ -312,16 +312,20 @@ devn_get_params(gx_device * pdev, gs_param_list * plist,
gs_param_int_array equiv_cmyk;
int equiv_elements[5 * (GX_DEVICE_MAX_SEPARATIONS - MAX_DEVICE_PROCESS_COLORS)] = { 0 }; /* 5 * max_spot_colors */
set_param_array(scna, NULL, 0);
set_param_array(sona, NULL, 0);
for (spot_num = 0; spot_num < pdevn_params->separations.num_separations; spot_num++) {
equiv_elements[i++] = pequiv_colors->color[spot_num].color_info_valid ? 1 : 0;
equiv_elements[i++] = pequiv_colors->color[spot_num].c;
equiv_elements[i++] = pequiv_colors->color[spot_num].m;
equiv_elements[i++] = pequiv_colors->color[spot_num].y;
equiv_elements[i++] = pequiv_colors->color[spot_num].k;
if (pequiv_colors != NULL) {
for (spot_num = 0; spot_num < pdevn_params->separations.num_separations; spot_num++) {
equiv_elements[i++] = pequiv_colors->color[spot_num].color_info_valid ? 1 : 0;
equiv_elements[i++] = pequiv_colors->color[spot_num].c;
equiv_elements[i++] = pequiv_colors->color[spot_num].m;
equiv_elements[i++] = pequiv_colors->color[spot_num].y;
equiv_elements[i++] = pequiv_colors->color[spot_num].k;
}
}
equiv_cmyk.data = equiv_elements;
equiv_cmyk.size = i;
equiv_cmyk.persistent = false;
......
......@@ -106,6 +106,7 @@ typedef struct directory_enum_s directory_enum;
struct file_enum_s {
char *pattern;
bool illegal;
struct directory_enum_s *current;
};
gs_private_st_ptrs2(st_file_enum, struct file_enum_s, "directory_enum",
......@@ -128,7 +129,7 @@ static int enumerate_directory_init(gs_memory_t *mem, directory_enum *pden, cons
return -1;
memcpy(pden->pattern, directory, dir_size);
if (dir_size > 1 && directory[dir_size - 1] != '/') {
if (dir_size > 1 && directory[dir_size - 1] != '/' && directory[dir_size - 1] != '\\') {
pden->pattern[dir_size++] = '/';
}
if (filename) {
......@@ -173,6 +174,7 @@ gp_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
return 0;
}
pfen->current = pden;
pfen->illegal = false;
/* pattern could be allocated as a string, */
/* but it's simpler for GC and freeing to allocate it as bytes. */
......@@ -181,17 +183,19 @@ gp_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
if (pattern == 0)
return 0;
/* translate the template into a pattern discarding the escape */
/* char '\' (not needed by the OS Find...File logic). Note that */
/* a final '\' in the string is also discarded. */
/* translate the template into a pattern. Note that */
/* a final '\' or '/' in the string is discarded. */
for (i = 0, j=0; i < patlen; i++) {
if (pat[i] == '\\') {
i++;
if (i == patlen)
break; /* '\' at end ignored */
if (j > 0 && (pattern[j-1] == '/' || pattern[j-1] == '\\')) {
while (pat[i] == '/' || pat[i] == '\\') {
i++;
if (i == patlen)
break; /* '\' at end ignored */
}
}
pattern[j++]=pat[i];
}
pfen->pattern = pattern;
pat = pfen->pattern;
patlen = j;
......@@ -202,8 +206,17 @@ gp_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
hsize = i + 1;
}
/* Scan for illegal characters in the directory path */
for (i=0; i < hsize; i++) {
if (pat[i] == '*' || pat[i] == '?')
/* We can't abort cleanly from here so we store the flag for later */
/* See gp_enumerate_files_next() below. */
pfen->illegal = true;
}
if (enumerate_directory_init(mem, pden, pfen->pattern, hsize, NULL, &pat[hsize], patlen - hsize) < 0)
{
gs_free_object(mem, pattern, "free file enumerator pattern buffer on error");
gs_free_object(mem, pden, "free directory enumerator on error");
gs_free_object(mem, pfen, "free file enumerator on error");
return 0;
......@@ -224,6 +237,11 @@ gp_enumerate_files_next(file_enum * pfen, char *ptr, uint maxlen)
#else
char outfname[(sizeof(pden->find_data.cFileName)*3+1)/2];
#endif
if (pfen->illegal) {
gp_enumerate_files_close(pfen);
return ~(uint) 0;
}
for(;;) {
if (pden->first_time) {
#ifdef GS_NO_UTF8
......@@ -312,7 +330,7 @@ gp_enumerate_files_next(file_enum * pfen, char *ptr, uint maxlen)
} else {
wchar_to_utf8(fname, pden->find_data.cFileName);
if (enumerate_directory_init(pden->memory, new_denum, pden->pattern, pden->head_size,
fname, &pden->pattern[pden->head_size], pden->pat_size - pden->head_size) < 0)
fname, "*", 1) < 0)
{
gs_free_object(pden->memory, new_denum, "free directory enumerator on error");
}
......
/* Copyright (C) 2001-2012 Artifex Software, Inc.
/* Copyright (C) 2001-2013 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
......@@ -33,7 +33,7 @@ const long gs_buildtime = GS_BUILDTIME;
#ifndef GS_COPYRIGHT
# define GS_COPYRIGHT\
"Copyright (C) 2012 Artifex Software, Inc. All rights reserved."
"Copyright (C) 2013 Artifex Software, Inc. All rights reserved."
#endif
const char *const gs_copyright = GS_COPYRIGHT;
......
......@@ -145,8 +145,15 @@ extern const char *const *const cmd_sub_op_names[16];
*/
#define cmd_max_intsize(siz)\
(((siz) * 8 + 6) / 7)
/* NB: Assume that the largest size is for dash patterns. Larger that this
* need to be read from the cbuf in a loop.
*/
#define cmd_largest_size\
(2 + (1 + cmd_max_dash) * sizeof(float))
(2 + sizeof(float) /* dot_length */\
+ sizeof(float) /* offset */\
+ (cmd_max_dash * sizeof(float))\
)
/* ---------------- Command parameters ---------------- */
......
......@@ -17,6 +17,7 @@
/* Higher-level image operations for band lists */
#include "math_.h"
#include "memory_.h"
#include "string_.h" /* for strcmp */
#include "gx.h"
#include "gserrors.h"
#include "gscspace.h"
......@@ -916,10 +917,13 @@ clist_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
if (cmd_largest_size + bytes_per_row > cdev->cend - cdev->cbuf)
goto use_default;
}
if (pim->Interpolate)
if (pim->Interpolate) {
if (strcmp("pattern-clist",dev->dname) == 0)
goto use_default;
pie->support.x = pie->support.y = MAX_ISCALE_SUPPORT + 1;
else
} else {
pie->support.x = pie->support.y = 0;
}
sbox.p.x = pie->rect.p.x - pie->support.x;
sbox.p.y = pie->rect.p.y - pie->support.y;
sbox.q.x = pie->rect.q.x + pie->support.x;
......
......@@ -160,6 +160,11 @@ top_up_cbuf(command_buf_t *pcb, const byte **pcbp)
stream_state *st = pcb->s->state;
# endif
if (pcb->end - cbp >= pcb->size) {
errprintf(pcb->s->memory, "Clist I/O error: cbp past end of buffer\n");
return (gs_error_ioerror);
}
if (seofp(pcb->s)) {
/* Can't use offset_map, because s_close resets s->state. Don't top up. */
pcb->end_status = pcb->s->end_status;
......
......@@ -2045,7 +2045,7 @@ $(GLOBJ)gxclrect.$(OBJ) : $(GLSRC)gxclrect.c $(AK) $(gx_h)\
$(GLCC) $(GLO_)gxclrect.$(OBJ) $(C_) $(GLSRC)gxclrect.c
$(GLOBJ)gxclimag.$(OBJ) : $(GLSRC)gxclimag.c $(AK) $(gx_h)\
$(gserrors_h) $(math__h) $(memory__h) $(gscdefs_h) $(gscspace_h)\
$(gserrors_h) $(math__h) $(memory__h) $(string__h) $(gscdefs_h) $(gscspace_h)\
$(gxarith_h) $(gxcldev_h) $(gxclpath_h) $(gxcspace_h)\
$(gxdevice_h) $(gxdevmem_h) $(gxfmap_h) $(gxiparam_h) $(gxpath_h)\
$(sisparam_h) $(stream_h) $(strimpl_h) $(gxcomp_h) $(gsserial_h)\
......
......@@ -263,6 +263,9 @@ s_ISpecialDownScale_process(stream_state * st, stream_cursor_read * pr,
/* Check whether we need to deliver any output. */
top:
ss->params.Active = (ss->src_y >= ss->params.TopMargin &&
ss->src_y <= ss->params.TopMargin + ss->params.PatchHeightIn);
if (cur_y > ss->dst_y) {
/* Deliver some or all of the current scaled row. */
/* to generate a vertically scaled output row. */
......@@ -282,7 +285,8 @@ top:
row = ss->dst;
}
/* Apply filter to zoom vertically from tmp to dst. */
idownscale_y(row, ss->tmp, ss);
if (ss->params.Active)
idownscale_y(row, ss->tmp, ss);
/* Idiotic C coercion rules allow T* and void* to be */
/* inter-assigned freely, but not compared! */
if ((void *)row != ss->dst) /* no buffering */
......@@ -291,7 +295,8 @@ top:
uint wcount = ss->dst_size - ss->dst_offset;
uint ncopy = min(wleft, wcount);
memcpy(pw->ptr + 1, (byte *) ss->dst + ss->dst_offset, ncopy);
if (ss->params.Active)
memcpy(pw->ptr + 1, (byte *) ss->dst + ss->dst_offset, ncopy);
pw->ptr += ncopy;
ss->dst_offset += ncopy;
if (ncopy != wcount)
......@@ -320,20 +325,23 @@ adv: ++(ss->dst_y);
row = pr->ptr + 1;
} else { /* We're buffering a row in src. */
row = ss->src;
memcpy((byte *) ss->src + ss->src_offset, pr->ptr + 1,
rcount);
if (ss->params.Active)
memcpy((byte *) ss->src + ss->src_offset, pr->ptr + 1,
rcount);
ss->src_offset = 0;
}
/* Apply filter to zoom horizontally from src to tmp. */
if_debug2m('w', ss->memory, "[w]idownscale_x y = %d to tmp row %d\n",
ss->src_y, (ss->src_y % MAX_ISCALE_SUPPORT));
idownscale_x(ss->tmp, row, ss);
if (ss->params.Active)
idownscale_x(ss->tmp, row, ss);
pr->ptr += rcount;
++(ss->src_y);
dda_next_assign(ss->dda_y,cur_y);
goto top;
} else { /* We don't have a complete row. Copy data to src buffer. */
memcpy((byte *) ss->src + ss->src_offset, pr->ptr + 1, rleft);
if (ss->params.Active)
memcpy((byte *) ss->src + ss->src_offset, pr->ptr + 1, rleft);
ss->src_offset += rleft;
pr->ptr += rleft;
return 0;
......
......@@ -15,10 +15,10 @@
# Major and minor version numbers.
# MINOR0 is different from MINOR only if MINOR is a single digit.
GS_VERSION_MAJOR=9
GS_VERSION_MINOR=09
GS_VERSION_MINOR0=09
GS_VERSION_MINOR=10
GS_VERSION_MINOR0=10
# Revision date: year x 10000 + month x 100 + day.
GS_REVISIONDATE=20130821
GS_REVISIONDATE=20130830
# Derived values
GS_VERSION=$(GS_VERSION_MAJOR)$(GS_VERSION_MINOR0)
GS_DOT_VERSION=$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR0)
......
......@@ -6914,11 +6914,23 @@ $as_echo "yes" >&6; }
JBIG2_DECODER=luratech
SHARE_JBIG2=0
JBIG2DIR=$srcdir/luratech/ldf_jb2
if test "$(uname)" = "Darwin"; then
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DMAC -DMAC_OS_X_BUILD"
else
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DLINUX"
fi
case `uname` in
Darwin*)
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DMAC -DMAC_OS_X_BUILD"
;;
AIX)
if test $ac_cv_c_compiler_gnu = yes; then
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -fsigned-char -DLINUX"
else
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -qchars=signed -DLINUX"
fi
;;
*)
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DLINUX"
;;
esac
JBIG2FILEDEVS='$(DD)gdevjbig2.dev'
JBIG2DEVS='$(PSD)jbig2.dev'
else
......@@ -7093,11 +7105,23 @@ $as_echo "yes" >&6; }
JPX_DECODER=luratech
SHARE_JPX=0
JPXDIR=$srcdir/luratech/lwf_jp2
if test "$(uname)" = "Darwin"; then
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DMAC -DMAC_OS_X_BUILD"
else
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DLINUX"
fi
case `uname` in
Darwin*)
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DMAC -DMAC_OS_X_BUILD"
;;
AIX)
if test $ac_cv_c_compiler_gnu = yes; then
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -fsigned-char -DLINUX"
else
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -qchars=signed -DLINUX"
fi
;;
*)
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DLINUX"
;;
esac
JPXDEVS='$(PSD)jpx.dev'
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
......
......@@ -1217,11 +1217,23 @@ if test x$with_luratech != xno; then
JBIG2_DECODER=luratech
SHARE_JBIG2=0
JBIG2DIR=$srcdir/luratech/ldf_jb2
if test "$(uname)" = "Darwin"; then
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DMAC -DMAC_OS_X_BUILD"
else
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DLINUX"
fi
case `uname` in
Darwin*)
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DMAC -DMAC_OS_X_BUILD"
;;
AIX)
if test $ac_cv_prog_gcc = yes; then
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -fsigned-char -DLINUX"
else
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -qchars=signed -DLINUX"
fi
;;
*)
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DLINUX"
;;
esac
JBIG2FILEDEVS='$(DD)gdevjbig2.dev'
JBIG2DEVS='$(PSD)jbig2.dev'
else
......@@ -1326,11 +1338,23 @@ if test x$with_luratech != xno; then
JPX_DECODER=luratech
SHARE_JPX=0
JPXDIR=$srcdir/luratech/lwf_jp2
if test "$(uname)" = "Darwin"; then
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DMAC -DMAC_OS_X_BUILD"
else
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DLINUX"
fi
case `uname` in
Darwin*)
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DMAC -DMAC_OS_X_BUILD"
;;
AIX)
if test $ac_cv_prog_gcc = yes; then
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -fsigned-char -DLINUX"
else
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -qchars=signed -DLINUX"
fi
;;
*)
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DLINUX"
;;
esac
JPXDEVS='$(PSD)jpx.dev'
else
AC_MSG_RESULT([no])
......
......@@ -1090,11 +1090,11 @@ pnmcmyk_print_page(gx_device_printer *pdev, FILE *pstream)
/* For now we assume that the CMYK may have gone through an ICC profile */
/* so we do a more complex conversion from CMYK to K. If we are using */
/* FastColor, we may be able to do this more efficiently. */
cmy = ( ((255 - *pcmyk++) * lum_red_weight) +
((255 - *pcmyk++) * lum_green_weight) +
((255 - *pcmyk++) * lum_blue_weight) +
(lum_all_weights / 2))
/ lum_all_weights;
cmy = ((255 - *pcmyk++) * lum_red_weight);
cmy += ((255 - *pcmyk++) * lum_green_weight);
cmy += ((255 - *pcmyk++) * lum_blue_weight);
cmy += (lum_all_weights / 2);
cmy /= lum_all_weights;
k = *pcmyk++;
if (k > cmy)
......
......@@ -638,6 +638,13 @@ pdf_open(gx_device * dev)
cos_dict_alloc(pdev, "pdf_open(global_named_objects)");
/* Initialize internal structures that don't have IDs. */
pdev->NI_stack = cos_array_alloc(pdev, "pdf_open(NI stack)");
pdev->vgstack = (pdf_viewer_state *)gs_alloc_bytes(pdev->pdf_memory, 11 * sizeof(pdf_viewer_state), "pdf_open(graphics state stack)");
if (pdev->vgstack == 0) {
code = gs_error_VMerror;
goto fail;
}
memset(pdev->vgstack, 0x00, 11 * sizeof(pdf_viewer_state));
pdev->vgstack_size = 11;
pdev->Namespace_stack = cos_array_alloc(pdev, "pdf_open(Namespace stack)");
pdf_initialize_ids(pdev);
code = pdf_compute_fileID(pdev);
......@@ -662,7 +669,7 @@ pdf_open(gx_device * dev)
pdev->outlines_id = 0;
pdev->next_page = 0;
pdev->text = pdf_text_data_alloc(mem);
pdev->sbstack_size = count_of(pdev->vgstack); /* Overestimated a few. */
pdev->sbstack_size = pdev->vgstack_size; /* Overestimated a few. */
pdev->sbstack = gs_alloc_struct_array(mem, pdev->sbstack_size, pdf_substream_save,
&st_pdf_substream_save_element, "pdf_open");
pdev->pages =
......@@ -2877,6 +2884,8 @@ pdf_close(gx_device * dev)
gs_free_object(mem, pdev->NI_stack, "Free Name Index stack");
pdev->NI_stack = 0;
gs_free_object(pdev->pdf_memory, pdev->vgstack, "pdf_close(graphics state stack)");
cos_release((cos_object_t *)pdev->Namespace_stack, "release Name space stack");
gs_free_object(mem, pdev->Namespace_stack, "Free Name space stack");
pdev->Namespace_stack = 0;
......
......@@ -219,9 +219,8 @@ const gx_device_pdf PDF_DEVICE_IDENT =
-1, /* PageLabels_current_page */
0, /* PageLabels_current_label */
0, /* */
{ /* vgstack[2] */
{0}, {0}
},
0, /* vgstack */
0, /* vgstack_size */
0, /* vgstack_depth */
0, /* vgstack_bottom */
{0}, /* vg_initial */
......
......@@ -380,10 +380,10 @@ pdf_xmp_write_translated(gx_device_pdf *pdev, stream *s, const byte *data, int d
}
memset(buf1, 0x00, (j * sizeof(UTF16)) + 2);
for (i = 0; i < j; i++) {
if (buf0[i] <= 0x7f || buf0[0] >= 0xAE) {
if (buf0[0] == 0x7f) {
if (buf0[i] <= 0x7f || buf0[i] >= 0xAE) {
if (buf0[i] == 0x7f) {
emprintf1(pdev->memory, "PDFDocEncoding %x cannot be represented in Unicode\n",
buf0[0]);
buf0[i]);
} else
buf1[(i * 2) + 3] = buf0[i];
} else {
......
......@@ -57,8 +57,18 @@ pdf_save_viewer_state(gx_device_pdf *pdev, stream *s)
{
const int i = pdev->vgstack_depth;
if (pdev->vgstack_depth >= count_of(pdev->vgstack))
return_error(gs_error_unregistered); /* Must not happen. */
if (pdev->vgstack_depth >= pdev->vgstack_size) {
pdf_viewer_state *new_vgstack = (pdf_viewer_state *)gs_alloc_bytes(pdev->pdf_memory,
(pdev->vgstack_size + 5) * sizeof(pdf_viewer_state), "increase graphics state stack size");
if (new_vgstack == 0)
return_error(gs_error_VMerror);
memset(new_vgstack, 0x00, (pdev->vgstack_size + 5) * sizeof(pdf_viewer_state));
memcpy(new_vgstack, pdev->vgstack, pdev->vgstack_size * sizeof(pdf_viewer_state));
gs_free_object(pdev->pdf_memory, pdev->vgstack, "resize graphics state stack, free old stack)");
pdev->vgstack = new_vgstack;
pdev->vgstack_size += 5;
}
pdev->vgstack[i].transfer_ids[0] = pdev->transfer_ids[0];