Updated sprintf to sprintf_s (and others). Removed error surpressing defines. closes #1
This commit is contained in:
parent
360ff882ba
commit
c2e3136e92
@ -50,9 +50,11 @@ unsigned long IpEndpointName::GetHostByName( const char *s )
|
||||
void IpEndpointName::AddressAsString( char *s ) const
|
||||
{
|
||||
if( address == ANY_ADDRESS ){
|
||||
std::sprintf( s, "<any>" );
|
||||
//std::sprintf( s, "<any>" );
|
||||
sprintf_s(s, ADDRESS_STRING_LENGTH, "<any>");
|
||||
}else{
|
||||
std::sprintf( s, "%d.%d.%d.%d",
|
||||
//std::sprintf( s, "%d.%d.%d.%d",
|
||||
sprintf_s(s, ADDRESS_STRING_LENGTH, "%d.%d.%d.%d",
|
||||
(int)((address >> 24) & 0xFF),
|
||||
(int)((address >> 16) & 0xFF),
|
||||
(int)((address >> 8) & 0xFF),
|
||||
@ -65,9 +67,11 @@ void IpEndpointName::AddressAndPortAsString( char *s ) const
|
||||
{
|
||||
if( port == ANY_PORT ){
|
||||
if( address == ANY_ADDRESS ){
|
||||
std::sprintf( s, "<any>:<any>" );
|
||||
//std::sprintf( s, "<any>:<any>" );
|
||||
sprintf_s(s, ADDRESS_AND_PORT_STRING_LENGTH, "<any>:<any>");
|
||||
}else{
|
||||
std::sprintf( s, "%d.%d.%d.%d:<any>",
|
||||
//std::sprintf( s, "%d.%d.%d.%d:<any>",
|
||||
sprintf_s(s, ADDRESS_AND_PORT_STRING_LENGTH, "%d.%d.%d.%d:<any>",
|
||||
(int)((address >> 24) & 0xFF),
|
||||
(int)((address >> 16) & 0xFF),
|
||||
(int)((address >> 8) & 0xFF),
|
||||
@ -75,9 +79,11 @@ void IpEndpointName::AddressAndPortAsString( char *s ) const
|
||||
}
|
||||
}else{
|
||||
if( address == ANY_ADDRESS ){
|
||||
std::sprintf( s, "<any>:%d", port );
|
||||
//std::sprintf( s, "<any>:%d", port );
|
||||
sprintf_s(s, ADDRESS_AND_PORT_STRING_LENGTH, "<any>:%d", port);
|
||||
}else{
|
||||
std::sprintf( s, "%d.%d.%d.%d:%d",
|
||||
//std::sprintf( s, "%d.%d.%d.%d:%d",
|
||||
sprintf_s(s, ADDRESS_AND_PORT_STRING_LENGTH, "%d.%d.%d.%d:%d",
|
||||
(int)((address >> 24) & 0xFF),
|
||||
(int)((address >> 16) & 0xFF),
|
||||
(int)((address >> 8) & 0xFF),
|
||||
|
@ -360,8 +360,9 @@ OutboundPacketStream& OutboundPacketStream::operator<<( const BeginMessage& rhs
|
||||
|
||||
messageCursor_ = BeginElement( messageCursor_ );
|
||||
|
||||
std::strcpy( messageCursor_, rhs.addressPattern );
|
||||
//std::strcpy( messageCursor_, rhs.addressPattern );
|
||||
std::size_t rhsLength = std::strlen(rhs.addressPattern);
|
||||
strcpy_s(messageCursor_, rhsLength, rhs.addressPattern);
|
||||
messageCursor_ += rhsLength + 1;
|
||||
|
||||
// zero pad to 4-byte boundary
|
||||
@ -602,8 +603,9 @@ OutboundPacketStream& OutboundPacketStream::operator<<( const char *rhs )
|
||||
CheckForAvailableArgumentSpace( RoundUp4(std::strlen(rhs) + 1) );
|
||||
|
||||
*(--typeTagsCurrent_) = STRING_TYPE_TAG;
|
||||
std::strcpy( argumentCurrent_, rhs );
|
||||
//std::strcpy( argumentCurrent_, rhs );
|
||||
std::size_t rhsLength = std::strlen(rhs);
|
||||
strcpy_s(argumentCurrent_, rhsLength, rhs);
|
||||
argumentCurrent_ += rhsLength + 1;
|
||||
|
||||
// zero pad to 4-byte boundary
|
||||
@ -622,8 +624,9 @@ OutboundPacketStream& OutboundPacketStream::operator<<( const Symbol& rhs )
|
||||
CheckForAvailableArgumentSpace( RoundUp4(std::strlen(rhs) + 1) );
|
||||
|
||||
*(--typeTagsCurrent_) = SYMBOL_TYPE_TAG;
|
||||
std::strcpy( argumentCurrent_, rhs );
|
||||
//std::strcpy( argumentCurrent_, rhs );
|
||||
std::size_t rhsLength = std::strlen(rhs);
|
||||
strcpy_s(argumentCurrent_, rhsLength, rhs);
|
||||
argumentCurrent_ += rhsLength + 1;
|
||||
|
||||
// zero pad to 4-byte boundary
|
||||
|
@ -126,11 +126,14 @@ std::ostream& operator<<( std::ostream & os,
|
||||
std::time_t t =
|
||||
(unsigned long)( arg.AsTimeTagUnchecked() >> 32 );
|
||||
|
||||
const char *timeString = std::ctime( &t );
|
||||
size_t len = std::strlen( timeString );
|
||||
//const char *timeString = std::ctime( &t );
|
||||
|
||||
const size_t len = 26; //26 chars needed for ctime_s
|
||||
char timeString[len];
|
||||
errno_t err = ctime_s(timeString, len, &t);
|
||||
|
||||
// -1 to omit trailing newline from string returned by ctime()
|
||||
if( len > 1 )
|
||||
if( !err )
|
||||
os.write( timeString, len - 1 );
|
||||
}
|
||||
break;
|
||||
|
@ -121,7 +121,7 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;__WIN32__;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;__WIN32__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
|
Loading…
x
Reference in New Issue
Block a user