Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/opendap/libdap4
Browse files Browse the repository at this point in the history
Resolved Conflicts: chunked_istream.cc
  • Loading branch information
jgallagher59701 committed Jul 3, 2019
2 parents fad855c + 124a7f7 commit 6b30688
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
14 changes: 8 additions & 6 deletions chunked_istream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ chunked_inbuf::underflow()
// To read data from the chunked stream, first read the header
uint32_t header;
d_is.read((char *) &header, 4);
#if !BYTE_ORDER_PREFIX
#if !BYTE_ORDER_PREFIX && HEADER_IN_NETWORK_BYTE_ORDER
// When the endian nature of the server is encoded in the chunk header, the header is
// sent using network byte order
ntohl(header);
header = ntohl(header);
#endif

// There are two 'EOF' cases: One where the END chunk is zero bytes and one where
Expand Down Expand Up @@ -218,8 +218,9 @@ chunked_inbuf::xsgetn(char* s, std::streamsize num)
// Get a chunk header
uint32_t header;
d_is.read((char *) &header, 4);
#if !BYTE_ORDER_PREFIX
ntohl(header);

#if !BYTE_ORDER_PREFIX && HEADER_IN_NETWORK_BYTE_ORDER
header = ntohl(header);
#endif

// There are two EOF cases: One where the END chunk is zero bytes and one where
Expand Down Expand Up @@ -343,8 +344,9 @@ chunked_inbuf::read_next_chunk()
// To read data from the chunked stream, first read the header
uint32_t header;
d_is.read((char *) &header, 4);
#if !BYTE_ORDER_PREFIX
ntohl(header);

#if !BYTE_ORDER_PREFIX && HEADER_IN_NETWORK_BYTE_ORDER
header = ntohl(header);
#endif

// There are two 'EOF' cases: One where the END chunk is zero bytes and one where
Expand Down
14 changes: 11 additions & 3 deletions chunked_ostream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ chunked_outbuf::data_chunk()
#if !BYTE_ORDER_PREFIX
// Add encoding of host's byte order. jhrg 11/24/13
if (!d_big_endian) header |= CHUNK_LITTLE_ENDIAN;
#if HEADER_IN_NETWORK_BYTE_ORDER
// network byte order for the header
htonl(header);
header = htonl(header);
#endif
#endif

d_os.write((const char *)&header, sizeof(int32_t));
Expand Down Expand Up @@ -120,8 +122,10 @@ chunked_outbuf::end_chunk()
#if !BYTE_ORDER_PREFIX
// Add encoding of host's byte order. jhrg 11/24/13
if (!d_big_endian) header |= CHUNK_LITTLE_ENDIAN;
#if HEADER_IN_NETWORK_BYTE_ORDER
// network byte order for the header
htonl(header);
#endif
#endif

// Write out the CHUNK_END header with the byte count.
Expand Down Expand Up @@ -167,8 +171,10 @@ chunked_outbuf::err_chunk(const std::string &m)
#if !BYTE_ORDER_PREFIX
// Add encoding of host's byte order. jhrg 11/24/13
if (!d_big_endian) header |= CHUNK_LITTLE_ENDIAN;
#if HEADER_IN_NETWORK_BYTE_ORDER
// network byte order for the header
htonl(header);
header = htonl(header);
#endif
#endif

// Write out the CHUNK_END header with the byte count.
Expand Down Expand Up @@ -274,8 +280,10 @@ chunked_outbuf::xsputn(const char *s, std::streamsize num)
#if !BYTE_ORDER_PREFIX
// Add encoding of host's byte order. jhrg 11/24/13
if (!d_big_endian) header |= CHUNK_LITTLE_ENDIAN;
#if HEADER_IN_NETWORK_BYTE_ORDER
// network byte order for the header
htonl(header);
header = htonl(header);
#endif
#endif
d_os.write((const char *)&header, sizeof(int32_t)); // Data chunk's CHUNK_TYPE is 0x00000000

Expand Down

0 comments on commit 6b30688

Please sign in to comment.