gnu: emacs-consult: Fix grammar.
[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
6 +++ b/src/af/util/xp/ut_jpeg.cpp
7 @@ -102,7 +102,7 @@ static boolean _jpegFillInputBuffer (j_decompress_ptr cinfo)
8 src->pub.next_input_byte = src->sourceBuf->getPointer (src->pos);
9 src->pub.bytes_in_buffer = src->sourceBuf->getLength ();
10
11 - return 1; // boolean is a libjpeg type that is an int.
12 + return (boolean)TRUE;
13 }
14
15 /*
16
17
18 In the following file, we also need to reverse header include order: JPEG needs
19 to be included before Glib, which is included by "abiword-garble.h" for this fix
20 to work.
21
22 The JPEG header needs the types FILE and size_t, we can get them from cstdio.
23
24 --- a/plugins/garble/xp/abiword-garble-jpeg.cpp 2009-09-05 17:49:53.000000000 +0200
25 +++ b/plugins/garble/xp/abiword-garble-jpeg.cpp 2014-09-07 21:28:49.364008571 +0200
26 @@ -20,12 +20,14 @@
27 * 02111-1307, USA.
28 */
29
30 -#include "abiword-garble.h"
31 +#include <cstdio>
32
33 extern "C" {
34 #include <jpeglib.h>
35 }
36
37 +#include "abiword-garble.h"
38 +
39 //-----------------------------------------------------------------------------
40 typedef struct {
41 struct jpeg_destination_mgr pub;
42 @@ -49,7 +51,7 @@
43 mem_dest_ptr dest = (mem_dest_ptr) cinfo->dest;
44 dest->pub.next_output_byte = dest->buf;
45 dest->pub.free_in_buffer = dest->bufsize;
46 - return FALSE;
47 + return (boolean)FALSE;
48 }
49
50 //-----------------------------------------------------------------------------
51 @@ -96,7 +98,7 @@
52 cinfo.image_width = (JDIMENSION) w;
53 cinfo.image_height = (JDIMENSION) h;
54 jpeg_set_defaults (&cinfo);
55 - jpeg_set_quality ( &cinfo, 50, TRUE );
56 + jpeg_set_quality ( &cinfo, 50, (boolean)TRUE );
57 cinfo.dest = (struct jpeg_destination_mgr *) (*cinfo.mem->alloc_small)((j_common_ptr)&cinfo, JPOOL_PERMANENT, sizeof(mem_destination_mgr));
58 dest = (mem_dest_ptr) cinfo.dest;
59 dest->pub.init_destination = _jpeg_init_destination;
60 @@ -105,7 +107,7 @@
61 dest->buf = (JOCTET*)data;
62 dest->bufsize = length;
63 dest->jpegsize = 0;
64 - jpeg_start_compress (&cinfo, TRUE);
65 + jpeg_start_compress (&cinfo, (boolean)TRUE);
66
67 // write data
68 for (int i=0; i<h; ++i)
69 @@ -121,4 +123,4 @@
70 free( dib[i] );
71 free( dib );
72 return true;
73 -}
74 \ No newline at end of file
75 +}