"Fossies" - the Fresh Open Source Software Archive

Member "libextractor-1.11/src/main/extractor_common.h" (30 Jan 2021, 1818 Bytes) of package /linux/privat/libextractor-1.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "extractor_common.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2      This file is part of libextractor.
    3      Copyright (C) 2012 Vidyut Samanta and Christian Grothoff
    4 
    5      libextractor is free software; you can redistribute it and/or modify
    6      it under the terms of the GNU General Public License as published
    7      by the Free Software Foundation; either version 3, or (at your
    8      option) any later version.
    9 
   10      libextractor is distributed in the hope that it will be useful, but
   11      WITHOUT ANY WARRANTY; without even the implied warranty of
   12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13      General Public License for more details.
   14 
   15      You should have received a copy of the GNU General Public License
   16      along with libextractor; see the file COPYING.  If not, write to the
   17      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   18      Boston, MA 02110-1301, USA.
   19  */
   20 /**
   21  * @file main/extractor_common.h
   22  * @brief commonly used functions within the library
   23  * @author Christian Grothoff
   24  */
   25 
   26 #ifndef EXTRACTOR_COMMON_H
   27 #define EXTRACTOR_COMMON_H
   28 
   29 /**
   30  * Writes 'size' bytes from 'buf' to 'fd', returns only when
   31  * writing is not possible, or when all 'size' bytes were written
   32  * (never does partial writes).
   33  *
   34  * @param fd fd to write into
   35  * @param buf buffer to read from
   36  * @param size number of bytes to write
   37  * @return number of bytes written (that is 'size'), or -1 on error
   38  */
   39 ssize_t
   40 EXTRACTOR_write_all_ (int fd,
   41                       const void *buf,
   42                       size_t size);
   43 
   44 
   45 /**
   46  * Read a buffer from a given descriptor.
   47  *
   48  * @param fd descriptor to read from
   49  * @param buf buffer to fill
   50  * @param size number of bytes to read into 'buf'
   51  * @return -1 on error, size on success
   52  */
   53 ssize_t
   54 EXTRACTOR_read_all_ (int fd,
   55                      void *buf,
   56                      size_t size);
   57 
   58 
   59 #endif