Skip to content

Commit

Permalink
Merge pull request #1 from drwalton/master
Browse files Browse the repository at this point in the history
Disable definition of snprintf on VS2015
  • Loading branch information
tbennun authored Jan 30, 2017
2 parents 7553b41 + aba5fde commit a19b5e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/windows/port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,17 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
return _vsnprintf(str, size-1, format, ap);
}

//Only define snprintf for VS 2013 and earlier, as VS 2015 now
// includes a definition of snprintf.
// See: https://msdn.microsoft.com/en-us/library/2ts7cx93.aspx
#if defined(_MSC_VER) && _MSC_VER < 1900

int snprintf(char *str, size_t size, const char *format, ...) {
va_list ap;
va_start(ap, format);
const int r = vsnprintf(str, size, format, ap);
va_end(ap);
return r;
}

#endif

0 comments on commit a19b5e0

Please sign in to comment.