~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/file/raw/raw_read_fd.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 Input function for image file with no header
  3 reading from file descriptor (yeuk!)
  4 */
  5 #include <tina/sys.h>
  6 #include <tina/sysfuncs.h>
  7 
  8 Imrect *raw_fd_read_image(int fd, int width, int height, Vartype vtype)
  9 {
 10     Imregion *roi_alloc(int, int, int, int);
 11     Imrect *image, *im_alloc(int, int, Imregion *, Vartype);
 12     int row_length;
 13     int ly, uy;
 14     int i;
 15     int read();
 16 
 17     image = im_alloc(height, width, (Imregion *) NULL, vtype);
 18 
 19     row_length = (image->region->ux - image->region->lx) * var_size(image->vtype);
 20     ly = image->region->ly;
 21     uy = image->region->uy;
 22     for (i = ly; i < uy; ++i)
 23     {
 24         void *row;
 25 
 26         IM_ROW_GET(image, i, row)
 27             if (read(fd, (char *) row, row_length) != row_length)
 28         {
 29             im_free(image);
 30             error("unexpected end of file", non_fatal);
 31             return (NULL);
 32         }
 33     }
 34     return (image);
 35 }
 36 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.