wok-next rev 20433

mupdf: update patch
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Feb 05 15:11:20 2018 +0100 (2018-02-05)
parents 696326359d1c
children 7d96b53ab037
files glusterfs/receipt mupdf/stuff/use_openjpeg_1.5.patch
line diff
     1.1 --- a/glusterfs/receipt	Mon Feb 05 10:24:55 2018 +0100
     1.2 +++ b/glusterfs/receipt	Mon Feb 05 15:11:20 2018 +0100
     1.3 @@ -11,12 +11,13 @@
     1.4  WGET_URL="https://download.gluster.org/pub/gluster/glusterfs/${VERSION%.*}/$VERSION/$TARBALL"
     1.5  
     1.6  DEPENDS="python readline mpc-library elfutils openssl"
     1.7 -BUILD_DEPENDS="flex python readline-dev mpc-library elfutils openssl-dev \
     1.8 -acl-dev sqlite-dev liburcu-dev"
     1.9 +BUILD_DEPENDS="flex python-dev readline-dev mpc-library elfutils openssl-dev \
    1.10 +acl-dev sqlite-dev liburcu-dev libxml2-dev"
    1.11  
    1.12  # Rules to configure and make the package.
    1.13  compile_rules()
    1.14  {
    1.15 +	sed -i "/^cat/,/^EOM/d;s/exit/echo '$HOST_SYSTEM'\n&/" config.sub
    1.16  	./configure --prefix=/usr --infodir=/usr/share/info \
    1.17  		--libexecdir=/usr/share \
    1.18  		--mandir=/usr/share/man \
     2.1 --- a/mupdf/stuff/use_openjpeg_1.5.patch	Mon Feb 05 10:24:55 2018 +0100
     2.2 +++ b/mupdf/stuff/use_openjpeg_1.5.patch	Mon Feb 05 15:11:20 2018 +0100
     2.3 @@ -11,28 +11,19 @@
     2.4  index dfb89f4..d27b5de 100644
     2.5  --- a/source/fitz/load-jpx.c
     2.6  +++ b/source/fitz/load-jpx.c
     2.7 -@@ -27,119 +27,51 @@ static void fz_opj_info_callback(const char *msg, void *client_data)
     2.8 +@@ -605,41 +605,6 @@
     2.9   	/* fz_warn("openjpeg info: %s", msg); */
    2.10   }
    2.11   
    2.12 --typedef struct stream_block_s
    2.13 --{
    2.14 --	unsigned char *data;
    2.15 --	int size;
    2.16 --	int pos;
    2.17 --} stream_block;
    2.18 --
    2.19  -static OPJ_SIZE_T fz_opj_stream_read(void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data)
    2.20  -{
    2.21  -	stream_block *sb = (stream_block *)p_user_data;
    2.22 --	int len;
    2.23 +-	OPJ_SIZE_T len;
    2.24  -
    2.25  -	len = sb->size - sb->pos;
    2.26 --	if (len < 0)
    2.27 --		len = 0;
    2.28  -	if (len == 0)
    2.29 --		return (OPJ_SIZE_T)-1;  /* End of file! */
    2.30 --	if ((OPJ_SIZE_T)len > p_nb_bytes)
    2.31 +-		return (OPJ_SIZE_T)-1; /* End of file! */
    2.32 +-	if (len > p_nb_bytes)
    2.33  -		len = p_nb_bytes;
    2.34  -	memcpy(p_buffer, sb->data + sb->pos, len);
    2.35  -	sb->pos += len;
    2.36 @@ -43,8 +34,8 @@
    2.37  -{
    2.38  -	stream_block *sb = (stream_block *)p_user_data;
    2.39  -
    2.40 --	if (skip > sb->size - sb->pos)
    2.41 --		skip = sb->size - sb->pos;
    2.42 +-	if (skip > (OPJ_OFF_T)(sb->size - sb->pos))
    2.43 +-		skip = (OPJ_OFF_T)(sb->size - sb->pos);
    2.44  -	sb->pos += skip;
    2.45  -	return sb->pos;
    2.46  -}
    2.47 @@ -53,17 +44,19 @@
    2.48  -{
    2.49  -	stream_block *sb = (stream_block *)p_user_data;
    2.50  -
    2.51 --	if (seek_pos > sb->size)
    2.52 +-	if (seek_pos > (OPJ_OFF_T)sb->size)
    2.53  -		return OPJ_FALSE;
    2.54  -	sb->pos = seek_pos;
    2.55  -	return OPJ_TRUE;
    2.56  -}
    2.57  -
    2.58 - fz_pixmap *
    2.59 - fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs, int indexed)
    2.60 + static int
    2.61 + l2subfactor(fz_context *ctx, unsigned int max_w, unsigned int w)
    2.62 + {
    2.63 +@@ -656,10 +621,11 @@
    2.64 + jpx_read_image(fz_context *ctx, fz_jpxd *state, unsigned char *data, size_t size, fz_colorspace *defcs, int onlymeta)
    2.65   {
    2.66   	fz_pixmap *img;
    2.67 - 	fz_colorspace *origcs;
    2.68  +	opj_event_mgr_t evtmgr;
    2.69   	opj_dparameters_t params;
    2.70  -	opj_codec_t *codec;
    2.71 @@ -71,15 +64,10 @@
    2.72   	opj_image_t *jpx;
    2.73  -	opj_stream_t *stream;
    2.74  +	opj_cio_t *stream;
    2.75 - 	fz_colorspace *colorspace;
    2.76   	unsigned char *p;
    2.77   	OPJ_CODEC_FORMAT format;
    2.78   	int a, n, w, h, depth, sgnd;
    2.79 - 	int x, y, k, v;
    2.80 --	stream_block sb;
    2.81 - 
    2.82 - 	if (size < 2)
    2.83 - 		fz_throw(ctx, FZ_ERROR_GENERIC, "not enough data to determine image format");
    2.84 +@@ -677,55 +643,30 @@
    2.85   
    2.86   	/* Check for SOC marker -- if found we have a bare J2K stream */
    2.87   	if (data[0] == 0xFF && data[1] == 0x4F)
    2.88 @@ -88,14 +76,14 @@
    2.89   	else
    2.90  -		format = OPJ_CODEC_JP2;
    2.91  +		format = CODEC_JP2;
    2.92 -+
    2.93 + 
    2.94  +	memset(&evtmgr, 0, sizeof(evtmgr));
    2.95  +	evtmgr.error_handler = fz_opj_error_callback;
    2.96  +	evtmgr.warning_handler = fz_opj_warning_callback;
    2.97  +	evtmgr.info_handler = fz_opj_info_callback;
    2.98 - 
    2.99 ++
   2.100   	opj_set_default_decoder_parameters(&params);
   2.101 - 	if (indexed)
   2.102 + 	if (fz_colorspace_is_indexed(ctx, defcs))
   2.103   		params.flags |= OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
   2.104   
   2.105   	codec = opj_create_decompress(format);
   2.106 @@ -104,23 +92,25 @@
   2.107  -	opj_set_error_handler(codec, fz_opj_error_callback, ctx);
   2.108  -	if (!opj_setup_decoder(codec, &params))
   2.109  -	{
   2.110 +-		opj_destroy_codec(codec);
   2.111  -		fz_throw(ctx, FZ_ERROR_GENERIC, "j2k decode failed");
   2.112  -	}
   2.113 --
   2.114 ++	opj_set_event_mgr((opj_common_ptr)codec, &evtmgr, ctx);
   2.115 ++	opj_setup_decoder(codec, &params);
   2.116 + 
   2.117  -	stream = opj_stream_default_create(OPJ_TRUE);
   2.118  -	sb.data = data;
   2.119  -	sb.pos = 0;
   2.120  -	sb.size = size;
   2.121 -+	opj_set_event_mgr((opj_common_ptr)codec, &evtmgr, ctx);
   2.122 -+	opj_setup_decoder(codec, &params);
   2.123 ++	stream = opj_cio_open((opj_common_ptr)codec, data, size);
   2.124   
   2.125  -	opj_stream_set_read_function(stream, fz_opj_stream_read);
   2.126  -	opj_stream_set_skip_function(stream, fz_opj_stream_skip);
   2.127  -	opj_stream_set_seek_function(stream, fz_opj_stream_seek);
   2.128 --	opj_stream_set_user_data(stream, &sb);
   2.129 +-	opj_stream_set_user_data(stream, &sb, NULL);
   2.130  -	/* Set the length to avoid an assert */
   2.131  -	opj_stream_set_user_data_length(stream, size);
   2.132 -+	stream = opj_cio_open((opj_common_ptr)codec, data, size);
   2.133 ++	jpx = opj_decode(codec, stream);
   2.134   
   2.135  -	if (!opj_read_header(stream, codec, &jpx))
   2.136  -	{
   2.137 @@ -128,7 +118,9 @@
   2.138  -		opj_destroy_codec(codec);
   2.139  -		fz_throw(ctx, FZ_ERROR_GENERIC, "Failed to read JPX header");
   2.140  -	}
   2.141 --
   2.142 ++	opj_cio_close(stream);
   2.143 ++	opj_destroy_decompress(codec);
   2.144 + 
   2.145  -	if (!opj_decode(codec, stream, jpx))
   2.146  -	{
   2.147  -		opj_stream_destroy(stream);
   2.148 @@ -136,18 +128,15 @@
   2.149  -		opj_image_destroy(jpx);
   2.150  -		fz_throw(ctx, FZ_ERROR_GENERIC, "Failed to decode JPX image");
   2.151  -	}
   2.152 -+	jpx = opj_decode(codec, stream);
   2.153 - 
   2.154 +-
   2.155  -	opj_stream_destroy(stream);
   2.156  -	opj_destroy_codec(codec);
   2.157 -+	opj_cio_close(stream);
   2.158 -+	opj_destroy_decompress(codec);
   2.159 - 
   2.160 +-
   2.161  -	/* jpx should never be NULL here, but check anyway */
   2.162   	if (!jpx)
   2.163   		fz_throw(ctx, FZ_ERROR_GENERIC, "opj_decode failed");
   2.164   
   2.165 -@@ -173,8 +105,8 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs
   2.166 +@@ -733,8 +674,8 @@
   2.167   	depth = jpx->comps[0].prec;
   2.168   	sgnd = jpx->comps[0].sgnd;
   2.169