media-add-ons/usb_webcam: Fix -wformat=

Change-Id: Ie726c7b4ef9328e5542d845a1e7276e0509c4682
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3344
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
Murai Takashi 2020-10-08 06:07:47 +09:00 committed by Jérôme Duval
parent 17904e6253
commit edb4846779
9 changed files with 53 additions and 32 deletions

View File

@ -84,7 +84,7 @@ WebCamMediaAddOn::CountFlavors()
status_t
WebCamMediaAddOn::GetFlavorAt(int32 n, const flavor_info **out_info)
{
PRINT((CH "(%d, ) roster %p is %lx" CT, n, fRoster, fInitStatus));
PRINT((CH "(%d, ) roster %p is %" B_PRIx32 CT, n, fRoster, fInitStatus));
int32 count;
CamDevice* cam;
if (!fRoster)

View File

@ -46,7 +46,8 @@ CamBufferingDeframer::Write(const void *buffer, size_t size)
b = (uint8 *)IB.Buffer();
l = IB.BufferLength();
PRINT((CH "(%p, %d), IB: %d" CT, buffer, size, IB.BufferLength()));
PRINT((CH "(%p, %" B_PRIuSIZE "), IB: %" B_PRIuSIZE CT, buffer, size,
IB.BufferLength()));
if (l < (int)(fMinFrameSize + fSkipSOFTags + fSkipEOFTags))
return size; // not enough data anyway
@ -56,7 +57,8 @@ CamBufferingDeframer::Write(const void *buffer, size_t size)
if (fFrames.CountItems() < MAXFRAMEBUF)
fCurrentFrame = AllocFrame();
else {
PRINT((CH "DROPPED %d bytes! (too many queued frames)" CT, size));
PRINT((CH "DROPPED %" B_PRIuSIZE " bytes! "
"(too many queued frames)" CT, size));
return size; // drop XXX
}
}
@ -93,7 +95,9 @@ CamBufferingDeframer::Write(const void *buffer, size_t size)
// queue it
BAutolock f(fLocker);
PRINT((CH ": Detaching a frame (%d bytes, %d to %d / %d)" CT, (size_t)fCurrentFrame->Position(), s, e, l));
PRINT((CH ": Detaching a frame (%" B_PRIuSIZE " bytes, "
"%d to %d / %d)" CT, (size_t)fCurrentFrame->Position(),
s, e, l));
fCurrentFrame->Seek(0LL, SEEK_SET);
fFrames.AddItem(fCurrentFrame);
release_sem(fFrameSem);
@ -113,7 +117,9 @@ size_t
CamBufferingDeframer::DiscardFromInput(size_t size)
{
int next = (fInputBuffIndex+1)%2;
PRINT((CH ": %d bytes of %d from buffs[%d] (%d left)" CT, size, IB.BufferLength(), fInputBuffIndex, IB.BufferLength() - size));
PRINT((CH ": %" B_PRIuSIZE " bytes of %" B_PRIuSIZE " from buffs[%d] "
"(%" B_PRIuSIZE " left)" CT,
size, IB.BufferLength(), fInputBuffIndex, IB.BufferLength() - size));
fInputBuffs[next].Seek(0LL, SEEK_SET);
fInputBuffs[next].SetSize(0);
uint8 *buff = (uint8 *)IB.Buffer();

View File

@ -53,7 +53,7 @@ CamRoster::DeviceAdded(BUSBDevice* _device)
fAddon->CameraAdded(cam);
return B_OK;
}
PRINT((CH " error 0x%08lx" CT, err));
PRINT((CH " error 0x%08" B_PRIx32 CT, err));
}
return B_ERROR;
}
@ -83,7 +83,7 @@ CamRoster::CountCameras()
{
int32 count;
fLocker.Lock();
PRINT((CH "(): %ld cameras" CT, fCameras.CountItems()));
PRINT((CH "(): %" B_PRId32 " cameras" CT, fCameras.CountItems()));
count = fCameras.CountItems();
fLocker.Unlock();
return count;
@ -157,7 +157,9 @@ CamRoster::LoadExternalAddons()
// if (sclass != B_SYMBOL_TYPE_TEXT)
// continue;
err = (*get_webcam_addon_func)(fAddon, &addon);
PRINT((CH ": Loaded addon '%s' with error 0x%08lx" CT, (err>0)?NULL:addon->BrandName(), err));
PRINT((CH ": Loaded addon '%s' with error 0x%08" B_PRIx32 CT,
(err > 0) ? NULL : addon->BrandName(),
err));
}
return B_OK;
}

