From feacc2de79ad5795fb6d77d591e9fca3b06964b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 8 Mar 2011 20:23:03 +0000 Subject: [PATCH] Patch by starsseed from ticket #7341: Use correct format strings in sprintf() invokations, specifically to avoid reading more bytes than are contained in the passed arguments. Thanks! Small cleanups of the touced code by myself included. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40876 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mediaconverter/MediaConverterApp.cpp | 8 ++++---- src/apps/mediaconverter/MediaFileInfo.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apps/mediaconverter/MediaConverterApp.cpp b/src/apps/mediaconverter/MediaConverterApp.cpp index 1691f7103e..24354a9beb 100644 --- a/src/apps/mediaconverter/MediaConverterApp.cpp +++ b/src/apps/mediaconverter/MediaConverterApp.cpp @@ -549,11 +549,11 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile, break; } completePercent = (float)(i - start) / (float)(end - start) * 100; - currPercent = (int16)floor(completePercent); + currPercent = (int32)completePercent; if (currPercent > lastPercent) { lastPercent = currPercent; snprintf(status.LockBuffer(128), 128, - B_TRANSLATE("Writing video track: %Ld %% complete"), + B_TRANSLATE("Writing video track: %ld%% complete"), currPercent); status.UnlockBuffer(); SetStatusMessage(status.String()); @@ -607,11 +607,11 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile, break; } completePercent = (float)(i - start) / (float)(end - start) * 100; - currPercent = (int16)floor(completePercent); + currPercent = (int32)completePercent; if (currPercent > lastPercent) { lastPercent = currPercent; snprintf(status.LockBuffer(128), 128, - B_TRANSLATE("Writing audio track: %Ld %% complete"), + B_TRANSLATE("Writing audio track: %ld%% complete"), currPercent); status.UnlockBuffer(); SetStatusMessage(status.String()); diff --git a/src/apps/mediaconverter/MediaFileInfo.cpp b/src/apps/mediaconverter/MediaFileInfo.cpp index 4263e46d56..41fde23f8f 100644 --- a/src/apps/mediaconverter/MediaFileInfo.cpp +++ b/src/apps/mediaconverter/MediaFileInfo.cpp @@ -70,7 +70,7 @@ MediaFileInfo::LoadInfo(BMediaFile* file) BString details; snprintf(details.LockBuffer(256), 256, - B_TRANSLATE_COMMENT("%Ld x %Ld, %Ld fps / %Ld frames", + B_TRANSLATE_COMMENT("%u x %u, %.2ffps / %Ld frames", "Width x Height, fps / frames"), format.Width(), format.Height(), rvf->field_rate / rvf->interlace, videoFrames);