Ticket #38: proposed-patch.txt

File proposed-patch.txt, 1.4 KB (added by Heinrich Stamerjohanns, 12 years ago)

Proposed patch to solve this problem

Line 
1diff --git a/servercomm/servercomm2.cc b/servercomm/servercomm2.cc
2index 1863977..ec12620 100644
3--- a/servercomm/servercomm2.cc
4+++ b/servercomm/servercomm2.cc
5@@ -37,6 +37,7 @@ rasdaman GmbH.
6
7 #include "config.h"
8 #include "mymalloc/mymalloc.h"
9+#include <byteswap.h>
10
11 static const char rcsid[] = "@(#)servercomm2, ServerComm: $Id: servercomm2.cc,v 1.121 2005/09/07 23:23:31 rasdev Exp $";
12
13@@ -3032,15 +3033,19 @@ ServerComm::getNextElement( unsigned long callingClientId,
14
15 case QT_FLOAT:
16 {
17- r_Float tmp = *(r_Float*)buffer;
18- *(r_Float*)buffer = r_Endian::swap(tmp);
19+ uint32_t value = bswap_32(*(uint32_t*)buffer);
20+ // use memcpy because older (<4.5?) gcc versions
21+ // choke if we assign to buffer directly
22+ memcpy(buffer, &value, sizeof(uint32_t));
23 }
24 break;
25
26 case QT_DOUBLE:
27 {
28- r_Double tmp = *(r_Double*)buffer;
29- *(r_Double*)buffer = r_Endian::swap(tmp);
30+ uint64_t value = bswap_64(*(uint64_t*)buffer);
31+ // use memcpy because older (<4.5?) gcc versions
32+ // choke if we assign to buffer directly
33+ memcpy(buffer, &value, sizeof(uint64_t));
34 }
35 break;
36