usb_webcam: Fix warnings and enable Werror
Done as part of #9460 Change-Id: I45f53451c91d63f5e5170234c75a831472cfffc7 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4501 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
5b38b945ae
commit
628ddb2790
@ -713,7 +713,7 @@ rule ArchitectureSetupWarnings architecture
|
||||
EnableWerror src add-ons media media-add-ons reader ;
|
||||
EnableWerror src add-ons media media-add-ons tone_producer_demo ;
|
||||
EnableWerror src add-ons media media-add-ons usb_vision ;
|
||||
# EnableWerror src add-ons media media-add-ons usb_webcam ;
|
||||
EnableWerror src add-ons media media-add-ons usb_webcam ;
|
||||
EnableWerror src add-ons media media-add-ons video_mixer ;
|
||||
EnableWerror src add-ons media media-add-ons video_producer_demo ;
|
||||
EnableWerror src add-ons media media-add-ons videowindow ;
|
||||
|
@ -175,8 +175,8 @@ WebCamMediaAddOn::CameraRemoved(CamDevice* device)
|
||||
void
|
||||
WebCamMediaAddOn::FillDefaultFlavorInfo(flavor_info* info)
|
||||
{
|
||||
info->name = "USB Web Camera";
|
||||
info->info = "USB Web Camera";
|
||||
info->name = (char *)"USB Web Camera";
|
||||
info->info = (char *)"USB Web Camera";
|
||||
info->kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE | B_PHYSICAL_INPUT;
|
||||
info->flavor_flags = 0;//B_FLAVOR_IS_GLOBAL;
|
||||
info->internal_id = atomic_add((int32*)&fInternalIDCounter, 1);
|
||||
|
@ -571,8 +571,6 @@ CamDevice::DataPumpThread()
|
||||
for (int i = 0; i<numPacketDescriptors; i++)
|
||||
packetDescriptors[i].request_length = 256;
|
||||
|
||||
int fullPackets = 0;
|
||||
int totalPackets = 0;
|
||||
while (fTransferEnabled) {
|
||||
ssize_t len = -1;
|
||||
BAutolock lock(fLocker);
|
||||
|
@ -78,9 +78,9 @@ CamSensor::AcceptVideoFrame(uint32 &width, uint32 &height)
|
||||
width = MaxWidth();
|
||||
if (height < 1)
|
||||
height = MaxHeight();
|
||||
if (width > MaxWidth())
|
||||
if (width > (uint32)MaxWidth())
|
||||
width = MaxWidth();
|
||||
if (height > MaxHeight())
|
||||
if (height > (uint32)MaxHeight())
|
||||
height = MaxHeight();
|
||||
return B_OK;
|
||||
}
|
||||
@ -130,7 +130,7 @@ status_t
|
||||
CamSensor::ProbeByIICSignature(const uint8 *regList, const uint8 *matchList,
|
||||
size_t count)
|
||||
{
|
||||
for (int i = 0; i < count; i++) {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
uint8 value = 0;
|
||||
ssize_t len;
|
||||
len = Device()->ReadIIC8(regList[i], &value);
|
||||
|
@ -67,12 +67,16 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
|
||||
end = bufsize;
|
||||
}
|
||||
// whole buffer belongs to a frame, simple
|
||||
if ((fState == ST_FRAME) && (fCurrentFrame->Position() + bufsize < fMinFrameSize)) {
|
||||
// no residual data, and
|
||||
fCurrentFrame->Write(buf, bufsize);
|
||||
fInputBuff.Seek(0LL, SEEK_SET);
|
||||
fInputBuff.SetSize(0);
|
||||
return size;
|
||||
if (fState == ST_FRAME) {
|
||||
off_t position = fCurrentFrame->Position();
|
||||
if (position + bufsize < 0
|
||||
|| (size_t)(position + bufsize) < fMinFrameSize) {
|
||||
// no residual data, and
|
||||
fCurrentFrame->Write(buf, bufsize);
|
||||
fInputBuff.Seek(0LL, SEEK_SET);
|
||||
fInputBuff.SetSize(0);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
// waiting for a frame...
|
||||
@ -116,10 +120,13 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
|
||||
#endif
|
||||
#if 1
|
||||
i = 0;
|
||||
if (fCurrentFrame->Position() < fMinFrameSize) {
|
||||
if (fCurrentFrame->Position() + bufsize >= fMinFrameSize)
|
||||
off_t currentFramePosition = fCurrentFrame->Position();
|
||||
if (currentFramePosition < 0
|
||||
|| (size_t)currentFramePosition < fMinFrameSize) {
|
||||
if (currentFramePosition + bufsize > 0
|
||||
&& (size_t)(currentFramePosition + bufsize) >= fMinFrameSize) {
|
||||
i = (fMinFrameSize - (size_t)fCurrentFrame->Position());
|
||||
else
|
||||
} else
|
||||
i = bufsize;
|
||||
}
|
||||
PRINT((CH ": checking for EOF; bufsize=%d i=%d" CT, bufsize, i));
|
||||
@ -133,7 +140,9 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
|
||||
i += j;
|
||||
PRINT((CH "| EOF[%d] at offset %d; pos %" B_PRIdOFF CT,
|
||||
which, i, fCurrentFrame->Position()));
|
||||
if (fCurrentFrame->Position()+i >= fMaxFrameSize) {
|
||||
off_t position = fCurrentFrame->Position();
|
||||
if (position + i >= 0
|
||||
&& (size_t)(position + i) >= fMaxFrameSize) {
|
||||
// too big: discard
|
||||
//i = -1;
|
||||
discard = true;
|
||||
@ -159,7 +168,9 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
|
||||
PRINT((CH ": writing %d bytes" CT, end));
|
||||
if (end <= bufsize)
|
||||
fCurrentFrame->Write(buf, end);
|
||||
if (fCurrentFrame->Position() > fMaxFrameSize) {
|
||||
off_t currentPosition = fCurrentFrame->Position();
|
||||
if (currentPosition > 0
|
||||
&& (size_t)currentPosition > fMaxFrameSize) {
|
||||
fCurrentFrame->SetSize(fMaxFrameSize);
|
||||
detach = true;
|
||||
}
|
||||
|
@ -711,7 +711,7 @@ VideoProducer::GetParameterValue(
|
||||
*((uint32 *)value) = fColor;
|
||||
return B_OK;
|
||||
case P_INFO:
|
||||
if (*size < fInfoString.Length() + 1)
|
||||
if (*size < (size_t)(fInfoString.Length() + 1))
|
||||
return EINVAL;
|
||||
*last_change = fLastColorChange;
|
||||
*size = fInfoString.Length() + 1;
|
||||
|
@ -27,7 +27,7 @@ const usb_webcam_support_descriptor kSupportedDevices[] = {
|
||||
};
|
||||
|
||||
|
||||
#warning TODO!
|
||||
// TODO: Complete implementation!
|
||||
|
||||
// datasheets: (scarce)
|
||||
// http://www.digchip.com/datasheets/parts/datasheet/132/NW800.php
|
||||
@ -88,10 +88,7 @@ NW80xCamDevice::SupportsIsochronous()
|
||||
|
||||
status_t
|
||||
NW80xCamDevice::StartTransfer()
|
||||
{
|
||||
status_t err;
|
||||
uint8 r;
|
||||
|
||||
{
|
||||
SetScale(1);
|
||||
if (Sensor())
|
||||
SetVideoFrame(BRect(0, 0, Sensor()->MaxWidth()-1, Sensor()->MaxHeight()-1));
|
||||
@ -100,6 +97,9 @@ NW80xCamDevice::StartTransfer()
|
||||
|
||||
DumpRegs();
|
||||
#if 0
|
||||
status_t err;
|
||||
uint8 r;
|
||||
|
||||
err = ReadReg(SN9C102_CHIP_CTRL, &r, 1, true);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -116,11 +116,11 @@ status_t
|
||||
NW80xCamDevice::StopTransfer()
|
||||
{
|
||||
status_t err;
|
||||
uint8 r;
|
||||
|
||||
DumpRegs();
|
||||
DumpRegs();
|
||||
err = CamDevice::StopTransfer();
|
||||
#if 0
|
||||
uint8 r;
|
||||
|
||||
// if (err < 0)
|
||||
// return err;
|
||||
err = ReadReg(SN9C102_CHIP_CTRL, &r, 1, true);
|
||||
@ -158,7 +158,7 @@ NW80xCamDevice::GetStatusIIC()
|
||||
{
|
||||
status_t err = B_ERROR;
|
||||
uint8 status = 0;
|
||||
#warning WRITEME
|
||||
// TODO: WRITEME
|
||||
//dprintf(ID "i2c_status: error 0x%08lx, status = %02x\n", err, status);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -169,8 +169,7 @@ NW80xCamDevice::GetStatusIIC()
|
||||
status_t
|
||||
NW80xCamDevice::WaitReadyIIC()
|
||||
{
|
||||
status_t err;
|
||||
#warning WRITEME
|
||||
// TODO: WRITEME
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
@ -178,8 +177,7 @@ NW80xCamDevice::WaitReadyIIC()
|
||||
ssize_t
|
||||
NW80xCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count)
|
||||
{
|
||||
status_t err;
|
||||
int i;
|
||||
size_t i;
|
||||
uint8 buffer[0x23];
|
||||
if (count > 16)
|
||||
return EINVAL;
|
||||
@ -206,7 +204,6 @@ ssize_t
|
||||
NW80xCamDevice::ReadIIC8(uint8 address, uint8 *data)
|
||||
{
|
||||
status_t err;
|
||||
int i;
|
||||
uint8 buffer[0x23];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
buffer[0x20] = Sensor() ? Sensor()->IICReadAddress() : 0;
|
||||
@ -234,7 +231,6 @@ ssize_t
|
||||
NW80xCamDevice::ReadIIC16(uint8 address, uint16 *data)
|
||||
{
|
||||
status_t err;
|
||||
int i;
|
||||
uint8 buffer[0x23];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
buffer[0x20] = Sensor() ? Sensor()->IICReadAddress() : 0;
|
||||
|
@ -123,7 +123,7 @@ QuickCamDevice::GetStatusIIC()
|
||||
{
|
||||
status_t err = B_ERROR;
|
||||
uint8 status = 0;
|
||||
#warning WRITEME
|
||||
// TODO: WRITEME
|
||||
//dprintf(ID "i2c_status: error 0x%08lx, status = %02x\n", err, status);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -134,7 +134,7 @@ QuickCamDevice::GetStatusIIC()
|
||||
status_t
|
||||
QuickCamDevice::WaitReadyIIC()
|
||||
{
|
||||
#warning WRITEME
|
||||
// TODO: WRITEME
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ QuickCamDevice::WaitReadyIIC()
|
||||
ssize_t
|
||||
QuickCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
uint8 buffer[0x23];
|
||||
if (count > 16)
|
||||
return EINVAL;
|
||||
|
@ -170,10 +170,10 @@ TAS5110C1BSensor::SetVideoFrame(BRect rect)
|
||||
void
|
||||
TAS5110C1BSensor::AddParameters(BParameterGroup *group, int32 &index)
|
||||
{
|
||||
BContinuousParameter *p;
|
||||
CamSensor::AddParameters(group, index);
|
||||
|
||||
#ifdef ENABLE_GAIN
|
||||
BContinuousParameter *p;
|
||||
// NON-FUNCTIONAL
|
||||
BParameterGroup *g = group->MakeGroup("global gain");
|
||||
p = g->MakeContinuousParameter(index++,
|
||||
|
Loading…
Reference in New Issue
Block a user