View File

@ -134,7 +134,7 @@ CamSensor::ProbeByIICSignature(const uint8 *regList, const uint8 *matchList,
uint8 value = 0;
ssize_t len;
len = Device()->ReadIIC8(regList[i], &value);
PRINT((CH ": ReadIIC8 = %d val = %d" CT, len, value));
PRINT((CH ": ReadIIC8 = %" B_PRIdSSIZE " val = %d" CT, len, value));
if (len < 1)
return ENODEV;
if (value != matchList[i])

View File

@ -48,7 +48,8 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
if (fFrames.CountItems() < MAXFRAMEBUF)
fCurrentFrame = AllocFrame();
else {
PRINT((CH "DROPPED %d bytes! (too many queued frames)" CT, size));
PRINT((CH "DROPPED %" B_PRIuSIZE " bytes! "
"(too many queued frames)" CT, size));
return size; // drop XXX
}
}
@ -130,7 +131,8 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
PRINT((CH ": EOF? %02x [%02x %02x %02x %02x] %02x" CT, buf[i-1], buf[i], buf[i+1], buf[i+2], buf[i+3], buf[i+4]));
while ((j = FindEOF(buf + i, bufsize - i, &which)) > -1) {
i += j;
PRINT((CH "| EOF[%d] at offset %d; pos %Ld" CT, which, i, fCurrentFrame->Position()));
PRINT((CH "| EOF[%d] at offset %d; pos %" B_PRIdOFF CT,
which, i, fCurrentFrame->Position()));
if (fCurrentFrame->Position()+i >= fMaxFrameSize) {
// too big: discard
//i = -1;
@ -163,7 +165,9 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
}
if (detach) {
BAutolock f(fLocker);
PRINT((CH ": Detaching a frame (%d bytes, end = %d, )" CT, (size_t)fCurrentFrame->Position(), end));
PRINT((CH ": Detaching a frame "
"(%" B_PRIuSIZE " bytes, end = %d, )" CT,
(size_t)fCurrentFrame->Position(), end));
fCurrentFrame->Seek(0LL, SEEK_SET);
if (discard) {
delete fCurrentFrame;

View File

@ -913,17 +913,18 @@ VideoProducer::FrameGenerator()
((fFrame - fFrameBase) *
(1000000 / fConnectedFormat.field_rate)) -
fProcessingLatency;
PRINT(("PS: %Ld\n", fProcessingLatency));
PRINT(("PS: %" B_PRIdBIGTIME "\n", fProcessingLatency));
/* Drop frame if it's at least a frame late */
if (wait_until < system_time())
continue;
PRINTF(1, ("FrameGenerator: wait until %Ld, %ctimed out, %crunning, %cenabled.\n",
wait_until,
(err == B_OK)?'!':' ',
(fRunning)?' ':'!',
(fEnabled)?' ':'!'));
PRINTF(1, ("FrameGenerator: wait until %" B_PRIdBIGTIME ", "
"%ctimed out, %crunning, %cenabled.\n",
wait_until,
(err == B_OK)?'!':' ',
(fRunning)?' ':'!',
(fEnabled)?' ':'!'));
/* If the semaphore was acquired successfully, it means something
* changed the timing information (see VideoProducer::Connect()) and

View File

@ -138,7 +138,7 @@ DumpRegs();
ssize_t
NW80xCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
{
PRINT((CH "(%u, @%p, %u)" CT, address, data, count));
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ")" CT, address, data, count));
return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x04, address, 0, count, data);
}
@ -146,7 +146,8 @@ NW80xCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
ssize_t
NW80xCamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached)
{
PRINT((CH "(%u, @%p, %u, %d)" CT, address, data, count, cached));
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ", %d)" CT, address, data, count,
cached));
memset(data, 0xaa, count); // linux drivers do that without explaining why !?
return SendCommand(USB_REQTYPE_DEVICE_IN, 0x04, address, 0, count, data);
}

View File

@ -103,7 +103,7 @@ DumpRegs();
ssize_t
QuickCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
{
PRINT((CH "(%u, @%p, %u)" CT, address, data, count));
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ")" CT, address, data, count));
return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x04, address, 0, count, data);
}
@ -111,7 +111,8 @@ QuickCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
ssize_t
QuickCamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached)
{
PRINT((CH "(%u, @%p, %u, %d)" CT, address, data, count, cached));
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ", %d)" CT, address, data, count,
cached));
memset(data, 0xaa, count); // linux drivers do that without explaining why !?
return SendCommand(USB_REQTYPE_DEVICE_IN, 0x04, address, 0, count, data);
}

View File

@ -289,10 +289,11 @@ SonixCamDevice::PowerOnSensor(bool on)
ssize_t
SonixCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
{
PRINT((CH "(%u, @%p, %u)" CT, address, data, count));
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ")" CT, address, data, count));
status_t err;
if (address + count > SN9C102_REG_COUNT) {
PRINT((CH ": Invalid register range [%u;%u]" CT, address, address+count));
PRINT((CH ": Invalid register range [%u;%" B_PRIuSIZE "]" CT, address,
address + count));
return EINVAL;
}
memcpy(&fCachedRegs[address], data, count);
@ -306,10 +307,12 @@ SonixCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
ssize_t
SonixCamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached)
{
PRINT((CH "(%u, @%p, %u, %d)" CT, address, data, count, cached));
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ", %d)" CT, address, data, count,
cached));
status_t err;
if (address + count > SN9C102_REG_COUNT) {
PRINT((CH ": Invalid register range [%u;%u]" CT, address, address+count));
PRINT((CH ": Invalid register range [%u;%" B_PRIuSIZE "]" CT, address,
address + count));
return EINVAL;
}
if (cached) {
@ -361,7 +364,7 @@ SonixCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count)
{
status_t err;
uint8 buffer[8];
PRINT((CH "(%u, @%p, %u)" CT, address, data, count));
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ")" CT, address, data, count));
if (!Sensor())
return B_NO_INIT;
@ -655,7 +658,7 @@ SonixCamDevice::ValidateStartOfFrameTag(const uint8 *tag, size_t taglen)
// SOF come with an 00, 40, 80, C0 sequence,
// supposedly corresponding with an equal byte in the end tag
fFrameTagState = tag[7] & 0xC0;
PRINT((CH "(, %d) state %x" CT, taglen, fFrameTagState));
PRINT((CH "(, %" B_PRIuSIZE ") state %x" CT, taglen, fFrameTagState));
// which seems to be the same as of the EOF tag
return true;
@ -696,7 +699,7 @@ SonixCamDevice::GetFrameBitmap(BBitmap **bm, bigtime_t *stamp /* = NULL */)
long int w = (long)(VideoFrame().right - VideoFrame().left + 1);
long int h = (long)(VideoFrame().bottom - VideoFrame().top + 1);
b = new BBitmap(VideoFrame().OffsetToSelf(0,0), 0, B_RGB32, w*4);
PRINT((CH ": Frame: %dx%d" CT, w, h));
PRINT((CH ": Frame: %ldx%ld" CT, w, h));
bayer2rgb24((unsigned char *)b->Bits(), (unsigned char *)f->Buffer(), w, h);
@ -726,17 +729,20 @@ SonixCamDevice::FillFrameBuffer(BBuffer *buffer, bigtime_t *stamp)
long int w = (long)(VideoFrame().right - VideoFrame().left + 1);
long int h = (long)(VideoFrame().bottom - VideoFrame().top + 1);
PRINT((CH ": VideoFrame = %fx%f,%fx%f Frame: %dx%d" CT, VideoFrame().left, VideoFrame().top, VideoFrame().right, VideoFrame().bottom, w, h));
PRINT((CH ": VideoFrame = %fx%f,%fx%f Frame: %ldx%ld" CT,
VideoFrame().left, VideoFrame().top, VideoFrame().right,
VideoFrame().bottom, w, h));
if (buffer->SizeAvailable() >= (size_t)w*h*4)
bayer2rgb32le((unsigned char *)buffer->Data(), (unsigned char *)f->Buffer(), w, h);
delete f;
PRINT((CH ": available %d, required %d" CT, buffer->SizeAvailable(), w*h*4));
PRINT((CH ": available %" B_PRIuSIZE ", required %ld" CT,
buffer->SizeAvailable(), w*h*4));
if (buffer->SizeAvailable() < (size_t)w*h*4)
return E2BIG;
PRINT((CH ": got 1 frame (len %d)" CT, buffer->SizeUsed()));
PRINT((CH ": got 1 frame (len %" B_PRIuSIZE ")" CT, buffer->SizeUsed()));
return B_OK;
}