~dannf/ubuntu/saucy/djvulibre/lp1224195

« back to all changes in this revision

Viewing changes to libdjvu/DjVuDocEditor.cpp

  • Committer: Package Import Robot
  • Author(s): Barak A. Pearlmutter
  • Date: 2011-06-09 23:06:30 UTC
  • mfrom: (1.1.8) (12.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20110609230630-iixyb3dzba1lio13
Tags: 3.5.24-7
upstream fix to page extraction bug (closes: #629941)

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
//C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
53
53
//C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
54
54
//C- +------------------------------------------------------------------
55
 
// 
56
 
// $Id: DjVuDocEditor.cpp,v 1.23 2008/09/28 12:46:14 leonb Exp $
57
 
// $Name: debian_version_3_5_23-3 $
58
55
 
59
56
#ifdef HAVE_CONFIG_H
60
57
# include "config.h"
558
555
                                         can_compress_flag);
559
556
  }
560
557
 
561
 
         // Oh. It does exist... Check that it has IFF structure
 
558
  // Oh. It does exist... Check that it has IFF structure
562
559
  {
563
 
       const GP<IFFByteStream> giff(
564
 
         IFFByteStream::create(file_pool->get_stream()));
565
 
       IFFByteStream &iff=*giff;
566
 
       GUTF8String chkid;
567
 
 
568
 
       int length;
569
 
       length=iff.get_chunk(chkid);
570
 
       if (chkid!="FORM:DJVI" && chkid!="FORM:DJVU" &&
571
 
         chkid!="FORM:BM44" && chkid!="FORM:PM44")
572
 
       G_THROW( ERR_MSG("DjVuDocEditor.not_1_page") "\t"+file_url.get_string());
573
 
 
574
 
       // Wonderful. It's even a DjVu file. Scan for NDIR chunks.
575
 
       // If NDIR chunk is found, ignore the file
576
 
       while(iff.get_chunk(chkid))
577
 
       {
578
 
         if (chkid=="NDIR")
579
 
           return false;
580
 
         iff.close_chunk();
581
 
       }
 
560
    const GP<IFFByteStream> giff(
 
561
       IFFByteStream::create(file_pool->get_stream()));
 
562
    IFFByteStream &iff=*giff;
 
563
    GUTF8String chkid;
 
564
    iff.get_chunk(chkid);
 
565
    if (chkid!="FORM:DJVI" && chkid!="FORM:DJVU" &&
 
566
        chkid!="FORM:BM44" && chkid!="FORM:PM44")
 
567
      G_THROW( ERR_MSG("DjVuDocEditor.not_1_page") "\t"
 
568
               + file_url.get_string());
 
569
    // Wonderful. It's even a DjVu file. Scan for NDIR chunks.
 
570
    // If NDIR chunk is found, ignore the file
 
571
    while(iff.get_chunk(chkid))
 
572
      {
 
573
        if (chkid=="NDIR")
 
574
          return false;
 
575
        iff.close_chunk();
 
576
      }
582
577
  }
583
578
  return insert_file(file_pool,file_url,is_page,file_pos,name2id,source);
584
579
}