More cleanup of sprintf usage in favor of snprintf. This is to resolve deprecation warnings on Mac OSX

This commit is contained in:
harry 2024-02-23 22:38:40 -05:00
parent 7b79d9db4c
commit 37574f9bef
35 changed files with 468 additions and 513 deletions

View File

@ -795,7 +795,7 @@ struct OutputStream
if ( writeError )
{
char msg[512];
sprintf( msg, "%s Stream Write Errors Detected.\nOutput may be incomplete or corrupt.\nSee log file '%s' for details\n",
snprintf( msg, sizeof(msg), "%s Stream Write Errors Detected.\nOutput may be incomplete or corrupt.\nSee log file '%s' for details\n",
isAudio ? "Audio" : "Video", AV_LOG_FILE_NAME);
FCEUD_PrintError(msg);
}
@ -2123,7 +2123,7 @@ int aviRecordLogOpen(void)
if ( avLogFp == NULL )
{
char msg[512];
sprintf( msg, "Error: Failed to open AV Recording log file for writing: %s\n", AV_LOG_FILE_NAME);
snprintf( msg, sizeof(msg), "Error: Failed to open AV Recording log file for writing: %s\n", AV_LOG_FILE_NAME);
FCEUD_PrintError(msg);
avLogFp = stdout;
}
@ -2224,7 +2224,7 @@ int aviRecordOpenFile( const char *filepath )
avi_info.add_pair( "IMED", QSysInfo::prettyProductName().toLocal8Bit().constData() );
sprintf( txt, "FCEUX %s", FCEU_VERSION_STRING );
snprintf( txt, sizeof(txt), "FCEUX %s", FCEU_VERSION_STRING );
avi_info.add_pair( "ITCH", txt );
romFile = getRomFile();
@ -2305,7 +2305,7 @@ int aviRecordOpenFile( const char *filepath )
char msg[512];
fprintf( avLogFp, "Error: Failed to open AVI file.\n");
recordEnable = false;
sprintf( msg, "Error: AV Recording Initialization Failed.\nSee %s for details...\n", AV_LOG_FILE_NAME);
snprintf( msg, sizeof(msg), "Error: AV Recording Initialization Failed.\nSee %s for details...\n", AV_LOG_FILE_NAME);
FCEUD_PrintError(msg);
return -1;
}
@ -2320,7 +2320,7 @@ int aviRecordOpenFile( const char *filepath )
char msg[512];
fprintf( avLogFp, "Error: Failed to open AVI file.\n");
recordEnable = false;
sprintf( msg, "Error: AV Recording Initialization Failed.\nSee %s for details...\n", AV_LOG_FILE_NAME);
snprintf( msg, sizeof(msg), "Error: AV Recording Initialization Failed.\nSee %s for details...\n", AV_LOG_FILE_NAME);
FCEUD_PrintError(msg);
return -1;
}
@ -3136,7 +3136,7 @@ void LibavOptionsPage::initSampleRateSelect( const char *codec_name )
while ( c->supported_samplerates[i] != 0 )
{
sprintf( rateName, "%i", c->supported_samplerates[i] );
snprintf( rateName, sizeof(rateName), "%i", c->supported_samplerates[i] );
audioSampleRate->addItem( tr(rateName), c->supported_samplerates[i] );
@ -3410,7 +3410,7 @@ void LibavEncOptItem::setValueText(void)
if ( units[x]->default_val.i64 & i )
{
char stmp2[128];
sprintf( stmp2, "%s", units[x]->name );
snprintf( stmp2, sizeof(stmp2), "%s", units[x]->name );
if (j>0)
{
strcat( stmp, ",");
@ -3445,7 +3445,7 @@ void LibavEncOptItem::setValueText(void)
if ( units[x]->default_val.i64 == i )
{
char stmp2[128];
sprintf( stmp2, " (%s)", units[x]->name );
snprintf( stmp2, sizeof(stmp2), " (%s)", units[x]->name );
strcat( stmp, stmp2 );
break;
}
@ -3481,12 +3481,12 @@ LibavEncOptWin::LibavEncOptWin(int type, QWidget *parent)
if ( type )
{
codec_name = LIBAV::audio_st.selEnc.c_str();
sprintf( title, "%s Audio Encoder Configuration", codec_name );
snprintf( title, sizeof(title), "%s Audio Encoder Configuration", codec_name );
}
else
{
codec_name = LIBAV::video_st.selEnc.c_str();
sprintf( title, "%s Video Encoder Configuration", codec_name );
snprintf( title, sizeof(title), "%s Video Encoder Configuration", codec_name );
}
setWindowTitle( title );
resize(512, 512);
@ -3816,13 +3816,13 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
grid->addWidget( new QLabel( tr("Range:") ), 2, 0 );
sprintf( stmp, "[ %.0f, %.0f ]", opt->min, opt->max );
snprintf( stmp, sizeof(stmp), "[ %.0f, %.0f ]", opt->min, opt->max );
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
grid->addWidget( new QLabel( tr("Default:") ), 3, 0 );
sprintf( stmp, "%lli", (long long)opt->default_val.i64 );
snprintf( stmp, sizeof(stmp), "%lli", (long long)opt->default_val.i64 );
grid->addWidget( new QLabel( tr(stmp) ), 3, 1 );
@ -3838,12 +3838,12 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
{
if ( item->units[i]->help )
{
sprintf( stmp, "%3lli: %s - %s", (long long)item->units[i]->default_val.i64,
snprintf( stmp, sizeof(stmp), "%3lli: %s - %s", (long long)item->units[i]->default_val.i64,
item->units[i]->name, item->units[i]->help );
}
else
{
sprintf( stmp, "%3lli: %s", (long long)item->units[i]->default_val.i64,
snprintf( stmp, sizeof(stmp), "%3lli: %s", (long long)item->units[i]->default_val.i64,
item->units[i]->name );
}
@ -3874,13 +3874,13 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
grid->addWidget( new QLabel( tr("Range:") ), 2, 0 );
sprintf( stmp, "[ %e, %e ]", opt->min, opt->max );
snprintf( stmp, sizeof(stmp), "[ %e, %e ]", opt->min, opt->max );
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
grid->addWidget( new QLabel( tr("Default:") ), 3, 0 );
sprintf( stmp, "%f", opt->default_val.dbl );
snprintf( stmp, sizeof(stmp), "%f", opt->default_val.dbl );
grid->addWidget( new QLabel( tr(stmp) ), 3, 1 );
@ -3905,7 +3905,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
if ( opt->default_val.str )
{
sprintf( stmp, "%s", opt->default_val.str );
snprintf( stmp, sizeof(stmp), "%s", opt->default_val.str );
}
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
@ -3929,7 +3929,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
grid->addWidget( new QLabel( tr("Default:") ), 2, 0 );
sprintf( stmp, "%i/%i", opt->default_val.q.num, opt->default_val.q.den );
snprintf( stmp, sizeof(stmp), "%i/%i", opt->default_val.q.num, opt->default_val.q.den );
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
@ -3959,7 +3959,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
grid->addWidget( new QLabel( tr("Default:") ), 2, 0 );
sprintf( stmp, "%s", opt->default_val.i64 ? "true" : "false" );
snprintf( stmp, sizeof(stmp), "%s", opt->default_val.i64 ? "true" : "false" );
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
@ -3983,7 +3983,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
grid->addWidget( new QLabel( tr("Default:") ), 2, 0 );
sprintf( stmp, "0x%08llX", (unsigned long long)opt->default_val.i64 );
snprintf( stmp, sizeof(stmp), "0x%08llX", (unsigned long long)opt->default_val.i64 );
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
@ -3993,7 +3993,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
for (size_t i=0; i<item->units.size(); i++)
{
sprintf( stmp, "%s", item->units[i]->name );
snprintf( stmp, sizeof(stmp), "%s", item->units[i]->name );
c = new QCheckBox( tr(stmp) );

View File

@ -475,112 +475,112 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
avi->getChunkData( item->filePos(), data.buf, item->getSize()+8 );
sprintf( stmp, "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("fcc") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(4) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(4) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("cb") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(8) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(8) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwMicroSecPerFrame") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(12) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(12) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwMaxBytesPerSec") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(16) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(16) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwPaddingGranularity") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "0x%X", data.readU32(20) );
snprintf( stmp, sizeof(stmp), "0x%X", data.readU32(20) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwFlags") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(24) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(24) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwTotalFrames") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(28) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(28) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwInitialFrames") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(32) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(32) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwStreams") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(36) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(36) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwSuggestedBufferSize") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(40) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(40) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwWidth") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(44) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(44) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwHeight") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(48) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(48) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwScale") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(52) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(52) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwRate") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(56) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(56) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwStart") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(60) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(60) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwLength") );
@ -593,21 +593,21 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
avi->getChunkData( item->filePos(), data.buf, item->getSize()+8 );
sprintf( stmp, "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("fcc") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(4) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(4) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("cb") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%c%c%c%c", data.buf[8], data.buf[9], data.buf[10], data.buf[11] );
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[8], data.buf[9], data.buf[10], data.buf[11] );
strcpy( strhType, stmp );
twi = new QTreeWidgetItem();
@ -617,11 +617,11 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
if ( isalnum(data.buf[12]) )
{
sprintf( stmp, "%c%c%c%c", data.buf[12], data.buf[13], data.buf[14], data.buf[15] );
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[12], data.buf[13], data.buf[14], data.buf[15] );
}
else
{
sprintf( stmp, "0x%X", data.readU32(12) );
snprintf( stmp, sizeof(stmp), "0x%X", data.readU32(12) );
}
twi = new QTreeWidgetItem();
@ -629,42 +629,42 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "0x%X", data.readU32(16) );
snprintf( stmp, sizeof(stmp), "0x%X", data.readU32(16) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwFlags") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(20) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(20) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("wPriority") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(22) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(22) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("wLanguage") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(24) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(24) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwInitialFrames") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(28) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(28) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwScale") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(32) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(32) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwRate") );
@ -672,68 +672,68 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
if ( strcmp( strhType, "vids" ) == 0 )
{
sprintf( stmp, "(%13.10f Hz)", (double)data.readU32(32) / (double)data.readU32(28) );
snprintf( stmp, sizeof(stmp), "(%13.10f Hz)", (double)data.readU32(32) / (double)data.readU32(28) );
twi->setText( 3, tr(stmp) );
}
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(36) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(36) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwStart") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(40) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(40) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwLength") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(44) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(44) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwSuggestedBufferSize") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%i", data.readI32(48) );
snprintf( stmp, sizeof(stmp), "%i", data.readI32(48) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwQuality") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(52) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(52) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("dwSampleSize") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(56) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(56) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("rcFrame.left") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(58) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(58) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("rcFrame.top") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(60) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(60) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("rcFrame.right") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(62) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(62) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("rcFrame.bottom") );
@ -748,49 +748,49 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
avi->getChunkData( item->filePos(), data.buf, item->getSize()+8 );
sprintf( stmp, "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("fcc") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(4) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(4) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("cb") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(8) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(8) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("biSize") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%i", data.readI32(12) );
snprintf( stmp, sizeof(stmp), "%i", data.readI32(12) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("biWidth") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%i", data.readI32(16) );
snprintf( stmp, sizeof(stmp), "%i", data.readI32(16) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("biHeight") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(20) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(20) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("biPlanes") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(22) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(22) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("biBitCount") );
@ -799,11 +799,11 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
if ( isalnum(data.buf[24]) )
{
sprintf( stmp, "%c%c%c%c", data.buf[24], data.buf[25], data.buf[26], data.buf[27] );
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[24], data.buf[25], data.buf[26], data.buf[27] );
}
else
{
sprintf( stmp, "0x%X", data.readU32(24) );
snprintf( stmp, sizeof(stmp), "0x%X", data.readU32(24) );
}
twi = new QTreeWidgetItem();
@ -811,35 +811,35 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(28) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(28) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("biSizeImage") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%i", data.readI32(32) );
snprintf( stmp, sizeof(stmp), "%i", data.readI32(32) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("biXPelsPerMeter") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%i", data.readI32(36) );
snprintf( stmp, sizeof(stmp), "%i", data.readI32(36) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("biYPelsPerMeter") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(40) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(40) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("biClrUsed") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(44) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(44) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("biClrImportant") );
@ -854,56 +854,56 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
avi->getChunkData( item->filePos(), data.buf, dataSize );
sprintf( stmp, "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("fcc") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(4) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(4) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("cb") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(8) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(8) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("wFormatTag") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(10) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(10) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("nChannels") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(12) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(12) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("nSamplesPerSec") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(16) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(16) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("nAvgBytesPerSec") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(20) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(20) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("nBlockAlign") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU16(22) );
snprintf( stmp, sizeof(stmp), "%u", data.readU16(22) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("nBitsPerSample") );
@ -929,21 +929,21 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
avi->getChunkData( item->filePos(), data.buf, item->getSize()+8 );
sprintf( stmp, "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("fcc") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(4) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(4) );
twi = new QTreeWidgetItem();
twi->setText( 0, tr("cb") );
twi->setText( 2, tr(stmp) );
item->addChild(twi);
sprintf( stmp, "%u", data.readU32(8) );
snprintf( stmp, sizeof(stmp), "%u", data.readU32(8) );
for (i=0; i < static_cast<int>(item->getSize()); i++)
{
@ -991,7 +991,7 @@ AviRiffTreeItem::AviRiffTreeItem(int typeIn, long long int fposIn, const char *f
strcpy( fourcc, fourccIn );
//sprintf( stmp, "0x%08llX", fposIn );
//snprintf( stmp, sizeof(stmp), "0x%08llX", fposIn );
switch ( type )
{
@ -1013,16 +1013,16 @@ AviRiffTreeItem::AviRiffTreeItem(int typeIn, long long int fposIn, const char *f
if ( showSizeHex )
{
sprintf( stmp, "0x%08lX", (unsigned long)size );
snprintf( stmp, sizeof(stmp), "0x%08lX", (unsigned long)size );
}
else
{
sprintf( stmp, "%zu", size );
snprintf( stmp, sizeof(stmp), "%zu", size );
}
setText( 2, QString(stmp) );
sprintf( stmp, "0x%08llX", fposIn );
snprintf( stmp, sizeof(stmp), "0x%08llX", fposIn );
setText( 3, QString(stmp) );
}

View File

@ -517,9 +517,9 @@ int GuiCheatsDialog_t::addSearchResult(uint32_t a, uint8_t last, uint8_t current
item = new QTreeWidgetItem();
sprintf(addrStr, "$%04X", a);
sprintf(lastStr, "%02X", last);
sprintf(curStr, "%02X", current);
snprintf(addrStr, sizeof(addrStr), "$%04X", a);
snprintf(lastStr, sizeof(lastStr), "%02X", last);
snprintf(curStr, sizeof(curStr), "%02X", current);
//item->setFont( 0, font );
//item->setFont( 1, font );
@ -693,11 +693,11 @@ int GuiCheatsDialog_t::activeCheatListCB(const char *name, uint32 a, uint8 v, in
if (c >= 0)
{
sprintf(codeStr, "$%04X?%02X:%02X", a, c, v);
snprintf(codeStr, sizeof(codeStr), "$%04X?%02X:%02X", a, c, v);
}
else
{
sprintf(codeStr, "$%04X:%02X ", a, v);
snprintf(codeStr, sizeof(codeStr), "$%04X:%02X ", a, v);
}
item = actvCheatList->topLevelItem(actvCheatIdx);
@ -834,7 +834,7 @@ void GuiCheatsDialog_t::saveCheatFile(void)
dialog.selectFile(dir);
}
sprintf(dir, "%s/cheats", FCEUI_GetBaseDirectory());
snprintf(dir, sizeof(dir), "%s/cheats", FCEUI_GetBaseDirectory());
dialog.setDirectory(tr(dir));
@ -1025,15 +1025,15 @@ void GuiCheatsDialog_t::actvCheatItemClicked(QTreeWidgetItem *item, int column)
FCEUI_ToggleCheat(row);
}
}
sprintf(stmp, "%04X", a);
snprintf(stmp, sizeof(stmp), "%04X", a);
cheatAddrEntry->setText(tr(stmp));
sprintf(stmp, "%02X", v);
snprintf(stmp, sizeof(stmp), "%02X", v);
cheatValEntry->setText(tr(stmp));
if (c >= 0)
{
sprintf(stmp, "%02X", c);
snprintf(stmp, sizeof(stmp), "%02X", c);
cheatCmpEntry->setText(tr(stmp));
}
else

View File

@ -364,22 +364,22 @@ void CodeDataLoggerDialog_t::updatePeriodic(void)
if (cdloggerdataSize > 0)
{
sprintf(str, "0x%06x %.2f%%", codecount, (fcodecount / fromsize) * 100);
snprintf(str, sizeof(str), "0x%06x %.2f%%", codecount, (fcodecount / fromsize) * 100);
prgLoggedCodeLabel->setText(tr(str));
sprintf(str, "0x%06x %.2f%%", datacount, (fdatacount / fromsize) * 100);
snprintf(str, sizeof(str), "0x%06x %.2f%%", datacount, (fdatacount / fromsize) * 100);
prgLoggedDataLabel->setText(tr(str));
sprintf(str, "0x%06x %.2f%%", undefinedcount, (fundefinedcount / fromsize) * 100);
snprintf(str, sizeof(str), "0x%06x %.2f%%", undefinedcount, (fundefinedcount / fromsize) * 100);
prgUnloggedLabel->setText(tr(str));
sprintf(str, "0x%06x %.2f%%", rendercount, (frendercount / fvromsize) * 100);
snprintf(str, sizeof(str), "0x%06x %.2f%%", rendercount, (frendercount / fvromsize) * 100);
chrLoggedCodeLabel->setText(tr(str));
sprintf(str, "0x%06x %.2f%%", vromreadcount, (fvromreadcount / fvromsize) * 100);
snprintf(str, sizeof(str), "0x%06x %.2f%%", vromreadcount, (fvromreadcount / fvromsize) * 100);
chrLoggedDataLabel->setText(tr(str));
sprintf(str, "0x%06x %.2f%%", undefinedvromcount, (fundefinedvromcount / fvromsize) * 100);
snprintf(str, sizeof(str), "0x%06x %.2f%%", undefinedvromcount, (fundefinedvromcount / fvromsize) * 100);
chrUnloggedLabel->setText(tr(str));
}
else
@ -392,7 +392,7 @@ void CodeDataLoggerDialog_t::updatePeriodic(void)
chrUnloggedLabel->setText(tr("------"));
}
sprintf(str, "CDL File: %s", loadedcdfile);
snprintf(str, sizeof(str), "CDL File: %s", loadedcdfile);
cdlFileLabel->setText(tr(str));
}

View File

@ -167,7 +167,7 @@ ColorMenuPickerDialog_t::ColorMenuPickerDialog_t( QColor *c, const char *titleTe
style = this->style();
sprintf( stmp, "Pick Color for %s", titleText);
snprintf( stmp, sizeof(stmp), "Pick Color for %s", titleText);
setWindowTitle( stmp );

View File

@ -150,7 +150,7 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
tabView[i][j] = new DebuggerTabWidget(i,j);
sprintf( stmp, "debuggerTabView%i%i\n", i+1, j+1 );
snprintf( stmp, sizeof(stmp), "debuggerTabView%i%i\n", i+1, j+1 );
tabView[i][j]->setObjectName( tr(stmp) );
@ -1553,7 +1553,7 @@ void ConsoleDebugger::loadDisplayViews(void)
for (int j=0; j<4; j++)
{
QString tabListVal;
sprintf( key, "debugger/tabView%i%i", i+1, j+1 );
snprintf( key, sizeof(key), "debugger/tabView%i%i", i+1, j+1 );
tabListVal = settings.value(key).toString();
QStringList tabList = tabListVal.split(',');
@ -1610,7 +1610,7 @@ void ConsoleDebugger::loadDisplayViews(void)
// Save Vertical Panel State
for (int i=0; i<2; i++)
{
sprintf( key, "debugger/vPanelState%i", i+1);
snprintf( key, sizeof(key), "debugger/vPanelState%i", i+1);
vsplitter[i]->restoreState( settings.value(key).toByteArray() );
}
@ -1628,7 +1628,7 @@ void ConsoleDebugger::saveDisplayViews(void)
for (int j=0; j<4; j++)
{
QString tabListVal;
sprintf( key, "debugger/tabView%i%i", i+1, j+1 );
snprintf( key, sizeof(key), "debugger/tabView%i%i", i+1, j+1 );
for (int k=0; k<tabView[i][j]->count(); k++)
{
@ -1650,7 +1650,7 @@ void ConsoleDebugger::saveDisplayViews(void)
// Save Vertical Panel State
for (int i=0; i<2; i++)
{
sprintf( key, "debugger/vPanelState%i", i+1);
snprintf( key, sizeof(key), "debugger/vPanelState%i", i+1);
settings.setValue( key, vsplitter[i]->saveState());
}
@ -1981,13 +1981,13 @@ DebuggerBreakpointEditor::DebuggerBreakpointEditor(int editIndex, watchpointinfo
rom_radio->setChecked(true);
}
sprintf( stmp, "%04X", wp->address );
snprintf( stmp, sizeof(stmp), "%04X", wp->address );
addr1->setText( tr(stmp) );
if ( wp->endaddress > 0 )
{
sprintf( stmp, "%04X", wp->endaddress );
snprintf( stmp, sizeof(stmp), "%04X", wp->endaddress );
addr2->setText( tr(stmp) );
}
@ -2032,14 +2032,14 @@ DebuggerBreakpointEditor::DebuggerBreakpointEditor(int editIndex, watchpointinfo
if ( romAddr >= 0 )
{
wp->address = romAddr;
sprintf( stmp, "%X", wp->address );
snprintf( stmp, sizeof(stmp), "%X", wp->address );
addr1->setText( tr(stmp) );
rom_radio->setChecked(true);
}
else
{
char str[64];
sprintf(str, "K==#%02X", getBank(wp->address));
snprintf(str, sizeof(str), "K==#%02X", getBank(wp->address));
cond->setText( tr(str) );
}
}
@ -2388,11 +2388,11 @@ void ConsoleDebugger::bpListUpdate( bool reset )
if ( watchpoint[i].endaddress > 0 )
{
sprintf( addrStr, "$%04X-%04X:", watchpoint[i].address, watchpoint[i].endaddress );
snprintf( addrStr, sizeof(addrStr), "$%04X-%04X:", watchpoint[i].address, watchpoint[i].endaddress );
}
else
{
sprintf( addrStr, "$%04X:", watchpoint[i].address );
snprintf( addrStr, sizeof(addrStr), "$%04X:", watchpoint[i].address );
}
flags[0] = (watchpoint[i].flags & WP_E) ? 'E' : '-';
@ -2519,7 +2519,7 @@ void ConsoleDebugger::edit_BM_name( int addr )
bm = dbgBmMgr.getAddr( addr );
sprintf( stmp, "Specify Bookmark Name for %04X", addr );
snprintf( stmp, sizeof(stmp), "Specify Bookmark Name for %04X", addr );
dialog.setWindowTitle( tr("Edit Bookmark") );
dialog.setLabelText( tr(stmp) );
@ -2571,7 +2571,7 @@ void ConsoleDebugger::bmListUpdate( bool reset )
bmTree->addTopLevelItem( item );
}
sprintf( addrStr, "%04X", bm->addr );
snprintf( addrStr, sizeof(addrStr), "%04X", bm->addr );
//item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable );
item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemNeverHasChildren );
@ -3501,7 +3501,7 @@ void ConsoleDebugger::setBookmarkSelectedAddress( int addr )
{
char stmp[32];
sprintf( stmp, "%04X", addr );
snprintf( stmp, sizeof(stmp), "%04X", addr );
selBmAddr->setText( tr(stmp) );
@ -3947,16 +3947,16 @@ void QAsmView::updateAssemblyView(void)
if (displayROMoffsets && (a->rom != -1) )
{
sprintf(chr, " %06X: ", a->rom);
snprintf(chr, sizeof(chr), " %06X: ", a->rom);
}
else
{
sprintf(chr, "%02X:%04X: ", a->bank, addr);
snprintf(chr, sizeof(chr), "%02X:%04X: ", a->bank, addr);
}
}
else
{
sprintf(chr, " :%04X: ", addr);
snprintf(chr, sizeof(chr), " :%04X: ", addr);
}
line.append(chr);
@ -3964,7 +3964,7 @@ void QAsmView::updateAssemblyView(void)
if (size == 0)
{
sprintf(chr, "%02X UNDEFINED", GetMem(addr++));
snprintf(chr, sizeof(chr), "%02X UNDEFINED", GetMem(addr++));
line.append(chr);
}
else
@ -3973,7 +3973,7 @@ void QAsmView::updateAssemblyView(void)
{
while (addr < 0xFFFF)
{
sprintf(chr, "%02X OVERFLOW\n", GetMem(addr++));
snprintf(chr, sizeof(chr), "%02X OVERFLOW\n", GetMem(addr++));
line.append(chr);
}
delete a;
@ -3981,7 +3981,7 @@ void QAsmView::updateAssemblyView(void)
}
for (int j = 0; j < size; j++)
{
sprintf(chr, "%02X ", opcode[j] = GetMem(addr++));
snprintf(chr, sizeof(chr), "%02X ", opcode[j] = GetMem(addr++));
if ( showByteCodes ) line.append(chr);
}
while (size < 3)
@ -4217,23 +4217,23 @@ void ConsoleDebugger::updateRegisterView(void)
char stmp[64];
char str[32], str2[32];
sprintf( stmp, "%04X", X.PC );
snprintf( stmp, sizeof(stmp), "%04X", X.PC );
pcEntry->setText( tr(stmp) );
sprintf( stmp, "%02X", X.A );
snprintf( stmp, sizeof(stmp), "%02X", X.A );
regAEntry->setText( tr(stmp) );
sprintf( stmp, "%02X", X.X );
snprintf( stmp, sizeof(stmp), "%02X", X.X );
regXEntry->setText( tr(stmp) );
sprintf( stmp, "%02X", X.Y );
snprintf( stmp, sizeof(stmp), "%02X", X.Y );
regYEntry->setText( tr(stmp) );
sprintf( stmp, "%02X", X.P );
snprintf( stmp, sizeof(stmp), "%02X", X.P );
regPEntry->setText( tr(stmp) );
@ -4248,7 +4248,7 @@ void ConsoleDebugger::updateRegisterView(void)
stackPtr = X.S | 0x0100;
sprintf( stmp, "Stack: $%04X", stackPtr );
snprintf( stmp, sizeof(stmp), "Stack: $%04X", stackPtr );
stackFrame->setTitle( tr(stmp) );
stackText->updateText();
@ -4266,26 +4266,26 @@ void ConsoleDebugger::updateRegisterView(void)
ResetDebugStatisticsCounters();
counter_value2 = 0;
}
sprintf(stmp, "%10llu (+%llu)", counter_value1, counter_value2);
snprintf(stmp, sizeof(stmp), "%10llu (+%llu)", counter_value1, counter_value2);
cpuCyclesVal->setText( tr(stmp) );
sprintf(stmp, "%10llu (+%llu)", total_instructions, delta_instructions);
snprintf(stmp, sizeof(stmp), "%10llu (+%llu)", total_instructions, delta_instructions);
cpuInstrsVal->setText( tr(stmp) );
// PPU Labels
sprintf(stmp, "$%02X", PPU[0] );
snprintf(stmp, sizeof(stmp), "$%02X", PPU[0] );
ppuCtrlReg->setText( tr(stmp) );
sprintf(stmp, "$%02X", PPU[1] );
snprintf(stmp, sizeof(stmp), "$%02X", PPU[1] );
ppuMaskReg->setText( tr(stmp) );
sprintf(stmp, "$%02X", PPU[2] );
snprintf(stmp, sizeof(stmp), "$%02X", PPU[2] );
ppuStatReg->setText( tr(stmp) );
sprintf(stmp, "$%04X", (int)FCEUPPU_PeekAddress());
snprintf(stmp, sizeof(stmp), "$%04X", (int)FCEUPPU_PeekAddress());
ppuAddrDsp->setText( tr(stmp) );
sprintf(stmp, "$%02X", PPU[3] );
snprintf(stmp, sizeof(stmp), "$%02X", PPU[3] );
oamAddrDsp->setText( tr(stmp) );
extern int linestartts;
@ -4302,41 +4302,41 @@ void ConsoleDebugger::updateRegisterView(void)
if (!vblankScanLines)
{
// Idle scanline (240)
sprintf(str, "%d", scanline); // was "Idle %d"
snprintf(str, sizeof(str), "%d", scanline); // was "Idle %d"
} else if (scanline + vblankScanLines == (PAL?311:261))
{
// Pre-render
sprintf(str, "-1"); // was "Prerender -1"
snprintf(str, sizeof(str), "-1"); // was "Prerender -1"
} else
{
// Vblank lines (241-260/310)
sprintf(str, "%d", scanline + vblankScanLines); // was "Vblank %d"
snprintf(str, sizeof(str), "%d", scanline + vblankScanLines); // was "Vblank %d"
}
sprintf(str2, "%d", vblankPixel);
snprintf(str2, sizeof(str2), "%d", vblankPixel);
} else
{
// Scanlines 0 - 239
sprintf(str, "%d", scanline);
sprintf(str2, "%d", ppupixel);
snprintf(str, sizeof(str), "%d", scanline);
snprintf(str2, sizeof(str2), "%d", ppupixel);
}
if(newppu)
{
sprintf(str ,"%d",newppu_get_scanline());
sprintf(str2,"%d",newppu_get_dot());
snprintf(str , sizeof(str), "%d",newppu_get_scanline());
snprintf(str2, sizeof(str2), "%d",newppu_get_dot());
}
sprintf( stmp, "%s", str );
snprintf( stmp, sizeof(stmp), "%s", str );
ppuScanLineDsp->setText( tr(stmp) );
sprintf( stmp, "%s", str2 );
snprintf( stmp, sizeof(stmp), "%s", str2 );
ppuPixelDsp->setText( tr(stmp) );
int ppuScrollPosX, ppuScrollPosY;
ppu_getScroll( ppuScrollPosX, ppuScrollPosY);
sprintf( stmp, "%i", ppuScrollPosX );
snprintf( stmp, sizeof(stmp), "%i", ppuScrollPosX );
ppuScrollX->setText( tr(stmp) );
sprintf( stmp, "%i", ppuScrollPosY );
snprintf( stmp, sizeof(stmp), "%i", ppuScrollPosY );
ppuScrollY->setText( tr(stmp) );
}
//----------------------------------------------------------------------------
@ -4415,7 +4415,7 @@ void ConsoleDebugger::updatePeriodic(void)
if ( lastBpIdx >= 0 )
{
char stmp[128];
sprintf( stmp, " Emulator Stopped / Paused at Breakpoint: %i", lastBpIdx );
snprintf( stmp, sizeof(stmp), " Emulator Stopped / Paused at Breakpoint: %i", lastBpIdx );
emuStatLbl->setText( tr(stmp) );
}
else
@ -5374,7 +5374,7 @@ void QAsmView::setSelAddrToLine( int line )
selAddrWidth = 4;
selAddrValue = addr;
selAddrType = 0;
sprintf( selAddrText, "%04X", addr );
snprintf( selAddrText, sizeof(selAddrText), "%04X", addr );
if ( parent )
@ -5598,7 +5598,7 @@ bool QAsmView::event(QEvent *event)
}
else if ( showSymHexDecode )
{
sprintf( stmp, "$%04X", asmEntry[line]->sym.offset() );
snprintf( stmp, sizeof(stmp), "$%04X", asmEntry[line]->sym.offset() );
QToolTip::showText(helpEvent->globalPos(), tr(stmp), this );
}
@ -5606,11 +5606,11 @@ bool QAsmView::event(QEvent *event)
{
if ( asmEntry[line]->bank < 0 )
{
sprintf( stmp, "ADDR:\t$%04X", asmEntry[line]->addr );
snprintf( stmp, sizeof(stmp), "ADDR:\t$%04X", asmEntry[line]->addr );
}
else
{
sprintf( stmp, "ADDR:\t$%04X\nBANK:\t$%02X\nROM:\t$%06X",
snprintf( stmp, sizeof(stmp), "ADDR:\t$%04X\nBANK:\t$%02X\nROM:\t$%06X",
asmEntry[line]->addr, asmEntry[line]->bank, asmEntry[line]->rom );
}
@ -5631,11 +5631,11 @@ bool QAsmView::event(QEvent *event)
if ( bank < 0 )
{
sprintf( stmp, "ADDR:\t$%04X", addr );
snprintf( stmp, sizeof(stmp), "ADDR:\t$%04X", addr );
}
else
{
sprintf( stmp, "ADDR:\t$%04X\nBANK:\t$%02X\nROM:\t$%06X",
snprintf( stmp, sizeof(stmp), "ADDR:\t$%04X\nBANK:\t$%02X\nROM:\t$%06X",
addr, bank, romOfs );
}
@ -5909,7 +5909,7 @@ void QAsmView::mouseMoveEvent(QMouseEvent * event)
bank = getBank(addr);
romOfs = GetNesFileAddress(addr);
sprintf( txt, "CPU Address: %02X:%04X", bank, addr);
snprintf( txt, sizeof(txt), "CPU Address: %02X:%04X", bank, addr);
s.assign( txt );
@ -5923,14 +5923,14 @@ void QAsmView::mouseMoveEvent(QMouseEvent * event)
{
fileName = "...";
}
sprintf( txt, "\nOffset 0x%06X in File \"%s\" (NL file: %X)", romOfs, fileName, bank);
snprintf( txt, sizeof(txt), "\nOffset 0x%06X in File \"%s\" (NL file: %X)", romOfs, fileName, bank);
s.append( txt );
}
}
else
{
sprintf( txt, "CPU Address: %04X", addr);
snprintf( txt, sizeof(txt), "CPU Address: %04X", addr);
s.assign( txt );
}
@ -6212,13 +6212,13 @@ void QAsmView::mousePressEvent(QMouseEvent * event)
if ( selAddrType )
{
sprintf( selAddrText, "%06X", addr );
snprintf( selAddrText, sizeof(selAddrText), "%06X", addr );
selAddrWidth = 6;
selAddrChar = pcLocLinePos+1;
}
else
{
sprintf( selAddrText, "%04X", addr );
snprintf( selAddrText, sizeof(selAddrText), "%04X", addr );
selAddrWidth = 4;
selAddrChar = pcLocLinePos+3;
}
@ -6357,7 +6357,7 @@ void QAsmView::contextMenuEvent(QContextMenuEvent *event)
if ( ctxMenuAddrType == 0 )
{
sprintf( stmp, "Go to $%04X\tDouble+Click", ctxMenuAddr );
snprintf( stmp, sizeof(stmp), "Go to $%04X\tDouble+Click", ctxMenuAddr );
act = new QAction(tr(stmp), &menu);
menu.addAction(act);
//act->setShortcut( QKeySequence(tr("Ctrl+F10")));
@ -7105,7 +7105,7 @@ void DebuggerStackDisplay::contextMenuEvent(QContextMenuEvent *event)
{
char stmp[8];
sprintf( stmp, "%i", i+1 );
snprintf( stmp, sizeof(stmp), "%i", i+1 );
bytesPerLineAct[i] = new QAction(tr(stmp), &menu);
bytesPerLineAct[i]->setCheckable(true);
@ -7172,11 +7172,11 @@ void DebuggerStackDisplay::updateText(void)
{
if ( showAddrs || (stackBytesPerLine <= 1) )
{
sprintf( stmp, "%03X: %02X", stackPtr, GetMem(stackPtr) );
snprintf( stmp, sizeof(stmp), "%03X: %02X", stackPtr, GetMem(stackPtr) );
}
else
{
sprintf( stmp, "%02X", GetMem(stackPtr) );
snprintf( stmp, sizeof(stmp), "%02X", GetMem(stackPtr) );
}
stackLine.assign( stmp );
@ -7194,21 +7194,21 @@ void DebuggerStackDisplay::updateText(void)
{
if ( showAddrs )
{
sprintf( stmp, "\n%03X: %02X", stackPtr, GetMem(stackPtr) );
snprintf( stmp, sizeof(stmp), "\n%03X: %02X", stackPtr, GetMem(stackPtr) );
}
else
{
sprintf( stmp, "\n%02X", GetMem(stackPtr) );
snprintf( stmp, sizeof(stmp), "\n%02X", GetMem(stackPtr) );
}
}
else
{
sprintf( stmp, ",%02X", GetMem(stackPtr) );
snprintf( stmp, sizeof(stmp), ",%02X", GetMem(stackPtr) );
}
}
else
{
sprintf( stmp, "\n%03X: %02X", stackPtr, GetMem(stackPtr) );
snprintf( stmp, sizeof(stmp), "\n%03X: %02X", stackPtr, GetMem(stackPtr) );
}
stackLine.append( stmp );
@ -7312,11 +7312,11 @@ asmLookAheadPopup::asmLookAheadPopup( int addr, QWidget *parent )
hbox = new QHBoxLayout();
vbox->addLayout( hbox );
sprintf( stmp, "%02X : $%04X", bank, addr );
snprintf( stmp, sizeof(stmp), "%02X : $%04X", bank, addr );
cpuAddr->setText( tr(stmp) );
sprintf( stmp, "#$%02X", GetMem(addr) );
snprintf( stmp, sizeof(stmp), "#$%02X", GetMem(addr) );
cpuVal->setText( tr(stmp) );
sprintf( stmp, "$%06X", romOfs );
snprintf( stmp, sizeof(stmp), "$%06X", romOfs );
romAddr->setText( tr(stmp) );
lbl = new QLabel( tr("CPU ADDR:") );
@ -7343,9 +7343,9 @@ asmLookAheadPopup::asmLookAheadPopup( int addr, QWidget *parent )
hbox = new QHBoxLayout();
vbox->addLayout( hbox );
sprintf( stmp, "$%04X", addr );
snprintf( stmp, sizeof(stmp), "$%04X", addr );
cpuAddr->setText( tr(stmp) );
sprintf( stmp, "#$%02X", GetMem(addr) );
snprintf( stmp, sizeof(stmp), "#$%02X", GetMem(addr) );
cpuVal->setText( tr(stmp) );
lbl = new QLabel( tr("CPU ADDR:") );
@ -7502,10 +7502,10 @@ ppuRegPopup::ppuRegPopup( QWidget *parent )
sprite0hit_cbox = new QCheckBox( tr("Sprite 0 Hit") );
spriteOvrflw_cbox = new QCheckBox( tr("Sprite Overflow") );
sprintf( stmp, "$%04X", 0x2000 + (0x400*(PPU[0] & 0x03)));
snprintf( stmp, sizeof(stmp), "$%04X", 0x2000 + (0x400*(PPU[0] & 0x03)));
ppuBgAddr->setText( tr(stmp) );
sprintf( stmp, "$%04X", (PPU[0] & 0x08) ? 0x1000 : 0x0000 );
snprintf( stmp, sizeof(stmp), "$%04X", (PPU[0] & 0x08) ? 0x1000 : 0x0000 );
ppuSprAddr->setText( tr(stmp) );
nmiBlank_cbox->setChecked( PPU[0] & 0x80 );
@ -7865,7 +7865,7 @@ DebugBreakOnDialog::DebugBreakOnDialog(int type, QWidget *parent )
refMode = breakOnInstrMode;
threshold = break_instructions_limit;
sprintf(stmp, "Current Instruction Count: %10llu (+%llu)", totalCount, deltaCount);
snprintf(stmp, sizeof(stmp), "Current Instruction Count: %10llu (+%llu)", totalCount, deltaCount);
currLbl->setText( tr(stmp) );
}
@ -7889,7 +7889,7 @@ DebugBreakOnDialog::DebugBreakOnDialog(int type, QWidget *parent )
refMode = breakOnCycleMode;
threshold = break_cycles_limit;
sprintf(stmp, "Current Cycle Count: %10llu (+%llu)", totalCount, deltaCount);
snprintf(stmp, sizeof(stmp), "Current Cycle Count: %10llu (+%llu)", totalCount, deltaCount);
currLbl->setText( tr(stmp) );
}
@ -7969,7 +7969,7 @@ DebugBreakOnDialog::DebugBreakOnDialog(int type, QWidget *parent )
grid->addWidget( btn, row, 4-(col*2) );
sprintf( stmp, "%+i%c", -bb, c);
snprintf( stmp, sizeof(stmp), "%+i%c", -bb, c);
btn->setText( tr(stmp) );
@ -7979,7 +7979,7 @@ DebugBreakOnDialog::DebugBreakOnDialog(int type, QWidget *parent )
grid->addWidget( btn, row, 4-(col*2)+1 );
sprintf( stmp, "%+i%c", bb, c);
snprintf( stmp, sizeof(stmp), "%+i%c", bb, c);
btn->setText( tr(stmp) );
@ -8118,7 +8118,7 @@ void DebugBreakOnDialog::updateCurrent(void)
totalCount = total_instructions;
deltaCount = delta_instructions;
sprintf(stmp, "Current Instruction Count: %10llu (+%llu)", totalCount, deltaCount);
snprintf(stmp, sizeof(stmp), "Current Instruction Count: %10llu (+%llu)", totalCount, deltaCount);
currLbl->setText( tr(stmp) );
}
@ -8137,7 +8137,7 @@ void DebugBreakOnDialog::updateCurrent(void)
ResetDebugStatisticsCounters();
deltaCount = 0;
}
sprintf(stmp, "Current Cycle Count: %10llu (+%llu)", totalCount, deltaCount);
snprintf(stmp, sizeof(stmp), "Current Cycle Count: %10llu (+%llu)", totalCount, deltaCount);
currLbl->setText( tr(stmp) );
}
@ -8195,7 +8195,7 @@ void DebugBreakOnDialog::setThreshold( unsigned long long int val )
threshold = val;
sprintf( stmp, "%llu", threshold );
snprintf( stmp, sizeof(stmp), "%llu", threshold );
countEntryBox->setText( tr(stmp) );
@ -8229,11 +8229,11 @@ void DebugBreakOnDialog::updateLabel(void)
if ( delta > 0 )
{
sprintf( stmp, "Will break in %lli CPU Instruction%s", delta, (delta > 1) ? "s":"" );
snprintf( stmp, sizeof(stmp), "Will break in %lli CPU Instruction%s", delta, (delta > 1) ? "s":"" );
}
else
{
sprintf( stmp, "Will break immediately, CPU instruction count already exceeds value by %lli.", -delta);
snprintf( stmp, sizeof(stmp), "Will break immediately, CPU instruction count already exceeds value by %lli.", -delta);
}
}
else
@ -8242,11 +8242,11 @@ void DebugBreakOnDialog::updateLabel(void)
if ( delta > 0 )
{
sprintf( stmp, "Will break in %lli CPU Instruction%s", delta, (delta > 1) ? "s":"" );
snprintf( stmp, sizeof(stmp), "Will break in %lli CPU Instruction%s", delta, (delta > 1) ? "s":"" );
}
else
{
sprintf( stmp, "Will break immediately, CPU instruction count already exceeds value by %lli.", -delta);
snprintf( stmp, sizeof(stmp), "Will break immediately, CPU instruction count already exceeds value by %lli.", -delta);
}
}
}
@ -8258,11 +8258,11 @@ void DebugBreakOnDialog::updateLabel(void)
if ( delta > 0 )
{
sprintf( stmp, "Will break in %lli CPU cycle%s", delta, (delta > 1) ? "s":"" );
snprintf( stmp, sizeof(stmp), "Will break in %lli CPU cycle%s", delta, (delta > 1) ? "s":"" );
}
else
{
sprintf( stmp, "Will break immediately, CPU cycle count already exceeds value by %lli.", -delta);
snprintf( stmp, sizeof(stmp), "Will break immediately, CPU cycle count already exceeds value by %lli.", -delta);
}
}
else
@ -8271,11 +8271,11 @@ void DebugBreakOnDialog::updateLabel(void)
if ( delta > 0 )
{
sprintf( stmp, "Will break in %lli CPU cycle%s", delta, (delta > 1) ? "s":"" );
snprintf( stmp, sizeof(stmp), "Will break in %lli CPU cycle%s", delta, (delta > 1) ? "s":"" );
}
else
{
sprintf( stmp, "Will break immediately, CPU cycle count already exceeds value %lli.", -delta);
snprintf( stmp, sizeof(stmp), "Will break immediately, CPU cycle count already exceeds value %lli.", -delta);
}
}
}

