Permalink
Browse files

Enable printf format checking for Codecprintf and fix warning fallout

git-svn-id: https://svn.perian.org/trunk@1414 621663c8-3916-0410-8f58-edc14a8543d5
  • Loading branch information...
astrange
astrange committed Apr 9, 2011
1 parent c008bf7 commit 5cc87fd742bd71401127ff6881f6483be8b7f337
Showing with 29 additions and 20 deletions.
  1. +2 −1 Codecprintf.h
  2. +4 −4 FFusionCodec.c
  3. +1 −1 MatroskaImport.cpp
  4. +21 −13 MatroskaImportPrivate.cpp
  5. +1 −1 Subtitles/SubImport.mm
View
@@ -28,7 +28,8 @@
extern "C" {
#endif
int Codecprintf(FILE *, const char *format, ...);
#undef printf
int Codecprintf(FILE *, const char *format, ...) __attribute__((format (printf, 2, 3)));
void FourCCprintf(const char *string, FourCharCode a);
const char *FourCCString(FourCharCode c);
View
@@ -890,15 +890,15 @@ pascal ComponentResult FFusionCodecBeginBand(FFusionGlobals glob, CodecDecompres
myDrp->frameData = NULL;
myDrp->buffer = NULL;
FFusionDebugPrint("%p BeginBand #%d. (%sdecoded, packed %d)\n", glob, p->frameNumber, not(myDrp->decoded), glob->packedType);
FFusionDebugPrint("%p BeginBand #%ld. (%sdecoded, packed %d)\n", glob, p->frameNumber, not(myDrp->decoded), glob->packedType);
if (!glob->avContext) {
Codecprintf(glob->fileLog, "Perian: QT tried to call BeginBand without preflighting!\n");
return internalComponentErr;
}
if (p->frameNumber == 0 && myDrp->pixelFormat != ColorConversionDstForPixFmt(glob->avContext->pix_fmt)) {
Codecprintf(glob->fileLog, "QT gave us unwanted pixelFormat %s (%08x), this will not work\n", FourCCString(myDrp->pixelFormat), myDrp->pixelFormat);
Codecprintf(glob->fileLog, "QT gave us unwanted pixelFormat %s (%08x), this will not work\n", FourCCString(myDrp->pixelFormat), (unsigned)myDrp->pixelFormat);
}
if(myDrp->decoded)
@@ -966,7 +966,7 @@ pascal ComponentResult FFusionCodecBeginBand(FFusionGlobals glob, CodecDecompres
}
else
{
Codecprintf(glob->fileLog, "parse failed frame %d with size %d\n", p->frameNumber, bufferSize);
Codecprintf(glob->fileLog, "parse failed frame %ld with size %d\n", p->frameNumber, bufferSize);
if(glob->data.unparsedFrames.dataSize != 0)
Codecprintf(glob->fileLog, ", parser had extra data\n");
}
@@ -1068,7 +1068,7 @@ pascal ComponentResult FFusionCodecBeginBand(FFusionGlobals glob, CodecDecompres
static OSErr PrereqDecompress(FFusionGlobals glob, FrameData *prereq, AVCodecContext *context, int width, int height, AVFrame *picture)
{
FFusionDebugPrint("%p prereq-decompressing frame #%d.\n", glob, prereq->frameNumber);
FFusionDebugPrint("%p prereq-decompressing frame #%ld.\n", glob, prereq->frameNumber);
FrameData *preprereq = FrameDataCheckPrereq(prereq);
if(preprereq)
View
@@ -366,7 +366,7 @@ ComponentResult MatroskaImport::Idle(long inFlags, long *outFlags)
goto finish;
} catch (CRTError &cerr) {
err = cerr.getError();
Codecprintf(NULL, "MKV: caught an error (%d): %s\n", err, cerr.what());
Codecprintf(NULL, "MKV: caught an error (%d): %s\n", (int)err, cerr.what());
goto finish;
}
View
@@ -404,7 +404,7 @@ ComponentResult MatroskaImport::ReadVobSubContentEncodings(KaxContentEncodings *
Codecprintf(NULL, "MKV: warning, track compression algorithm %d not zlib\n", algo);
if ((*mkvTrack.desc)->dataFormat != kSubFormatVobSub)
Codecprintf(NULL, "MKV: warning, compressed track %4.4s probably won't work (not VobSub)\n", &(*mkvTrack.desc)->dataFormat);
Codecprintf(NULL, "MKV: warning, compressed track %s probably won't work (not VobSub)\n", FourCCString((*mkvTrack.desc)->dataFormat));
Handle ext = NewHandle(1);
**ext = algo;
@@ -516,7 +516,7 @@ ComponentResult MatroskaImport::AddVideoTrack(KaxTrackEntry &kaxTrack, MatroskaT
SampleDescriptionHandle sampleDesc = mkvTrack.desc;
OSType compressedType = compressStreamFourCC((*sampleDesc)->dataFormat);
if (compressedType == 0)
Codecprintf(NULL, "MKV: warning, compressed track %4.4s probably won't work\n", &(*mkvTrack.desc)->dataFormat);
Codecprintf(NULL, "MKV: warning, compressed track %s probably won't work\n", FourCCString((*mkvTrack.desc)->dataFormat));
else
{
Handle ext = NewHandle(4);
@@ -633,7 +633,7 @@ ComponentResult MatroskaImport::AddAudioTrack(KaxTrackEntry &kaxTrack, MatroskaT
OSType compressedType = compressStreamFourCC(asbd.mFormatID);
if (compressedType == 0)
Codecprintf(NULL, "MKV: warning, compressed track %4.4s probably won't work\n", &(*mkvTrack.desc)->dataFormat);
Codecprintf(NULL, "MKV: warning, compressed track %s probably won't work\n", FourCCString((*mkvTrack.desc)->dataFormat));
else
{
asbd.mFormatID = compressedType;
@@ -935,7 +935,7 @@ ComponentResult MatroskaImport::ReadAttachments(KaxAttachments &attachments)
fileData.GetSize(),
isJPEG ? kQTMetaDataTypeJPEGImage : kQTMetaDataTypePNGImage, NULL);
if (err)
Codecprintf(NULL, "MKV: Error adding cover art %d\n", err);
Codecprintf(NULL, "MKV: Error adding cover art %d\n", (int)err);
QTMetaDataRelease(movieMetaData);
}
@@ -1268,8 +1268,10 @@ void MatroskaTrack::AddBlock(KaxInternalBlock &block, uint32 duration, short fla
}
else {
lastFrames.push_back(newFrame);
if (!usesLacing && type == track_video)
if (!usesLacing && type == track_video) {
//Codecprintf(NULL, "push_back pts %lld dts %lld\n", newFrame.pts, newFrame.dts);
ptsReorder.push_back(newFrame.pts);
}
}
newFrame.buffer = NULL;
@@ -1305,7 +1307,7 @@ void MatroskaTrack::AddFrame(MatroskaFrame &frame)
PtrToHand(packet, &sampleH, size);
err = AddMediaSample(theMedia, sampleH, 0, size, end - start, desc, 1, 0, &sampleTime);
if (err) {
Codecprintf(NULL, "MKV: error adding subtitle sample %d\n", err);
Codecprintf(NULL, "MKV: error adding subtitle sample %d\n", (int)err);
return;
}
DisposeHandle(sampleH);
@@ -1315,11 +1317,14 @@ void MatroskaTrack::AddFrame(MatroskaFrame &frame)
} else if (sampleTable) {
if(frame.duration) {
SInt64 sampleNum;
//assert(displayOffset >= 0);
//Codecprintf(NULL, "Add frame offset %lld, size %lld, duration %ld, offset %lld\n", frame.offset, frame.size, frame.duration, displayOffset);
err = QTSampleTableAddSampleReferences(sampleTable, frame.offset, frame.size, frame.duration,
displayOffset, 1, frame.flags, qtSampleDesc, &sampleNum);
if (err) {
Codecprintf(NULL, "MKV: error adding sample reference to table %d\n", err);
Codecprintf(NULL, "MKV: error adding sample reference to table %d\n", (int)err);
return;
}
@@ -1338,7 +1343,7 @@ void MatroskaTrack::AddFrame(MatroskaFrame &frame)
err = AddMediaSampleReferences64(theMedia, desc, 1, &sample, &sampleTime);
if (err) {
Codecprintf(NULL, "MKV: error adding sample reference to media %d\n", err);
Codecprintf(NULL, "MKV: error adding sample reference to media %d\n", (int)err);
return;
}
}
@@ -1347,7 +1352,7 @@ void MatroskaTrack::AddFrame(MatroskaFrame &frame)
if (type == track_subtitle) {
err = InsertMediaIntoTrack(theTrack, frame.pts, sampleTime, frame.duration, fixed1);
if (err) {
Codecprintf(NULL, "MKV: error adding subtitle media into track %d\n", err);
Codecprintf(NULL, "MKV: error adding subtitle media into track %d\n", (int)err);
return;
}
} else {
@@ -1376,18 +1381,21 @@ void MatroskaTrack::AddSamplesToTrack()
return; // nothing to add
err = AddSampleTableToMedia(theMedia, sampleTable, firstSample, numSamples, NULL);
firstSample = -1;
numSamples = 0;
if (err) {
Codecprintf(NULL, "MKV: error adding sample table to the media %d\n", err);
Codecprintf(NULL, "MKV: error adding sample table to the media %d\n", (int)err);
durationToAdd = 0;
firstSample = -1;
numSamples = 0;
return;
}
firstSample = -1;
numSamples = 0;
}
err = InsertMediaIntoTrack(theTrack, -1, maxLoadedTime, durationToAdd, fixed1);
if (err)
Codecprintf(NULL, "MKV: error inserting media into track %d\n", err);
Codecprintf(NULL, "MKV: error inserting media into track %d\n", (int)err);
if (!err) {
if (!maxLoadedTime && lowestPTS)
View
@@ -624,7 +624,7 @@ static ComponentResult LoadSingleTextSubtitle(CFURLRef theDirectory, CFStringRef
if (err) {
err = GetMoviesError();
Codecprintf(stderr,"error %d adding line from %d to %d in external subtitles",err,sl->begin_time,sl->end_time);
Codecprintf(NULL,"SSA: error %d adding line from %d to %d",(int)err,sl->begin_time,sl->end_time);
} else {
ConvertTimeScale(&startTime, movieTimeScale);
InsertMediaIntoTrack(theTrack, startTime.value.lo, sampleTime, sl->end_time - sl->begin_time, movieRate);

0 comments on commit 5cc87fd

Please sign in to comment.