Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

size_t ByteStream::readall ( void *  buffer,
size_t  size 
) [inherited]

Reads data and blocks until everything has been read. This function is essentially similar to function read#. Unlike function read# however, function readall# will never return a value smaller than size# unless an end-of-file mark is reached. This is implemented by repeatedly calling function read# until everything is read or until we reach an end-of-file mark. Note that read# and readall# are equivalent when size# is one.

Definition at line 395 of file ByteStream.cpp.

References ByteStream::read().

Referenced by DjVuPalette::decode(), DjVuInfo::decode(), DjVuPalette::decode_rgb_entries(), GPixmap::init(), GBitmap::init(), ByteStream::read16(), ByteStream::read24(), ByteStream::read32(), ByteStream::read8(), and ByteStream::readat().

  size_t total = 0;
    while (size > 0)
      int nitems = read(buffer, size);
      // Replaced perror() below with G_THROW(). It still makes little sense
      // as there is no guarantee, that errno is right. Still, throwing
      // exception instead of continuing to loop is better.
      // - eaf
      if(nitems < 0) 
        G_THROW(strerror(errno));               //  (No error in the DjVuMessageFile)
      if (nitems == 0)
      total += nitems;
      size -= nitems; 
      buffer = (void*)((char*)buffer + nitems);
  return total;

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  Doxygen 1.6.0   Back to index