diff --git a/mdstcpip/mdsip.h b/mdstcpip/mdsip.h index acebb6feed..b05b1aecc9 100644 --- a/mdstcpip/mdsip.h +++ b/mdstcpip/mdsip.h @@ -101,12 +101,14 @@ #define Endian(c) (c & BigEndian) #define CType(c) (c & 0x0f) #define IsCompressed(c) (c & COMPRESSED) + +// somewhat jScope only message->h.status #ifdef NOCOMPRESSION #define SUPPORTS_COMPRESSION 0 #else #define SUPPORTS_COMPRESSION 0x8000 #endif -#define SupportsCompression(c) (c & SUPPORTS_COMPRESSION) +#define SupportsCompression(s) (s & SUPPORTS_COMPRESSION) #define EVENTASTREQUEST "---EVENTAST---REQUEST---" #define EVENTCANREQUEST "---EVENTCAN---REQUEST---" diff --git a/mdstcpip/mdsip_connections.h b/mdstcpip/mdsip_connections.h index 54fbffcbea..e9de943d7f 100644 --- a/mdstcpip/mdsip_connections.h +++ b/mdstcpip/mdsip_connections.h @@ -192,12 +192,14 @@ typedef struct _io_routines #define Endian(c) (c & BigEndian) #define CType(c) (c & 0x0f) #define IsCompressed(c) (c & COMPRESSED) + +// somewhat jScope only message->h.status #ifdef NOCOMPRESSION #define SUPPORTS_COMPRESSION 0 #else #define SUPPORTS_COMPRESSION 0x8000 #endif -#define SupportsCompression(c) (c & SUPPORTS_COMPRESSION) +#define SupportsCompression(s) (s & SUPPORTS_COMPRESSION) #define FlipBytes(num, ptr) \ { \ diff --git a/mdstcpip/mdsipshr/ProcessMessage.c b/mdstcpip/mdsipshr/ProcessMessage.c index bb6cba2fac..1443a3924a 100644 --- a/mdstcpip/mdsipshr/ProcessMessage.c +++ b/mdstcpip/mdsipshr/ProcessMessage.c @@ -476,24 +476,17 @@ static inline void convert_default(Message *m, int num, const mdsdsc_t *d, uint3 } } -static inline int _send_response(Connection *connection, Message **message, int status, mdsdsc_t *d) +static inline int _send_response(Connection *connection, Message *message, Message **message_out, int status, mdsdsc_t *d) { const int client_type = connection->client_type; const unsigned char message_id = connection->message_id; Message *m = NULL; int serial = STATUS_NOT_OK || (connection->descrip[0] && connection->descrip[0]->dtype == DTYPE_SERIAL); - if (!serial && SupportsCompression(client_type)) - { - EMPTYXD(xd); - status = MdsSerializeDscOut(d, &xd); - MdsFreeDescriptor(d); - d = xd.pointer; - serial = 1; - } + (void)message; if (serial && STATUS_OK && d->class == CLASS_A) { mdsdsc_a_t *array = (mdsdsc_a_t *)d; - *message = m = malloc(sizeof(MsgHdr) + array->arsize); + *message_out = m = malloc(sizeof(MsgHdr) + array->arsize); memset(&m->h, 0, sizeof(MsgHdr)); m->h.msglen = sizeof(MsgHdr) + array->arsize; m->h.client_type = client_type; @@ -510,7 +503,7 @@ static inline int _send_response(Connection *connection, Message **message, int uint16_t length; uint32_t num; uint32_t nbytes = get_nbytes(&length, &num, client_type, d); - *message = m = malloc(sizeof(MsgHdr) + nbytes); + *message_out = m = malloc(sizeof(MsgHdr) + nbytes); memset(&m->h, 0, sizeof(MsgHdr)); m->h.msglen = sizeof(MsgHdr) + nbytes; m->h.client_type = client_type; @@ -563,7 +556,7 @@ static int send_response(Connection *connection, Message *message, const int sta { int status; INIT_AND_FREE_ON_EXIT(Message *, m); - status = _send_response(connection, &m, status_in, d); + status = _send_response(connection, message, &m, status_in, d); FREE_NOW(m); if (STATUS_NOT_OK) return FALSE; // no good close connection