Replace the swprintf and snprintf defines by swprintf_irr and snprintf_irr to avoid conflicts with the standard libraries (and other libraries).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5055 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2015-03-01 22:00:17 +00:00
parent db604be111
commit ab330c1204
23 changed files with 87 additions and 86 deletions

View File

@ -1,6 +1,7 @@
--------------------------
Changes in 1.9 (not yet released)
- Replace the swprintf and snprintf defines by swprintf_irr and snprintf_irr to avoid conflicts with the standard libraries (and other libraries).
- XBox support removed as it would need DX8 (this was about the original XBox).
- Support for Direct3D 8 removed after svn revision 5052 due to lack of maintenance.
- _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX removed. This was a bugfix for VS2003 (in combination with .NET) which we haven't supported in a while.

View File

@ -75,7 +75,7 @@ public:
if (image)
{
c8 buf[256];
snprintf(buf, 256, "%s_shot%04d.jpg",
snprintf_irr(buf, 256, "%s_shot%04d.jpg",
FilenameTemplate.c_str(),
++Number);
Device->getVideoDriver()->writeImageToFile(image, buf, 85 );

View File

@ -196,13 +196,13 @@ s32 GameData::save ( const path &filename )
if (!file)
return 0;
snprintf ( buf, 128, "playerposition %.f %.f %.f\nplayerrotation %.f %.f %.f\n",
snprintf_irr ( buf, 128, "playerposition %.f %.f %.f\nplayerrotation %.f %.f %.f\n",
PlayerPosition.X, PlayerPosition.Z, PlayerPosition.Y,
PlayerRotation.X, PlayerRotation.Z, PlayerRotation.Y);
file->write ( buf, (s32) strlen ( buf ) );
for ( i = 0; i != fs->getFileArchiveCount(); ++i )
{
snprintf ( buf, 128, "archive %s\n",stringc ( fs->getFileArchive(i)->getFileList()->getPath() ).c_str () );
snprintf_irr ( buf, 128, "archive %s\n",stringc ( fs->getFileArchive(i)->getFileList()->getPath() ).c_str () );
file->write ( buf, (s32) strlen ( buf ) );
}
@ -327,7 +327,7 @@ void Q3Player::create ( IrrlichtDevice *device, IQ3LevelMesh* mesh, ISceneNode *
s32 count = weaponMesh->getAnimationCount();
for ( s32 i = 0; i != count; ++i )
{
snprintf ( buf, 64, "Animation: %s", weaponMesh->getAnimationName(i) );
snprintf_irr ( buf, 64, "Animation: %s", weaponMesh->getAnimationName(i) );
device->getLogger()->log(buf, ELL_INFORMATION);
}
}
@ -410,7 +410,7 @@ void Q3Player::setAnim ( const c8 *name )
{
if ( name )
{
snprintf ( animation, 64, "%s", name );
snprintf_irr ( animation, 64, "%s", name );
if ( WeaponNode )
{
WeaponNode->setAnimationEndCallback ( this );
@ -605,7 +605,7 @@ void CQuake3EventHandler::createTextures()
data = (u32*) ( (u8*) data + image->getPitch() );
}
image->unlock();
snprintf ( buf, 64, "smoke_%02d", i );
snprintf_irr ( buf, 64, "smoke_%02d", i );
driver->addTexture( buf, image );
image->drop ();
}
@ -624,7 +624,7 @@ void CQuake3EventHandler::createTextures()
data = (u32*) ( (u8*) data + image->getPitch() );
}
image->unlock();
snprintf ( buf, 64, "fog_%02d", i );
snprintf_irr ( buf, 64, "fog_%02d", i );
driver->addTexture( buf, image );
image->drop ();
}
@ -712,7 +712,7 @@ void CQuake3EventHandler::CreateGUI()
else if ( core::equals ( aspect, 1.6f ) ) a = "16:10 widescreen";
else if ( core::equals ( aspect, 2.133333f ) ) a = "20:9 widescreen";
snprintf ( buf, sizeof ( buf ), "%d x %d, %s",w, h, a );
snprintf_irr ( buf, sizeof ( buf ), "%d x %d, %s",w, h, a );
gui.VideoMode->addItem ( stringw ( buf ).c_str(), val );
}
}
@ -1149,14 +1149,14 @@ void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNod
if ( imageIndex < 0 )
{
swprintf ( msg, 128, L"%hs,%hs",
swprintf_irr ( msg, 128, L"%hs,%hs",
Game->Device->getSceneManager ()->getSceneNodeTypeName ( (*it)->getType () ),
(*it)->getName()
);
}
else
{
swprintf ( msg, 128, L"%hs",(*it)->getName() );
swprintf_irr ( msg, 128, L"%hs",(*it)->getName() );
}
node = nodeParent->addChildBack( msg, 0, imageIndex );
@ -1166,7 +1166,7 @@ void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNod
for (; ait != (*it)->getAnimators().end(); ++ait)
{
imageIndex = -1;
swprintf ( msg, 128, L"%hs",
swprintf_irr ( msg, 128, L"%hs",
Game->Device->getSceneManager ()->getAnimatorTypeName ( (*ait)->getType () )
);
@ -1216,14 +1216,14 @@ void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
static const c8*p[] = { "ft", "rt", "bk", "lf", "up", "dn" };
u32 i = 0;
snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] );
snprintf_irr ( buf, 64, "%s_%s.jpg", texture, p[i] );
SkyNode = smgr->addSkyBoxSceneNode( driver->getTexture ( buf ), 0, 0, 0, 0, 0 );
if (SkyNode)
{
for ( i = 0; i < 6; ++i )
{
snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] );
snprintf_irr ( buf, 64, "%s_%s.jpg", texture, p[i] );
SkyNode->getMaterial(i).setTexture ( 0, driver->getTexture ( buf ) );
}
}
@ -1231,7 +1231,7 @@ void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
else
if ( 1 == dome )
{
snprintf ( buf, 64, "%s.jpg", texture );
snprintf_irr ( buf, 64, "%s.jpg", texture );
SkyNode = smgr->addSkyDomeSceneNode(
driver->getTexture( buf ), 32,32,
1.f, 1.f, 1000.f, 0, 11);
@ -1239,7 +1239,7 @@ void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
else
if ( 2 == dome )
{
snprintf ( buf, 64, "%s.jpg", texture );
snprintf_irr ( buf, 64, "%s.jpg", texture );
SkyNode = smgr->addSkyDomeSceneNode(
driver->getTexture( buf ), 16,8,
0.95f, 2.f, 1000.f, 0, 11);
@ -1517,7 +1517,7 @@ bool CQuake3EventHandler::OnEvent(const SEvent& eve)
rot = cam->getRotation ();
}
snprintf(buf, 256, "%s_%ls_%.0f_%.0f_%.0f_%.0f_%.0f_%.0f.jpg",
snprintf_irr(buf, 256, "%s_%ls_%.0f_%.0f_%.0f_%.0f_%.0f_%.0f.jpg",
DRIVER_TYPE_NAMES_SHORT[Game->Device->getVideoDriver()->getDriverType()],
Game->CurrentMapName.c_str(),
pos.X, pos.Y, pos.Z,
@ -1781,7 +1781,7 @@ void CQuake3EventHandler::useItem( Q3Player * player)
node->addAnimator(anim);
anim->drop();
snprintf ( buf, 64, "bullet: %s on %.1f,%1.f,%1.f",
snprintf_irr ( buf, 64, "bullet: %s on %.1f,%1.f,%1.f",
imp.when ? "hit" : "nohit", end.X, end.Y, end.Z );
node->setName ( buf );
@ -1849,7 +1849,7 @@ void CQuake3EventHandler::createParticleImpacts( u32 now )
{
pas = sm->addParticleSystemSceneNode(false, BulletParent, -1, Impacts[i].pos);
snprintf ( buf, 64, "bullet impact smoke at %.1f,%.1f,%1.f",
snprintf_irr ( buf, 64, "bullet impact smoke at %.1f,%.1f,%1.f",
Impacts[i].pos.X,Impacts[i].pos.Y,Impacts[i].pos.Z);
pas->setName ( buf );
@ -2022,7 +2022,7 @@ void CQuake3EventHandler::Animate()
#ifdef _IRR_SCENEMANAGER_DEBUG
IAttributes * attr = Game->Device->getSceneManager()->getParameters();
swprintf ( msg, 128,
swprintf_irr ( msg, 128,
L"Q3 %s [%ls], FPS:%03d Tri:%.03fm Cull %d/%d nodes (%d,%d,%d)",
Game->CurrentMapName.c_str(),
driver->getName(),
@ -2035,7 +2035,7 @@ void CQuake3EventHandler::Animate()
attr->getAttributeAsInt ( "drawn_transparent_effect" )
);
#else
swprintf ( msg, 128,
swprintf_irr ( msg, 128,
L"Q3 %s [%ls], FPS:%03d Tri:%.03fm",
Game->CurrentMapName.c_str(),
driver->getName(),
@ -2045,7 +2045,7 @@ swprintf ( msg, 128,
#endif
Game->Device->setWindowCaption( msg );
swprintf ( msg, 128,
swprintf_irr ( msg, 128,
L"%03d fps, F1 GUI on/off, F2 respawn, F3-F6 toggle Nodes, F7 Collision on/off"
L", F8 Gravity on/off, Right Mouse Toggle GUI",
Game->Device->getVideoDriver()->getFPS ()

View File

@ -331,7 +331,7 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
loadParam.startTime = device->getTimer()->getRealTime();
if ( loadParam.verbose > 1 )
{
snprintf(buf, 128, "q3shaderfactory start" );
snprintf_irr(buf, 128, "q3shaderfactory start" );
device->getLogger()->log( buf, ELL_INFORMATION);
}
}
@ -485,7 +485,7 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
if ( loadParam.verbose > 0 )
{
loadParam.endTime = device->getTimer()->getRealTime ();
snprintf(buf, 128, "q3shaderfactory needed %04d ms to create %d shader nodes",
snprintf_irr(buf, 128, "q3shaderfactory needed %04d ms to create %d shader nodes",
loadParam.endTime - loadParam.startTime,
sceneNodeID
);
@ -594,7 +594,7 @@ void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
if ( 0 == node )
{
snprintf ( buf, 128, "q3ModelFactory shader %s failed", meshBuffer->Shader.c_str() );
snprintf_irr ( buf, 128, "q3ModelFactory shader %s failed", meshBuffer->Shader.c_str() );
device->getLogger()->log ( buf );
continue;
}

View File

@ -111,7 +111,7 @@ void CDemo::run()
// write statistics
const s32 nowfps = driver->getFPS();
swprintf(tmp, 255, L"%ls fps:%3d triangles:%0.3f mio/s",
swprintf_irr(tmp, 255, L"%ls fps:%3d triangles:%0.3f mio/s",
driver->getName(), driver->getFPS(),
driver->getPrimitiveCountDrawn(1) * (1.f / 1000000.f));

View File

@ -121,7 +121,7 @@ public:
: array(0), allocated(0), used(0)
{
c8 tmpbuf[255];
snprintf(tmpbuf, 255, "%0.6f", number);
snprintf_irr(tmpbuf, 255, "%0.6f", number);
*this = tmpbuf;
}

View File

@ -113,16 +113,16 @@ typedef double f64;
#include <wchar.h>
#ifdef _IRR_WINDOWS_API_
//! Defines for s{w,n}printf because these methods do not match the ISO C
//! standard on Windows platforms, but it does on all others.
//! These should be int snprintf(char *str, size_t size, const char *format, ...);
//! and int swprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, ...);
//! Defines for s{w,n}printf_irr because s{w,n}printf methods do not match the ISO C
//! standard on Windows platforms.
//! We want int snprintf_irr(char *str, size_t size, const char *format, ...);
//! and int swprintf_irr(wchar_t *wcs, size_t maxlen, const wchar_t *format, ...);
#if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE)
#define swprintf swprintf_s
#define snprintf sprintf_s
#define swprintf_irr swprintf_s
#define snprintf_irr sprintf_s
#elif !defined(__CYGWIN__)
#define swprintf _snwprintf
#define snprintf _snprintf
#define swprintf_irr _snwprintf
#define snprintf_irr _snprintf
#endif
// define the wchar_t type if not already built in.

View File

@ -1166,7 +1166,7 @@ bool CAnimatedMeshHalfLife::postLoadModel( const io::path &filename )
c8 seq[8];
for (u32 i = 1; i < Header->numseqgroups; i++)
{
snprintf( seq, 8, "%02d.mdl", i );
snprintf_irr( seq, 8, "%02d.mdl", i );
submodel = path + texname + seq;
AnimationHeader[i] = loadModel(0, submodel);

View File

@ -2041,7 +2041,7 @@ public:
virtual core::stringw getStringW() _IRR_OVERRIDE_
{
wchar_t buf[32];
swprintf(buf, 32, L"%p", Value);
swprintf_irr(buf, 32, L"%p", Value);
return core::stringw(buf);
}

View File

@ -211,7 +211,7 @@ irr::core::stringw CColladaMeshWriterNames::nameForMaterial(const video::SMateri
irr::core::stringw CColladaMeshWriterNames::nameForPtr(const void* ptr) const
{
wchar_t buf[32];
swprintf(buf, 32, L"%p", ptr);
swprintf_irr(buf, 32, L"%p", ptr);
return irr::core::stringw(buf);
}
@ -980,7 +980,7 @@ bool CColladaMeshWriter::hasSecondTextureCoordinates(video::E_VERTEX_TYPE type)
void CColladaMeshWriter::writeVector(const irr::core::vector3df& vec)
{
wchar_t tmpbuf[255];
swprintf(tmpbuf, 255, L"%f %f %f", vec.X, vec.Y, vec.Z);
swprintf_irr(tmpbuf, 255, L"%f %f %f", vec.X, vec.Y, vec.Z);
Writer->writeText(tmpbuf);
}
@ -989,7 +989,7 @@ void CColladaMeshWriter::writeUv(const irr::core::vector2df& vec)
{
// change handedness
wchar_t tmpbuf[255];
swprintf(tmpbuf, 255, L"%f %f", vec.X, 1.f-vec.Y);
swprintf_irr(tmpbuf, 255, L"%f %f", vec.X, 1.f-vec.Y);
Writer->writeText(tmpbuf);
}
@ -997,7 +997,7 @@ void CColladaMeshWriter::writeUv(const irr::core::vector2df& vec)
void CColladaMeshWriter::writeVector(const irr::core::vector2df& vec)
{
wchar_t tmpbuf[255];
swprintf(tmpbuf, 255, L"%f %f", vec.X, vec.Y);
swprintf_irr(tmpbuf, 255, L"%f %f", vec.X, vec.Y);
Writer->writeText(tmpbuf);
}
@ -1006,9 +1006,9 @@ void CColladaMeshWriter::writeColor(const irr::video::SColorf& colorf, bool writ
{
wchar_t tmpbuf[255];
if ( writeAlpha )
swprintf(tmpbuf, 255, L"%f %f %f %f", colorf.getRed(), colorf.getGreen(), colorf.getBlue(), colorf.getAlpha());
swprintf_irr(tmpbuf, 255, L"%f %f %f %f", colorf.getRed(), colorf.getGreen(), colorf.getBlue(), colorf.getAlpha());
else
swprintf(tmpbuf, 255, L"%f %f %f", colorf.getRed(), colorf.getGreen(), colorf.getBlue());
swprintf_irr(tmpbuf, 255, L"%f %f %f", colorf.getRed(), colorf.getGreen(), colorf.getBlue());
Writer->writeText(tmpbuf);
}
@ -1117,7 +1117,7 @@ irr::core::stringw CColladaMeshWriter::nameForMaterial(const video::SMaterial &
irr::core::stringw CColladaMeshWriter::nameForMaterialSymbol(const scene::IMesh* mesh, int materialId) const
{
wchar_t buf[100];
swprintf(buf, 100, L"mat_symb_%p_%d", mesh, materialId);
swprintf_irr(buf, 100, L"mat_symb_%p_%d", mesh, materialId);
return irr::core::stringw(buf);
}
@ -2248,7 +2248,7 @@ void CColladaMeshWriter::writeLookAtElement(const irr::core::vector3df& eyePos,
Writer->writeElement(L"lookat", false);
wchar_t tmpbuf[255];
swprintf(tmpbuf, 255, L"%f %f %f %f %f %f %f %f %f", eyePos.X, eyePos.Y, eyePos.Z, targetPos.X, targetPos.Y, targetPos.Z, upVector.X, upVector.Y, upVector.Z);
swprintf_irr(tmpbuf, 255, L"%f %f %f %f %f %f %f %f %f", eyePos.X, eyePos.Y, eyePos.Z, targetPos.X, targetPos.Y, targetPos.Z, upVector.X, upVector.Y, upVector.Z);
Writer->writeText(tmpbuf);
Writer->writeClosingTag(L"lookat");

View File

@ -105,7 +105,7 @@ void CGUISpinBox::setValue(f32 val)
{
wchar_t str[100];
swprintf(str, 99, FormatString.c_str(), val);
swprintf_irr(str, 99, FormatString.c_str(), val);
EditBox->setText(str);
verifyValueRange();
}
@ -130,9 +130,9 @@ void CGUISpinBox::setRange(f32 min, f32 max)
// we have to round the range - otherwise we can get into an infinte setValue/verifyValueRange cycle.
wchar_t str[100];
swprintf(str, 99, FormatString.c_str(), RangeMin);
swprintf_irr(str, 99, FormatString.c_str(), RangeMin);
RangeMin = core::fast_atof(core::stringc(str).c_str());
swprintf(str, 99, FormatString.c_str(), RangeMax);
swprintf_irr(str, 99, FormatString.c_str(), RangeMax);
RangeMax = core::fast_atof(core::stringc(str).c_str());
verifyValueRange();

View File

@ -47,18 +47,18 @@ bool CImageWriterPPM::writeImage(io::IWriteFile *file, IImage *image, u32 param)
const bool binary = false;
if (binary)
size = snprintf(cache, 70, "P6\n");
size = snprintf_irr(cache, 70, "P6\n");
else
size = snprintf(cache, 70, "P3\n");
size = snprintf_irr(cache, 70, "P3\n");
if (file->write(cache, size) != size)
return false;
size = snprintf(cache, 70, "%d %d\n", imageSize.Width, imageSize.Height);
size = snprintf_irr(cache, 70, "%d %d\n", imageSize.Width, imageSize.Height);
if (file->write(cache, size) != size)
return false;
size = snprintf(cache, 70, "255\n");
size = snprintf_irr(cache, 70, "255\n");
if (file->write(cache, size) != size)
return false;
@ -87,7 +87,7 @@ bool CImageWriterPPM::writeImage(io::IWriteFile *file, IImage *image, u32 param)
for (u32 c = 0; c < imageSize.Width; ++c, ++n)
{
const video::SColor& pixel = image->getPixel(c, h);
size = snprintf(cache, 70, "%.3u %.3u %.3u%s", pixel.getRed(), pixel.getGreen(), pixel.getBlue(), n % 5 == 4 ? "\n" : " ");
size = snprintf_irr(cache, 70, "%.3u %.3u %.3u%s", pixel.getRed(), pixel.getGreen(), pixel.getBlue(), n % 5 == 4 ? "\n" : " ");
if (file->write(cache, size) != size)
return false;
}

View File

@ -133,7 +133,7 @@ bool CIrrDeviceFB::createWindow(const core::dimension2d<u32>& windowSize, u32 bi
// make format settings
ioctl(Framebuffer, FBIOGET_FSCREENINFO, &fbfixscreeninfo);
ioctl(Framebuffer, FBIOGET_VSCREENINFO, &oldscreeninfo);
snprintf(buf, 256, "Original resolution: %d x %d\nARGB%d%d%d%d\n",oldscreeninfo.xres,oldscreeninfo.yres,
snprintf_irr(buf, 256, "Original resolution: %d x %d\nARGB%d%d%d%d\n",oldscreeninfo.xres,oldscreeninfo.yres,
oldscreeninfo.transp.length,oldscreeninfo.red.length,oldscreeninfo.green.length,oldscreeninfo.blue.length);
os::Printer::log(buf);
memcpy(&fbscreeninfo, &oldscreeninfo, sizeof(struct fb_var_screeninfo));
@ -153,7 +153,7 @@ snprintf(buf, 256, "Original resolution: %d x %d\nARGB%d%d%d%d\n",oldscreeninfo.
ioctl(Framebuffer, FBIOPUT_VSCREENINFO, &fbscreeninfo);
ioctl(Framebuffer, FBIOGET_VSCREENINFO, &fbscreeninfo);
snprintf(buf, 256, "New resolution: %d x %d (%d x %d)\nARGB%d%d%d%d\n",fbscreeninfo.xres,fbscreeninfo.yres,fbscreeninfo.xres_virtual,fbscreeninfo.yres_virtual,
snprintf_irr(buf, 256, "New resolution: %d x %d (%d x %d)\nARGB%d%d%d%d\n",fbscreeninfo.xres,fbscreeninfo.yres,fbscreeninfo.xres_virtual,fbscreeninfo.yres_virtual,
fbscreeninfo.transp.length,fbscreeninfo.red.length,fbscreeninfo.green.length,fbscreeninfo.blue.length);
os::Printer::log(buf);

View File

@ -228,7 +228,7 @@ int IrrPrintXError(Display *display, XErrorEvent *event)
char msg[256];
char msg2[256];
snprintf(msg, 256, "%d", event->request_code);
snprintf_irr(msg, 256, "%d", event->request_code);
XGetErrorDatabaseText(display, "XRequest", msg, "unknown", msg2, 256);
XGetErrorText(display, event->error_code, msg, 256);
os::Printer::log("X Error", msg, ELL_WARNING);

View File

@ -682,7 +682,7 @@ bool COpenGLDriver::genericDriverInit()
{
char buf[32];
const u32 maj = ShaderLanguageVersion/100;
snprintf(buf, 32, "%u.%u", maj, ShaderLanguageVersion-maj*100);
snprintf_irr(buf, 32, "%u.%u", maj, ShaderLanguageVersion-maj*100);
os::Printer::log("GLSL version", buf, ELL_INFORMATION);
}
else

View File

@ -120,7 +120,7 @@ bool CPLYMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 fla
// video::SColor &col = ( (video::S3DVertex*)buf )->Color;
// x y z nx ny nz red green blue alpha u v [u1 v1 | tx ty tz]\n
snprintf(outLine, 1024,
snprintf_irr(outLine, 1024,
"%f %f %f %f %f %f\n",// %u %u %u %u %f %f\n",
pos.X, pos.Z, pos.Y, // Y and Z are flipped
n.X, n.Z, n.Y);
@ -161,7 +161,7 @@ bool CPLYMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 fla
}
// count a b c\n
snprintf(outLine, 1024, "3 %u %u %u\n", a, b, c);
snprintf_irr(outLine, 1024, "3 %u %u %u\n", a, b, c);
// write the line
file->write(outLine, strlen(outLine));
}

View File

@ -1041,7 +1041,7 @@ void CQ3LevelMesh::constructMesh()
if ( LoadParam.verbose > 1 )
{
snprintf( buf, sizeof ( buf ),
snprintf_irr( buf, sizeof ( buf ),
"quake3::constructMesh start to create %d faces, %d vertices,%d mesh vertices",
NumFaces,
NumVertices,
@ -1082,7 +1082,7 @@ void CQ3LevelMesh::constructMesh()
{
LoadParam.endTime = os::Timer::getRealTime();
snprintf( buf, sizeof ( buf ),
snprintf_irr( buf, sizeof ( buf ),
"quake3::constructMesh needed %04d ms to create %d faces, %d vertices,%d mesh vertices",
LoadParam.endTime - LoadParam.startTime,
NumFaces,
@ -1418,7 +1418,7 @@ void CQ3LevelMesh::createCurvedSurface_bezier(SMeshBufferLightMap* meshBuffer,
{
LoadParam.endTime = os::Timer::getRealTime();
snprintf( buf, sizeof ( buf ),
snprintf_irr( buf, sizeof ( buf ),
"quake3::createCurvedSurface_bezier needed %04d ms to create bezier patch.(%dx%d)",
LoadParam.endTime - LoadParam.startTime,
biquadWidth,
@ -1803,7 +1803,7 @@ void CQ3LevelMesh::cleanMesh(SMesh *m, const bool texture0important)
LoadParam.startTime = os::Timer::getRealTime();
if ( LoadParam.verbose > 1 )
{
snprintf( buf, sizeof ( buf ),
snprintf_irr( buf, sizeof ( buf ),
"quake3::cleanMeshes start for %d meshes",
m->MeshBuffers.size()
);
@ -1846,7 +1846,7 @@ void CQ3LevelMesh::cleanMesh(SMesh *m, const bool texture0important)
{
if ( LoadParam.verbose > 1 )
{
snprintf( buf, sizeof ( buf ),
snprintf_irr( buf, sizeof ( buf ),
"quake3::cleanMeshes cleaning mesh %d %d size",
blockstart,
blockcount
@ -1862,7 +1862,7 @@ void CQ3LevelMesh::cleanMesh(SMesh *m, const bool texture0important)
if ( LoadParam.verbose > 0 )
{
LoadParam.endTime = os::Timer::getRealTime();
snprintf( buf, sizeof ( buf ),
snprintf_irr( buf, sizeof ( buf ),
"quake3::cleanMeshes needed %04d ms to clean %d of %d meshes",
LoadParam.endTime - LoadParam.startTime,
remove,
@ -1882,7 +1882,7 @@ void CQ3LevelMesh::calcBoundingBoxes()
if ( LoadParam.verbose > 1 )
{
snprintf( buf, sizeof ( buf ),
snprintf_irr( buf, sizeof ( buf ),
"quake3::calcBoundingBoxes start create %d textures and %d lightmaps",
NumTextures,
NumLightMaps
@ -1922,7 +1922,7 @@ void CQ3LevelMesh::calcBoundingBoxes()
{
LoadParam.endTime = os::Timer::getRealTime();
snprintf( buf, sizeof ( buf ),
snprintf_irr( buf, sizeof ( buf ),
"quake3::calcBoundingBoxes needed %04d ms to create %d textures and %d lightmaps",
LoadParam.endTime - LoadParam.startTime,
NumTextures,
@ -1945,7 +1945,7 @@ void CQ3LevelMesh::loadTextures()
if ( LoadParam.verbose > 1 )
{
snprintf( buf, sizeof ( buf ),
snprintf_irr( buf, sizeof ( buf ),
"quake3::loadTextures start create %d textures and %d lightmaps",
NumTextures,
NumLightMaps
@ -2046,7 +2046,7 @@ void CQ3LevelMesh::loadTextures()
{
LoadParam.endTime = os::Timer::getRealTime();
snprintf( buf, sizeof ( buf ),
snprintf_irr( buf, sizeof ( buf ),
"quake3::loadTextures needed %04d ms to create %d textures and %d lightmaps",
LoadParam.endTime - LoadParam.startTime,
NumTextures,

View File

@ -69,7 +69,7 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const io::path& name,
{
char buf[256];
core::stringw showName ( name );
snprintf ( buf, 256, "Burningvideo: Warning Texture %ls reformat %dx%d -> %dx%d,%d",
snprintf_irr ( buf, 256, "Burningvideo: Warning Texture %ls reformat %dx%d -> %dx%d,%d",
showName.c_str(),
OriginalSize.Width, OriginalSize.Height, optSize.Width, optSize.Height,
BURNINGSHADER_COLOR_FORMAT

View File

@ -212,7 +212,7 @@ void CTRTextureBlend::setParam ( u32 index, f32 value)
if ( showname && ( lsrcFact != srcFact || ldstFact != dstFact ) )
{
char buf[128];
snprintf ( buf, 128, "missing shader: %s %s",n[srcFact], n[dstFact] );
snprintf_irr ( buf, 128, "missing shader: %s %s",n[srcFact], n[dstFact] );
os::Printer::log( buf, ELL_INFORMATION );
lsrcFact = srcFact;

View File

@ -227,7 +227,7 @@ namespace scene
const u32 endTime = os::Timer::getRealTime();
c8 tmp[255];
snprintf(tmp, 255, "Generated terrain data (%dx%d) in %.4f seconds",
snprintf_irr(tmp, 255, "Generated terrain data (%dx%d) in %.4f seconds",
TerrainData.Size, TerrainData.Size, (endTime - startTime) / 1000.0f );
os::Printer::log(tmp);
@ -463,7 +463,7 @@ namespace scene
const u32 endTime = os::Timer::getTime();
c8 tmp[255];
snprintf(tmp, 255, "Generated terrain data (%dx%d) in %.4f seconds",
snprintf_irr(tmp, 255, "Generated terrain data (%dx%d) in %.4f seconds",
TerrainData.Size, TerrainData.Size, (endTime - startTime) / 1000.0f);
os::Printer::log(tmp);
@ -776,7 +776,7 @@ namespace scene
if (now - lastTime > 1000)
{
char buf[64];
snprintf(buf, 64, "Count: %d, Visible: %d", count, visible);
snprintf_irr(buf, 64, "Count: %d, Visible: %d", count, visible);
os::Printer::log(buf);
lastTime = now;

View File

@ -115,7 +115,7 @@ CWADReader::CWADReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
{
SWADFileEntry &e = FileList[i];
char buf[128];
snprintf ( buf, 128, "c:\\h2\\%s", e.wadFileName.c_str() );
snprintf_irr ( buf, 128, "c:\\h2\\%s", e.wadFileName.c_str() );
createDir ( buf );
FILE * f = fopen ( buf, "wb" );
@ -200,7 +200,7 @@ bool CWADReader::scanLocalHeader()
save.wadFileName += ".wal2";
break;
default:
snprintf ( buf, 16, ".%02d", entry.type );
snprintf_irr ( buf, 16, ".%02d", entry.type );
save.wadFileName += buf;
break;
}
@ -217,7 +217,7 @@ bool CWADReader::scanLocalHeader()
case WAD_TYP_QPIC: save.wadFileName += ".qpic"; break;
case WAD_TYP_FONT: save.wadFileName += ".font"; break;
default:
snprintf ( buf, 16, ".%02d", entry.type );
snprintf_irr ( buf, 16, ".%02d", entry.type );
save.wadFileName += buf;
break;
}

View File

@ -620,7 +620,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
c8* pBuf = new c8[ uncompressedSize ];
if (!pBuf)
{
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
swprintf_irr ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
os::Printer::log( buf, ELL_ERROR);
if (decrypted)
decrypted->drop();
@ -633,7 +633,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
pcData = new u8[decryptedSize];
if (!pcData)
{
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
swprintf_irr ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf;
return 0;
@ -674,7 +674,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
if (err != Z_OK)
{
swprintf ( buf, 64, L"Error decompressing %s", Files[index].FullName.c_str() );
swprintf_irr ( buf, 64, L"Error decompressing %s", Files[index].FullName.c_str() );
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf;
return 0;
@ -694,7 +694,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
c8* pBuf = new c8[ uncompressedSize ];
if (!pBuf)
{
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
swprintf_irr ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
os::Printer::log( buf, ELL_ERROR);
if (decrypted)
decrypted->drop();
@ -707,7 +707,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
pcData = new u8[decryptedSize];
if (!pcData)
{
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
swprintf_irr ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf;
return 0;
@ -745,7 +745,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
if (err != BZ_OK)
{
swprintf ( buf, 64, L"Error decompressing %s", Files[index].FullName.c_str() );
swprintf_irr ( buf, 64, L"Error decompressing %s", Files[index].FullName.c_str() );
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf;
return 0;
@ -766,7 +766,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
c8* pBuf = new c8[ uncompressedSize ];
if (!pBuf)
{
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
swprintf_irr ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
os::Printer::log( buf, ELL_ERROR);
if (decrypted)
decrypted->drop();
@ -779,7 +779,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
pcData = new u8[decryptedSize];
if (!pcData)
{
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
swprintf_irr ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() );
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf;
return 0;
@ -826,7 +826,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
os::Printer::log("Decryption support not enabled. File cannot be read.", ELL_ERROR);
return 0;
default:
swprintf ( buf, 64, L"file has unsupported compression method. %s", Files[index].FullName.c_str() );
swprintf_irr ( buf, 64, L"file has unsupported compression method. %s", Files[index].FullName.c_str() );
os::Printer::log( buf, ELL_ERROR);
return 0;
};

View File

@ -63,7 +63,7 @@ int main()
{
const core::dimension2d<u32>& screenSize = driver->getScreenSize();
wchar_t caption[512];
swprintf(caption, 512, L"screen (%4u/%4u)", screenSize.Width, screenSize.Height);
swprintf_irr(caption, 512, L"screen (%4u/%4u)", screenSize.Width, screenSize.Height);
device->setWindowCaption(caption);
driver->beginScene(true, true, video::SColor(0,200,200,200));
smgr->drawAll();