View File

@ -332,7 +332,7 @@ void ConsoleSndConfDialog_t::periodicUpdate(void)
bufUsage->setValue( (int)(percBufUse) );
sprintf( stmp, "Sink Starve Count: %u", nes_shm->sndBuf.starveCounter );
snprintf( stmp, sizeof(stmp), "Sink Starve Count: %u", nes_shm->sndBuf.starveCounter );
starveLbl->setText( tr(stmp) );
@ -396,7 +396,7 @@ void ConsoleSndConfDialog_t::setSliderFromProperty(QSlider *slider, QLabel *lbl,
char stmp[32];
g_config->getOption(property, &pval);
slider->setValue(pval);
sprintf(stmp, "%i", pval);
snprintf(stmp, sizeof(stmp), "%i", pval);
lbl->setText(stmp);
}
//----------------------------------------------------
@ -404,7 +404,7 @@ void ConsoleSndConfDialog_t::bufSizeChanged(int value)
{
char stmp[32];
sprintf(stmp, "%i", value);
snprintf(stmp, sizeof(stmp), "%i", value);
bufSizeLabel->setText(stmp);
@ -422,7 +422,7 @@ void ConsoleSndConfDialog_t::volumeChanged(int value)
{
char stmp[32];
sprintf(stmp, "%i", value);
snprintf(stmp, sizeof(stmp), "%i", value);
volLbl->setText(stmp);
@ -439,7 +439,7 @@ void ConsoleSndConfDialog_t::triangleChanged(int value)
{
char stmp[32];
sprintf(stmp, "%i", value);
snprintf(stmp, sizeof(stmp), "%i", value);
triLbl->setText(stmp);
@ -456,7 +456,7 @@ void ConsoleSndConfDialog_t::square1Changed(int value)
{
char stmp[32];
sprintf(stmp, "%i", value);
snprintf(stmp, sizeof(stmp), "%i", value);
sqr1Lbl->setText(stmp);
@ -473,7 +473,7 @@ void ConsoleSndConfDialog_t::square2Changed(int value)
{
char stmp[32];
sprintf(stmp, "%i", value);
snprintf(stmp, sizeof(stmp), "%i", value);
sqr2Lbl->setText(stmp);
@ -490,7 +490,7 @@ void ConsoleSndConfDialog_t::noiseChanged(int value)
{
char stmp[32];
sprintf(stmp, "%i", value);
snprintf(stmp, sizeof(stmp), "%i", value);
nseLbl->setText(stmp);
@ -507,7 +507,7 @@ void ConsoleSndConfDialog_t::pcmChanged(int value)
{
char stmp[32];
sprintf(stmp, "%i", value);
snprintf(stmp, sizeof(stmp), "%i", value);
pcmLbl->setText(stmp);

View File

@ -1339,7 +1339,7 @@ QString fceuGetOpcodeToolTip( uint8_t *opcode, int size )
for (int i=0; i<size; i++)
{
sprintf(stmp, "$%02X ", opcode[i] );
snprintf(stmp, sizeof(stmp), "$%02X ", opcode[i] );
text.append( stmp );
}
@ -1347,7 +1347,7 @@ QString fceuGetOpcodeToolTip( uint8_t *opcode, int size )
text.append( addrMode );
text.append( "\nCycle Count:\t\t" );
sprintf( stmp, "%i", X6502_GetOpcodeCycles( opcode[0] ) );
snprintf( stmp, sizeof(stmp), "%i", X6502_GetOpcodeCycles( opcode[0] ) );
text.append( stmp );
text.append( "\n" );

View File

@ -518,7 +518,7 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
scrRateReadout->setFont( font );
scrRateReadout->setReadOnly(true);
scrRateReadout->setAlignment(Qt::AlignCenter);
sprintf( stmp, "%.3f", consoleWindow->getRefreshRate() );
snprintf( stmp, sizeof(stmp), "%.3f", consoleWindow->getRefreshRate() );
scrRateReadout->setText( tr(stmp) );
hbox->addWidget( new QLabel( tr("Refresh Rate (Hz):") ) );
@ -606,11 +606,11 @@ void ConsoleVideoConfDialog_t::updateReadouts(void)
v = consoleWindow->viewport_Interface->size();
}
sprintf( stmp, "%i x %i ", w.width(), w.height() );
snprintf( stmp, sizeof(stmp), "%i x %i ", w.width(), w.height() );
winSizeReadout->setText( tr(stmp) );
sprintf( stmp, "%i x %i ", v.width(), v.height() );
snprintf( stmp, sizeof(stmp), "%i x %i ", v.width(), v.height() );
vpSizeReadout->setText( tr(stmp) );
}

View File

@ -1038,7 +1038,7 @@ void consoleWin_t::createMainMenu(void)
{
char stmp[8];
sprintf( stmp, "Slot &%i", i );
snprintf( stmp, sizeof(stmp), "Slot &%i", i );
state[i] = new QAction(tr(stmp), this);
state[i]->setCheckable(true);
@ -1254,7 +1254,7 @@ void consoleWin_t::createMainMenu(void)
{
char stmp[8];
sprintf( stmp, "&%ix", i+1 );
snprintf( stmp, sizeof(stmp), "&%ix", i+1 );
winSizeAct[i] = new QAction(tr(stmp), this);
@ -1629,7 +1629,7 @@ void consoleWin_t::createMainMenu(void)
for (int j=1; j<=(6-i); j++)
{
sprintf( stmp, "%i On, %i Off", i, j );
snprintf( stmp, sizeof(stmp), "%i On, %i Off", i, j );
autoFireMenuAction *afAct = new autoFireMenuAction( i, j, tr(stmp), this);
afAct->setCheckable(true);
group->addAction(afAct);
@ -2217,7 +2217,7 @@ void consoleWin_t::buildRecentRomMenu(void)
for (int i=0; i<10; i++)
{
sprintf(buf, "SDL.RecentRom%02i", i);
snprintf(buf, sizeof(buf), "SDL.RecentRom%02i", i);
g_config->getOption( buf, &s);
@ -2270,7 +2270,7 @@ void consoleWin_t::saveRecentRomMenu(void)
for (it=romList.begin(); it != romList.end(); it++)
{
s = *it;
sprintf(buf, "SDL.RecentRom%02i", i);
snprintf(buf, sizeof(buf), "SDL.RecentRom%02i", i);
g_config->setOption( buf, *s );
@ -2279,7 +2279,7 @@ void consoleWin_t::saveRecentRomMenu(void)
}
for (i = romList.size(); i < 10; i++)
{
sprintf(buf, "SDL.RecentRom%02i", i);
snprintf(buf, sizeof(buf), "SDL.RecentRom%02i", i);
g_config->setOption( buf, "");
}
@ -2290,7 +2290,7 @@ void consoleWin_t::clearRecentRomMenu()
char buf[128];
for (int i = 0; i < 10; i++)
{
sprintf(buf, "SDL.RecentRom%02i", i);
snprintf(buf, sizeof(buf), "SDL.RecentRom%02i", i);
g_config->setOption( buf, "");
}
clearRomList();
@ -3476,7 +3476,7 @@ void consoleWin_t::warnAmbiguousShortcut( QShortcut *shortcut)
std::string msg;
int c = 0;
sprintf( stmp, "Error: Ambiguous Shortcut Activation for Key Sequence: '%s'\n", shortcut->key().toString().toLocal8Bit().constData() );
snprintf( stmp, sizeof(stmp), "Error: Ambiguous Shortcut Activation for Key Sequence: '%s'\n", shortcut->key().toString().toLocal8Bit().constData() );
msg.assign( stmp );

View File

@ -616,11 +616,11 @@ FKBConfigDialog::FKBConfigDialog(QWidget *parent)
if ( strcmp( keyNames[j], keyNames[j+1] ) == 0 )
{
sprintf( stmp, " %s ", keyNames[j] );
snprintf( stmp, sizeof(stmp), " %s ", keyNames[j] );
}
else
{
sprintf( stmp, " %s - %s ", keyNames[j], keyNames[j+1] );
snprintf( stmp, sizeof(stmp), " %s - %s ", keyNames[j], keyNames[j+1] );
}
item->setText(0, tr(stmp) );
@ -1331,26 +1331,26 @@ void FKBConfigDialog::mappingSave(void)
}
stmp[k] = 0;
//sprintf(stmp, "k%s", SDL_GetKeyName(bmap[c][i].ButtonNum));
//snprintf(stmp, sizeof(stmp), "k%s", SDL_GetKeyName(bmap[c][i].ButtonNum));
}
else
{
if (fkbmap[i].ButtonNum & 0x2000)
{
/* Hat "button" */
sprintf(stmp, "h%i.%i",
snprintf(stmp, sizeof(stmp), "h%i.%i",
(fkbmap[i].ButtonNum >> 8) & 0x1F, fkbmap[i].ButtonNum & 0xFF);
}
else if (fkbmap[i].ButtonNum & 0x8000)
{
/* Axis "button" */
sprintf(stmp, "%ca%i",
snprintf(stmp, sizeof(stmp), "%ca%i",
(fkbmap[i].ButtonNum & 0x4000) ? '-' : '+', fkbmap[i].ButtonNum & 0x3FFF);
}
else
{
/* Button */
sprintf(stmp, "b%i", fkbmap[i].ButtonNum);
snprintf(stmp, sizeof(stmp), "b%i", fkbmap[i].ButtonNum);
}
}
fprintf( fp, "%s=%s\n", FamilyKeyBoardNames[i], stmp );
@ -1462,7 +1462,7 @@ FKBKeyMapDialog::FKBKeyMapDialog( int idx, QWidget *parent )
setLayout( mainLayout );
sprintf( stmp, "Press a key to set new physical mapping for the '%s' Key", keyNames[idx*2] );
snprintf( stmp, sizeof(stmp), "Press a key to set new physical mapping for the '%s' Key", keyNames[idx*2] );
msgLbl = new QLabel( tr(stmp) );

View File

@ -209,111 +209,111 @@ void FrameTimingDialog_t::updateTimingStats(void)
getFrameTimingStats(&stats);
// Absolute
sprintf(stmp, "%.3f", stats.frameTimeAbs.tgt * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeAbs.tgt * 1e3);
frameTimeAbs->setText(1, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeAbs.cur * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeAbs.cur * 1e3);
frameTimeAbs->setText(2, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeAbs.min * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeAbs.min * 1e3);
frameTimeAbs->setText(3, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeAbs.max * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeAbs.max * 1e3);
frameTimeAbs->setText(4, tr(stmp));
// Delta
sprintf(stmp, "%.3f", stats.frameTimeDel.tgt * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeDel.tgt * 1e3);
frameTimeDel->setText(1, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeDel.cur * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeDel.cur * 1e3);
frameTimeDel->setText(2, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeDel.min * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeDel.min * 1e3);
frameTimeDel->setText(3, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeDel.max * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeDel.max * 1e3);
frameTimeDel->setText(4, tr(stmp));
// Work
sprintf(stmp, "lt %.3f", stats.frameTimeWork.tgt * 1e3);
snprintf(stmp, sizeof(stmp), "lt %.3f", stats.frameTimeWork.tgt * 1e3);
frameTimeWork->setText(1, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeWork.cur * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeWork.cur * 1e3);
frameTimeWork->setText(2, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeWork.min * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeWork.min * 1e3);
frameTimeWork->setText(3, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeWork.max * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeWork.max * 1e3);
frameTimeWork->setText(4, tr(stmp));
// Idle
sprintf(stmp, "gt %.3f", stats.frameTimeIdle.tgt * 1e3);
snprintf(stmp, sizeof(stmp), "gt %.3f", stats.frameTimeIdle.tgt * 1e3);
frameTimeIdle->setText(1, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeIdle.cur * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeIdle.cur * 1e3);
frameTimeIdle->setText(2, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeIdle.min * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeIdle.min * 1e3);
frameTimeIdle->setText(3, tr(stmp));
sprintf(stmp, "%.3f", stats.frameTimeIdle.max * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeIdle.max * 1e3);
frameTimeIdle->setText(4, tr(stmp));
// Work %
sprintf(stmp, "lt %.1f", 100.0 * stats.frameTimeWork.tgt / stats.frameTimeAbs.tgt);
snprintf(stmp, sizeof(stmp), "lt %.1f", 100.0 * stats.frameTimeWork.tgt / stats.frameTimeAbs.tgt);
frameTimeWorkPct->setText(1, tr(stmp));
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeWork.cur / stats.frameTimeAbs.tgt);
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeWork.cur / stats.frameTimeAbs.tgt);
frameTimeWorkPct->setText(2, tr(stmp));
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeWork.min / stats.frameTimeAbs.tgt);
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeWork.min / stats.frameTimeAbs.tgt);
frameTimeWorkPct->setText(3, tr(stmp));
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeWork.max / stats.frameTimeAbs.tgt);
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeWork.max / stats.frameTimeAbs.tgt);
frameTimeWorkPct->setText(4, tr(stmp));
// Idle %
sprintf(stmp, "gt %.1f", 100.0 * stats.frameTimeIdle.tgt / stats.frameTimeAbs.tgt);
snprintf(stmp, sizeof(stmp), "gt %.1f", 100.0 * stats.frameTimeIdle.tgt / stats.frameTimeAbs.tgt);
frameTimeIdlePct->setText(1, tr(stmp));
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeIdle.cur / stats.frameTimeAbs.tgt);
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeIdle.cur / stats.frameTimeAbs.tgt);
frameTimeIdlePct->setText(2, tr(stmp));
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeIdle.min / stats.frameTimeAbs.tgt);
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeIdle.min / stats.frameTimeAbs.tgt);
frameTimeIdlePct->setText(3, tr(stmp));
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeIdle.max / stats.frameTimeAbs.tgt);
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeIdle.max / stats.frameTimeAbs.tgt);
frameTimeIdlePct->setText(4, tr(stmp));
// Video
sprintf(stmp, "%.3f", stats.videoTimeDel.tgt * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.videoTimeDel.tgt * 1e3);
videoTimeAbs->setText(1, tr(stmp));
sprintf(stmp, "%.3f", stats.videoTimeDel.cur * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.videoTimeDel.cur * 1e3);
videoTimeAbs->setText(2, tr(stmp));
sprintf(stmp, "%.3f", stats.videoTimeDel.min * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.videoTimeDel.min * 1e3);
videoTimeAbs->setText(3, tr(stmp));
sprintf(stmp, "%.3f", stats.videoTimeDel.max * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.videoTimeDel.max * 1e3);
videoTimeAbs->setText(4, tr(stmp));
// Emulator to GUI Thread Signal Delay
sprintf(stmp, "%.3f", stats.emuSignalDelay.tgt * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.emuSignalDelay.tgt * 1e3);
emuSignalDelay->setText(1, tr(stmp));
sprintf(stmp, "%.3f", stats.emuSignalDelay.cur * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.emuSignalDelay.cur * 1e3);
emuSignalDelay->setText(2, tr(stmp));
sprintf(stmp, "%.3f", stats.emuSignalDelay.min * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.emuSignalDelay.min * 1e3);
emuSignalDelay->setText(3, tr(stmp));
sprintf(stmp, "%.3f", stats.emuSignalDelay.max * 1e3);
snprintf(stmp, sizeof(stmp), "%.3f", stats.emuSignalDelay.max * 1e3);
emuSignalDelay->setText(4, tr(stmp));
// Late Count
sprintf(stmp, "%u", stats.lateCount);
snprintf(stmp, sizeof(stmp), "%u", stats.lateCount);
frameLateCount->setText(1, tr("0"));
frameLateCount->setText(2, tr(stmp));

