0001-sidplay2-libs-2.1.1.patch 7.7 KB

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