Skip to content

Commit

Permalink
Now builds on Windows under Visual Studio 2022
Browse files Browse the repository at this point in the history
We still have lots of warnings.
  • Loading branch information
FurryFuttock committed Feb 6, 2024
1 parent 2c765de commit b6a5343
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions source/src/byte_bufs.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ByteBuf

uint8_t* data() const { return start; }
uint8_t* end() const { return limit; }
ssize_t size() const { return limit - start; } // ssize_t is signed
uint16_t size() const { return limit - start; } // uint16_t is signed

protected:
uint8_t* start;
Expand Down Expand Up @@ -72,7 +72,7 @@ class BufWriter
/// Return the unused size of the buffer, the remaining capacity which is empty.
/// A negative value would indicate an overrun, but that also indicates a bug in
/// in this class because protections are everywhere to prevent overruns.
ssize_t capacity() const { return limit - start; }
uint16_t capacity() const { return limit - start; }

/// Advance the start of the buffer by the specified number of bytes and trim
/// the capacity().
Expand Down Expand Up @@ -174,7 +174,7 @@ class BufReader
/// in the buffer.
/// A negative value would indicate an overrun, but that also indicates a bug in
/// in this class because protections are everywhere to prevent overruns.
ssize_t size() const { return limit - start; }
uint16_t size() const { return limit - start; }

/// Advance the start of the buffer by the specified number of bytes and trim
/// the size().
Expand Down
4 changes: 4 additions & 0 deletions source/src/cip/cipconnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,11 @@ void CipConn::GeneralConfiguration( ConnectionData* aConnData, ConnInstanceType
// "expected_packet_rate x connection_timeout_multiplier". Initial value
// is called a "pre-consumption" timeout value.
if( RxTimeoutUSecs() )
#ifdef _MSC_VER
SetInactivityWatchDogTimerUSecs(max(RxTimeoutUSecs(), 10000000u));
#else
SetInactivityWatchDogTimerUSecs( std::max( RxTimeoutUSecs(), 10000000u ) );
#endif
else
{
// this is not an erro
Expand Down
5 changes: 4 additions & 1 deletion source/src/enet_encap/encap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,11 @@ static int disposeOfLargePacket( int aSocket, unsigned aCount )
while( aCount )
{
// toss in chunks.
#ifdef _MSC_VER
int readz = min(aCount, unsigned(sizeof chunk));
#else
int readz = std::min( aCount, unsigned( sizeof chunk ) );

#endif
int num_read = Encapsulation::EnsuredTcpRecv( aSocket, chunk, readz );

if( num_read != readz )
Expand Down

0 comments on commit b6a5343

Please sign in to comment.