Codycam Warning fixes

"Niels Reedijk" <n.reedijk-EIBgga6/0yRmR6Xm/[email protected]> Sun, 30 Nov 2003 21:17:09 GMT
Newsgroups gmane.os.openbeos.preferences
Message-ID <[email protected]>
Hi,

I've fixed a whole number of warnings.

patch-1
    Fix numerous warnings in codycam

Can I merge these with the main cvs repository?

Niels


--- orig/CodyCam.cpp
+++ mod/CodyCam.cpp
@@ -93,9 +93,6 @@
 CodyCam::ReadyToRun()
 {
        /* create the window for the app */
-       uint32 x =3D WINDOW_SIZE_X;
-       uint32 y =3D WINDOW_SIZE_Y;
-
        fWindow =3D new VideoWindow(BRect(28, 28, 28 + (WINDOW_SIZE_X-1),=
=20
28 + (WINDOW_SIZE_Y-1)),
                                                                (const=20
char *)"CodyCam", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE, &
fPort);

@@ -127,8 +124,6 @@
 void
 CodyCam::MessageReceived(BMessage *message)
 {
-       status_t status;
-
        switch (message->what)
        {
                case msg_start:
@@ -368,7 +363,7 @@
 ErrorAlert(const char * message, status_t err)
 {
        char msg[256];
-       sprintf(msg, "%s\n%s [%x]", message, strerror(err), err);
+       sprintf(msg, "%s\n%s [%lx]", message, strerror(err), err);
        (new BAlert("", msg, "Quit"))->Go();
        be_app->PostMessage(B_QUIT_REQUESTED);
 }
@@ -424,9 +419,9 @@

 VideoWindow::VideoWindow (BRect frame, const char *title, window_type=20
type, uint32 flags, port_id * consumerport) :
        BWindow(frame,title,type,flags),
+       fPortPtr(consumerport),
        fView(NULL),
-       fVideoView(NULL),
-       fPortPtr(consumerport)
+       fVideoView(NULL)
 {
        fFtpInfo.port =3D 0;
        fFtpInfo.rate =3D 0x7fffffff;
@@ -519,7 +514,6 @@
 VideoWindow::MessageReceived(BMessage *message)
 {
        BControl        *p;
-       uint32          index;

        p =3D NULL;
        message->FindPointer((const char *)"source",(void **)&p);
@@ -868,7 +862,6 @@
 ControlWindow::MessageReceived(BMessage * message)
 {
        BParameterWeb * web =3D NULL;
-       BView * panel =3D NULL;
        status_t err;

        switch (message->what)

--- orig/FtpClient.cpp
+++ mod/FtpClient.cpp
@@ -44,7 +44,7 @@
 {
        bool rc =3D false;
        string cmd, replystr;
-       int code, codetype, i, numread;
+       int code, codetype, numread;
        char buf[513];

        cmd =3D "TYPE A";
@@ -453,7 +453,7 @@

        if(m_control !=3D 0)
        {
-               if(cmd.find("PASS") !=3D -1)
+               if(cmd.find("PASS") !=3D string::npos)
                        printf("PASS <suppressed>  (real password sent)
\n");
                else
                        printf("%s\n", ccmd.c_str());
@@ -607,7 +607,6 @@
        unsigned short port;
        BNetAddress addr;
        int i, code, codetype;
-       char buf[32];
        bool rc =3D false;
        struct sockaddr_in sa;=20

--- orig/VideoConsumer.cpp
+++ mod/VideoConsumer.cpp
@@ -43,21 +43,21 @@
        BMediaNode(name),
        BMediaEventLooper(),
        BBufferConsumer(B_MEDIA_RAW_VIDEO),
-       mView(view),
-       mWindow(NULL),
        mStatusLine(statusLine),
        mInternalID(internal_id),
        mAddOn(addon),
-       mTimeToFtp(false),
-       mFtpComplete(true),
-       mRate(1000000),
-       mImageFormat(0),
-       mTranslator(0),
-       mPassiveFtp(true),
        mConnectionActive(false),
        mMyLatency(20000),
+       mWindow(NULL),
+       mView(view),
+       mOurBuffers(false),
        mBuffers(NULL),
-       mOurBuffers(false)
+       mTimeToFtp(false),
+       mFtpComplete(true),
+       mRate(1000000),
+        mImageFormat(0),
+        mTranslator(0),
+        mPassiveFtp(true)
 {
        FUNCTION("VideoConsumer::VideoConsumer\n");

@@ -85,7 +85,6 @@
 VideoConsumer::~VideoConsumer()
 {
        FUNCTION("VideoConsumer::~VideoConsumer\n");
-       status_t status;

        Quit();

@@ -196,6 +195,9 @@
                                       =20
ERROR("VideoConsumer::RequestCompleted: Not using our buffers!\n");
                        }
                        break;
+               default:
+                       ERROR("VideoConsumer::RequestCompleted: Invalid=20
argument\n");
+                       break;
        }
        return B_OK;
 }
@@ -240,7 +242,7 @@
 void
 VideoConsumer::BufferReceived(BBuffer * buffer)
 {
-       LOOP("VideoConsumer::Buffer #%d received\n", buffer->ID());
+       LOOP("VideoConsumer::Buffer #%ld received\n", buffer->ID());

        if (RunState() =3D=3D B_STOPPED)
        {
@@ -284,7 +286,6 @@
        // create a buffer group
        uint32 mXSize =3D with_format.u.raw_video.display.line_width;
        uint32 mYSize =3D with_format.u.raw_video.display.line_count;
-       uint32 mRowBytes =3D=20
with_format.u.raw_video.display.bytes_per_row;
        color_space mColorspace =3D=20
with_format.u.raw_video.display.format;
        PROGRESS("VideoConsumer::CreateBuffers - Colorspace =3D %d\n",=20
mColorspace);

@@ -317,7 +318,7 @@
                }
                else
                {
-                       ERROR("VideoConsumer::CreateBuffers - ERROR=20
CREATING VIDEO RING BUFFER: %08x\n", status);
+                       ERROR("VideoConsumer::CreateBuffers - ERROR=20
CREATING VIDEO RING BUFFER: %08lx\n", status);
                        return B_ERROR;
                }
        }
@@ -330,7 +331,7 @@
                        if (buffList[j] !=3D NULL)
                        {
                                mBufferMap[j] =3D (uint32) buffList[j];
-                               PROGRESS(" j =3D %d buffer =3D %08x\n", j=
,=20
mBufferMap[j]);
+                               PROGRESS(" j =3D %d buffer =3D %08lx\n", =
j,=20
mBufferMap[j]);
                        }
                        else
                        {
@@ -350,7 +351,6 @@
 VideoConsumer::DeleteBuffers()
 {
        FUNCTION("VideoConsumer::DeleteBuffers\n");
-       status_t status;

        if (mBuffers)
        {=20