2
0
mirror of https://github.com/boostorg/uuid.git synced 2026-01-19 04:42:16 +00:00

MinGW-not-w64 doesn't have std::snprintf

This commit is contained in:
Peter Dimov
2024-04-22 13:30:59 +03:00
parent e2a66aaf73
commit 2e33055308
2 changed files with 5 additions and 4 deletions

View File

@@ -4,11 +4,11 @@
#include <boost/uuid/detail/md5.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/core/snprintf.hpp>
#include <boost/core/lightweight_test.hpp>
#include <cstdint>
#include <string>
#include <cstddef>
#include <cstdio>
template<std::size_t N> std::string digest_to_string( unsigned char const (&v)[ N ] )
{
@@ -17,7 +17,7 @@ template<std::size_t N> std::string digest_to_string( unsigned char const (&v)[
for( std::size_t i = 0; i < N; ++i )
{
char buffer[ 8 ];
std::snprintf( buffer, sizeof( buffer ), "%02x", static_cast<int>( v[ i ] ) );
boost::core::snprintf( buffer, sizeof( buffer ), "%02x", static_cast<int>( v[ i ] ) );
r += buffer;
}

View File

@@ -3,11 +3,12 @@
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/uuid/detail/sha1.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/core/snprintf.hpp>
#include <boost/core/lightweight_test.hpp>
#include <cstdint>
#include <string>
#include <cstddef>
#include <cstdio>
template<std::size_t N> std::string digest_to_string( unsigned char const (&v)[ N ] )
{
@@ -16,7 +17,7 @@ template<std::size_t N> std::string digest_to_string( unsigned char const (&v)[
for( std::size_t i = 0; i < N; ++i )
{
char buffer[ 8 ];
std::snprintf( buffer, sizeof( buffer ), "%02x", static_cast<int>( v[ i ] ) );
boost::core::snprintf( buffer, sizeof( buffer ), "%02x", static_cast<int>( v[ i ] ) );
r += buffer;
}