- Fix snprintf and vsnprintf detection errors for Visual Studio 2015 in CMake

- Fix user-defined literal errors for Visual Studio 2015
This commit is contained in:
xboi209 2015-08-01 02:41:45 -07:00
parent 095cdee275
commit 9a5be8f445
21 changed files with 35 additions and 34 deletions

View file

@ -11,6 +11,7 @@ include(DefineInstallationPaths)
include(CheckIncludeFileCXX)
include(CheckIncludeFilesCXX)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckLibraryExists)
include(CheckTypeSizeCXX)
include(CheckCXXCompilerFlag)
@ -187,9 +188,9 @@ check_function_exists(kqueue HAVE_KQUEUE)
check_function_exists(setitimer HAVE_SETITIMER)
check_function_exists(epoll_create HAVE_EPOLL_CREATE)
check_function_exists(getrlimit HAVE_GETRLIMIT)
check_function_exists(vsnprintf HAVE_VSNPRINTF)
check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF)
check_function_exists(_vsnprintf HAVE__VSNPRINTF)
check_function_exists(snprintf HAVE_SNPRINTF)
check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
check_function_exists(_snprintf HAVE__SNPRINTF)
check_function_exists(setpgrp HAVE_SETPGRP)
check_function_exists(inet_aton HAVE_INET_ATON)

View file

