package/nbd: add option for the trdump utility
[buildroot-gz.git] / package / libsidplay2 / 0001-sidplay2-libs-2.1.1.patch
blob7c6813bb661410886e6f3793574098e8c265cb09
1 From 38493fceb39ac33e12c9c69d78f5584413b479f4 Mon Sep 17 00:00:00 2001
2 From: Bernd Kuhls <bernd.kuhls@t-online.de>
3 Date: Wed, 1 Mar 2017 10:03:40 +0100
4 Subject: [PATCH] Various fixes to compile libsidplay2 with newer gcc compilers
6 Downloaded from
7 http://tsubasa.googlecode.com/svn/trunk/tsubasa/sidplay2-libs/sidplay2-libs-2.1.1.diff
9 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
10 [Thomas: adjusted to avoid the need to autoreconf, which doesn't work
11 properly on this package.]
12 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
13 ---
14 builders/hardsid-builder/src/hardsid-builder.cpp | 1 +
15 builders/resid-builder/src/resid-builder.cpp | 1 +
16 builders/resid-builder/src/resid.cpp | 1 +
17 configure | 2 +-
18 libsidplay/configure | 5 +++--
19 libsidplay/include/sidplay/SmartPtr.h | 28 ++++++++++++------------
20 libsidplay/include/sidplay/sidendian.h | 18 +++++++++------
21 libsidutils/include/sidplay/utils/SidUsage.h | 2 +-
22 8 files changed, 33 insertions(+), 25 deletions(-)
24 diff --git a/builders/hardsid-builder/src/hardsid-builder.cpp b/builders/hardsid-builder/src/hardsid-builder.cpp
25 index f54d0a9..9375e40 100644
26 --- a/builders/hardsid-builder/src/hardsid-builder.cpp
27 +++ b/builders/hardsid-builder/src/hardsid-builder.cpp
28 @@ -47,6 +47,7 @@
29 ***************************************************************************/
31 #include <stdio.h>
32 +#include <cstring>
33 #include "config.h"
35 #ifdef HAVE_EXCEPTIONS
36 diff --git a/builders/resid-builder/src/resid-builder.cpp b/builders/resid-builder/src/resid-builder.cpp
37 index e6e4eaa..4c7650f 100644
38 --- a/builders/resid-builder/src/resid-builder.cpp
39 +++ b/builders/resid-builder/src/resid-builder.cpp
40 @@ -37,6 +37,7 @@
41 ***************************************************************************/
43 #include <stdio.h>
44 +#include <cstring>
46 #include "config.h"
47 #ifdef HAVE_EXCEPTIONS
48 diff --git a/builders/resid-builder/src/resid.cpp b/builders/resid-builder/src/resid.cpp
49 index 8c27850..d3123c5 100644
50 --- a/builders/resid-builder/src/resid.cpp
51 +++ b/builders/resid-builder/src/resid.cpp
52 @@ -16,6 +16,7 @@
53 * *
54 ***************************************************************************/
56 +#include <cstring>
57 #include "config.h"
59 #ifdef HAVE_EXCEPTIONS
60 diff --git a/configure b/configure
61 index 1200eaf..77948b4 100755
62 --- a/configure
63 +++ b/configure
64 @@ -1227,7 +1227,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
66 #Variables
67 pwd=`pwd`
68 -builders='${libdir}'/sidplay/builders
69 +builders='${libdir}'/
70 ac_configure_args="$ac_configure_args --disable-library-checks"
72 ac_aux_dir=
73 diff --git a/libsidplay/configure b/libsidplay/configure
74 index 05a8ea6..3d93956 100755
75 --- a/libsidplay/configure
76 +++ b/libsidplay/configure
77 @@ -23466,8 +23466,9 @@ _ACEOF
78 cat confdefs.h >>conftest.$ac_ext
79 cat >>conftest.$ac_ext <<_ACEOF
80 /* end confdefs.h. */
81 -#include <fstream.h>
82 - #include <iomanip.h>
83 +#include <fstream>
84 + #include <iomanip>
85 + using namespace std;
86 int
87 main ()
89 diff --git a/libsidplay/include/sidplay/SmartPtr.h b/libsidplay/include/sidplay/SmartPtr.h
90 index c0cbb1a..15efd10 100644
91 --- a/libsidplay/include/sidplay/SmartPtr.h
92 +++ b/libsidplay/include/sidplay/SmartPtr.h
93 @@ -17,16 +17,16 @@ class SmartPtrBase_sidtt
94 doFree = bufOwner;
95 if ( bufferLen >= 1 )
97 - pBufCurrent = ( bufBegin = buffer );
98 - bufEnd = bufBegin + bufferLen;
99 - bufLen = bufferLen;
100 - status = true;
101 + this->pBufCurrent = ( this->bufBegin = buffer );
102 + this->bufEnd = this->bufBegin + bufferLen;
103 + this->bufLen = bufferLen;
104 + this->status = true;
106 else
108 - pBufCurrent = ( bufBegin = ( bufEnd = 0 ));
109 - bufLen = 0;
110 - status = false;
111 + this->pBufCurrent = ( this->bufBegin = ( this->bufEnd = 0 ));
112 + this->bufLen = 0;
113 + this->status = false;
117 @@ -211,16 +211,16 @@ class SmartPtr_sidtt : public SmartPtrBase_sidtt<T>
119 if ( bufferLen >= 1 )
121 - pBufCurrent = ( bufBegin = buffer );
122 - bufEnd = bufBegin + bufferLen;
123 - bufLen = bufferLen;
124 - status = true;
125 + this->pBufCurrent = ( this->bufBegin = buffer );
126 + this->bufEnd = this->bufBegin + bufferLen;
127 + this->bufLen = bufferLen;
128 + this->status = true;
130 else
132 - pBufCurrent = bufBegin = bufEnd = 0;
133 - bufLen = 0;
134 - status = false;
135 + this->pBufCurrent = this->bufBegin = this->bufEnd = 0;
136 + this->bufLen = 0;
137 + this->status = false;
141 diff --git a/libsidplay/include/sidplay/sidendian.h b/libsidplay/include/sidplay/sidendian.h
142 index 9fa8582..6115282 100644
143 --- a/libsidplay/include/sidplay/sidendian.h
144 +++ b/libsidplay/include/sidplay/sidendian.h
145 @@ -16,6 +16,10 @@
146 ***************************************************************************/
147 /***************************************************************************
148 * $Log: sidendian.h,v $
149 + * Revision 1.6 2005/11/20 11:02:06 s_a_white
150 + * Work around for bug in gcc 4 (optimiser breaks if variable never has a
151 + * direct assignment).
153 * Revision 1.5 2001/07/03 22:44:13 s_a_white
154 * Added endian_16 to convert a 16 bit value to an array of 8s.
156 @@ -141,7 +145,7 @@ inline void endian_16swap8 (uint_least16_t &word)
157 // Convert high-byte and low-byte to 16-bit word.
158 inline uint_least16_t endian_16 (uint8_t hi, uint8_t lo)
160 - uint_least16_t word;
161 + uint_least16_t word = 0;
162 endian_16lo8 (word, lo);
163 endian_16hi8 (word, hi);
164 return word;
165 @@ -165,7 +169,7 @@ inline void endian_16 (uint8_t ptr[2], uint_least16_t word)
167 inline void endian_16 (char ptr[2], uint_least16_t word)
169 - endian_16 ((uint8_t *) ptr, word);
170 + endian_16 ((uint8_t *) ptr, word);
173 // Convert high-byte and low-byte to 16-bit little endian word.
174 @@ -334,7 +338,7 @@ inline void endian_32swap16 (uint_least32_t &dword)
175 // Swap word endian.
176 inline void endian_32swap8 (uint_least32_t &dword)
178 - uint_least16_t lo, hi;
179 + uint_least16_t lo = 0, hi = 0;
180 lo = endian_32lo16 (dword);
181 hi = endian_32hi16 (dword);
182 endian_16swap8 (lo);
183 @@ -346,8 +350,8 @@ inline void endian_32swap8 (uint_least32_t &dword)
184 // Convert high-byte and low-byte to 32-bit word.
185 inline uint_least32_t endian_32 (uint8_t hihi, uint8_t hilo, uint8_t hi, uint8_t lo)
187 - uint_least32_t dword;
188 - uint_least16_t word;
189 + uint_least32_t dword = 0;
190 + uint_least16_t word = 0;
191 endian_32lo8 (dword, lo);
192 endian_32hi8 (dword, hi);
193 endian_16lo8 (word, hilo);
194 @@ -374,7 +378,7 @@ inline void endian_little32 (uint8_t ptr[4], uint_least32_t dword)
195 defined(SID_WORDS_LITTLEENDIAN)
196 *((uint_least32_t *) ptr) = dword;
197 #else
198 - uint_least16_t word;
199 + uint_least16_t word = 0;
200 ptr[0] = endian_32lo8 (dword);
201 ptr[1] = endian_32hi8 (dword);
202 word = endian_32hi16 (dword);
203 @@ -401,7 +405,7 @@ inline void endian_big32 (uint8_t ptr[4], uint_least32_t dword)
204 defined(SID_WORDS_BIGENDIAN)
205 *((uint_least32_t *) ptr) = dword;
206 #else
207 - uint_least16_t word;
208 + uint_least16_t word = 0;
209 word = endian_32hi16 (dword);
210 ptr[1] = endian_16lo8 (word);
211 ptr[0] = endian_16hi8 (word);
212 diff --git a/libsidutils/include/sidplay/utils/SidUsage.h b/libsidutils/include/sidplay/utils/SidUsage.h
213 index 2afb0f3..0496eea 100755
214 --- a/libsidutils/include/sidplay/utils/SidUsage.h
215 +++ b/libsidutils/include/sidplay/utils/SidUsage.h
216 @@ -33,7 +33,7 @@ struct sid2_usage_t: public sid_usage_t
217 uint_least16_t length; // usage scan length
219 // Copy common parts of basic usage to extended usage.
220 - sid2_usage_t &sid2_usage_t::operator= (const sid_usage_t &usage)
221 + sid2_usage_t &operator= (const sid_usage_t &usage)
223 *((sid_usage_t *) this) = usage;
224 return *this;
226 2.7.4