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

int IFFByteStream::check_id ( const char *  id  )  [static]

Checks a potential chunk identifier. This function categorizes the chunk identifier formed by the first four characters of string chkid#. It returns #0# if this is a legal identifier for a regular chunk. It returns #+1# if this is a reserved composite chunk identifier. It returns #-1# if this is an illegal or otherwise reserved identifier which should not be used.

Definition at line 144 of file IFFByteStream.cpp.

Referenced by get_chunk(), GIFFManager::load_chunk(), and put_chunk().

  int i;
  // check absence of null bytes
  for (i=0; i<4; i++)
    if (id[i]<0x20 || id[i]>0x7e)
      return -1;
  // check composite chunks
  static const char *szComposite[] = { "FORM", "LIST", "PROP", "CAT ", 0 };
  for (i=0; szComposite[i]; i++) 
    if (!memcmp(id, szComposite[i], 4))
      return 1;
  // check reserved chunks
  static const char *szReserved[] = { "FOR", "LIS", "CAT", 0 };
  for (i=0; szReserved[i]; i++) 
    if (!memcmp(id, szReserved[i], 3) && id[3]>='1' && id[3]<='9')
      return -1;
  // regular chunk
  return 0;

Generated by  Doxygen 1.6.0   Back to index