@ -643,7 +643,7 @@ namespace pvpgn
curraccount = (t_account*)entry_get_data(curr);
if (curraccount->uid == uid)
{
eventlog(eventlog_level_debug, __FUNCTION__, "BUG: user \"%s\":"UID_FORMAT" already has an account (\"%s\":"UID_FORMAT")", username, uid, account_get_name(curraccount), curraccount->uid);
eventlog(eventlog_level_debug, __FUNCTION__, "BUG: user \"%s\":" UID_FORMAT " already has an account (\"%s\":" UID_FORMAT ")", username, uid, account_get_name(curraccount), curraccount->uid);
hashtable_entry_release(curr);
return NULL;
}
@ -656,7 +656,7 @@ namespace pvpgn
{
if (strcasecmp(tname, username) == 0)
{
eventlog(eventlog_level_debug, __FUNCTION__, "BUG: user \"%s\":"UID_FORMAT" already has an account (\"%s\":"UID_FORMAT")", username, uid, tname, curraccount->uid);
eventlog(eventlog_level_debug, __FUNCTION__, "BUG: user \"%s\":" UID_FORMAT " already has an account (\"%s\":" UID_FORMAT ")", username, uid, tname, curraccount->uid);
hashtable_entry_release(curr);
return NULL;
}

View file

@ -255,7 +255,7 @@ namespace pvpgn
conf_set_bool(&tmp, valstr, 0);
if (tmp) {
printf(PVPGN_SOFTWARE" version "PVPGN_VERSION"\n");
printf(PVPGN_SOFTWARE" version " PVPGN_VERSION "\n");
exitflag = 1;
}

View file

@ -2007,7 +2007,7 @@ namespace pvpgn
static int _handle_version_command(t_connection * c, char const *text)
{
message_send_text(c, message_type_info, c, PVPGN_SOFTWARE" "PVPGN_VERSION);
message_send_text(c, message_type_info, c, PVPGN_SOFTWARE " " PVPGN_VERSION);
return 0;
}

View file

@ -979,7 +979,7 @@ namespace pvpgn
if (game->bad)
std::fprintf(fp, "[ game results ignored due to inconsistencies ]\n\n");
std::fprintf(fp, "name=\"%s\" id="GAMEID_FORMAT"\n",
std::fprintf(fp, "name=\"%s\" id=" GAMEID_FORMAT "\n",
game_get_name(game),
game->id);
std::fprintf(fp, "clienttag=%4s type=\"%s\" option=\"%s\"\n",

View file

@ -159,8 +159,8 @@ namespace pvpgn
std::sprintf(temp, ":Maximum length exceeded");
irc_send(conn, RPL_WELCOME, temp);
if ((14 + std::strlen(server_get_hostname()) + 10 + std::strlen(PVPGN_SOFTWARE" "PVPGN_VERSION) + 1) <= MAX_IRC_MESSAGE_LEN)
std::sprintf(temp, ":Your host is %s, running "PVPGN_SOFTWARE" "PVPGN_VERSION, server_get_hostname());
if ((14 + std::strlen(server_get_hostname()) + 10 + std::strlen(PVPGN_SOFTWARE " " PVPGN_VERSION) + 1) <= MAX_IRC_MESSAGE_LEN)
std::sprintf(temp, ":Your host is %s, running " PVPGN_SOFTWARE " " PVPGN_VERSION, server_get_hostname());
else
std::sprintf(temp, ":Maximum length exceeded");
irc_send(conn, RPL_YOURHOST, temp);
@ -174,13 +174,13 @@ namespace pvpgn
irc_send(conn, RPL_CREATED, temp);
/* we don't give mode information on MYINFO we give it on ISUPPORT */
if ((std::strlen(server_get_hostname()) + 7 + std::strlen(PVPGN_SOFTWARE" "PVPGN_VERSION) + 9 + 1) <= MAX_IRC_MESSAGE_LEN)
std::sprintf(temp, "%s "PVPGN_SOFTWARE" "PVPGN_VERSION" - -", server_get_hostname());
if ((std::strlen(server_get_hostname()) + 7 + std::strlen(PVPGN_SOFTWARE " " PVPGN_VERSION) + 9 + 1) <= MAX_IRC_MESSAGE_LEN)
std::sprintf(temp, "%s " PVPGN_SOFTWARE " " PVPGN_VERSION " - -", server_get_hostname());
else
std::sprintf(temp, ":Maximum length exceeded");
irc_send(conn, RPL_MYINFO, temp);
std::sprintf(temp, "NICKLEN=%d TOPICLEN=%d CHANNELLEN=%d PREFIX=%s CHANTYPES="CHANNEL_TYPE" NETWORK=%s IRCD="PVPGN_SOFTWARE,
std::sprintf(temp, "NICKLEN=%d TOPICLEN=%d CHANNELLEN=%d PREFIX=%s CHANTYPES=" CHANNEL_TYPE " NETWORK=%s IRCD=" PVPGN_SOFTWARE,
MAX_CHARNAME_LEN, MAX_TOPIC_LEN, MAX_CHANNELNAME_LEN, CHANNEL_PREFIX, prefs_get_irc_network_name());
if ((std::strlen(temp)) <= MAX_IRC_MESSAGE_LEN)
@ -338,7 +338,7 @@ namespace pvpgn
break;
}
snprintf(msgtemp, sizeof(msgtemp), "Account "UID_FORMAT" created.", account_get_uid(temp));
snprintf(msgtemp, sizeof(msgtemp), "Account " UID_FORMAT " created.", account_get_uid(temp));
message_send_text(conn, message_type_info, conn, msgtemp);
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] account \"%s\" created", conn_get_socket(conn), username);
conn_unget_chatname(conn, username);

View file

@ -164,8 +164,8 @@ namespace pvpgn
// global variables
lua::table g(vm);
g.update("PVPGN_SOFTWARE", PVPGN_SOFTWARE);
g.update("PVPGN_VERSION", PVPGN_VERSION);
g.update(" PVPGN_SOFTWARE ", PVPGN_SOFTWARE);
g.update(" PVPGN_VERSION ", PVPGN_VERSION);
// config variables from bnetd.conf
lua::transaction bind(vm);

View file

@ -462,7 +462,7 @@ void pvpgn_greeting(void)
{
struct utsname utsbuf;
#ifdef HAVE_GETPID
eventlog(eventlog_level_info, __FUNCTION__, PVPGN_SOFTWARE" version "PVPGN_VERSION" process %u", (unsigned int)getpid());
eventlog(eventlog_level_info, __FUNCTION__, PVPGN_SOFTWARE" version " PVPGN_VERSION " process %u", (unsigned int)getpid());
#else
eventlog(eventlog_level_info, __FUNCTION__, PVPGN_SOFTWARE" version "PVPGN_VERSION);
#endif
@ -472,7 +472,7 @@ void pvpgn_greeting(void)
eventlog(eventlog_level_info, __FUNCTION__, "running on %s (%s %s, %s)", utsbuf.sysname, utsbuf.version, utsbuf.release, utsbuf.machine);
}
printf("You are currently Running "PVPGN_SOFTWARE" "PVPGN_VERSION"\n");
printf("You are currently Running " PVPGN_SOFTWARE " " PVPGN_VERSION "\n");
printf("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
printf("If you need support:\n");
printf(" * READ the documentation at http://pvpgndocs.berlios.de/\n");
@ -531,7 +531,7 @@ extern int main(int argc, char ** argv)
if (!(hexstrm = std::fopen(cmdline_get_hexfile(), "w")))
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for writing the hexdump (std::fopen: %s)", cmdline_get_hexfile(), std::strerror(errno));
else
std::fprintf(hexstrm, "# dump generated by "PVPGN_SOFTWARE" version "PVPGN_VERSION"\n");
std::fprintf(hexstrm, "# dump generated by " PVPGN_SOFTWARE " version " PVPGN_VERSION "\n");
}
/* Run the pre server stuff */

View file

@ -242,7 +242,7 @@ namespace pvpgn
break;
case 'v':
std::strcpy(&out[outpos], PVPGN_SOFTWARE" "PVPGN_VERSION);
std::strcpy(&out[outpos], PVPGN_SOFTWARE " " PVPGN_VERSION);
outpos += std::strlen(&out[outpos]);
break;

View file

@ -83,7 +83,7 @@ extern int main(int argc, char * argv[])
forcefile = 1;
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return EXIT_SUCCESS;
}
else if (std::strcmp(argv[a], "-h") == 0 || std::strcmp(argv[a], "--help") == 0 || std::strcmp(argv[a], "--usage")

View file

@ -199,7 +199,7 @@ extern int main(int argc, char * argv[])
forcefile = 1;
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return EXIT_SUCCESS;
}
else if (std::strcmp(argv[a], "-h") == 0 || std::strcmp(argv[a], "--help") == 0 || std::strcmp(argv[a], "--usage")

View file

@ -120,7 +120,7 @@ extern int main(int argc, char * argv[])
forcefile = 1;
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return EXIT_SUCCESS;
}
else if (std::strcmp(argv[a], "-h") == 0 || std::strcmp(argv[a], "--help") == 0 || std::strcmp(argv[a], "--usage")

View file

@ -73,7 +73,7 @@ extern int main(int argc, char * argv[])
forcefile = 1;
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return EXIT_SUCCESS;
}
else if (std::strcmp(argv[a], "-h") == 0 || std::strcmp(argv[a], "--help") == 0 || std::strcmp(argv[a], "--usage")

View file

@ -73,7 +73,7 @@ extern int main(int argc, char * argv[])
forcefile = 1;
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return EXIT_SUCCESS;
}
else if (std::strcmp(argv[a], "-h") == 0 || std::strcmp(argv[a], "--help") == 0 || std::strcmp(argv[a], "--usage")

View file

@ -72,7 +72,7 @@ extern int main(int argc, char * argv[])
forcepass = 1;
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return EXIT_SUCCESS;
}
else if (std::strcmp(argv[a], "-h") == 0 || std::strcmp(argv[a], "--help") == 0 || std::strcmp(argv[a], "--usage")

View file

@ -71,7 +71,7 @@ extern int main(int argc, char * argv[])
forcepass = 1;
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return EXIT_SUCCESS;
}
else if (std::strcmp(argv[a], "-h") == 0 || std::strcmp(argv[a], "--help") == 0 || std::strcmp(argv[a], "--usage")

View file

@ -189,7 +189,7 @@ extern int main(int argc, char * argv[])
}
#ifdef HAVE_GETPID
eventlog(eventlog_level_info, __FUNCTION__, "bntrackd version "PVPGN_VERSION" process %u", (unsigned int)getpid());
eventlog(eventlog_level_info, __FUNCTION__, "bntrackd version " PVPGN_VERSION " process %u", (unsigned int)getpid());
#else
eventlog(eventlog_level_info, __FUNCTION__, "bntrackd version "PVPGN_VERSION);
#endif
@ -694,7 +694,7 @@ namespace {
usage(argv[0]);
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
std::exit(0);
}
else if (std::strcmp(argv[a], "--command") == 0 || std::strcmp(argv[a], "--expire") == 0 ||

View file

@ -96,7 +96,7 @@ extern int main(int argc, char * argv[])
servname = argv[a];
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return EXIT_SUCCESS;
}
else if (std::strcmp(argv[a], "-h") == 0 || std::strcmp(argv[a], "--help") == 0 || std::strcmp(argv[a], "--usage") == 0)

