More cleanup of sprintf usage in favor of snprintf. This is to resolve deprecation warnings on Mac OSX
This commit is contained in:
parent
db8fd407ab
commit
c324a82526
|
@ -2274,7 +2274,7 @@ void TasEditorWindow::exportMovieFile(void)
|
|||
markerID = markersManager.getMarkerAtFrame(i);
|
||||
if (markerID)
|
||||
{
|
||||
sprintf( framenum, "%i ", i );
|
||||
snprintf( framenum, sizeof(framenum), "%i ", i );
|
||||
//_itoa(i, framenum, 10);
|
||||
//strcat(framenum, " ");
|
||||
subtitle = framenum;
|
||||
|
@ -2337,7 +2337,7 @@ void TasEditorWindow::buildRecentProjectMenu(void)
|
|||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
sprintf(buf, "SDL.RecentTasProject%02i", i);
|
||||
snprintf(buf, sizeof(buf), "SDL.RecentTasProject%02i", i);
|
||||
|
||||
g_config->getOption( buf, &s);
|
||||
|
||||
|
@ -2373,7 +2373,7 @@ void TasEditorWindow::saveRecentProjectMenu(void)
|
|||
for (it=projList.begin(); it != projList.end(); it++)
|
||||
{
|
||||
s = *it;
|
||||
sprintf(buf, "SDL.RecentTasProject%02i", i);
|
||||
snprintf(buf, sizeof(buf), "SDL.RecentTasProject%02i", i);
|
||||
|
||||
g_config->setOption( buf, s->c_str() );
|
||||
|
||||
|
@ -6651,7 +6651,7 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
|
|||
|
||||
//rect = QRect( -pxLineXScroll + pxFrameColX, y, pxWidthFrameCol, pxLineSpacing );
|
||||
|
||||
sprintf( stmp, "%07i", lineNum );
|
||||
snprintf( stmp, sizeof(stmp), "%07i", lineNum );
|
||||
|
||||
rect = painter.fontMetrics().boundingRect( tr(stmp) );
|
||||
|
||||
|
@ -7492,7 +7492,7 @@ void markerDragPopup::paintEvent(QPaintEvent *event)
|
|||
w = event->rect().width();
|
||||
h = event->rect().height();
|
||||
|
||||
sprintf( txt, "%07i", rowIndex );
|
||||
snprintf( txt, sizeof(txt), "%07i", rowIndex );
|
||||
|
||||
//painter.setFont(font);
|
||||
//I want to make the title bar pasted on the content
|
||||
|
|
|
@ -658,7 +658,7 @@ void BOOKMARKS::paintEvent(QPaintEvent *event)
|
|||
}
|
||||
|
||||
x = pxStartCol1 + pxCharWidth;
|
||||
sprintf( txt, "%i", item );
|
||||
snprintf( txt, sizeof(txt), "%i", item );
|
||||
|
||||
painter.drawText( x, y+pxLineTextOfs, tr(txt) );
|
||||
|
||||
|
|
|
@ -1023,11 +1023,11 @@ void BRANCHES::paintEvent(QPaintEvent *event)
|
|||
char framenum_string[16] = {0};
|
||||
if (bookmarks->itemUnderMouse < TOTAL_BOOKMARKS)
|
||||
{
|
||||
sprintf( framenum_string, "%07i", bookmarks->bookmarksArray[bookmarks->itemUnderMouse].snapshot.keyFrame );
|
||||
snprintf( framenum_string, sizeof(framenum_string), "%07i", bookmarks->bookmarksArray[bookmarks->itemUnderMouse].snapshot.keyFrame );
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( framenum_string, "%07i", currFrameCounter );
|
||||
snprintf( framenum_string, sizeof(framenum_string), "%07i", currFrameCounter );
|
||||
}
|
||||
x = viewRect.x() + (2 * pxBoxWidth);
|
||||
y = pxLineSpacing;
|
||||
|
|
|
@ -522,7 +522,7 @@ int HISTORY::registerChanges(int mod_type, int start, int end, int size, const c
|
|||
if (mod_type == MODTYPE_INSERTNUM)
|
||||
{
|
||||
snap.endFrame = start + size - 1;
|
||||
sprintf( framenum, "%i", size);
|
||||
snprintf( framenum, sizeof(framenum), "%i", size);
|
||||
strcat(snap.description, framenum);
|
||||
} else
|
||||
{
|
||||
|
@ -540,12 +540,12 @@ int HISTORY::registerChanges(int mod_type, int start, int end, int size, const c
|
|||
snap.endFrame = snapshots[real_pos].endFrame;
|
||||
// add upper and lower frame to description
|
||||
strcat(snap.description, " ");
|
||||
sprintf( framenum, "%i", snap.startFrame);
|
||||
snprintf( framenum, sizeof(framenum), "%i", snap.startFrame);
|
||||
strcat(snap.description, framenum);
|
||||
if (snap.endFrame > snap.startFrame)
|
||||
{
|
||||
strcat(snap.description, "-");
|
||||
sprintf( framenum, "%i", snap.endFrame);
|
||||
snprintf( framenum, sizeof(framenum), "%i", snap.endFrame);
|
||||
strcat(snap.description, framenum);
|
||||
}
|
||||
// add comment if there is one specified
|
||||
|
@ -570,12 +570,12 @@ int HISTORY::registerChanges(int mod_type, int start, int end, int size, const c
|
|||
// don't combine
|
||||
// add upper and lower frame to description
|
||||
strcat(snap.description, " ");
|
||||
sprintf( framenum, "%i", snap.startFrame);
|
||||
snprintf( framenum, sizeof(framenum), "%i", snap.startFrame);
|
||||
strcat(snap.description, framenum);
|
||||
if (snap.endFrame > snap.startFrame)
|
||||
{
|
||||
strcat(snap.description, "-");
|
||||
sprintf( framenum, "%i", snap.endFrame);
|
||||
snprintf( framenum, sizeof(framenum), "%i", snap.endFrame);
|
||||
strcat(snap.description, framenum);
|
||||
}
|
||||
// add comment if there is one specified
|
||||
|
@ -681,7 +681,7 @@ void HISTORY::registerMarkersChange(int modificationType, int start, int end, co
|
|||
// add the frame to description
|
||||
char framenum[16];
|
||||
strcat(snap.description, " ");
|
||||
sprintf( framenum, "%i", snap.startFrame);
|
||||
snprintf( framenum, sizeof(framenum), "%i", snap.startFrame);
|
||||
strcat(snap.description, framenum);
|
||||
if (snap.endFrame > snap.startFrame || modificationType == MODTYPE_MARKER_DRAG || modificationType == MODTYPE_MARKER_SWAP)
|
||||
{
|
||||
|
@ -691,7 +691,7 @@ void HISTORY::registerMarkersChange(int modificationType, int start, int end, co
|
|||
strcat(snap.description, "<->");
|
||||
else
|
||||
strcat(snap.description, "-");
|
||||
sprintf( framenum, "%i", snap.endFrame);
|
||||
snprintf( framenum, sizeof(framenum), "%i", snap.endFrame);
|
||||
strcat(snap.description, framenum);
|
||||
}
|
||||
// add comment if there is one specified
|
||||
|
@ -718,7 +718,7 @@ void HISTORY::registerBookmarkSet(int slot, BOOKMARK& backupCopy, int oldCurrent
|
|||
snap.startFrame = snap.endFrame = snap.keyFrame = bookmarks->bookmarksArray[slot].snapshot.keyFrame;
|
||||
char framenum[16];
|
||||
strcat(snap.description, " ");
|
||||
sprintf( framenum, "%i", snap.keyFrame);
|
||||
snprintf( framenum, sizeof(framenum), "%i", snap.keyFrame);
|
||||
strcat(snap.description, framenum);
|
||||
if (taseditorConfig->enableHotChanges)
|
||||
snap.inputlog.copyHotChanges(&getCurrentSnapshot().inputlog);
|
||||
|
@ -823,10 +823,10 @@ void HISTORY::registerRecording(int frameOfChange, uint32 joypadDifferenceBits)
|
|||
}
|
||||
// add upper and lower frame to description
|
||||
strcat(snap->description, " ");
|
||||
sprintf( framenum, "%i", snap->startFrame);
|
||||
snprintf( framenum, sizeof(framenum), "%i", snap->startFrame);
|
||||
strcat(snap->description, framenum);
|
||||
strcat(snap->description, "-");
|
||||
sprintf( framenum, "%i", snap->endFrame);
|
||||
snprintf( framenum, sizeof(framenum), "%i", snap->endFrame);
|
||||
strcat(snap->description, framenum);
|
||||
// truncate history here
|
||||
historyTotalItems = historyCursorPos+1;
|
||||
|
@ -860,7 +860,7 @@ void HISTORY::registerRecording(int frameOfChange, uint32 joypadDifferenceBits)
|
|||
}
|
||||
// add upper frame to description
|
||||
strcat(snap.description, " ");
|
||||
sprintf( framenum, "%i", frameOfChange);
|
||||
snprintf( framenum, sizeof(framenum), "%i", frameOfChange);
|
||||
strcat(snap.description, framenum);
|
||||
// set hotchanges
|
||||
if (taseditorConfig->enableHotChanges)
|
||||
|
@ -942,7 +942,7 @@ int HISTORY::registerLuaChanges(const char* name, int start, bool insertionOrDel
|
|||
// add upper frame to description
|
||||
char framenum[16];
|
||||
strcat(snap.description, " ");
|
||||
sprintf( framenum, "%i", first_changes);
|
||||
snprintf( framenum, sizeof(framenum), "%i", first_changes);
|
||||
strcat(snap.description, framenum);
|
||||
// set hotchanges
|
||||
if (taseditorConfig->enableHotChanges)
|
||||
|
|
|
@ -447,7 +447,7 @@ void PLAYBACK::redrawMarkerData()
|
|||
strcpy(new_text, upperMarkerText);
|
||||
}
|
||||
char num[16];
|
||||
sprintf( num, "%i", displayedMarkerNumber);
|
||||
snprintf( num, sizeof(num), "%i", displayedMarkerNumber);
|
||||
strcat(new_text, num);
|
||||
strcat(new_text, " ");
|
||||
tasWin->upperMarkerLabel->setText( QObject::tr(new_text) );
|
||||
|
|
|
@ -193,7 +193,7 @@ void SELECTION::redrawMarkerData()
|
|||
strcpy(new_text, lowerMarkerText);
|
||||
}
|
||||
char num[16];
|
||||
sprintf( num, "%i", displayedMarkerNumber);
|
||||
snprintf( num, sizeof(num), "%i", displayedMarkerNumber);
|
||||
strcat(new_text, num);
|
||||
strcat(new_text, " ");
|
||||
tasWin->lowerMarkerLabel->setText( QObject::tr(new_text) );
|
||||
|
|
|
@ -73,7 +73,7 @@ void SPLICER::update(void)
|
|||
// rows
|
||||
if (size > 1)
|
||||
{
|
||||
sprintf( num, "%i", size);
|
||||
snprintf( num, sizeof(num), "%i", size);
|
||||
strcat(new_text, num);
|
||||
strcat(new_text, numTextRows);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ void SPLICER::update(void)
|
|||
int columns = NUM_JOYPAD_BUTTONS * joysticksPerFrame[getInputType(currMovieData)]; // in future the number of columns will depend on selected columns
|
||||
if (columns > 1)
|
||||
{
|
||||
sprintf( num, "%i", columns);
|
||||
snprintf( num, sizeof(num), "%i", columns);
|
||||
strcat(new_text, num);
|
||||
strcat(new_text, numTextColumns);
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ void SPLICER::redrawInfoAboutClipboard(void)
|
|||
// rows
|
||||
if (clipboardSelection.size() > 1)
|
||||
{
|
||||
sprintf( num, "%zi", clipboardSelection.size());
|
||||
snprintf( num, sizeof(num), "%zi", clipboardSelection.size());
|
||||
strcat(new_text, num);
|
||||
strcat(new_text, numTextRows);
|
||||
}
|
||||
|
@ -799,7 +799,7 @@ void SPLICER::redrawInfoAboutClipboard(void)
|
|||
int columns = NUM_JOYPAD_BUTTONS * joysticksPerFrame[getInputType(currMovieData)]; // in future the number of columns will depend on selected columns
|
||||
if (columns > 1)
|
||||
{
|
||||
sprintf( num, "%i", columns);
|
||||
snprintf( num, sizeof(num), "%i", columns);
|
||||
strcat(new_text, num);
|
||||
strcat(new_text, numTextColumns);
|
||||
}
|
||||
|
|
|
@ -279,10 +279,10 @@ bool TASEDITOR_PROJECT::load(const char* fullName)
|
|||
message.assign("This project was saved using different version of TAS Editor!\n\n");
|
||||
message.append("Original version: ");
|
||||
char versionNum[16];
|
||||
sprintf( versionNum, "%u", projectFileVersion);
|
||||
snprintf( versionNum, sizeof(versionNum), "%u", projectFileVersion);
|
||||
message.append(versionNum);
|
||||
message.append("\nCurrent version: ");
|
||||
sprintf( versionNum, "%i", PROJECT_FILE_CURRENT_VERSION);
|
||||
snprintf( versionNum, sizeof(versionNum), "%i", PROJECT_FILE_CURRENT_VERSION);
|
||||
message.append(versionNum);
|
||||
message.append("\n\nClick Yes to try loading all data from the file (may crash).\n");
|
||||
message.append("Click No to only load movie data.\n");
|
||||
|
|
Loading…
Reference in New Issue