[haiku-commits] Change in haiku[master]: media-add-ons/usb_webcam: Fix -wformat=

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 21 Oct 2020 20:50:09 +0000

From Murai Takashi <tmurai01@xxxxxxxxx>:

Murai Takashi has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3344 ;)


Change subject: media-add-ons/usb_webcam: Fix -wformat=
......................................................................

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

Change-Id: Ie726c7b4ef9328e5542d845a1e7276e0509c4682
---
M src/add-ons/media/media-add-ons/usb_webcam/AddOn.cpp
M src/add-ons/media/media-add-ons/usb_webcam/CamBufferingDeframer.cpp
M src/add-ons/media/media-add-ons/usb_webcam/CamRoster.cpp
M src/add-ons/media/media-add-ons/usb_webcam/CamSensor.cpp
M src/add-ons/media/media-add-ons/usb_webcam/CamStreamingDeframer.cpp
M src/add-ons/media/media-add-ons/usb_webcam/Producer.cpp
M src/add-ons/media/media-add-ons/usb_webcam/addons/NW80xCamDevice.cpp
M src/add-ons/media/media-add-ons/usb_webcam/addons/quickcam/QuickCamDevice.cpp
M src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp
9 files changed, 49 insertions(+), 28 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/44/3344/1

diff --git a/src/add-ons/media/media-add-ons/usb_webcam/AddOn.cpp 
b/src/add-ons/media/media-add-ons/usb_webcam/AddOn.cpp
index 13fdb8b..ea60ae1 100644
--- a/src/add-ons/media/media-add-ons/usb_webcam/AddOn.cpp
+++ b/src/add-ons/media/media-add-ons/usb_webcam/AddOn.cpp
@@ -84,7 +84,7 @@
 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)
diff --git 
a/src/add-ons/media/media-add-ons/usb_webcam/CamBufferingDeframer.cpp 
b/src/add-ons/media/media-add-ons/usb_webcam/CamBufferingDeframer.cpp
index b2d2ddd..bdf5d9e 100644
--- a/src/add-ons/media/media-add-ons/usb_webcam/CamBufferingDeframer.cpp
+++ b/src/add-ons/media/media-add-ons/usb_webcam/CamBufferingDeframer.cpp
@@ -46,7 +46,8 @@
        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 @@
                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 @@

                        // 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 @@
 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();
diff --git a/src/add-ons/media/media-add-ons/usb_webcam/CamRoster.cpp 
b/src/add-ons/media/media-add-ons/usb_webcam/CamRoster.cpp
index 4054e6c..ec7bda7 100644
--- a/src/add-ons/media/media-add-ons/usb_webcam/CamRoster.cpp
+++ b/src/add-ons/media/media-add-ons/usb_webcam/CamRoster.cpp
@@ -53,7 +53,7 @@
                        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 @@
 {
        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 @@
 //             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;
 }
diff --git a/src/add-ons/media/media-add-ons/usb_webcam/CamSensor.cpp 
b/src/add-ons/media/media-add-ons/usb_webcam/CamSensor.cpp
index c5ceafd..8a5444f 100644
--- a/src/add-ons/media/media-add-ons/usb_webcam/CamSensor.cpp
+++ b/src/add-ons/media/media-add-ons/usb_webcam/CamSensor.cpp
@@ -134,7 +134,7 @@
                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])
diff --git 
a/src/add-ons/media/media-add-ons/usb_webcam/CamStreamingDeframer.cpp 
b/src/add-ons/media/media-add-ons/usb_webcam/CamStreamingDeframer.cpp
index cf3975a..ddab0c3 100644
--- a/src/add-ons/media/media-add-ons/usb_webcam/CamStreamingDeframer.cpp
+++ b/src/add-ons/media/media-add-ons/usb_webcam/CamStreamingDeframer.cpp
@@ -48,7 +48,8 @@
                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 @@
                        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 @@
                }
                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;
diff --git a/src/add-ons/media/media-add-ons/usb_webcam/Producer.cpp 
b/src/add-ons/media/media-add-ons/usb_webcam/Producer.cpp
index 1b72f92..4246374 100644
--- a/src/add-ons/media/media-add-ons/usb_webcam/Producer.cpp
+++ b/src/add-ons/media/media-add-ons/usb_webcam/Producer.cpp
@@ -913,13 +913,14 @@
                                                ((fFrame - fFrameBase) *
                                                (1000000 / 
fConnectedFormat.field_rate)) -
                                fProcessingLatency;
-PRINT(("PS: %Ld\n", fProcessingLatency));
+               PRINT(("PS: %" B_PRId64 "\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",
+               PRINTF(1, ("FrameGenerator: wait until %" B_PRId64 ", %ctimed 
out, "
+                                               "%crunning, %cenabled.\n",
                                        wait_until,
                                        (err == B_OK)?'!':' ',
                                        (fRunning)?' ':'!',
diff --git 
a/src/add-ons/media/media-add-ons/usb_webcam/addons/NW80xCamDevice.cpp 
b/src/add-ons/media/media-add-ons/usb_webcam/addons/NW80xCamDevice.cpp
index a63b31d..8b98c90 100644
--- a/src/add-ons/media/media-add-ons/usb_webcam/addons/NW80xCamDevice.cpp
+++ b/src/add-ons/media/media-add-ons/usb_webcam/addons/NW80xCamDevice.cpp
@@ -138,7 +138,7 @@
 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 @@
 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);
 }
diff --git 
a/src/add-ons/media/media-add-ons/usb_webcam/addons/quickcam/QuickCamDevice.cpp 
b/src/add-ons/media/media-add-ons/usb_webcam/addons/quickcam/QuickCamDevice.cpp
index 48f59cb..944e5cf 100644
--- 
a/src/add-ons/media/media-add-ons/usb_webcam/addons/quickcam/QuickCamDevice.cpp
+++ 
b/src/add-ons/media/media-add-ons/usb_webcam/addons/quickcam/QuickCamDevice.cpp
@@ -103,7 +103,7 @@
 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 @@
 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);
 }
diff --git 
a/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp 
b/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp
index 0cc7549..2a08411 100644
--- a/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp
+++ b/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp
@@ -289,10 +289,11 @@
 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 @@
 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 @@
 {
        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 @@
        // 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 @@
        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 @@

        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;
 }


--
To view, visit https://review.haiku-os.org/c/haiku/+/3344
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ie726c7b4ef9328e5542d845a1e7276e0509c4682
Gerrit-Change-Number: 3344
Gerrit-PatchSet: 1
Gerrit-Owner: Murai Takashi <tmurai01@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: media-add-ons/usb_webcam: Fix -wformat= - Gerrit