misc: pstring: Refactor dependents.

This commit is contained in:
Oskar Strengbohm 2024-04-27 21:30:57 +02:00
parent f9fdfc22e8
commit 4582b44eb3
22 changed files with 141 additions and 127 deletions

View File

@ -81,11 +81,11 @@
* $NoKeywords: $
*/
#include <stdio.h>
#include <stdarg.h>
#include <cstdio>
#include <cstdarg>
#include <string.h>
#include <assert.h>
#include "pstring.h"
#include "gr.h"
#include "mono.h"
#include "renderer.h"
@ -115,11 +115,11 @@ void grViewport::get_font(char *fontname, int size) {
// ---------------------------------------------------------------------------
int grViewport::printf(grTextAlign align, int x, int y, char *fmt, ...) {
va_list arglist;
std::va_list arglist;
int len;
va_start(arglist, fmt);
len = Pvsprintf(Str_buf, STR_BUF_SIZE, fmt, arglist);
len = std::vsnprintf(Str_buf, STR_BUF_SIZE, fmt, arglist);
va_end(arglist);
if (len < 0)
return 0;
@ -128,11 +128,11 @@ int grViewport::printf(grTextAlign align, int x, int y, char *fmt, ...) {
}
int grViewport::printf(int x, int y, char *fmt, ...) {
va_list arglist;
std::va_list arglist;
int len;
va_start(arglist, fmt);
len = Pvsprintf(Str_buf, STR_BUF_SIZE, fmt, arglist);
len = std::vsnprintf(Str_buf, STR_BUF_SIZE, fmt, arglist);
va_end(arglist);
if (len < 0)
return 0;

View File

@ -16,9 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstdarg>
#include <cstdio>
#include "DllWrappers.h"
#include "pserror.h"
#include "pstring.h"
#include "cfile.h"
#include "gamefont.h"
#include "grdefs.h"
@ -99,9 +101,9 @@ void MonoPrintf(int n, char *format, ...) {
#ifndef RELEASE
char tempbuffer[300];
va_list ap;
std::va_list ap;
va_start(ap, format);
Pvsprintf(tempbuffer, 300, format, ap);
std::vsnprintf(tempbuffer, 300, format, ap);
va_end(ap);
Debug_ConsolePrintf(n, tempbuffer);

View File

@ -133,8 +133,10 @@
* $NoKeywords: $
*/
#include <cstdarg>
#include <cstdio>
#include "TelComEffects.h"
#include "pstring.h"
#include "mem.h"
#include "vecmat.h"
#include <string.h>
@ -682,9 +684,9 @@ int FindButtonEffectByXY(int x, int y, int screen) {
char *format(const char *fmt, ...) {
static char tempbuffer[8192];
va_list ap;
std::va_list ap;
va_start(ap, fmt);
Pvsprintf(tempbuffer, sizeof (tempbuffer), fmt, ap);
std::vsnprintf(tempbuffer, sizeof(tempbuffer), fmt, ap);
va_end(ap);
return tempbuffer;
}

View File

@ -102,6 +102,9 @@
* $NoKeywords: $
*/
#include <cstdarg>
#include <cstdio>
#include <string.h>
#include <stdlib.h>
@ -555,7 +558,7 @@ void SetCVarString(int index, const char *val) {
if (to_whom != MULTI_SEND_MESSAGE_ALL)
val = msg;
Psprintf(str, sizeof(str), TXT_HUDSAY, Players[Player_num].callsign, val);
std::snprintf(str, sizeof(str), TXT_HUDSAY, Players[Player_num].callsign, val);
MultiSendMessageFromServer(GR_RGB(0, 128, 255), str, to_whom);
@ -770,10 +773,10 @@ void PrintDedicatedMessage(const char *fmt, ...) {
return;
char buf[CON_MAX_STRINGLEN];
va_list args;
std::va_list args;
va_start(args, fmt);
Pvsprintf(buf, CON_MAX_STRINGLEN, fmt, args);
std::vsnprintf(buf, CON_MAX_STRINGLEN, fmt, args);
va_end(args);
con_Printf(buf);

View File

@ -220,7 +220,9 @@
* $NoKeywords: $
*/
#include "pstring.h"
#include <cstdarg>
#include <cstdio>
#include "hud.h"
#include "grtext.h"
#include "gamefont.h"
@ -236,10 +238,6 @@
#include "multi.h"
#include "render.h"
#include <stdio.h>
#include <stdarg.h>
#include <algorithm>
//////////////////////////////////////////////////////////////////////////////
@ -890,11 +888,11 @@ void RenderHUDQuad(int x, int y, int w, int h, float u0, float v0, float u1, flo
// renders text, scaled, alphaed, saturated,
void RenderHUDText(ddgr_color col, ubyte alpha, int sat_count, int x, int y, const char *fmt, ...) {
va_list arglist;
std::va_list arglist;
char buf[128];
va_start(arglist, fmt);
Pvsprintf(buf, 128, fmt, arglist);
std::vsnprintf(buf, 128, fmt, arglist);
va_end(arglist);
RenderHUDTextFlagsNoFormat(0, col, alpha, sat_count, x, y, buf);
@ -926,12 +924,12 @@ void RenderHUDTextFlagsNoFormat(int flags, ddgr_color col, ubyte alpha, int sat_
// renders text, scaled, alphaed, saturated,
void RenderHUDTextFlags(int flags, ddgr_color col, ubyte alpha, int sat_count, int x, int y, const char *fmt, ...) {
va_list arglist;
std::va_list arglist;
char buf[128];
int i;
va_start(arglist, fmt);
Pvsprintf(buf, 128, fmt, arglist);
std::vsnprintf(buf, 128, fmt, arglist);
va_end(arglist);
grtext_SetAlpha(alpha);

View File

@ -322,12 +322,12 @@
* $NoKeywords: $
*/
#include <stdio.h>
#include <cstdarg>
#include <cstdio>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include "pstring.h"
#include "grdefs.h"
#include "hud.h"
#include "game.h"
@ -516,13 +516,13 @@ bool AddMultipleLinesToHUDMessages(char *temp_message, ddgr_color color) {
// adds a colored hud message to the list
// Returns true if message added, or false if message not (because the previous message was the same)
bool AddColoredHUDMessage(ddgr_color color, const char *format, ...) {
va_list args;
std::va_list args;
char *message = NULL;
char *last_message = NULL;
char temp_message[HUD_MESSAGE_LENGTH * 2];
va_start(args, format);
Pvsprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
std::vsnprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
va_end(args);
if (Demo_flags == DF_RECORDING) {
@ -552,13 +552,13 @@ bool AddFilteredColoredHUDMessage(ddgr_color color, const char *format, ...) {
if (Game_mode & GM_MULTI && checked_command_line)
return false; // filter this message
va_list args;
std::va_list args;
char *message = NULL;
char *last_message = NULL;
char temp_message[HUD_MESSAGE_LENGTH * 2];
va_start(args, format);
Pvsprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
std::vsnprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
va_end(args);
if (Demo_flags == DF_RECORDING) {
@ -588,13 +588,13 @@ bool AddFilteredHUDMessage(const char *format, ...) {
if (Game_mode & GM_MULTI && checked_command_line)
return false; // filter this message
va_list args;
std::va_list args;
char *message = NULL;
char *last_message = NULL;
char temp_message[HUD_MESSAGE_LENGTH * 2];
va_start(args, format);
Pvsprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
std::vsnprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
va_end(args);
if (Demo_flags == DF_RECORDING) {
@ -612,13 +612,13 @@ bool AddFilteredHUDMessage(const char *format, ...) {
// top one and move the others up
// Returns true if message added, or false if message not (because the previous message was the same)
bool AddHUDMessage(const char *format, ...) {
va_list args;
std::va_list args;
char *message = NULL;
char *last_message = NULL;
char temp_message[HUD_MESSAGE_LENGTH * 2];
va_start(args, format);
Pvsprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
std::vsnprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
va_end(args);
if (Demo_flags == DF_RECORDING) {
@ -636,13 +636,13 @@ bool AddHUDMessage(const char *format, ...) {
// top one and move the others up
// Returns true if message added, or false if message not (because the previous message was the same)
bool AddBlinkingHUDMessage(const char *format, ...) {
va_list args;
std::va_list args;
char *message = NULL;
char *last_message = NULL;
char temp_message[HUD_MESSAGE_LENGTH * 2];
va_start(args, format);
Pvsprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
std::vsnprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
va_end(args);
if (Demo_flags == DF_RECORDING) {
@ -1387,12 +1387,12 @@ void StartPersistentHUDMessage(ddgr_color color, int x, int y, float time, int f
// for centering on an axis, set either x or y to -1.
void AddPersistentHUDMessage(ddgr_color color, int x, int y, float time, int flags, int sound_index, const char *fmt,
...) {
va_list args;
std::va_list args;
char temp_message[HUD_MESSAGE_LENGTH * 2];
// start new message
va_start(args, fmt);
Pvsprintf(temp_message, HUD_MESSAGE_LENGTH * 2, fmt, args);
std::vsnprintf(temp_message, HUD_MESSAGE_LENGTH * 2, fmt, args);
va_end(args);
if (Hud_persistent_msg_id != HUD_INVALID_ID) // already one active, so queue the new one

View File

@ -182,6 +182,9 @@
* $NoKeywords: $
*/
#include <cstdarg>
#include <cstdio>
#include "newui_core.h"
#include "bitmap.h"
#include "mem.h"
@ -193,13 +196,11 @@
#include "application.h"
#include "stringtable.h"
#include "gamefont.h"
#include "pstring.h"
#include "textaux.h"
#include "d3music.h"
#include "hlsoundlib.h"
#include <string.h>
#include <stdarg.h>
extern void ui_DoCursor();
@ -2035,12 +2036,12 @@ short *newuiSheet::AddSlider(const char *title, short range, short init_pos, tSl
// adds a static text item
void newuiSheet::AddText(const char *text, ...) {
va_list arglist;
std::va_list arglist;
char buf[512];
int len;
va_start(arglist, text);
len = Pvsprintf(buf, 512, text, arglist);
len = std::vsnprintf(buf, 512, text, arglist);
va_end(arglist);
newuiSheet::t_gadget_desc *gadget = AddGadget(-1, GADGET_STATIC_TXT, buf);

View File

@ -570,6 +570,8 @@
* $NoKeywords: $
*/
#include <cstdio>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
@ -598,7 +600,6 @@
#include "config.h"
#include "difficulty.h"
#include "PilotPicsAPI.h"
#include "pstring.h"
#include "Mission.h"
#include "mem.h"
#include "polymodel.h"
@ -3889,14 +3890,14 @@ void ShowPilotPicDialog(pilot *Pilot) {
if (ppic_id == id_list[idx])
selected_index = idx + 1;
Psprintf(temp_buffer, PILOT_STRING_SIZE + 6, "%s%d", pname, idx);
std::snprintf(temp_buffer, PILOT_STRING_SIZE + 6, "%s%d", pname, idx);
list->AddItem(temp_buffer);
}
} else {
if (ppic_id == id_list[idx])
selected_index = idx + 1;
Psprintf(temp_buffer, PILOT_STRING_SIZE + 6, "%s", pname);
std::snprintf(temp_buffer, PILOT_STRING_SIZE + 6, "%s", pname);
list->AddItem(temp_buffer);
}

View File

@ -49,16 +49,16 @@
* $NoKeywords: $
*/
#include <cstdarg>
#include <cstdio>
#include "ddgrWin32.h"
#include "ddgrWin32GDI.h"
#include "ddgrWin32DX.h"
#include "pserror.h"
#include "pstring.h"
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
/* DDGR_WIN32 Library
v2.0 enhancements = concept of graphic subsystem when initializing.
@ -185,10 +185,10 @@ void ddgr_FatalError(const char *fmt, ...) {
}
// create whole error message
va_list arglist;
std::va_list arglist;
va_start(arglist, fmt);
Pvsprintf(buf, 768, fmt, arglist);
std::vsnprintf(buf, 768, fmt, arglist);
va_end(arglist);
if (DDGR_subsystems[i] = !-1) {
@ -206,11 +206,11 @@ void ddgr_FatalError(const char *fmt, ...) {
}
void ddgr_PushError(const char *fmt, ...) {
va_list arglist;
std::va_list arglist;
char buf[128];
va_start(arglist, fmt);
Pvsprintf(buf, 128, fmt, arglist);
std::vsnprintf(buf, 128, fmt, arglist);
va_end(arglist);
DDGR_error_msgs[DDGR_num_msgs] = new char[strlen(buf) + 1];

View File

@ -37,9 +37,11 @@
*
*/
#include <cstdarg>
#include <cstdio>
#include "ssl_lib.h"
#include "pserror.h"
#include "pstring.h"
#include <string.h>
@ -57,7 +59,7 @@ void llsSystem::CheckForErrors() {
}
void llsSystem::ErrorText(const char *fmt, ...) {
va_list arglist;
std::va_list arglist;
char buf[128];
int len, slen;
@ -69,7 +71,7 @@ void llsSystem::ErrorText(const char *fmt, ...) {
strcat(m_error_text, "\n");
va_start(arglist, fmt);
len = Pvsprintf(buf, 128, fmt, arglist);
len = std::vsnprintf(buf, 128, fmt, arglist);
va_end(arglist);
if (len < 0)
return;
@ -78,4 +80,4 @@ void llsSystem::ErrorText(const char *fmt, ...) {
return;
}
strcat(m_error_text, buf);
}
}

View File

@ -91,13 +91,14 @@
#if 0
#include <cstdarg>
#include <cstdio>
#include "DDAccess.h"
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>
#include "pserror.h"
#include "pstring.h"
#include "mono.h"
#include "ddio.h"
#include "ddio_win.h"
@ -1373,9 +1374,9 @@ void PrintDirectInputErrorString( HRESULT hr,const char *format, ... )
#endif
char buffer[2048];
va_list marker;
std::va_list marker;
va_start(marker,format);
Pvsprintf(buffer,2048,format,marker);
std::vsnprintf(buffer,2048,format,marker);
va_end(marker);
strcat(buffer,": \n");

View File

@ -104,13 +104,15 @@
// ----------------------------------------------------------------------------
// Win32 IO System Main Library Interface
// ----------------------------------------------------------------------------
#include <cstdarg>
#include <cstdio>
#include "DDAccess.h"
#include <stdlib.h>
#include <stdarg.h>
#include "pserror.h"
#include "pstring.h"
#include "Application.h"
#include "ddio_win.h"
#include "ddio.h"
@ -180,10 +182,10 @@ void ddio_InternalClose() {
#ifdef _DEBUG
void ddio_DebugMessage(unsigned err, char *fmt, ...) {
char buf[128];
va_list arglist;
std::va_list arglist;
va_start(arglist, fmt);
Pvsprintf(buf, 128, fmt, arglist);
std::vsnprintf(buf, 128, fmt, arglist);
va_end(arglist);
mprintf((0, "DDIO: %s\n", buf));

View File

@ -146,16 +146,16 @@
* $NoKeywords: $
*/
#include <cstdarg>
#include <cstdio>
#include "grtextlib.h"
#include "renderer.h"
#include "pserror.h"
#include "pstring.h"
#include "mem.h"
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@ -407,12 +407,12 @@ void grtext_SetFont(int font_handle) {
// puts a formatted string in the text buffer
void grtext_Printf(int x, int y, const char *fmt, ...) {
va_list arglist;
std::va_list arglist;
int len;
char buf[512];
va_start(arglist, fmt);
len = Pvsprintf(buf, 512, fmt, arglist);
len = std::vsnprintf(buf, 512, fmt, arglist);
va_end(arglist);
if (len < 0)
return;
@ -426,12 +426,12 @@ int grtext_GetFont() { return Grtext_font; }
// puts a centered string in the text buffer.
void grtext_CenteredPrintf(int xoff, int y, const char *fmt, ...) {
int new_x;
va_list arglist;
std::va_list arglist;
int len;
char buf[512];
va_start(arglist, fmt);
len = Pvsprintf(buf, 512, fmt, arglist);
len = std::vsnprintf(buf, 512, fmt, arglist);
va_end(arglist);
if (len < 0)
return;

View File

@ -37,6 +37,8 @@
*
*/
#include <cstdarg>
#include <cstdio>
#include "FontEditor.h"
#include "pstypes.h"
@ -44,12 +46,9 @@
#include "bitmap.h"
#include "renderer.h"
#include "grtext.h"
#include "pstring.h"
#include "ddio.h"
#include "mem.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
// Font File stuff
@ -99,12 +98,12 @@ void message_box(const char *fmt, ...)
#define FIXED_MSGBOX_WIDTH (512)
#define FIXED_MSGBOX_HEIGHT (128)
va_list arglist;
std::va_list arglist;
char buf[512];
int len;
va_start(arglist,fmt);
len = Pvsprintf(buf,512,fmt,arglist);
len = std::vsnprintf(buf,512,fmt,arglist);
va_end(arglist);
if (len < 0) return;

View File

@ -539,9 +539,10 @@
* $NoKeywords: $
*/
#include <cstdarg>
#include <cstdio>
#include <string.h>
#include <stdarg.h>
#ifndef NEWEDITOR
#include "d3edit.h"
@ -561,7 +562,6 @@
#include "trigger.h"
#include "mem.h"
#include "doorway.h"
#include "pstring.h"
#ifndef NEWEDITOR
#include "editor_lighting.h"
@ -2205,11 +2205,11 @@ int error_buf_offset;
//Log an error in the room check process
void CheckError(const char *str,...)
{
va_list arglist;
std::va_list arglist;
int nchars;
va_start(arglist, str);
nchars = Pvsprintf(error_buf+error_buf_offset,BUF_LEN-error_buf_offset, str, arglist);
nchars = std::vsnprintf(error_buf+error_buf_offset,BUF_LEN-error_buf_offset, str, arglist);
va_end(arglist);
error_buf_offset += strlen(error_buf+error_buf_offset);
@ -3398,4 +3398,4 @@ void ListObjectsInAllLevels()
}
DumpTextToClipboard(error_buf);
}
}

View File

@ -761,6 +761,8 @@
* $NoKeywords: $
*/
#include <cstdarg>
#include <cstdio>
#include "stdafx.h"
#include "editor.h"
@ -804,7 +806,6 @@
// D3 EDITOR HEADERS
#include "pserror.h"
#include "pstring.h"
#include "Application.h"
#include "AppDatabase.h"
#include "program.h"
@ -1594,10 +1595,10 @@ void EditorStatus( const char *format, ... )
{
if (MFC_Main_frame) {
char status_line[256];
va_list ap;
std::va_list ap;
va_start(ap, format);
Pvsprintf(status_line, 256,format, ap);
std::vsnprintf(status_line, 256,format, ap);
va_end(ap);
MFC_Main_frame->SetStatusMessage(status_line);
@ -1609,10 +1610,10 @@ void SplashMessage(const char *format, ...)
{
if (D3_splash_screen) {
char status_line[256];
va_list ap;
std::va_list ap;
va_start(ap, format);
Pvsprintf(status_line, 256,format, ap);
std::vsnprintf(status_line, 256,format, ap);
va_end(ap);
D3_splash_screen->PutText(status_line);
@ -1625,10 +1626,10 @@ char Editor_error_message[1000]="";
//code should call this with the error message.
void SetErrorMessage(const char *fmt,...)
{
va_list arglist;
std::va_list arglist;
va_start(arglist,fmt);
Pvsprintf(Editor_error_message,sizeof(Editor_error_message),fmt,arglist);
std::vsnprintf(Editor_error_message,sizeof(Editor_error_message),fmt,arglist);
va_end(arglist);
mprintf ((0,"Editor error: %s\n",Editor_error_message));

View File

@ -364,6 +364,9 @@
// editor.cpp : Defines the class behaviors for the application.
//
#include <cstdarg>
#include <cstdio>
#include "stdafx.h"
#include "editor.h"
#include "MainFrm.h"
@ -376,7 +379,6 @@
#include "moveworld.h"
#include "d3edit.h"
#include "pserror.h"
#include "pstring.h"
#include "args.h"
#include "game.h"
#include "trigger.h"
@ -1067,13 +1069,13 @@ bool FileDialog(CWnd *wnd, BOOL open, LPCTSTR filter, char *pathname, char *init
// fmt - printf-style text & arguments
void PrintToDlgItem(CDialog *dlg,int id,char *fmt,...)
{
va_list arglist;
std::va_list arglist;
char str[3000];
int len;
CEdit *ebox;
va_start(arglist,fmt);
len = Pvsprintf(str,3000,fmt,arglist);
len = std::vsnprintf(str,3000,fmt,arglist);
va_end(arglist);
ASSERT(len < 3000);

View File

@ -433,8 +433,11 @@
*
* $NoKeywords: $
*/
#include <cstdarg>
#include <cstdio>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#if defined(WIN32)
@ -3078,8 +3081,6 @@ void Read256TextureNames ()
cfclose (infile);
}*/
#include "pstring.h"
void DataError(const char *fmt, ...) {
// Got a data error!
// Int3();
@ -3094,11 +3095,11 @@ void DataError(const char *fmt, ...) {
// Write to file if switch specified
if (FindArg("-datacheck")) {
static char last_filename[_MAX_PATH];
va_list arglist;
std::va_list arglist;
char buf[1024];
va_start(arglist, fmt);
Pvsprintf(buf, sizeof(buf), fmt, arglist);
std::vsnprintf(buf, sizeof(buf), fmt, arglist);
va_end(arglist);
// Open file if not already open

View File

@ -64,14 +64,14 @@
*
*/
#include <stdio.h>
#include <cstdarg>
#include <cstdio>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "mono.h"
#include "pserror.h"
#include "pstring.h"
#include "debug.h"
#include "application.h"
@ -118,14 +118,14 @@ extern int no_debug_dialog;
// exits the application and prints out a standard error message
void Error(const char *fmt, ...) {
va_list arglist;
std::va_list arglist;
int exit_msg_len;
strcpy(Exit_message, "Error: ");
va_start(arglist, fmt);
exit_msg_len = strlen(Exit_message);
Pvsprintf(Exit_message + exit_msg_len, MAX_MSG_LEN - exit_msg_len, fmt, arglist);
std::vsnprintf(Exit_message + exit_msg_len, MAX_MSG_LEN - exit_msg_len, fmt, arglist);
va_end(arglist);
snprintf(Exit_title_str, sizeof(Exit_title_str), "%s Error", App_title);
@ -242,11 +242,11 @@ void SetMessageBoxTitle(const char *title) { strncpy(Messagebox_title, title, si
// Pops up a dialog box to display a message
void OutrageMessageBox(const char *str, ...) {
char buf[BUF_LEN];
va_list arglist;
std::va_list arglist;
int nchars;
va_start(arglist, str);
nchars = Pvsprintf(buf, BUF_LEN, str, arglist);
nchars = std::vsnprintf(buf, BUF_LEN, str, arglist);
va_end(arglist);
if (nchars >= BUF_LEN)
@ -258,12 +258,12 @@ void OutrageMessageBox(const char *str, ...) {
int OutrageMessageBox(int type, const char *str, ...) {
char buf[BUF_LEN];
va_list arglist;
std::va_list arglist;
int os_flags = 0;
int nchars;
va_start(arglist, str);
nchars = Pvsprintf(buf, BUF_LEN, str, arglist);
nchars = std::vsnprintf(buf, BUF_LEN, str, arglist);
va_end(arglist);
if (type == MBOX_OK)

View File

@ -16,10 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstdarg>
#include <cstdio>
#include "logfile.h"
#include "pstring.h"
#include <stdio.h>
#include <stdarg.h>
#ifdef _DEBUG
static bool log_enable = true;
@ -61,9 +61,9 @@ void logfile::end() {
void logfile::printf(const char *fmt, ...) {
if (fp && fmt) {
char msg[256];
va_list arglist;
std::va_list arglist;
va_start(arglist, fmt);
Pvsprintf(msg, sizeof(msg), fmt, arglist);
std::vsnprintf(msg, sizeof(msg), fmt, arglist);
va_end(arglist);
logfile::puts(msg);

View File

@ -64,18 +64,18 @@
* $NoKeywords: $
*/
#include <cstdarg>
#include <cstdio>
#include "DDAccess.h"
#include "Application.h"
#include "AppConsole.h"
#include "TaskSystem.h"
#define WIN32_LEAN_AND_MEAN
#include "pstring.h"
#include <windows.h>
#include <stdarg.h>
#include <string.h>
#include <process.h>
#include <stdio.h>
#include <algorithm>
@ -102,11 +102,11 @@ int con_Char(HWND hWnd, UINT vkey);
void con_Printf(const char *fmt, ...) {
char buf[CON_MAX_STRINGLEN];
va_list args;
std::va_list args;
// filter out messages
va_start(args, fmt);
Pvsprintf(buf, CON_MAX_STRINGLEN, fmt, args);
std::vsnprintf(buf, CON_MAX_STRINGLEN, fmt, args);
int len = strlen(buf);
if (len >= CON_MAX_STRINGLEN) {

View File

@ -16,19 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RELEASE
#include <cstdarg>
#include <cstdio>
#include "Debug.h"
#include "pstring.h"
#include "networking.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winioctl.h>
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <io.h>
@ -152,7 +151,7 @@ void nw_InitTCPLogging(char *ip, unsigned short port) {
}
void nw_TCPPrintf(int n, char *format, ...) {
va_list args;
std::va_list args;
if (tcp_log_sock == INVALID_SOCKET)
return;
@ -162,7 +161,7 @@ void nw_TCPPrintf(int n, char *format, ...) {
return;
va_start(args, format);
Pvsprintf(tcp_log_buffer, MAX_TCPLOG_LEN, format, args);
std::vsnprintf(tcp_log_buffer, MAX_TCPLOG_LEN, format, args);
fd_set read_fds;
timeval tv = {0, 0};
@ -372,7 +371,7 @@ void Debug_ConsoleClose(int n) {
void Debug_ConsolePrintf(int n, const char *format, ...) {
static bool newline = false;
char *ptr = Mono_buffer;
va_list args;
std::va_list args;
if (n >= MAX_NUM_VWINDOWS)
return;
@ -387,7 +386,7 @@ void Debug_ConsolePrintf(int n, const char *format, ...) {
// if (!OPEN) return;
va_start(args, format);
Pvsprintf(ptr, MAX_MONO_LENGTH, format, args);
std::vsnprintf(ptr, MAX_MONO_LENGTH, format, args);
if (strlen(ptr) >= MAX_MONO_LENGTH) {
return;
@ -414,7 +413,7 @@ void Debug_ConsolePrintf(int n, const char *format, ...) {
void Debug_ConsolePrintf(int n, int row, int col, const char *format, ...) {
char *ptr = Mono_buffer;
int r, c;
va_list args;
std::va_list args;
if (Debug_NT)
return;
@ -429,7 +428,7 @@ void Debug_ConsolePrintf(int n, int row, int col, const char *format, ...) {
return;
va_start(args, format);
Pvsprintf(ptr, MAX_MONO_LENGTH, format, args);
std::vsnprintf(ptr, MAX_MONO_LENGTH, format, args);
// if (n==MAX_NUM_WINDOWS)
// OutputDebugString (Mono_buffer);