Problem: magic literals for UCHAR_MAX

Solution: use UCHAR_MAX constant instead
This commit is contained in:
Simon Giesecke
2018-05-28 18:46:36 +02:00
parent a4c817e736
commit 7c2d1c1824
7 changed files with 21 additions and 12 deletions

View File

@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <string.h>
#include <limits>
#include <limits.h>
#include "decoder.hpp"
#include "v1_decoder.hpp"
@@ -57,10 +58,10 @@ zmq::v1_decoder_t::~v1_decoder_t ()
int zmq::v1_decoder_t::one_byte_size_ready (unsigned char const *)
{
// First byte of size is read. If it is 0xff read 8-byte size.
// First byte of size is read. If it is UCHAR_MAX (0xff) read 8-byte size.
// Otherwise allocate the buffer for message data and read the
// message data into it.
if (*_tmpbuf == 0xff)
if (*_tmpbuf == UCHAR_MAX)
next_step (_tmpbuf, 8, &v1_decoder_t::eight_byte_size_ready);
else {
// There has to be at least one byte (the flags) in the message).