Update of /cvsroot/playerstage/code/player/server/drivers/camera/v4l
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10946/server/drivers/camera/v4l

Modified Files:
        .cvsignore camerav4l.cc 
Log Message:
applied Toby's patch to replace fixed-size arrays

Index: .cvsignore
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/camera/v4l/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** .cvsignore  17 Sep 2007 02:18:59 -0000      1.2
--- .cvsignore  1 Nov 2007 22:16:18 -0000       1.3
***************
*** 4,5 ****
--- 4,7 ----
  *.la
  *.a
+ .libs
+ *.lo

Index: camerav4l.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/camera/v4l/camerav4l.cc,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** camerav4l.cc        18 Oct 2007 22:33:27 -0000      1.31
--- camerav4l.cc        1 Nov 2007 22:16:18 -0000       1.32
***************
*** 550,570 ****
  {
    int i;
!   size_t size;
    unsigned char * ptr1, * ptr2;
  
    // Set the image properties
    this->data.width       = this->width;
    this->data.height      = this->height;
    this->data.bpp         = this->depth;
!   this->data.image_count = this->width * this->height * this->depth / 8;
    this->data.compression = PLAYER_CAMERA_COMPRESS_RAW;
  
-   assert(data.image_count <= sizeof(this->data.image));
- 
    if (have_ov519)
    {
      this->data.image_count = (*(unsigned short *)(frame->data))*8;
      assert(data.image_count > 0);
-     assert(data.image_count <= sizeof(this->data.image));
      assert(data.image_count <= ((size_t)(this->frame->size)));
      this->data.compression = PLAYER_CAMERA_COMPRESS_JPEG;
--- 550,571 ----
  {
    int i;
!   size_t image_count;
    unsigned char * ptr1, * ptr2;
  
+   // Compute size of image
+   image_count = this->width * this->height * this->depth / 8;
+ 
    // Set the image properties
    this->data.width       = this->width;
    this->data.height      = this->height;
    this->data.bpp         = this->depth;
!   this->data.image_count = image_count;
!   this->data.image       = new unsigned char [image_count];
    this->data.compression = PLAYER_CAMERA_COMPRESS_RAW;
  
    if (have_ov519)
    {
      this->data.image_count = (*(unsigned short *)(frame->data))*8;
      assert(data.image_count > 0);
      assert(data.image_count <= ((size_t)(this->frame->size)));
      this->data.compression = PLAYER_CAMERA_COMPRESS_JPEG;
***************
*** 577,581 ****
      data.image_count = i;
      assert(data.image_count > 0);
-     assert(data.image_count <= sizeof(this->data.image));
      assert(data.image_count <= ((size_t)(this->frame->size)));
      memcpy(data.image, ((unsigned char *)(this->frame->data)) + sizeof(int), 
data.image_count);
--- 578,581 ----
***************
*** 627,634 ****
    }
  
-   // Copy data to server
-   size = sizeof(this->data) - sizeof(this->data.image) + data.image_count;
-   /* We should do this to be efficient */
- 
    if (this->publish_interval)
    {
--- 627,630 ----
***************
*** 639,643 ****
        this->data.bpp         = 0;
        this->data.image_count = 0;
-       size = sizeof(this->data) - sizeof(this->data.image);
      } else this->publish_time = time(NULL);
    }
--- 635,638 ----
***************
*** 645,649 ****
    Publish(this->device_addr, 
            PLAYER_MSGTYPE_DATA, PLAYER_CAMERA_DATA_STATE,
!           reinterpret_cast<void*>(&this->data), size, NULL);
  
    return;
--- 640,645 ----
    Publish(this->device_addr, 
            PLAYER_MSGTYPE_DATA, PLAYER_CAMERA_DATA_STATE,
!           reinterpret_cast<void*>(&this->data));
!   delete [] this->data.image;
  
    return;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to