View file

@ -630,7 +630,7 @@ namespace
}
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return EXIT_SUCCESS;
}
else if (std::strcmp(argv[a], "-h") == 0 || std::strcmp(argv[a], "--help") == 0 || std::strcmp(argv[a], "--usage") == 0)

View file

@ -326,7 +326,7 @@ extern int main(int argc, char * argv[])
}
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return 0;
}
else if (std::strcmp(argv[a], "-h") == 0 || std::strcmp(argv[a], "--help") == 0 || std::strcmp(argv[a], "--usage") == 0)
@ -359,7 +359,7 @@ extern int main(int argc, char * argv[])
std::fprintf(stderr, "%s: could not open file \"%s\" for writing the hexdump (std::fopen: %s)", argv[0], hexfile, std::strerror(errno));
else
{
std::fprintf(hexstrm, "# dump generated by bnftp version "PVPGN_VERSION"\n");
std::fprintf(hexstrm, "# dump generated by bnftp version " PVPGN_VERSION "\n");
}
}

View file

@ -338,7 +338,7 @@ extern int main(int argc, char * argv[])
ignoreversion = 1;
else if (std::strcmp(argv[a], "-v") == 0 || std::strcmp(argv[a], "--version") == 0)
{
std::printf("version "PVPGN_VERSION"\n");
std::printf("version " PVPGN_VERSION "\n");
return EXIT_SUCCESS;
}
else if (std::strcmp(argv[a], "--client") == 0 || std::strcmp(argv[a], "--owner") == 0 ||
@ -678,7 +678,7 @@ extern int main(int argc, char * argv[])
if (str_to_uint(temp, &uid) < 0 || uid < 1)
std::printf(" Account: UNKNOWN\n");
else
std::printf(" Account: "UID_FORMAT"\n", uid);
std::printf(" Account: " UID_FORMAT "\n", uid);
if (j < keys && (temp = packet_get_str_const(rpacket, strpos, 256)))
strpos += std::strlen(temp) + 1;