Skip to content

Commit

Permalink
Another try at non-c++ snprintf msvc-12 issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
grafikrobot committed Aug 27, 2023
1 parent 3faea16 commit 859c7cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/engine/hcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <errno.h>
#include <string.h>
#include <stdio.h>

typedef struct hcachedata HCACHEDATA ;

Expand Down Expand Up @@ -174,7 +175,6 @@ OBJECT * read_netstring( FILE * f )
template <typename... Args>
void write_netstring( FILE * f, char const * format, Args... args )
{
using namespace std;
if ( format == nullptr ) format = "";
auto size = snprintf(nullptr, 0, format, args...);
std::unique_ptr<char[]> s(new char[size+1]);
Expand Down
3 changes: 2 additions & 1 deletion src/engine/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Distributed under the Boost Software License, Version 1.0.
#include <memory>
#include <string>

#include <stdio.h>

namespace b2 {

struct object
Expand Down Expand Up @@ -87,7 +89,6 @@ struct value
template <typename... Args>
static inline value * format(const char * f, Args... args)
{
using namespace std;
auto size = snprintf(nullptr, 0, f, args...);
std::unique_ptr<char[]> s(new char[size + 1]);
snprintf(s.get(), size + 1, f, args...);
Expand Down

0 comments on commit 859c7cc

Please sign in to comment.