Fix warnings.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24319 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol
2008-03-09 02:38:09 +00:00
parent a8006c78f0
commit e53032e55d
8 changed files with 21 additions and 23 deletions
@@ -109,7 +109,7 @@ WebCamMediaAddOn::InstantiateNodeFor(
return NULL; return NULL;
fRoster->Lock(); fRoster->Lock();
for (int i = 0; i < fRoster->CountCameras(); i++) { for (uint32 i = 0; i < fRoster->CountCameras(); i++) {
CamDevice *c; CamDevice *c;
c = fRoster->CameraAt(i); c = fRoster->CameraAt(i);
PRINT((CH ": cam[%d]: %d, %s" CT, i, c->FlavorInfo()->internal_id, c->BrandName())); PRINT((CH ": cam[%d]: %d, %s" CT, i, c->FlavorInfo()->internal_id, c->BrandName()));
@@ -147,6 +147,7 @@ WebCamMediaAddOn::CameraAdded(CamDevice* device)
{ {
PRINT((CH "()" CT)); PRINT((CH "()" CT));
NotifyFlavorChange(); NotifyFlavorChange();
return B_OK;
} }
status_t status_t
@@ -154,6 +155,7 @@ WebCamMediaAddOn::CameraRemoved(CamDevice* device)
{ {
PRINT((CH "()" CT)); PRINT((CH "()" CT));
NotifyFlavorChange(); NotifyFlavorChange();
return B_OK;
} }
void void
@@ -40,7 +40,7 @@ CamBufferingDeframer::Write(const void *buffer, size_t size)
PRINT((CH "(%p, %d), IB: %d" CT, buffer, size, IB.BufferLength())); PRINT((CH "(%p, %d), IB: %d" CT, buffer, size, IB.BufferLength()));
if (l < fMinFrameSize + fSkipSOFTags + fSkipEOFTags) if (l < (int)(fMinFrameSize + fSkipSOFTags + fSkipEOFTags))
return size; // not enough data anyway return size; // not enough data anyway
if (!fCurrentFrame) { if (!fCurrentFrame) {
@@ -53,9 +53,9 @@ CamBufferingDeframer::Write(const void *buffer, size_t size)
} }
} }
for (s = 0; (l - s > fMinFrameSize) && ((i = FindSOF(b + s, l - fMinFrameSize - s, &which)) > -1); s++) { for (s = 0; (l - s > (int)fMinFrameSize) && ((i = FindSOF(b + s, l - fMinFrameSize - s, &which)) > -1); s++) {
s += i; s += i;
if (s + fSkipSOFTags + fMinFrameSize + fSkipEOFTags > l) if ((int)(s + fSkipSOFTags + fMinFrameSize + fSkipEOFTags) > l)
break; break;
if (!fDevice->ValidateStartOfFrameTag(b + s, fSkipSOFTags)) if (!fDevice->ValidateStartOfFrameTag(b + s, fSkipSOFTags))
continue; continue;
@@ -64,7 +64,7 @@ CamBufferingDeframer::Write(const void *buffer, size_t size)
PRINT((CH ": SOF: ... %02x %02x %02x %02x %02x %02x" CT, b[s+6], b[s+7], b[s+8], b[s+9], b[s+10], b[s+11])); PRINT((CH ": SOF: ... %02x %02x %02x %02x %02x %02x" CT, b[s+6], b[s+7], b[s+8], b[s+9], b[s+10], b[s+11]));
for (e = s + fSkipSOFTags + fMinFrameSize; for (e = s + fSkipSOFTags + fMinFrameSize;
((e <= s + fSkipSOFTags + fMaxFrameSize) && ((e <= (int)(s + fSkipSOFTags + fMaxFrameSize)) &&
(e < l) && ((i = 0*FindEOF(b + e, l - e, &which)) > -1)); (e < l) && ((i = 0*FindEOF(b + e, l - e, &which)) > -1));
e++) { e++) {
e += i; e += i;
@@ -115,6 +115,6 @@ CamBufferingDeframer::DiscardFromInput(size_t size)
IB.Seek(0LL, SEEK_SET); IB.Seek(0LL, SEEK_SET);
IB.SetSize(0); IB.SetSize(0);
fInputBuffIndex = next; fInputBuffIndex = next;
return size;
} }
@@ -101,7 +101,6 @@ CamDeframer::WaitFrame(bigtime_t timeout)
status_t status_t
CamDeframer::GetFrame(CamFrame **frame, bigtime_t *stamp) CamDeframer::GetFrame(CamFrame **frame, bigtime_t *stamp)
{ {
status_t err = EINTR;
PRINT((CH "()" CT)); PRINT((CH "()" CT));
BAutolock l(fLocker); BAutolock l(fLocker);
CamFrame *f = (CamFrame *)fFrames.RemoveItem((int32)0); CamFrame *f = (CamFrame *)fFrames.RemoveItem((int32)0);
@@ -115,7 +114,6 @@ CamDeframer::GetFrame(CamFrame **frame, bigtime_t *stamp)
status_t status_t
CamDeframer::DropFrame() CamDeframer::DropFrame()
{ {
status_t err = EINTR;
PRINT((CH "()" CT)); PRINT((CH "()" CT));
BAutolock l(fLocker); BAutolock l(fLocker);
CamFrame *f = (CamFrame *)fFrames.RemoveItem((int32)0); CamFrame *f = (CamFrame *)fFrames.RemoveItem((int32)0);
@@ -161,7 +159,7 @@ int
CamDeframer::FindTags(const uint8 *buf, size_t buflen, const uint8 **tags, int tagcount, size_t taglen, size_t skiplen, int *which) CamDeframer::FindTags(const uint8 *buf, size_t buflen, const uint8 **tags, int tagcount, size_t taglen, size_t skiplen, int *which)
{ {
int i, t; int i, t;
for (i = 0; i < buflen - skiplen + 1; i++) { for (i = 0; i < (int)(buflen - skiplen + 1); i++) {
for (t = 0; t < tagcount; t++) { for (t = 0; t < tagcount; t++) {
if (!memcmp(buf+i, tags[t], taglen)) { if (!memcmp(buf+i, tags[t], taglen)) {
if (which) if (which)
@@ -29,12 +29,12 @@ struct { const char *name; SensorInstFunc instfunc; } kSensorTable[] = {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
CamDevice::CamDevice(CamDeviceAddon &_addon, BUSBDevice* _device) CamDevice::CamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
: fInitStatus(B_NO_INIT), : fInitStatus(B_NO_INIT),
fSensor(NULL),
fCamDeviceAddon(_addon), fCamDeviceAddon(_addon),
fDevice(_device), fDevice(_device),
fSupportedDeviceIndex(-1), fSupportedDeviceIndex(-1),
fTransferEnabled(false), fTransferEnabled(false),
fLocker("WebcamDeviceLock"), fLocker("WebcamDeviceLock")
fSensor(NULL)
{ {
// fill in the generic flavor // fill in the generic flavor
memset(&fFlavorInfo, 0, sizeof(fFlavorInfo)); memset(&fFlavorInfo, 0, sizeof(fFlavorInfo));
@@ -61,7 +61,7 @@ void
CamRoster::DeviceRemoved(BUSBDevice* _device) CamRoster::DeviceRemoved(BUSBDevice* _device)
{ {
PRINT((CH "()" CT)); PRINT((CH "()" CT));
for(uint32 i = 0; i < fCameras.CountItems(); ++i) for(int32 i = 0; i < fCameras.CountItems(); ++i)
{ {
CamDevice* cam = (CamDevice *)fCameras.ItemAt(i); CamDevice* cam = (CamDevice *)fCameras.ItemAt(i);
if( cam->Matches(_device) ) if( cam->Matches(_device) )
@@ -115,7 +115,7 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
} }
PRINT((CH ": checking for EOF; bufsize=%d i=%d" CT, bufsize, i)); PRINT((CH ": checking for EOF; bufsize=%d i=%d" CT, bufsize, i));
if (i + fSkipEOFTags > bufsize) { // not enough room to check for EOF, leave it for next time if (i + (int)fSkipEOFTags > bufsize) { // not enough room to check for EOF, leave it for next time
end = i; end = i;
i = -1; // don't detach yet i = -1; // don't detach yet
} else { } else {
@@ -762,8 +762,8 @@ VideoProducer::FrameGenerator()
// This is where we fill the video buffer. // This is where we fill the video buffer.
uint32 *p = (uint32 *)buffer->Data();
#if 0 #if 0
uint32 *p = (uint32 *)buffer->Data();
/* Fill in a pattern */ /* Fill in a pattern */
for (uint32 y=0;y<fConnectedFormat.display.line_count;y++) for (uint32 y=0;y<fConnectedFormat.display.line_count;y++)
for (uint32 x=0;x<fConnectedFormat.display.line_width;x++) for (uint32 x=0;x<fConnectedFormat.display.line_width;x++)
@@ -62,7 +62,7 @@ SonixCamDevice::SonixCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
const BUSBConfiguration *config = GetDevice()->ConfigurationAt(0); const BUSBConfiguration *config = GetDevice()->ConfigurationAt(0);
if (config) { if (config) {
const BUSBInterface *inter = config->InterfaceAt(0); const BUSBInterface *inter = config->InterfaceAt(0);
int i; uint32 i;
GetDevice()->SetConfiguration(config); GetDevice()->SetConfiguration(config);
@@ -228,7 +228,6 @@ ssize_t
SonixCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count) SonixCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count)
{ {
status_t err; status_t err;
uint8 status;
uint8 buffer[8]; uint8 buffer[8];
if (!Sensor()) if (!Sensor())
return B_NO_INIT; return B_NO_INIT;
@@ -265,7 +264,6 @@ ssize_t
SonixCamDevice::ReadIIC(uint8 address, uint8 *data) SonixCamDevice::ReadIIC(uint8 address, uint8 *data)
{ {
status_t err, lasterr = B_OK; status_t err, lasterr = B_OK;
uint8 status;
uint8 buffer[8]; uint8 buffer[8];
if (!Sensor()) if (!Sensor())
return B_NO_INIT; return B_NO_INIT;
@@ -431,8 +429,8 @@ SonixCamDevice::GetFrameBitmap(BBitmap **bm, bigtime_t *stamp /* = NULL */)
return err; return err;
PRINT((CH ": VideoFrame = %fx%f,%fx%f" CT, VideoFrame().left, VideoFrame().top, VideoFrame().right, VideoFrame().bottom)); PRINT((CH ": VideoFrame = %fx%f,%fx%f" CT, VideoFrame().left, VideoFrame().top, VideoFrame().right, VideoFrame().bottom));
long int w = VideoFrame().right - VideoFrame().left + 1; long int w = (long)(VideoFrame().right - VideoFrame().left + 1);
long int h = VideoFrame().bottom - VideoFrame().top + 1; long int h = (long)(VideoFrame().bottom - VideoFrame().top + 1);
b = new BBitmap(VideoFrame().OffsetToSelf(0,0), 0, B_RGB32, w*4); b = new BBitmap(VideoFrame().OffsetToSelf(0,0), 0, B_RGB32, w*4);
PRINT((CH ": Frame: %dx%d" CT, w, h)); PRINT((CH ": Frame: %dx%d" CT, w, h));
@@ -462,17 +460,17 @@ SonixCamDevice::FillFrameBuffer(BBuffer *buffer, bigtime_t *stamp)
if (err < B_OK) if (err < B_OK)
return err; return err;
long int w = VideoFrame().right - VideoFrame().left + 1; long int w = (long)(VideoFrame().right - VideoFrame().left + 1);
long int h = VideoFrame().bottom - VideoFrame().top + 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: %dx%d" CT, VideoFrame().left, VideoFrame().top, VideoFrame().right, VideoFrame().bottom, w, h));
if (buffer->SizeAvailable() >= w*h*4) if (buffer->SizeAvailable() >= (size_t)w*h*4)
bayer2rgb32le((unsigned char *)buffer->Data(), (unsigned char *)f->Buffer(), w, h); bayer2rgb32le((unsigned char *)buffer->Data(), (unsigned char *)f->Buffer(), w, h);
delete f; delete f;
PRINT((CH ": available %d, required %d" CT, buffer->SizeAvailable(), w*h*4)); PRINT((CH ": available %d, required %d" CT, buffer->SizeAvailable(), w*h*4));
if (buffer->SizeAvailable() < w*h*4) if (buffer->SizeAvailable() < (size_t)w*h*4)
return E2BIG; return E2BIG;
PRINT((CH ": got 1 frame (len %d)" CT, buffer->SizeUsed())); PRINT((CH ": got 1 frame (len %d)" CT, buffer->SizeUsed()));
return B_OK; return B_OK;