libecwj2-3.3-msvc90-fixes.patch 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. diff -r 486075d14769 -r d53918598fbf libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJP2File.cpp
  2. --- libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJP2File.cpp Wed Sep 30 11:55:26 2009 +0100
  3. +++ libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJP2File.cpp Wed Sep 30 12:20:09 2009 +0100
  4. @@ -137,7 +137,7 @@
  5. m_bCodestreamOnly = false;
  6. m_eCompressionOrder = CNCSJPCProgressionOrderType::RPCL;
  7. - m_nDecompressionLayers = CNCSJPCBuffer::MAXUINT16;
  8. + m_nDecompressionLayers = CNCSJPCBuffer::NCS_MAXUINT16;
  9. m_nNextLine = 0;
  10. //Default geodata usage - was JP2_GEODATA_USE_WLD_GML_PCS
  11. diff -r 486075d14769 -r d53918598fbf libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJPCBuffer.cpp
  12. --- libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJPCBuffer.cpp Wed Sep 30 11:55:26 2009 +0100
  13. +++ libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJPCBuffer.cpp Wed Sep 30 12:20:09 2009 +0100
  14. @@ -26,19 +26,19 @@
  15. //void * memcpy_amd(void *dest, const void *src, size_t n);
  16. -const UINT32 CNCSJPCBuffer::MAXUINT8 = (unsigned)0xff;
  17. -const UINT32 CNCSJPCBuffer::MAXUINT16 = (unsigned)0xffff;
  18. -const UINT32 CNCSJPCBuffer::MAXUINT32 = (unsigned)0xffffffff;
  19. -const UINT32 CNCSJPCBuffer::MINUINT8 = 0;
  20. -const UINT32 CNCSJPCBuffer::MINUINT16 = 0;
  21. -const UINT32 CNCSJPCBuffer::MINUINT32 = 0;
  22. +const UINT32 CNCSJPCBuffer::NCS_MAXUINT8 = (unsigned)0xff;
  23. +const UINT32 CNCSJPCBuffer::NCS_MAXUINT16 = (unsigned)0xffff;
  24. +const UINT32 CNCSJPCBuffer::NCS_MAXUINT32 = (unsigned)0xffffffff;
  25. +const UINT32 CNCSJPCBuffer::NCS_MINUINT8 = 0;
  26. +const UINT32 CNCSJPCBuffer::NCS_MINUINT16 = 0;
  27. +const UINT32 CNCSJPCBuffer::NCS_MINUINT32 = 0;
  28. -const UINT32 CNCSJPCBuffer::MAXINT8 = 0x7f;
  29. -const UINT32 CNCSJPCBuffer::MAXINT16 = 0x7fff;
  30. -const UINT32 CNCSJPCBuffer::MAXINT32 = 0x7fffffff;
  31. -const INT32 CNCSJPCBuffer::MININT8 = (-1 * (signed)CNCSJPCBuffer::MAXINT8 - 1);
  32. -const INT32 CNCSJPCBuffer::MININT16 = (-1 * (signed)CNCSJPCBuffer::MAXINT16 - 1);
  33. -const INT32 CNCSJPCBuffer::MININT32 = (-1 * (signed)CNCSJPCBuffer::MAXINT32 - 1);
  34. +const UINT32 CNCSJPCBuffer::NCS_MAXINT8 = 0x7f;
  35. +const UINT32 CNCSJPCBuffer::NCS_MAXINT16 = 0x7fff;
  36. +const UINT32 CNCSJPCBuffer::NCS_MAXINT32 = 0x7fffffff;
  37. +const INT32 CNCSJPCBuffer::NCS_MININT8 = (-1 * (signed)CNCSJPCBuffer::NCS_MAXINT8 - 1);
  38. +const INT32 CNCSJPCBuffer::NCS_MININT16 = (-1 * (signed)CNCSJPCBuffer::NCS_MAXINT16 - 1);
  39. +const INT32 CNCSJPCBuffer::NCS_MININT32 = (-1 * (signed)CNCSJPCBuffer::NCS_MAXINT32 - 1);
  40. const UINT32 CNCSJPCBuffer::AT_OWNER = (1 << 0);
  41. const UINT32 CNCSJPCBuffer::AT_CHILD = (1 << 1);
  42. @@ -308,27 +308,27 @@
  43. switch(m_eType) {
  44. case CNCSJPCBuffer::BT_INT16:
  45. // Optimise some common cases
  46. - if(nMin == MINUINT8 && nMax == MAXUINT8) {
  47. + if(nMin == NCS_MINUINT8 && nMax == NCS_MAXUINT8) {
  48. // UINT8 range
  49. for(x = 0; x < nWidth; x++) {
  50. INT16 v = ((INT16*)m_pBuffer)[x];
  51. if(v & 0xff00) { // Top bit is sign bit, so this tests for both >nMax & <nMin in one
  52. - if(v > (INT16)MAXUINT8) {
  53. - ((INT16*)m_pBuffer)[x] = MAXUINT8;
  54. - } else if(v < (INT16)MINUINT8) {
  55. - ((INT16*)m_pBuffer)[x] = MINUINT8;
  56. + if(v > (INT16)NCS_MAXUINT8) {
  57. + ((INT16*)m_pBuffer)[x] = NCS_MAXUINT8;
  58. + } else if(v < (INT16)NCS_MINUINT8) {
  59. + ((INT16*)m_pBuffer)[x] = NCS_MINUINT8;
  60. }
  61. }
  62. }
  63. - } else if(nMin == MININT8 && nMax == MAXINT8) {
  64. + } else if(nMin == NCS_MININT8 && nMax == NCS_MAXINT8) {
  65. // INT8 range
  66. for(x = 0; x < nWidth; x++) {
  67. INT16 v = ((INT16*)m_pBuffer)[x];
  68. if(v & 0xff80) { // Top bit is sign bit, so this tests for both >nMax & <nMin in one
  69. - if(v > (INT16)MAXINT8) {
  70. - ((INT16*)m_pBuffer)[x] = MAXINT8;
  71. - } else if(v < (INT16)MININT8) {
  72. - ((INT16*)m_pBuffer)[x] = MININT8;
  73. + if(v > (INT16)NCS_MAXINT8) {
  74. + ((INT16*)m_pBuffer)[x] = NCS_MAXINT8;
  75. + } else if(v < (INT16)NCS_MININT8) {
  76. + ((INT16*)m_pBuffer)[x] = NCS_MININT8;
  77. }
  78. }
  79. }
  80. @@ -345,27 +345,27 @@
  81. break;
  82. case CNCSJPCBuffer::BT_INT32:
  83. // Optimise some common cases
  84. - if(nMin == MINUINT16 && nMax == MAXUINT16) {
  85. + if(nMin == NCS_MINUINT16 && nMax == NCS_MAXUINT16) {
  86. // UINT16 range
  87. for(x = 0; x < nWidth; x++) {
  88. INT32 v = ((INT32*)m_pBuffer)[x];
  89. if(v & 0xffff0000) { // Top bit is sign bit, so this tests for both >nMax & <nMin in one
  90. - if(v > (INT32)MAXUINT16) {
  91. - ((INT32*)m_pBuffer)[x] = MAXUINT16;
  92. - } else if(v < (INT32)MINUINT16) {
  93. - ((INT32*)m_pBuffer)[x] = MINUINT16;
  94. + if(v > (INT32)NCS_MAXUINT16) {
  95. + ((INT32*)m_pBuffer)[x] = NCS_MAXUINT16;
  96. + } else if(v < (INT32)NCS_MINUINT16) {
  97. + ((INT32*)m_pBuffer)[x] = NCS_MINUINT16;
  98. }
  99. }
  100. }
  101. - } else if(nMin == MININT16 && nMax == MAXINT16) {
  102. + } else if(nMin == NCS_MININT16 && nMax == NCS_MAXINT16) {
  103. // INT16 range
  104. for(x = 0; x < nWidth; x++) {
  105. INT32 v = ((INT32*)m_pBuffer)[x];
  106. if(v & 0xffff8000) { // Top bit is sign bit, so this tests for both >nMax & <nMin in one
  107. - if(v > (INT32)MAXINT16) {
  108. - ((INT32*)m_pBuffer)[x] = MAXINT16;
  109. - } else if(v < (INT32)MININT16) {
  110. - ((INT32*)m_pBuffer)[x] = MININT16;
  111. + if(v > (INT32)NCS_MAXINT16) {
  112. + ((INT32*)m_pBuffer)[x] = NCS_MAXINT16;
  113. + } else if(v < (INT32)NCS_MININT16) {
  114. + ((INT32*)m_pBuffer)[x] = NCS_MININT16;
  115. }
  116. }
  117. }
  118. @@ -403,13 +403,13 @@
  119. return(Clip(NCSCeil(fMin), NCSFloor(fMax)));
  120. break;
  121. case CNCSJPCBuffer::BT_IEEE4:
  122. - if(fMin == MINUINT8 && fMax == MAXUINT8) {
  123. + if(fMin == NCS_MINUINT8 && fMax == NCS_MAXUINT8) {
  124. for(x = 0; x < nWidth; x++) {
  125. IEEE4 v = ((IEEE4*)m_pBuffer)[x];
  126. - if(v > MAXUINT8) {
  127. - ((IEEE4*)m_pBuffer)[x] = MAXUINT8;
  128. - } else if(v < MINUINT8) {
  129. - ((IEEE4*)m_pBuffer)[x] = MINUINT8;
  130. + if(v > NCS_MAXUINT8) {
  131. + ((IEEE4*)m_pBuffer)[x] = NCS_MAXUINT8;
  132. + } else if(v < NCS_MINUINT8) {
  133. + ((IEEE4*)m_pBuffer)[x] = NCS_MINUINT8;
  134. }
  135. }
  136. } else {
  137. diff -r 486075d14769 -r d53918598fbf libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJPCPLTMarker.cpp
  138. --- libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJPCPLTMarker.cpp Wed Sep 30 11:55:26 2009 +0100
  139. +++ libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJPCPLTMarker.cpp Wed Sep 30 12:20:09 2009 +0100
  140. @@ -173,7 +173,7 @@
  141. nPrevHeaderLength = TMP.m_nHeaderLength;
  142. TMP.m_nHeaderLength += (UINT32)nTotalHeaderLength;
  143. }
  144. - if(nTotalHeaderLength > CNCSJPCBuffer::MAXUINT32) {
  145. + if(nTotalHeaderLength > CNCSJPCBuffer::NCS_MAXUINT32) {
  146. // Too big to store cumulated length in the PacketLength struct, so
  147. // set it back to false and reparse the entire PLT
  148. m_bCumulativeLengths = false;
  149. @@ -202,7 +202,7 @@
  150. nPrevHeaderLength = TMP.m_nHeaderLength;
  151. TMP.m_nHeaderLength += nTotalHeaderLength;
  152. }
  153. - if(nTotalHeaderLength > CNCSJPCBuffer::MAXUINT32) {
  154. + if(nTotalHeaderLength > CNCSJPCBuffer::NCS_MAXUINT32) {
  155. // Too big to store cumulated length in the PacketLength struct, so
  156. // set it back to false and reparse the entire PLT
  157. m_bCumulativeLengths = false;
  158. diff -r 486075d14769 -r d53918598fbf libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJPCT1Coder.cpp
  159. --- libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJPCT1Coder.cpp Wed Sep 30 11:55:26 2009 +0100
  160. +++ libecwj2-3.3/Source/C/NCSEcw/NCSJP2/NCSJPCT1Coder.cpp Wed Sep 30 12:20:09 2009 +0100
  161. @@ -917,7 +917,7 @@
  162. int passno=0;
  163. int passtype;
  164. - INT32 nMax = CNCSJPCBuffer::MININT32;
  165. + INT32 nMax = CNCSJPCBuffer::NCS_MININT32;
  166. UINT32 nWidth = pDecBuf->GetWidth();
  167. UINT32 nHeight = pDecBuf->GetHeight();
  168. @@ -956,7 +956,7 @@
  169. UINT32 nSubWidth = nWidth / 8;
  170. __m128 mm7 = _mm_set1_ps(fRatio);
  171. - __m128i mm4 = _mm_set1_epi16((short)CNCSJPCBuffer::MININT16);
  172. + __m128i mm4 = _mm_set1_epi16((short)CNCSJPCBuffer::NCS_MININT16);
  173. for(UINT32 y = 0; y < nHeight; y++) {
  174. INT16 *pSrc = (INT16*)pDecBuf->GetPtr() + y * nDecStep;
  175. @@ -1008,7 +1008,7 @@
  176. UINT32 nSubWidth = nWidth / 4;
  177. __m128 mm7 = _mm_set1_ps(fRatio);
  178. - __m64 mm4 = _mm_set1_pi16((short)CNCSJPCBuffer::MININT16);
  179. + __m64 mm4 = _mm_set1_pi16((short)CNCSJPCBuffer::NCS_MININT16);
  180. for(UINT32 y = 0; y < nHeight; y++) {
  181. INT16 *pSrc = (INT16*)pDecBuf->GetPtr() + y * nDecStep;
  182. diff -r 486075d14769 -r d53918598fbf libecwj2-3.3/Source/include/NCSJPCBuffer.h
  183. --- libecwj2-3.3/Source/include/NCSJPCBuffer.h Wed Sep 30 11:55:26 2009 +0100
  184. +++ libecwj2-3.3/Source/include/NCSJPCBuffer.h Wed Sep 30 12:20:09 2009 +0100
  185. @@ -48,30 +48,30 @@
  186. class NCSJPC_EXPORT_ALL CNCSJPCBuffer: public CNCSJPCRect {
  187. public:
  188. /** Maximum UINT8 value */
  189. - static const UINT32 MAXUINT8;
  190. + static const UINT32 NCS_MAXUINT8;
  191. /** Maximum UINT16 value */
  192. - static const UINT32 MAXUINT16;
  193. + static const UINT32 NCS_MAXUINT16;
  194. /** Maximum UINT32 value */
  195. - static const UINT32 MAXUINT32;
  196. + static const UINT32 NCS_MAXUINT32;
  197. /** Minimum UINT8 value */
  198. - static const UINT32 MINUINT8;
  199. + static const UINT32 NCS_MINUINT8;
  200. /** Minimum UINT16 value */
  201. - static const UINT32 MINUINT16;
  202. + static const UINT32 NCS_MINUINT16;
  203. /** Minimum UINT32 value */
  204. - static const UINT32 MINUINT32;
  205. + static const UINT32 NCS_MINUINT32;
  206. /** Maximum INT8 value */
  207. - static const UINT32 MAXINT8;
  208. + static const UINT32 NCS_MAXINT8;
  209. /** Maximum INT16 value */
  210. - static const UINT32 MAXINT16;
  211. + static const UINT32 NCS_MAXINT16;
  212. /** Maximum INT32 value */
  213. - static const UINT32 MAXINT32;
  214. + static const UINT32 NCS_MAXINT32;
  215. /** Minimum INT8 value */
  216. - static const INT32 MININT8;
  217. + static const INT32 NCS_MININT8;
  218. /** Minimum INT16 value */
  219. - static const INT32 MININT16;
  220. + static const INT32 NCS_MININT16;
  221. /** Minimum INT32 value */
  222. - static const INT32 MININT32;
  223. + static const INT32 NCS_MININT32;
  224. /**
  225. * SystemInfo class - Some basic system capabilities we care about.