gnu: libmtp: Update to 1.1.11.
[jackhill/guix/guix.git] / gnu / packages / patches / abiword-explictly-cast-bools.patch
1 As of JPEG-9, the type 'boolean' is an enumeration, but since glib defines
2 TRUE and FALSE as numeric constants and this is C++, they need to be explicitly
3 casted.
4
5 --- a/src/af/util/xp/ut_jpeg.cpp 2009-07-08 19:33:53.000000000 +0200
6 +++ b/src/af/util/xp/ut_jpeg.cpp 2014-09-06 19:55:55.876997404 +0200
7 @@ -102,7 +102,7 @@
8 src->pub.next_input_byte = src->sourceBuf->getPointer (src->pos);
9 src->pub.bytes_in_buffer = src->sourceBuf->getLength ();
10
11 - return TRUE;
12 + return (boolean)TRUE;
13 }
14
15 /*
16 @@ -161,7 +161,7 @@
17 /* set the data source */
18 _JPEG_ByteBufSrc (&cinfo, pBB);
19
20 - jpeg_read_header(&cinfo, TRUE);
21 + jpeg_read_header(&cinfo, (boolean)TRUE);
22 jpeg_start_decompress(&cinfo);
23 iImageWidth = cinfo.output_width;
24 iImageHeight = cinfo.output_height;
25 @@ -189,7 +189,7 @@
26 /* set the data source */
27 _JPEG_ByteBufSrc (&cinfo, pBB);
28
29 - jpeg_read_header(&cinfo, TRUE);
30 + jpeg_read_header(&cinfo, (boolean)TRUE);
31 jpeg_start_decompress(&cinfo);
32
33 int row_stride = cinfo.output_width * cinfo.output_components;
34
35
36 In the following file, we also need to reverse header include order: JPEG needs
37 to be included before Glib, which is included by "abiword-garble.h" for this fix
38 to work.
39
40 The JPEG header needs the types FILE and size_t, we can get them from cstdio.
41
42 --- a/plugins/garble/xp/abiword-garble-jpeg.cpp 2009-09-05 17:49:53.000000000 +0200
43 +++ b/plugins/garble/xp/abiword-garble-jpeg.cpp 2014-09-07 21:28:49.364008571 +0200
44 @@ -20,12 +20,14 @@
45 * 02111-1307, USA.
46 */
47
48 -#include "abiword-garble.h"
49 +#include <cstdio>
50
51 extern "C" {
52 #include <jpeglib.h>
53 }
54
55 +#include "abiword-garble.h"
56 +
57 //-----------------------------------------------------------------------------
58 typedef struct {
59 struct jpeg_destination_mgr pub;
60 @@ -49,7 +51,7 @@
61 mem_dest_ptr dest = (mem_dest_ptr) cinfo->dest;
62 dest->pub.next_output_byte = dest->buf;
63 dest->pub.free_in_buffer = dest->bufsize;
64 - return FALSE;
65 + return (boolean)FALSE;
66 }
67
68 //-----------------------------------------------------------------------------
69 @@ -96,7 +98,7 @@
70 cinfo.image_width = (JDIMENSION) w;
71 cinfo.image_height = (JDIMENSION) h;
72 jpeg_set_defaults (&cinfo);
73 - jpeg_set_quality ( &cinfo, 50, TRUE );
74 + jpeg_set_quality ( &cinfo, 50, (boolean)TRUE );
75 cinfo.dest = (struct jpeg_destination_mgr *) (*cinfo.mem->alloc_small)((j_common_ptr)&cinfo, JPOOL_PERMANENT, sizeof(mem_destination_mgr));
76 dest = (mem_dest_ptr) cinfo.dest;
77 dest->pub.init_destination = _jpeg_init_destination;
78 @@ -105,7 +107,7 @@
79 dest->buf = (JOCTET*)data;
80 dest->bufsize = length;
81 dest->jpegsize = 0;
82 - jpeg_start_compress (&cinfo, TRUE);
83 + jpeg_start_compress (&cinfo, (boolean)TRUE);
84
85 // write data
86 for (int i=0; i<h; ++i)
87 @@ -121,4 +123,4 @@
88 free( dib[i] );
89 free( dib );
90 return true;
91 -}
92 \ No newline at end of file
93 +}