View File

@ -368,7 +368,7 @@ void GameGenieDialog_t::ggChanged(const QString &s)
if ( a >= 0 )
{
sprintf( stmp, "%04X", a );
snprintf( stmp, sizeof(stmp), "%04X", a );
addr->setText( tr(stmp) );
}
@ -379,7 +379,7 @@ void GameGenieDialog_t::ggChanged(const QString &s)
if ( v >= 0 )
{
sprintf( stmp, "%02X", v );
snprintf( stmp, sizeof(stmp), "%02X", v );
val->setText( tr(stmp) );
}
@ -390,7 +390,7 @@ void GameGenieDialog_t::ggChanged(const QString &s)
if ( c >= 0 )
{
sprintf( stmp, "%02X", c );
snprintf( stmp, sizeof(stmp), "%02X", c );
cmp->setText( tr(stmp) );
}
@ -467,7 +467,7 @@ void GameGenieDialog_t::ListGGAddresses(void)
{
item = new QTreeWidgetItem();
sprintf(str, "%06X", i + (a & 0x1FFF) + 0x10);
snprintf(str, sizeof(str), "%06X", i + (a & 0x1FFF) + 0x10);
//printf("Added ROM ADDR: %s\n", str );
item->setText( 0, tr(str) );

View File

@ -215,7 +215,7 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
{
if (js->isConnected())
{
sprintf(stmp, "%i: %s", i, js->getName());
snprintf(stmp, sizeof(stmp), "%i: %s", i, js->getName());
devSel->addItem(tr(stmp), i);
}
}
@ -328,7 +328,7 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
char text[64];
QLabel *buttonName;
sprintf(text, "%s:", GamePadNames[i]);
snprintf(text, sizeof(text), "%s:", GamePadNames[i]);
//hbox2 = new QHBoxLayout();
@ -506,7 +506,7 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
for (int i = 0; i < GAMEPAD_NUM_DEVICES; i++)
{
sprintf(stmp, "SDL.Input.GamePad.%i.", i);
snprintf(stmp, sizeof(stmp), "SDL.Input.GamePad.%i.", i);
prefix = stmp;
g_config->getOption(prefix + "Profile", &lcl[i].profile);
@ -595,7 +595,7 @@ void GamePadConfDialog_t::loadMapList(void)
fileList = dir.entryList(filters, QDir::Files, QDir::NoSort);
sprintf(stmp, "SDL.Input.GamePad.%u.", portNum);
snprintf(stmp, sizeof(stmp), "SDL.Input.GamePad.%u.", portNum);
prefix = stmp;
g_config->getOption(prefix + "Profile", &mapName);
@ -880,7 +880,7 @@ void GamePadConfDialog_t::changeButton(int padNo, int x)
( strcmp( js1->getGUID(), js2->getGUID() ) != 0 ) )
{
char stmp[256];
sprintf( stmp, "Joystick device GUID MisMatch\n\nSelected device is: \n\t%s\n\nbut button mapping is from: \n\t%s",
snprintf( stmp, sizeof(stmp), "Joystick device GUID MisMatch\n\nSelected device is: \n\t%s\n\nbut button mapping is from: \n\t%s",
js1->getName(), js2->getName() );
QMessageBox::warning( this, tr("Mapping Error"), tr(stmp),
QMessageBox::Cancel, QMessageBox::Cancel );
@ -1100,7 +1100,7 @@ void GamePadConfDialog_t::saveConfig(void)
const char *guid;
std::string prefix, mapName;
sprintf(stmp, "SDL.Input.GamePad.%u.", portNum);
snprintf(stmp, sizeof(stmp), "SDL.Input.GamePad.%u.", portNum);
prefix = stmp;
mapName = mapSel->currentText().toLocal8Bit().constData();
@ -1134,7 +1134,7 @@ void GamePadConfDialog_t::createNewProfile(const char *name)
mapSel->setCurrentIndex(mapSel->count() - 1);
saveConfig();
sprintf(stmp, "Mapping Created: %s/%s \n", GamePad[portNum].getGUID(), name);
snprintf(stmp, sizeof(stmp), "Mapping Created: %s/%s \n", GamePad[portNum].getGUID(), name);
mapMsg->setText(tr(stmp));
}
//----------------------------------------------------
@ -1180,11 +1180,11 @@ void GamePadConfDialog_t::loadProfileCallback(void)
{
saveConfig();
sprintf(stmp, "Mapping Loaded: %s/%s \n", GamePad[portNum].getGUID(), mapName.c_str());
snprintf(stmp, sizeof(stmp), "Mapping Loaded: %s/%s \n", GamePad[portNum].getGUID(), mapName.c_str());
}
else
{
sprintf(stmp, "Error: Failed to Load Mapping: %s/%s \n", GamePad[portNum].getGUID(), mapName.c_str());
snprintf(stmp, sizeof(stmp), "Error: Failed to Load Mapping: %s/%s \n", GamePad[portNum].getGUID(), mapName.c_str());
}
mapMsg->setText(tr(stmp));
@ -1207,11 +1207,11 @@ void GamePadConfDialog_t::saveProfileCallback(void)
{
saveConfig();
sprintf(stmp, "Mapping Saved: %s/%s \n", GamePad[portNum].getGUID(), mapName.c_str());
snprintf(stmp, sizeof(stmp), "Mapping Saved: %s/%s \n", GamePad[portNum].getGUID(), mapName.c_str());
}
else
{
sprintf(stmp, "Error: Failed to Save Mapping: %s \n", mapName.c_str());
snprintf(stmp, sizeof(stmp), "Error: Failed to Save Mapping: %s \n", mapName.c_str());
}
mapMsg->setText(tr(stmp));
}
@ -1228,11 +1228,11 @@ void GamePadConfDialog_t::deleteProfileCallback(void)
if (ret == 0)
{
sprintf(stmp, "Mapping Deleted: %s/%s \n", GamePad[portNum].getGUID(), mapName.c_str());
snprintf(stmp, sizeof(stmp), "Mapping Deleted: %s/%s \n", GamePad[portNum].getGUID(), mapName.c_str());
}
else
{
sprintf(stmp, "Error: Failed to Delete Mapping: %s \n", mapName.c_str());
snprintf(stmp, sizeof(stmp), "Error: Failed to Delete Mapping: %s \n", mapName.c_str());
}
mapMsg->setText(tr(stmp));
@ -1269,7 +1269,7 @@ int GamePadConfDialog_t::promptToSave(void)
{
return 0;
}
sprintf(stmp, "Warning: Gamepad mappings have not been saved for port%c ", (n > 1) ? 's' : ' ');
snprintf(stmp, sizeof(stmp), "Warning: Gamepad mappings have not been saved for port%c ", (n > 1) ? 's' : ' ');
msg.assign(stmp);
@ -1278,7 +1278,7 @@ int GamePadConfDialog_t::promptToSave(void)
{
if (padNeedsSave[i])
{
sprintf(stmp, "%i", i + 1);
snprintf(stmp, sizeof(stmp), "%i", i + 1);
msg.append(stmp);
@ -1427,7 +1427,7 @@ void GamePadConfDialog_t::updatePeriodic(void)
{
char stmp[256];
//printf("Adding Newly Connected JS\n");
sprintf(stmp, "%i: %s", i, js->getName());
snprintf(stmp, sizeof(stmp), "%i: %s", i, js->getName());
devSel->addItem(tr(stmp), i);
}
}

View File

@ -1337,7 +1337,7 @@ void GuiPaletteColorSelect::setText(void)
{
return;
}
sprintf( stmp, "%s :: %s", gTxt, rTxt );
snprintf( stmp, sizeof(stmp), "%s :: %s", gTxt, rTxt );
lbl->setText( tr(stmp) );
@ -1356,7 +1356,7 @@ void GuiPaletteColorSelect::updateColor(void)
{
txtColor.setRgb( 255, 255, 255 );
}
sprintf( stmp, "QLabel { background-color : %s; color : %s; border-color : black; }",
snprintf( stmp, sizeof(stmp), "QLabel { background-color : %s; color : %s; border-color : black; }",
color.name().toLocal8Bit().constData(), txtColor.name().toLocal8Bit().constData() );
lbl->setStyleSheet( stmp );

View File

@ -865,7 +865,7 @@ int HexEditorCharTable_t::loadFromFile( const char *filepath )
if ( hexValue > 255 )
{
sprintf( errMsg, "Error: Line %i: Hex Value 0x%X exceeds 0xFF \n", lineNum, hexValue );
snprintf( errMsg, sizeof(errMsg), "Error: Line %i: Hex Value 0x%X exceeds 0xFF \n", lineNum, hexValue );
retVal = -1;
continue;
}
@ -874,7 +874,7 @@ int HexEditorCharTable_t::loadFromFile( const char *filepath )
if ( line[i] != '=' )
{
sprintf( errMsg, "Error: Line %i: Expected assignment operator '=' but got '%c' \n", lineNum, line[i] );
snprintf( errMsg, sizeof(errMsg), "Error: Line %i: Expected assignment operator '=' but got '%c' \n", lineNum, line[i] );
retVal = -1;
continue;
}
@ -929,7 +929,7 @@ int HexEditorCharTable_t::loadFromFile( const char *filepath )
if ( mapValue > 255 )
{
sprintf( errMsg, "Error: Line %i: Map Value 0x%X exceeds 0xFF \n", lineNum, mapValue );
snprintf( errMsg, sizeof(errMsg), "Error: Line %i: Map Value 0x%X exceeds 0xFF \n", lineNum, mapValue );
retVal = -1;
continue;
}
@ -1519,7 +1519,7 @@ void HexEditorDialog_t::setWindowTitle(void)
modeString = memViewNames[ editor->getMode() ];
sprintf( stmp, "Hex Editor - %s: 0x%04X", modeString, editor->getAddr() );
snprintf( stmp, sizeof(stmp), "Hex Editor - %s: 0x%04X", modeString, editor->getAddr() );
QDialog::setWindowTitle( tr(stmp) );
@ -2253,7 +2253,7 @@ void QHexEdit::openGotoAddrDialog(void)
QHBoxLayout *hbox;
QPushButton *okButton, *cancelButton;
sprintf( stmp, "Specify Address [ 0x0 -> 0x%X ]", mb.size()-1 );
snprintf( stmp, sizeof(stmp), "Specify Address [ 0x0 -> 0x%X ]", mb.size()-1 );
vbox = new QVBoxLayout();
hbox = new QHBoxLayout();
@ -2418,7 +2418,7 @@ void QHexEdit::loadHighlightToClipboard(void)
for (a=startAddr; a<=endAddr; a++)
{
sprintf( c, "%02X ", memAccessFunc(a) );
snprintf( c, sizeof(c), "%02X ", memAccessFunc(a) );
s.append(c);
}
@ -3145,17 +3145,17 @@ void QHexEdit::contextMenuEvent(QContextMenuEvent *event)
subMenu->addAction(act);
connect( act, SIGNAL(triggered(void)), this, SLOT(frzRamUnsetAll(void)) );
sprintf( stmp, "Add &Read Breakpoint for Address $%04X", addr );
snprintf( stmp, sizeof(stmp), "Add &Read Breakpoint for Address $%04X", addr );
act = new QAction(tr(stmp), &menu);
menu.addAction(act);
connect( act, SIGNAL(triggered(void)), this, SLOT(addRamReadBP(void)) );
sprintf( stmp, "Add &Write Breakpoint for Address $%04X", addr );
snprintf( stmp, sizeof(stmp), "Add &Write Breakpoint for Address $%04X", addr );
act = new QAction(tr(stmp), &menu);
menu.addAction(act);
connect( act, SIGNAL(triggered(void)), this, SLOT(addRamWriteBP(void)) );
sprintf( stmp, "Add &Execute Breakpoint for Address $%04X", addr );
snprintf( stmp, sizeof(stmp), "Add &Execute Breakpoint for Address $%04X", addr );
act = new QAction(tr(stmp), &menu);
menu.addAction(act);
connect( act, SIGNAL(triggered(void)), this, SLOT(addRamExecuteBP(void)) );
@ -3167,7 +3167,7 @@ void QHexEdit::contextMenuEvent(QContextMenuEvent *event)
if ( romAddr >= 0 )
{
jumpToRomValue = romAddr;
sprintf( stmp, "&Go Here in ROM File: (%08X)", romAddr );
snprintf( stmp, sizeof(stmp), "&Go Here in ROM File: (%08X)", romAddr );
act = new QAction(tr(stmp), &menu);
menu.addAction(act);
connect( act, SIGNAL(triggered(void)), this, SLOT(jumpToROM(void)) );
@ -3181,12 +3181,12 @@ void QHexEdit::contextMenuEvent(QContextMenuEvent *event)
break;
case MODE_NES_PPU:
{
sprintf( stmp, "Add &Read Breakpoint for Address $%04X", addr );
snprintf( stmp, sizeof(stmp), "Add &Read Breakpoint for Address $%04X", addr );
act = new QAction(tr(stmp), &menu);
menu.addAction(act);
connect( act, SIGNAL(triggered(void)), this, SLOT(addPpuReadBP(void)) );
sprintf( stmp, "Add &Write Breakpoint for Address $%04X", addr );
snprintf( stmp, sizeof(stmp), "Add &Write Breakpoint for Address $%04X", addr );
act = new QAction(tr(stmp), &menu);
menu.addAction(act);
connect( act, SIGNAL(triggered(void)), this, SLOT(addPpuWriteBP(void)) );
@ -3236,16 +3236,16 @@ void QHexEdit::addBookMarkCB(void)
{
default:
case MODE_NES_RAM:
sprintf( stmp, "CPU %04X", ctxAddr );
snprintf( stmp, sizeof(stmp), "CPU %04X", ctxAddr );
break;
case MODE_NES_PPU:
sprintf( stmp, "PPU %04X", ctxAddr );
snprintf( stmp, sizeof(stmp), "PPU %04X", ctxAddr );
break;
case MODE_NES_OAM:
sprintf( stmp, "OAM %04X", ctxAddr );
snprintf( stmp, sizeof(stmp), "OAM %04X", ctxAddr );
break;
case MODE_NES_ROM:
sprintf( stmp, "ROM %04X", ctxAddr );
snprintf( stmp, sizeof(stmp), "ROM %04X", ctxAddr );
break;
}
@ -3436,7 +3436,7 @@ void QHexEdit::addRamReadBP(void)
if ( ctxAddr >= 0x8000 )
{
sprintf(cond, "K==#%02X", getBank(ctxAddr));
snprintf(cond, sizeof(cond), "K==#%02X", getBank(ctxAddr));
}
retval = NewBreak( name, ctxAddr, -1, type, cond, numWPs, true);
@ -3463,7 +3463,7 @@ void QHexEdit::addRamWriteBP(void)
if ( ctxAddr >= 0x8000 )
{
sprintf(cond, "K==#%02X", getBank(ctxAddr));
snprintf(cond, sizeof(cond), "K==#%02X", getBank(ctxAddr));
}
retval = NewBreak( name, ctxAddr, -1, type, cond, numWPs, true);
@ -3490,7 +3490,7 @@ void QHexEdit::addRamExecuteBP(void)
if ( ctxAddr >= 0x8000 )
{
sprintf(cond, "K==#%02X", getBank(ctxAddr));
snprintf(cond, sizeof(cond), "K==#%02X", getBank(ctxAddr));
}
retval = NewBreak( name, ctxAddr, -1, type, cond, numWPs, true);
@ -3920,7 +3920,7 @@ void QHexEdit::paintEvent(QPaintEvent *event)
painter.setPen( fgColor );
sprintf( txt, "%06X", addr );
snprintf( txt, sizeof(txt), "%06X", addr );
painter.drawText( x, y, tr(txt) );
x = pxHexOffset - pxLineXScroll;

View File

@ -181,7 +181,7 @@ InputConfDialog_t::InputConfDialog_t(QWidget *parent)
color = pal.color(QPalette::WindowText);
sprintf(stmp, "border: 2px solid #%02X%02X%02X", color.red(), color.green(), color.blue());
snprintf(stmp, sizeof(stmp), "border: 2px solid #%02X%02X%02X", color.red(), color.green(), color.blue());
//printf("%s\n", stmp);
nesPortLabel[0]->setAlignment(Qt::AlignCenter);

View File

@ -423,7 +423,7 @@ void LuaControlDialog_t::startLuaScript(void)
if (0 == FCEU_LoadLuaCode(scriptPath->text().toLocal8Bit().constData(), scriptArgs->text().toLocal8Bit().constData()))
{
char error_msg[2048];
sprintf( error_msg, "Error: Could not open the selected lua script: '%s'\n", scriptPath->text().toLocal8Bit().constData());
snprintf( error_msg, sizeof(error_msg), "Error: Could not open the selected lua script: '%s'\n", scriptPath->text().toLocal8Bit().constData());
FCEUD_PrintError(error_msg);
}
FCEU_WRAPPER_UNLOCK();

View File

@ -247,7 +247,7 @@ void MoviePlayDialog_t::updateMovieText(void)
if (fp == NULL)
{
sprintf(stmp, "Error: Failed to open file '%s'", path.c_str());
snprintf(stmp, sizeof(stmp), "Error: Failed to open file '%s'", path.c_str());
showErrorMsgWindow(stmp);
clearMovieText();
return;
@ -260,7 +260,7 @@ void MoviePlayDialog_t::updateMovieText(void)
validator->setMinMax(0, info.num_frames);
sprintf(stmp, "%u", (unsigned)info.num_frames);
snprintf(stmp, sizeof(stmp), "%u", (unsigned)info.num_frames);
movFramesLbl->setText(tr(stmp));
pauseAtFrameEntry->setText(tr(stmp));
@ -272,11 +272,11 @@ void MoviePlayDialog_t::updateMovieText(void)
int seconds = num_seconds % 60;
int minutes = (num_seconds / 60) % 60;
int hours = (num_seconds / 60 / 60) % 60;
sprintf(stmp, "%02d:%02d:%02d.%02d", hours, minutes, seconds, fraction);
snprintf(stmp, sizeof(stmp), "%02d:%02d:%02d.%02d", hours, minutes, seconds, fraction);
movLenLbl->setText(tr(stmp));
sprintf(stmp, "%u", (unsigned)info.rerecord_count);
snprintf(stmp, sizeof(stmp), "%u", (unsigned)info.rerecord_count);
recCountLbl->setText(tr(stmp));
@ -297,11 +297,11 @@ void MoviePlayDialog_t::updateMovieText(void)
if (info.emu_version_used < 20000)
{
sprintf(stmp, "FCEU %u.%02u.%02u%s", info.emu_version_used / 10000, (info.emu_version_used / 100) % 100, (info.emu_version_used) % 100, info.emu_version_used < 9813 ? " (blip)" : "");
snprintf(stmp, sizeof(stmp), "FCEU %u.%02u.%02u%s", info.emu_version_used / 10000, (info.emu_version_used / 100) % 100, (info.emu_version_used) % 100, info.emu_version_used < 9813 ? " (blip)" : "");
}
else
{
sprintf(stmp, "FCEUX %u.%02u.%02u", info.emu_version_used / 10000, (info.emu_version_used / 100) % 100, (info.emu_version_used) % 100);
snprintf(stmp, sizeof(stmp), "FCEUX %u.%02u.%02u", info.emu_version_used / 10000, (info.emu_version_used / 100) % 100, (info.emu_version_used) % 100);
}
emuUsedLbl->setText(tr(stmp));
@ -315,14 +315,14 @@ void MoviePlayDialog_t::updateMovieText(void)
if (strcmp(stmp, md5_asciistr(info.md5_of_rom_used)) != 0)
{
sprintf(stmp, "Warning: Selected movie file '%s' may not have been created using the currently loaded ROM.", path.c_str());
snprintf(stmp, sizeof(stmp), "Warning: Selected movie file '%s' may not have been created using the currently loaded ROM.", path.c_str());
showWarningMsgWindow(stmp);
}
}
}
else
{
sprintf(stmp, "Error: Selected file '%s' does not have a recognized movie format.", path.c_str());
snprintf(stmp, sizeof(stmp), "Error: Selected file '%s' does not have a recognized movie format.", path.c_str());
showErrorMsgWindow(stmp);
clearMovieText();
}
@ -485,7 +485,7 @@ void MoviePlayDialog_t::playMovie(void)
if (movieLoadError)
{
char stmp[256];
sprintf(stmp, "Error: Could not load movie file: %s \n", path.c_str());
snprintf(stmp, sizeof(stmp), "Error: Could not load movie file: %s \n", path.c_str());
showErrorMsgWindow(stmp);
}
else

View File

@ -277,7 +277,7 @@ void MovieRecordDialog_t::recordMovie(void)
if (loadStateFailed)
{
char str [1024];
sprintf(str, "Failed to load save state \"%s\".\nRecording from current state instead...", ic_file.c_str());
snprintf(str, sizeof(str), "Failed to load save state \"%s\".\nRecording from current state instead...", ic_file.c_str());
FCEUD_PrintError(str);
}
}

View File

@ -284,7 +284,7 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
{
char stmp[8];
sprintf( stmp, "&%ix", i+1 );
snprintf( stmp, sizeof(stmp), "&%ix", i+1 );
zoomAct[i] = new QAction(tr(stmp), this);
zoomAct[i]->setCheckable(true);
@ -346,7 +346,7 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
strcpy( stmp, "Full" );
break;
default:
sprintf( stmp, "1/%i", 0x01 << i );
snprintf( stmp, sizeof(stmp), "1/%i", 0x01 << i );
break;
}
@ -768,28 +768,28 @@ void ppuNameTableViewerDialog_t::setPropertyLabels( int TileID, int TileX, int T
{
char stmp[32];
sprintf( stmp, "%02X", TileID);
snprintf( stmp, sizeof(stmp), "%02X", TileID);
tileIdxLbl->setText( tr(stmp) );
sprintf( stmp, "%04X", TileID << 4);
snprintf( stmp, sizeof(stmp), "%04X", TileID << 4);
tileAddrLbl->setText( tr(stmp) );
sprintf( stmp, "%0d, %0d", TileX, TileY);
snprintf( stmp, sizeof(stmp), "%0d, %0d", TileX, TileY);
tileLocLbl->setText( tr(stmp) );
sprintf(stmp,"%04X",PPUAddress);
snprintf( stmp, sizeof(stmp), "%04X",PPUAddress);
ppuAddrLbl->setText( tr(stmp) );
sprintf(stmp,"%1X",NameTable);
snprintf( stmp, sizeof(stmp), "%1X",NameTable);
nameTableLbl->setText( tr(stmp) );
sprintf(stmp,"%02X",Attrib);
snprintf( stmp, sizeof(stmp), "%02X",Attrib);
attrDataLbl->setText( tr(stmp) );
sprintf(stmp,"%04X",AttAddress);
snprintf( stmp, sizeof(stmp), "%04X",AttAddress);
attrAddrLbl->setText( tr(stmp) );
sprintf(stmp,"%04X", palAddr );
snprintf( stmp, sizeof(stmp), "%04X", palAddr );
palAddrLbl->setText( tr(stmp) );
}
@ -1341,25 +1341,25 @@ void ppuNameTableView_t::contextMenuEvent(QContextMenuEvent *event)
redrawtables = true;
sprintf( stmp, "Open Tile $%04X in PPU &Viewer", tileAddr );
snprintf( stmp, sizeof(stmp), "Open Tile $%04X in PPU &Viewer", tileAddr );
act = new QAction(tr(stmp), &menu);
//act->setShortcut( QKeySequence(tr("V")));
connect( act, SIGNAL(triggered(void)), this, SLOT(openTilePpuViewer(void)) );
menu.addAction( act );
sprintf( stmp, "Open &Tile Addr $%04X in Hex Editor", tileAddr );
snprintf( stmp, sizeof(stmp), "Open &Tile Addr $%04X in Hex Editor", tileAddr );
act = new QAction(tr(stmp), &menu);
//act->setShortcut( QKeySequence(tr("H")));
connect( act, SIGNAL(triggered(void)), this, SLOT(openTileAddrHexEdit(void)) );
menu.addAction( act );
sprintf( stmp, "Open &Attr Addr $%04X in Hex Editor", atrbAddr );
snprintf( stmp, sizeof(stmp), "Open &Attr Addr $%04X in Hex Editor", atrbAddr );
act = new QAction(tr(stmp), &menu);
//act->setShortcut( QKeySequence(tr("H")));
connect( act, SIGNAL(triggered(void)), this, SLOT(openAtrbAddrHexEdit(void)) );
menu.addAction( act );
sprintf( stmp, "Open &PPU Addr $%04X in Hex Editor", ppuAddr );
snprintf( stmp, sizeof(stmp), "Open &PPU Addr $%04X in Hex Editor", ppuAddr );
act = new QAction(tr(stmp), &menu);
//act->setShortcut( QKeySequence(tr("H")));
connect( act, SIGNAL(triggered(void)), this, SLOT(openPpuAddrHexEdit(void)) );

View File

@ -143,7 +143,7 @@ PaletteConfDialog_t::PaletteConfDialog_t(QWidget *parent)
connect(ntscFrame, SIGNAL(clicked(bool)), this, SLOT(use_NTSC_Changed(bool)));
sprintf(stmp, "Tint: %3i", tint);
snprintf(stmp, sizeof(stmp), "Tint: %3i", tint);
tintFrame = new QGroupBox(tr(stmp));
hbox1 = new QHBoxLayout();
tintSlider = new QSlider(Qt::Horizontal);
@ -157,7 +157,7 @@ PaletteConfDialog_t::PaletteConfDialog_t(QWidget *parent)
tintFrame->setLayout(hbox1);
hbox2->addWidget(tintFrame);
sprintf(stmp, "Hue: %3i", hue);
snprintf(stmp, sizeof(stmp), "Hue: %3i", hue);
hueFrame = new QGroupBox(tr(stmp));
hbox1 = new QHBoxLayout();
hueSlider = new QSlider(Qt::Horizontal);
@ -190,7 +190,7 @@ PaletteConfDialog_t::PaletteConfDialog_t(QWidget *parent)
grid->setColumnStretch( 1, 40 );
grid->setColumnStretch( 2, 20 );
sprintf(stmp, "Notch: %3i%%", palnotch);
snprintf(stmp, sizeof(stmp), "Notch: %3i%%", palnotch);
notchFrame = new QGroupBox(tr(stmp));
#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
notchFrame->setMinimumWidth( notchFrame->fontMetrics().horizontalAdvance('2') * strlen(stmp) );
@ -207,7 +207,7 @@ PaletteConfDialog_t::PaletteConfDialog_t(QWidget *parent)
hbox1->addWidget(notchSlider);
notchFrame->setLayout(hbox1);
sprintf(stmp, "Saturation: %3i%%", palsaturation);
snprintf(stmp, sizeof(stmp), "Saturation: %3i%%", palsaturation);
saturationFrame = new QGroupBox(tr(stmp));
#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
saturationFrame->setMinimumWidth( saturationFrame->fontMetrics().horizontalAdvance('2') * strlen(stmp) );
@ -224,7 +224,7 @@ PaletteConfDialog_t::PaletteConfDialog_t(QWidget *parent)
hbox1->addWidget(saturationSlider);
saturationFrame->setLayout(hbox1);
sprintf(stmp, "Sharpness: %3i%%", palsharpness*2);
snprintf(stmp, sizeof(stmp), "Sharpness: %3i%%", palsharpness*2);
sharpnessFrame = new QGroupBox(tr(stmp));
#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
sharpnessFrame->setMinimumWidth( sharpnessFrame->fontMetrics().horizontalAdvance('2') * strlen(stmp) );
@ -241,7 +241,7 @@ PaletteConfDialog_t::PaletteConfDialog_t(QWidget *parent)
hbox1->addWidget(sharpnessSlider);
sharpnessFrame->setLayout(hbox1);
sprintf(stmp, "Contrast: %3i%%", palcontrast);
snprintf(stmp, sizeof(stmp), "Contrast: %3i%%", palcontrast);
contrastFrame = new QGroupBox(tr(stmp));
#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
contrastFrame->setMinimumWidth( contrastFrame->fontMetrics().horizontalAdvance('2') * strlen(stmp) );
@ -258,7 +258,7 @@ PaletteConfDialog_t::PaletteConfDialog_t(QWidget *parent)
hbox1->addWidget(contrastSlider);
contrastFrame->setLayout(hbox1);
sprintf(stmp, "Brightness: %3i%%", palbrightness);
snprintf(stmp, sizeof(stmp), "Brightness: %3i%%", palbrightness);
brightnessFrame = new QGroupBox(tr(stmp));
#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
brightnessFrame->setMinimumWidth( brightnessFrame->fontMetrics().horizontalAdvance('2') * strlen(stmp) );
@ -361,7 +361,7 @@ void PaletteConfDialog_t::hueChanged(int v)
int c, t;
char stmp[64];
sprintf(stmp, "Hue: %3i", v);
snprintf(stmp, sizeof(stmp), "Hue: %3i", v);
hueFrame->setTitle(stmp);
@ -382,7 +382,7 @@ void PaletteConfDialog_t::tintChanged(int v)
int c, h;
char stmp[64];
sprintf(stmp, "Tint: %3i", v);
snprintf(stmp, sizeof(stmp), "Tint: %3i", v);
tintFrame->setTitle(stmp);
@ -653,7 +653,7 @@ void PaletteConfDialog_t::palNotchChanged(int value)
{
char stmp[64];
sprintf( stmp, "Notch: %3i%%", value );
snprintf( stmp, sizeof(stmp), "Notch: %3i%%", value );
notchFrame->setTitle( tr(stmp) );
palnotch = value;
@ -671,7 +671,7 @@ void PaletteConfDialog_t::palSaturationChanged(int value)
{
char stmp[64];
sprintf( stmp, "Saturation: %3i%%", value );
snprintf( stmp, sizeof(stmp), "Saturation: %3i%%", value );
saturationFrame->setTitle( tr(stmp) );
palsaturation = value;
@ -689,7 +689,7 @@ void PaletteConfDialog_t::palSharpnessChanged(int value)
{
char stmp[64];
sprintf( stmp, "Sharpness: %3i%%", value*2 );
snprintf( stmp, sizeof(stmp), "Sharpness: %3i%%", value*2 );
sharpnessFrame->setTitle( tr(stmp) );
palsharpness = value;
@ -707,7 +707,7 @@ void PaletteConfDialog_t::palContrastChanged(int value)
{
char stmp[64];
sprintf( stmp, "Contrast: %3i%%", value );
snprintf( stmp, sizeof(stmp), "Contrast: %3i%%", value );
contrastFrame->setTitle( tr(stmp) );
palcontrast = value;
@ -725,7 +725,7 @@ void PaletteConfDialog_t::palBrightnessChanged(int value)
{
char stmp[64];
sprintf( stmp, "Brightness: %3i%%", value );
snprintf( stmp, sizeof(stmp), "Brightness: %3i%%", value );
brightnessFrame->setTitle( tr(stmp) );
palbrightness = value;

View File

@ -232,7 +232,7 @@ void PaletteEditorDialog_t::updatePeriodic(void)
chg = undoColorHistory.back();
sprintf( stmp, "&Undo $%02X = rgb(%3i,%3i,%3i)", chg.palIdx,
snprintf( stmp, sizeof(stmp), "&Undo $%02X = rgb(%3i,%3i,%3i)", chg.palIdx,
chg.newColor.red(), chg.newColor.green(), chg.newColor.blue() );
undoAct->setText( tr(stmp) );
@ -249,7 +249,7 @@ void PaletteEditorDialog_t::updatePeriodic(void)
chg = redoColorHistory.back();
sprintf( stmp, "&Redo $%02X = rgb(%3i,%3i,%3i)", chg.palIdx,
snprintf( stmp, sizeof(stmp), "&Redo $%02X = rgb(%3i,%3i,%3i)", chg.palIdx,
chg.newColor.red(), chg.newColor.green(), chg.newColor.blue() );
redoAct->setText( tr(stmp) );
@ -798,7 +798,7 @@ void nesPaletteView::contextMenuEvent(QContextMenuEvent *event)
update();
}
sprintf( stmp, "Edit Color %X%X", selCell.y(), selCell.x() );
snprintf( stmp, sizeof(stmp), "Edit Color %X%X", selCell.y(), selCell.x() );
act = new QAction(tr(stmp), &menu);
act->setShortcut( QKeySequence(tr("E")));
connect( act, SIGNAL(triggered(void)), this, SLOT(editSelColor(void)) );
@ -947,7 +947,7 @@ nesColorPickerDialog_t::nesColorPickerDialog_t( int palIndex, QColor *c, QWidget
style = this->style();
sprintf( stmp, "Pick Palette Color $%02X", palIndex );
snprintf( stmp, sizeof(stmp), "Pick Palette Color $%02X", palIndex );
setWindowTitle( stmp );
@ -1220,7 +1220,7 @@ void nesPalettePickerView::contextMenuEvent(QContextMenuEvent *event)
// //QActionGroup *group;
// char stmp[64];
//
// sprintf( stmp, "Edit Color %X%X", selCell.y(), selCell.x() );
// snprintf( stmp, sizeof(stmp), "Edit Color %X%X", selCell.y(), selCell.x() );
// act = new QAction(tr(stmp), &menu);
// act->setShortcut( QKeySequence(tr("E")));
// connect( act, SIGNAL(triggered(void)), this, SLOT(editSelColor(void)) );
@ -1341,7 +1341,7 @@ nesPalettePickerDialog::nesPalettePickerDialog( int idx, QWidget *parent)
palIdx = idx;
palAddr = 0x3F00 + palIdx;
sprintf( stmp, "Pick Palette Color for Address $%04X", palAddr );
snprintf( stmp, sizeof(stmp), "Pick Palette Color for Address $%04X", palAddr );
setWindowTitle( tr(stmp) );
palOrigVal = READPAL_MOTHEROFALL(palIdx & 0x1F);

View File

@ -2012,63 +2012,63 @@ void QRamSearchView::paintEvent(QPaintEvent *event)
painter.fillRect(0, y - pxLineSpacing + pxLineLead, viewWidth, pxLineSpacing, QColor("light blue"));
}
sprintf(addrStr, "$%04X", loc->addr);
snprintf(addrStr, sizeof(addrStr), "$%04X", loc->addr);
if (dpySize == 'd')
{
if (dpyType == 'h')
{
sprintf(valStr, "0x%08X", loc->val.v32.u);
sprintf(prevStr, "0x%08X", loc->hist.back().v32.u);
snprintf(valStr, sizeof(valStr), "0x%08X", loc->val.v32.u);
snprintf(prevStr, sizeof(prevStr), "0x%08X", loc->hist.back().v32.u);
}
else if (dpyType == 'u')
{
sprintf(valStr, "%u", loc->val.v32.u);
sprintf(prevStr, "%u", loc->hist.back().v32.u);
snprintf(valStr, sizeof(valStr), "%u", loc->val.v32.u);
snprintf(prevStr, sizeof(prevStr), "%u", loc->hist.back().v32.u);
}
else
{
sprintf(valStr, "%i", loc->val.v32.i);
sprintf(prevStr, "%i", loc->hist.back().v32.i);
snprintf(valStr, sizeof(valStr), "%i", loc->val.v32.i);
snprintf(prevStr, sizeof(prevStr), "%i", loc->hist.back().v32.i);
}
}
else if (dpySize == 'w')
{
if (dpyType == 'h')
{
sprintf(valStr, "0x%04X", loc->val.v16.u);
sprintf(prevStr, "0x%04X", loc->hist.back().v16.u);
snprintf(valStr, sizeof(valStr), "0x%04X", loc->val.v16.u);
snprintf(prevStr, sizeof(prevStr), "0x%04X", loc->hist.back().v16.u);
}
else if (dpyType == 'u')
{
sprintf(valStr, "%u", loc->val.v16.u);
sprintf(prevStr, "%u", loc->hist.back().v16.u);
snprintf(valStr, sizeof(valStr), "%u", loc->val.v16.u);
snprintf(prevStr, sizeof(prevStr), "%u", loc->hist.back().v16.u);
}
else
{
sprintf(valStr, "%i", loc->val.v16.i);
sprintf(prevStr, "%i", loc->hist.back().v16.i);
snprintf(valStr, sizeof(valStr), "%i", loc->val.v16.i);
snprintf(prevStr, sizeof(prevStr), "%i", loc->hist.back().v16.i);
}
}
else
{
if (dpyType == 'h')
{
sprintf(valStr, "0x%02X", loc->val.v8.u);
sprintf(prevStr, "0x%02X", loc->hist.back().v8.u);
snprintf(valStr, sizeof(valStr), "0x%02X", loc->val.v8.u);
snprintf(prevStr, sizeof(prevStr), "0x%02X", loc->hist.back().v8.u);
}
else if (dpyType == 'u')
{
sprintf(valStr, "%u", loc->val.v8.u);
sprintf(prevStr, "%u", loc->hist.back().v8.u);
snprintf(valStr, sizeof(valStr), "%u", loc->val.v8.u);
snprintf(prevStr, sizeof(prevStr), "%u", loc->hist.back().v8.u);
}
else
{
sprintf(valStr, "%i", loc->val.v8.i);
sprintf(prevStr, "%i", loc->hist.back().v8.i);
snprintf(valStr, sizeof(valStr), "%i", loc->val.v8.i);
snprintf(prevStr, sizeof(prevStr), "%i", loc->hist.back().v8.i);
}
}
sprintf(chgStr, "%u", loc->chgCount);
snprintf(chgStr, sizeof(chgStr), "%u", loc->chgCount);
for (i = 0; i < 4; i++)
{

View File

@ -403,11 +403,11 @@ void RamWatchDialog_t::updateRamWatchDisplay(void)
{
if ( rw->size > 1 )
{
sprintf (addrStr, "$%04X-$%04X", rw->addr, rw->addr + rw->size - 1);
snprintf (addrStr, sizeof(addrStr), "$%04X-$%04X", rw->addr, rw->addr + rw->size - 1);
}
else
{
sprintf (addrStr, "$%04X", rw->addr);
snprintf (addrStr, sizeof(addrStr), "$%04X", rw->addr);
}
}
@ -424,37 +424,37 @@ void RamWatchDialog_t::updateRamWatchDisplay(void)
{
if (rw->type == 's')
{
sprintf (valStr1, "%i", rw->val.i32);
snprintf (valStr1, sizeof(valStr1), "%i", rw->val.i32);
}
else
{
sprintf (valStr1, "%u", rw->val.u32);
snprintf (valStr1, sizeof(valStr1), "%u", rw->val.u32);
}
sprintf (valStr2, "0x%08X", rw->val.u32);
snprintf (valStr2, sizeof(valStr2), "0x%08X", rw->val.u32);
}
else if (rw->size == 2)
{
if (rw->type == 's')
{
sprintf (valStr1, "%6i", rw->val.i16);
snprintf (valStr1, sizeof(valStr1), "%6i", rw->val.i16);
}
else
{
sprintf (valStr1, "%6u", rw->val.u16);
snprintf (valStr1, sizeof(valStr1), "%6u", rw->val.u16);
}
sprintf (valStr2, "0x%04X", rw->val.u16);
snprintf (valStr2, sizeof(valStr2), "0x%04X", rw->val.u16);
}
else
{
if (rw->type == 's')
{
sprintf (valStr1, "%6i", rw->val.i8);
snprintf (valStr1, sizeof(valStr1), "%6i", rw->val.i8);
}
else
{
sprintf (valStr1, "%6u", rw->val.u8);
snprintf (valStr1, sizeof(valStr1), "%6u", rw->val.u8);
}
sprintf (valStr2, "0x%02X", rw->val.u8);
snprintf (valStr2, sizeof(valStr2), "0x%02X", rw->val.u8);
}
}
@ -851,7 +851,7 @@ void RamWatchDialog_t::openWatchEditWindow( ramWatch_t *rw, int mode)
if ( (rw->addr >= 0) && !rw->isSep )
{
sprintf( stmp, "%04X", rw->addr );
snprintf( stmp, sizeof(stmp), "%04X", rw->addr );
addrEntry->setText( tr(stmp) );
}
else

View File

@ -606,7 +606,7 @@ void StateRecorderDialog_t::recalcMemoryUsage(void)
int inumSnaps = static_cast<int>( fnumSnaps + 0.5f );
sprintf( stmp, "%i", inumSnaps );
snprintf( stmp, sizeof(stmp), "%i", inumSnaps );
numSnapsLbl->setText( tr(stmp) );
@ -642,11 +642,11 @@ void StateRecorderDialog_t::recalcMemoryUsage(void)
if (fsnapSize >= oneKiloByte)
{
sprintf( stmp, "%.02f kB", fsnapSize / oneKiloByte );
snprintf( stmp, sizeof(stmp), "%.02f kB", fsnapSize / oneKiloByte );
}
else
{
sprintf( stmp, "%.0f B", fsnapSize );
snprintf( stmp, sizeof(stmp), "%.0f B", fsnapSize );
}
snapMemSizeLbl->setText( tr(stmp) );
@ -655,20 +655,20 @@ void StateRecorderDialog_t::recalcMemoryUsage(void)
if (ftotalSize >= oneMegaByte)
{
sprintf( stmp, "%.02f MB", ftotalSize / oneMegaByte );
snprintf( stmp, sizeof(stmp), "%.02f MB", ftotalSize / oneMegaByte );
}
else if (ftotalSize >= oneKiloByte)
{
sprintf( stmp, "%.02f kB", ftotalSize / oneKiloByte );
snprintf( stmp, sizeof(stmp), "%.02f kB", ftotalSize / oneKiloByte );
}
else
{
sprintf( stmp, "%.0f B", ftotalSize );
snprintf( stmp, sizeof(stmp), "%.0f B", ftotalSize );
}
totalMemUsageLbl->setText( tr(stmp) );
sprintf( stmp, "%.02f ms", saveTimeMs);
snprintf( stmp, sizeof(stmp), "%.02f ms", saveTimeMs);
saveTimeLbl->setText( tr(stmp) );
}
//----------------------------------------------------------------------------

View File

@ -117,7 +117,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
#ifdef BRK_3BYTE_HACK
case 0x00:
sprintf(str,"BRK %02X %02X", opcode[1], opcode[2]);
snprintf(str, sizeof(str), "BRK %02X %02X", opcode[1], opcode[2]);
break;
#else
case 0x00: strcpy(str,"BRK"); break;
@ -699,7 +699,7 @@ void SymbolEditWindow::setAddr( int addrIn )
addr = addrIn;
sprintf( stmp, "%04X", addr );
snprintf( stmp, sizeof(stmp), "%04X", addr );
addrEntry->setText( tr(stmp) );
@ -921,7 +921,7 @@ void SymbolEditWindow::determineArrayStart(void)
if ( (val >= 0) && (val < 256) )
{
sprintf( digits, "%02X", val );
snprintf( digits, sizeof(digits), "%02X", val );
arrayInit->setText( tr(digits) );
}

View File

@ -329,6 +329,20 @@ void TimingConfDialog_t::saveValues(void)
#endif
}
//----------------------------------------------------------------------------
QString TimingConfDialog_t::getSchedPrioErrorMsg(const char* funcName, int errorCode)
{
QString msg = QString("Error: system call setPriority Failed\nReason: ") + QString(strerror(errorCode)) + QString("\n");
#ifdef __linux__
msg += "Ensure that your system has the proper resource permissions set in the file:\n\n";
msg += " /etc/security/limits.conf \n\n";
msg += "Adding the following lines to that file and rebooting will usually fix the issue:\n\n";
msg += "* - priority 99 \n";
msg += "* - rtprio 99 \n";
msg += "* - nice -20 \n";
#endif
return msg;
}
//----------------------------------------------------------------------------
void TimingConfDialog_t::emuSchedNiceChange(int val)
{
#ifndef WIN32
@ -339,19 +353,9 @@ void TimingConfDialog_t::emuSchedNiceChange(int val)
FCEU_WRAPPER_LOCK();
if (consoleWindow->emulatorThread->setNicePriority(-val))
{
char msg[1024];
sprintf(msg, "Error: system call setPriority Failed\nReason: %s\n", strerror(errno));
#ifdef __linux__
strcat(msg, "Ensure that your system has the proper resource permissions set in the file:\n\n");
strcat(msg, " /etc/security/limits.conf \n\n");
strcat(msg, "Adding the following lines to that file and rebooting will usually fix the issue:\n\n");
strcat(msg, "* - priority 99 \n");
strcat(msg, "* - rtprio 99 \n");
strcat(msg, "* - nice -20 \n");
#endif
printf("%s\n", msg);
consoleWindow->QueueErrorMsgWindow(msg);
QString msg = getSchedPrioErrorMsg("setPriority", errno);
printf("%s\n", msg.toLocal8Bit().constData());
consoleWindow->QueueErrorMsgWindow(msg.toLocal8Bit().constData());
updateSliderValues();
}
FCEU_WRAPPER_UNLOCK();
@ -377,19 +381,9 @@ void TimingConfDialog_t::emuSchedPrioChange(int val)
if (consoleWindow->emulatorThread->setSchedParam(policy, val))
{
char msg[1024];
sprintf(msg, "Error: system call pthread_setschedparam Failed\nReason: %s\n", strerror(errno));
#ifdef __linux__
strcat(msg, "Ensure that your system has the proper resource permissions set in the file:\n\n");
strcat(msg, " /etc/security/limits.conf \n\n");
strcat(msg, "Adding the following lines to that file and rebooting will usually fix the issue:\n\n");
strcat(msg, "* - priority 99 \n");
strcat(msg, "* - rtprio 99 \n");
strcat(msg, "* - nice -20 \n");
#endif
printf("%s\n", msg);
consoleWindow->QueueErrorMsgWindow(msg);
QString msg = getSchedPrioErrorMsg("pthread_setschedparam", errno);
printf("%s\n", msg.toLocal8Bit().constData());
consoleWindow->QueueErrorMsgWindow(msg.toLocal8Bit().constData());
updateSliderValues();
}
FCEU_WRAPPER_UNLOCK();
@ -412,19 +406,9 @@ void TimingConfDialog_t::emuSchedPolicyChange(int index)
if (consoleWindow->emulatorThread->setSchedParam(policy, prio))
{
char msg[1024];
sprintf(msg, "Error: system call pthread_setschedparam Failed\nReason: %s\n", strerror(errno));
#ifdef __linux__
strcat(msg, "Ensure that your system has the proper resource permissions set in the file:\n\n");
strcat(msg, " /etc/security/limits.conf \n\n");
strcat(msg, "Adding the following lines to that file and rebooting will usually fix the issue:\n\n");
strcat(msg, "* - priority 99 \n");
strcat(msg, "* - rtprio 99 \n");
strcat(msg, "* - nice -20 \n");
#endif
printf("%s\n", msg);
consoleWindow->QueueErrorMsgWindow(msg);
QString msg = getSchedPrioErrorMsg("pthread_setschedparam", errno);
printf("%s\n", msg.toLocal8Bit().constData());
consoleWindow->QueueErrorMsgWindow(msg.toLocal8Bit().constData());
}
updatePolicyBox();
@ -444,19 +428,9 @@ void TimingConfDialog_t::guiSchedNiceChange(int val)
FCEU_WRAPPER_LOCK();
if (consoleWindow->setNicePriority(-val))
{
char msg[1024];
sprintf(msg, "Error: system call setPriority Failed\nReason: %s\n", strerror(errno));
#ifdef __linux__
strcat(msg, "Ensure that your system has the proper resource permissions set in the file:\n\n");
strcat(msg, " /etc/security/limits.conf \n\n");
strcat(msg, "Adding the following lines to that file and rebooting will usually fix the issue:\n\n");
strcat(msg, "* - priority 99 \n");
strcat(msg, "* - rtprio 99 \n");
strcat(msg, "* - nice -20 \n");
#endif
printf("%s\n", msg);
consoleWindow->QueueErrorMsgWindow(msg);
QString msg = getSchedPrioErrorMsg("setPriority", errno);
printf("%s\n", msg.toLocal8Bit().constData());
consoleWindow->QueueErrorMsgWindow(msg.toLocal8Bit().constData());
updateSliderValues();
}
FCEU_WRAPPER_UNLOCK();
@ -480,19 +454,9 @@ void TimingConfDialog_t::guiSchedPrioChange(int val)
if (consoleWindow->setSchedParam(policy, val))
{
char msg[1024];
sprintf(msg, "Error: system call pthread_setschedparam Failed\nReason: %s\n", strerror(errno));
#ifdef __linux__
strcat(msg, "Ensure that your system has the proper resource permissions set in the file:\n\n");
strcat(msg, " /etc/security/limits.conf \n\n");
strcat(msg, "Adding the following lines to that file and rebooting will usually fix the issue:\n\n");
strcat(msg, "* - priority 99 \n");
strcat(msg, "* - rtprio 99 \n");
strcat(msg, "* - nice -20 \n");
#endif
printf("%s\n", msg);
consoleWindow->QueueErrorMsgWindow(msg);
QString msg = getSchedPrioErrorMsg("pthread_setschedparam", errno);
printf("%s\n", msg.toLocal8Bit().constData());
consoleWindow->QueueErrorMsgWindow(msg.toLocal8Bit().constData());
updateSliderValues();
}
FCEU_WRAPPER_UNLOCK();
@ -515,19 +479,9 @@ void TimingConfDialog_t::guiSchedPolicyChange(int index)
if (consoleWindow->setSchedParam(policy, prio))
{
char msg[1024];
sprintf(msg, "Error: system call pthread_setschedparam Failed\nReason: %s\n", strerror(errno));
#ifdef __linux__
strcat(msg, "Ensure that your system has the proper resource permissions set in the file:\n\n");
strcat(msg, " /etc/security/limits.conf \n\n");
strcat(msg, "Adding the following lines to that file and rebooting will usually fix the issue:\n\n");
strcat(msg, "* - priority 99 \n");
strcat(msg, "* - rtprio 99 \n");
strcat(msg, "* - nice -20 \n");
#endif
printf("%s\n", msg);
consoleWindow->QueueErrorMsgWindow(msg);
QString msg = getSchedPrioErrorMsg("pthread_setschedparam", errno);
printf("%s\n", msg.toLocal8Bit().constData());
consoleWindow->QueueErrorMsgWindow(msg.toLocal8Bit().constData());
}
updatePolicyBox();

View File

@ -63,6 +63,7 @@ private:
void updateTimingMech(void);
void updateOverclocking(void);
void saveValues(void);
QString getSchedPrioErrorMsg(const char* funcName, int errorCode);
public slots:
void closeWindow(void);

View File

@ -1244,7 +1244,7 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
olddatacount = datacount;
if (unloggedlines > 0)
{
//sprintf(str_result, "(%d lines skipped)", unloggedlines);
//snprintf(str_result, "(%d lines skipped)", unloggedlines);
rec.skippedLines = unloggedlines;
unloggedlines = 0;
}
@ -1265,8 +1265,8 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
if ((addr + size) > 0xFFFF)
{
//sprintf(str_data, "%02X ", opcode[0]);
//sprintf(str_disassembly, "OVERFLOW");
//snprintf(str_data, "%02X ", opcode[0]);
//snprintf(str_disassembly, "OVERFLOW");
rec.flags |= 0x01;
}
else
@ -1275,7 +1275,7 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
switch (size)
{
case 0:
//sprintf(str_disassembly,"UNDEFINED");
//snprintf(str_disassembly,"UNDEFINED");
rec.flags |= 0x02;
break;
case 1:
@ -1912,13 +1912,13 @@ void QTraceLogView::openBpEditWindow(int editIdx, watchpointinfo *wp, traceRecor
sprite_radio->setChecked(true);
}
sprintf(stmp, "%04X", wp->address);
snprintf(stmp, sizeof(stmp), "%04X", wp->address);
addr1->setText(tr(stmp));
if (wp->endaddress > 0)
{
sprintf(stmp, "%04X", wp->endaddress);
snprintf(stmp, sizeof(stmp), "%04X", wp->endaddress);
addr2->setText(tr(stmp));
}
@ -1958,11 +1958,11 @@ void QTraceLogView::openBpEditWindow(int editIdx, watchpointinfo *wp, traceRecor
char str[64];
if ((wp->address == recp->cpu.PC) && (recp->bank >= 0))
{
sprintf(str, "K==#%02X", recp->bank);
snprintf(str, sizeof(str), "K==#%02X", recp->bank);
}
else
{
sprintf(str, "K==#%02X", getBank(wp->address));
snprintf(str, sizeof(str), "K==#%02X", getBank(wp->address));
}
cond->setText(tr(str));
}
@ -2415,7 +2415,7 @@ void TraceLogDiskThread_t::run(void)
if (!tracer.open(logFilePath.c_str(), (bool)FCEUI_EmulationPaused()))
{
char stmp[1024];
sprintf( stmp, "Error: Failed to open log file for writing: %s", logFilePath.c_str() );
snprintf( stmp, sizeof(stmp), "Error: Failed to open log file for writing: %s", logFilePath.c_str() );
consoleWindow->QueueErrorMsgWindow(stmp);
return;
}
@ -2431,7 +2431,7 @@ void TraceLogDiskThread_t::run(void)
if ( logFile == -1 )
{
char stmp[1024];
sprintf( stmp, "Error: Failed to open log file for writing: %s", logFilePath.c_str() );
snprintf( stmp, sizeof(stmp), "Error: Failed to open log file for writing: %s", logFilePath.c_str() );
consoleWindow->QueueErrorMsgWindow(stmp);
return;
}

View File

@ -817,7 +817,7 @@ InitConfig()
for (unsigned int i=0; i<10; i++)
{
char buf[128];
sprintf(buf, "SDL.RecentRom%02u", i);
snprintf(buf, sizeof(buf), "SDL.RecentRom%02u", i);
config->addOption( buf, "");
}
@ -825,7 +825,7 @@ InitConfig()
for (unsigned int i=0; i<10; i++)
{
char buf[128];
sprintf(buf, "SDL.RecentTasProject%02u", i);
snprintf(buf, sizeof(buf), "SDL.RecentTasProject%02u", i);
config->addOption( buf, "");
}
@ -1084,7 +1084,7 @@ InitConfig()
//keyText.assign(" mod=");
//sprintf( buf, " key=%s", SDL_GetKeyName( Hotkeys[i] ) );
//snprintf( buf, sizeof(buf), " key=%s", SDL_GetKeyName( Hotkeys[i] ) );
if ( hotKeyName[0] != 0 )
{

View File

@ -1371,7 +1371,7 @@ void fceuWrapperLock(const char *filename, int line, const char *func)
printf("Already Locked By: %s\n", lockFile.c_str() );
printf("Requested By: %s:%i - %s\n", filename, line, func );
}
sprintf( txt, ":%i - ", line );
snprintf( txt, sizeof(txt), ":%i - ", line );
lockFile.assign(filename);
lockFile.append(txt);
lockFile.append(func);
@ -1398,7 +1398,7 @@ bool fceuWrapperTryLock(const char *filename, int line, const char *func, int ti
if ( lockAcq && debugMutexLock)
{
char txt[32];
sprintf( txt, ":%i - ", line );
snprintf( txt, sizeof(txt), ":%i - ", line );
lockFile.assign(filename);
lockFile.append(txt);
lockFile.append(func);

View File

@ -238,7 +238,7 @@ iNesHeaderEditor_t::iNesHeaderEditor_t(QWidget *parent)
for (i = 0; bmap[i].init; ++i)
{
sprintf(stmp, "%d %s", bmap[i].number, bmap[i].name);
snprintf(stmp, sizeof(stmp), "%d %s", bmap[i].number, bmap[i].name);
mapperComboBox->addItem( tr(stmp), bmap[i].number );
}
@ -307,25 +307,25 @@ iNesHeaderEditor_t::iNesHeaderEditor_t(QWidget *parent)
if (size >= 1024 << 3)
{
// The size of CHR ROM must be multiple of 8KB
sprintf( stmp, "%d KB", size / 1024);
snprintf( stmp, sizeof(stmp), "%d KB", size / 1024);
chrRomBox->addItem( tr(stmp), size );
// The size of PRG ROM must be multiple of 16KB
if (size >= 1024 * 16)
{
// PRG ROM
sprintf(stmp, "%d KB", size / 1024);
snprintf(stmp, sizeof(stmp), "%d KB", size / 1024);
prgRomBox->addItem( tr(stmp), size );
}
}
if (size >= 1024)
{
sprintf( stmp, "%d KB", size / 1024);
snprintf( stmp, sizeof(stmp), "%d KB", size / 1024);
}
else
{
sprintf( stmp, "%d B", size);
snprintf( stmp, sizeof(stmp), "%d B", size);
}
prgRamBox->addItem( tr(stmp), size );
@ -911,7 +911,7 @@ void iNesHeaderEditor_t::setHeaderData(iNES_HEADER* header)
{
if ( mapperComboBox->itemData(i).toInt() > mapper )
{
sprintf( buf, "%i Unknown/unsupported", i);
snprintf( buf, sizeof(buf), "%i Unknown/unsupported", i);
mapperComboBox->insertItem( i, tr(buf), mapper);
mapperComboBox->setCurrentIndex(i);
break;
@ -924,7 +924,7 @@ void iNesHeaderEditor_t::setHeaderData(iNES_HEADER* header)
}
// Sub Mapper
sprintf(buf, "%d", ines20 ? header->ROM_type3 >> 4 : 0);
snprintf(buf, sizeof(buf), "%d", ines20 ? header->ROM_type3 >> 4 : 0);
mapperSubEdit->setText( tr(buf) );
@ -1210,7 +1210,7 @@ void iNesHeaderEditor_t::setHeaderData(iNES_HEADER* header)
}
// Miscellaneous ROM Area(s)
sprintf(buf, "%d", header->misc_roms & 3);
snprintf(buf, sizeof(buf), "%d", header->misc_roms & 3);
miscRomsEdit->setText( tr(buf) );
// Trainer
@ -1398,7 +1398,7 @@ bool iNesHeaderEditor_t::WriteHeaderData(iNES_HEADER* header)
}
else
{
sprintf(buf, "Error: Mapper# should be less than %d in iNES %d.0 format.", 256, 1);
snprintf(buf, sizeof(buf), "Error: Mapper# should be less than %d in iNES %d.0 format.", 256, 1);
showErrorMsgWindow(buf);
return false;
}
@ -1406,7 +1406,7 @@ bool iNesHeaderEditor_t::WriteHeaderData(iNES_HEADER* header)
}
else
{
sprintf(buf, "Mapper# should be less than %d in iNES %d.0 format.", 4096, 2);
snprintf(buf, sizeof(buf), "Mapper# should be less than %d in iNES %d.0 format.", 4096, 2);
showErrorMsgWindow(buf);
return false;
}
@ -1483,13 +1483,13 @@ bool iNesHeaderEditor_t::WriteHeaderData(iNES_HEADER* header)
char buf2[64];
if (result % 1024 != 0)
{
sprintf(buf2, "%dB", result);
snprintf(buf2, sizeof(buf2), "%dB", result);
}
else
{
sprintf(buf2, "%dKB", result / 1024);
snprintf(buf2, sizeof(buf2), "%dKB", result / 1024);
}
sprintf(buf, "PRG ROM size you entered is invalid in iNES 2.0, do you want to set to its nearest value %s?", buf2);
snprintf(buf, sizeof(buf), "PRG ROM size you entered is invalid in iNES 2.0, do you want to set to its nearest value %s?", buf2);
showErrorMsgWindow(buf);
//if (MessageBox(hwnd, buf, "Error", MB_YESNO | MB_ICONERROR) == IDYES)
//{
@ -1691,13 +1691,13 @@ bool iNesHeaderEditor_t::WriteHeaderData(iNES_HEADER* header)
char buf2[64];
if (result % 1024 != 0)
{
sprintf(buf2, "%dB", result);
snprintf(buf2, sizeof(buf2), "%dB", result);
}
else
{
sprintf(buf2, "%dKB", result / 1024);
snprintf(buf2, sizeof(buf2), "%dKB", result / 1024);
}
sprintf(buf, "CHR ROM size you entered is invalid in iNES 2.0, do you want to set to its nearest value %s?", buf2);
snprintf(buf, sizeof(buf), "CHR ROM size you entered is invalid in iNES 2.0, do you want to set to its nearest value %s?", buf2);
showErrorMsgWindow(buf);
//if (MessageBox(hwnd, buf, "Error", MB_YESNO | MB_ICONERROR) == IDYES)
// SetDlgItemText(hwnd, IDC_CHRROM_COMBO, buf2);
@ -1986,7 +1986,7 @@ bool iNesHeaderEditor_t::WriteHeaderData(iNES_HEADER* header)
int ret;
QMessageBox msgBox(this);
sprintf(buf, "FCEUX doesn't support iNES Mapper# %d, this is not a serious problem, but the ROM will not be run in FCEUX properly.\nDo you want to continue?", mapper);
snprintf(buf, sizeof(buf), "FCEUX doesn't support iNES Mapper# %d, this is not a serious problem, but the ROM will not be run in FCEUX properly.\nDo you want to continue?", mapper);
msgBox.setIcon( QMessageBox::Warning );
msgBox.setText( tr(buf) );

View File

@ -2138,7 +2138,7 @@ const char *ButtonName(const ButtConfig *bc)
inputNum = bc->ButtonNum;
inputDirection = "";
}
sprintf(name, "js%i:%s%i%s", joyNum, inputType, inputNum, inputDirection);
snprintf(name, sizeof(name), "js%i:%s%i%s", joyNum, inputType, inputNum, inputDirection);
}
break;
}

View File

@ -887,7 +887,7 @@ void ppuPatternView_t::updateSelTileLabel(void)
char stmp[32];
if ( (selTile.y() >= 0) && (selTile.x() >= 0) )
{
sprintf( stmp, "Tile: $%X%X", selTile.y(), selTile.x() );
snprintf( stmp, sizeof(stmp), "Tile: $%X%X", selTile.y(), selTile.x() );
}
else
{
@ -949,7 +949,7 @@ void ppuPatternView_t::contextMenuEvent(QContextMenuEvent *event)
if ( mode )
{
sprintf( stmp, "Exit Tile &View: %X%X", selTile.y(), selTile.x() );
snprintf( stmp, sizeof(stmp), "Exit Tile &View: %X%X", selTile.y(), selTile.x() );
act = new QAction(tr(stmp), &menu);
act->setShortcut( QKeySequence(tr("Z")));
@ -958,7 +958,7 @@ void ppuPatternView_t::contextMenuEvent(QContextMenuEvent *event)
}
else
{
sprintf( stmp, "&View Tile: %X%X", selTile.y(), selTile.x() );
snprintf( stmp, sizeof(stmp), "&View Tile: %X%X", selTile.y(), selTile.x() );
act = new QAction(tr(stmp), &menu);
act->setShortcut( QKeySequence(tr("Z")));
@ -987,7 +987,7 @@ void ppuPatternView_t::contextMenuEvent(QContextMenuEvent *event)
{
char stmp[8];
sprintf( stmp, "&%i", i+1 );
snprintf( stmp, sizeof(stmp), "&%i", i+1 );
paletteAct[i] = new QAction(tr(stmp), &menu);
paletteAct[i]->setCheckable(true);
@ -1787,13 +1787,13 @@ void tilePaletteView_t::contextMenuEvent(QContextMenuEvent *event)
subMenu = menu.addMenu( tr("Copy Color to Clipboard") );
sprintf( stmp, "Hex #%02X%02X%02X", palo[i].r, palo[i].g, palo[i].b );
snprintf( stmp, sizeof(stmp), "Hex #%02X%02X%02X", palo[i].r, palo[i].g, palo[i].b );
act = new QAction(tr(stmp), &menu);
//act->setShortcut( QKeySequence(tr("G")));
connect( act, SIGNAL(triggered(void)), this, SLOT(copyColor2ClipBoardHex(void)) );
subMenu->addAction( act );
sprintf( stmp, "rgb(%3i,%3i,%3i)", palo[i].r, palo[i].g, palo[i].b );
snprintf( stmp, sizeof(stmp), "rgb(%3i,%3i,%3i)", palo[i].r, palo[i].g, palo[i].b );
act = new QAction(tr(stmp), &menu);
//act->setShortcut( QKeySequence(tr("G")));
connect( act, SIGNAL(triggered(void)), this, SLOT(copyColor2ClipBoardRGB(void)) );
@ -1815,7 +1815,7 @@ void tilePaletteView_t::copyColor2ClipBoardHex(void)
}
p = palcache[ (palIdx << 2) | selBox ];
sprintf( txt, "#%02X%02X%02X", palo[p].r, palo[p].g, palo[p].b );
snprintf( txt, sizeof(txt), "#%02X%02X%02X", palo[p].r, palo[p].g, palo[p].b );
clipboard->setText( tr(txt), QClipboard::Clipboard );
@ -1837,7 +1837,7 @@ void tilePaletteView_t::copyColor2ClipBoardRGB(void)
}
p = palcache[ (palIdx << 2) | selBox ];
sprintf( txt, "rgb(%3i,%3i,%3i)", palo[p].r, palo[p].g, palo[p].b );
snprintf( txt, sizeof(txt), "rgb(%3i,%3i,%3i)", palo[p].r, palo[p].g, palo[p].b );
clipboard->setText( tr(txt), QClipboard::Clipboard );
@ -2164,7 +2164,7 @@ void ppuTileEditor_t::setTile( QPoint *t )
addr = addr + ( t->y() * 0x0100 );
addr = addr + ( t->x() * 0x0010 );
sprintf( stmp, "Tile Index: $%X%X Address: $%04X", t->y(), t->x(), addr );
snprintf( stmp, sizeof(stmp), "Tile Index: $%X%X Address: $%04X", t->y(), t->x(), addr );
tileIdxLbl->setText( tr(stmp) );
tileView->setTile( t );
@ -2490,7 +2490,7 @@ void ppuTileView_t::contextMenuEvent(QContextMenuEvent *event)
//
// if ( mode )
// {
// sprintf( stmp, "Exit Tile View: %X%X", selTile.y(), selTile.x() );
// snprintf( stmp, sizeof(stmp), "Exit Tile View: %X%X", selTile.y(), selTile.x() );
//
// act = new QAction(tr(stmp), &menu);
// act->setShortcut( QKeySequence(tr("Z")));
@ -2506,7 +2506,7 @@ void ppuTileView_t::contextMenuEvent(QContextMenuEvent *event)
// }
// else
// {
// sprintf( stmp, "View Tile: %X%X", selTile.y(), selTile.x() );
// snprintf( stmp, sizeof(stmp), "View Tile: %X%X", selTile.y(), selTile.x() );
//
// act = new QAction(tr(stmp), &menu);
// act->setShortcut( QKeySequence(tr("Z")));
@ -2533,7 +2533,7 @@ void ppuTileView_t::contextMenuEvent(QContextMenuEvent *event)
// {
// char stmp[8];
//
// sprintf( stmp, "%i", i+1 );
// snprintf( stmp, sizeof(stmp), "%i", i+1 );
//
// paletteAct[i] = new QAction(tr(stmp), &menu);
// paletteAct[i]->setCheckable(true);
@ -2728,7 +2728,7 @@ void ppuTileEditColorPicker_t::mouseMoveEvent(QMouseEvent *event)
// char stmp[64];
// int ix = (tile.y()<<4)|tile.x();
// sprintf( stmp, "Palette: $%02X", palcache[ix]);
// snprintf( stmp, sizeof(stmp), "Palette: $%02X", palcache[ix]);
// frame->setTitle( tr(stmp) );
//}
@ -3192,25 +3192,25 @@ void spriteViewerDialog_t::periodicUpdate(void)
idx = oamView->getSpriteIndex();
sprintf( stmp, "$%02X", idx );
snprintf( stmp, sizeof(stmp), "$%02X", idx );
spriteIndexBox->setText( tr(stmp) );
sprintf( stmp, "$%02X", oamPattern.sprite[idx].tNum );
snprintf( stmp, sizeof(stmp), "$%02X", oamPattern.sprite[idx].tNum );
tileIndexBox->setText( tr(stmp) );
sprintf( stmp, "$%04X", oamPattern.sprite[idx].chrAddr );
snprintf( stmp, sizeof(stmp), "$%04X", oamPattern.sprite[idx].chrAddr );
tileAddrBox->setText( tr(stmp) );
sprintf( stmp, "$%04X", 0x3F00 + (oamPattern.sprite[idx].pal*4) );
snprintf( stmp, sizeof(stmp), "$%04X", 0x3F00 + (oamPattern.sprite[idx].pal*4) );
palAddrBox->setText( tr(stmp) );
if ( showPosHex->isChecked() )
{
sprintf( stmp, "$%02X, $%02X", oamPattern.sprite[idx].x, oamPattern.sprite[idx].y );
snprintf( stmp, sizeof(stmp), "$%02X, $%02X", oamPattern.sprite[idx].x, oamPattern.sprite[idx].y );
}
else
{
sprintf( stmp, "%3i, %3i", oamPattern.sprite[idx].x, oamPattern.sprite[idx].y );
snprintf( stmp, sizeof(stmp), "%3i, %3i", oamPattern.sprite[idx].x, oamPattern.sprite[idx].y );
}
posBox->setText( tr(stmp) );