hfaxd/FileTransfer.c++
/*
 * Send the raw image data for the current directory
 * in the open TIFF file.  If multiple strips are
 * present in the file they are concatenated w/o
 * consideration for any padding that might be present
 * or might be needed.
 */
Send the raw image data for the current directory
in the open TIFF file.  If multiple strips are
present in the file they are concatenated w/o
consideration for any padding that might be present
or might be needed.
Send the raw image data for the current directory in the open TIFF file . If multiple strips are present in the file they are concatenated w / o consideration for any padding that might be present or might be needed .
bool
HylaFAXServer::sendITIFFData(TIFF* tif, int fdout)
{
    TIFFSTRIPBYTECOUNTS* sb;
    (void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &sb);
    tdata_t buf = _TIFFmalloc(sb[0]);
    tsize_t bsize = sb[0];
    for (tstrip_t s = 0, ns = TIFFNumberOfStrips(tif); s < ns; s++) {
	tsize_t cc = sb[s];
	if (cc > bsize) {
	    buf = _TIFFrealloc(buf, cc);
	    bsize = cc;
	}
	if (buf == NULL) {
	    reply(551, "Error allocating intermediate buffer");
	    return (false);
	}
	if (TIFFReadRawStrip(tif, s, buf, cc) != cc) {
	    reply(551, "Error reading input file at strip %u", s);
	    goto bad;
	}
	if (write(fdout, buf, (u_int) cc) != cc) {
	    perror_reply(426, "Data connection", errno);
	    goto bad;
	}
	byte_count += cc;
    }
    _TIFFfree(buf);
    return (true);
bad:
    _TIFFfree(buf);
    return (false);
}
bool HylaFAXServer :: sendITIFFData ( TIFF * tif , int fdout ) { TIFFSTRIPBYTECOUNTS * sb ; ( void ) TIFFGetField ( tif , TIFFTAG_STRIPBYTECOUNTS , & sb ) ; tdata_t buf = _TIFFmalloc ( sb [ 0 ] ) ; tsize_t bsize = sb [ 0 ] ; for ( tstrip_t s = 0 , ns = TIFFNumberOfStrips ( tif ) ; s < ns ; s ++ ) { tsize_t cc = sb [ s ] ; if ( cc > bsize ) { buf = _TIFFrealloc ( buf , cc ) ; bsize = cc ; } if ( buf == NULL ) { reply ( 551 , " " ) ; return ( false ) ; } if ( TIFFReadRawStrip ( tif , s , buf , cc ) != cc ) { reply ( 551 , " " , s ) ; goto bad ; } if ( write ( fdout , buf , ( u_int ) cc ) != cc ) { perror_reply ( 426 , " " , errno ) ; goto bad ; } byte_count += cc ; } _TIFFfree ( buf ) ; return ( true ) ; bad : _TIFFfree ( buf ) ; return ( false ) ; }
Send the raw image data for the current directory
 in the open TIFF file.
Send the raw image data for the current directory in the open TIFF file .