Skip to content
  • Albert Astals Cid's avatar
    NetPBMWriter: Change destructor · e7f0fd89
    Albert Astals Cid authored
    Makes gcc 12.1 happier, i think it was a gcc bug anyway, but the new
    code is a bit "better" anyway, the warning i was getting is
    
    In file included from utils/ImageOutputDev.cc:44:
    In destructor ‘virtual NetPBMWriter::~NetPBMWriter()’,
        inlined from ‘virtual NetPBMWriter::~NetPBMWriter()’ at goo/NetPBMWriter.h:41:31,
        inlined from ‘void ImageOutputDev::writeImage(GfxState*, Object*, Stream*, int, int, GfxImageColorMap*, bool)’ at utils/ImageOutputDev.cc:636:16:
    goo/NetPBMWriter.h:41:31: warning: array subscript ‘NetPBMWriter[0]’ is partly outside array bounds of ‘ImgWriter [2]’ [-Warray-bounds]
       41 |     ~NetPBMWriter() override {};
          |                               ^
    utils/ImageOutputDev.cc: In member function ‘void ImageOutputDev::writeImage(GfxState*, Object*, Stream*, int, int, GfxImageColorMap*, bool)’:
    utils/ImageOutputDev.cc:620:57: note: object of size 16 allocated by ‘operator new’
      620 |             writer = new PNGWriter(PNGWriter::MONOCHROME);
          |                                                         ^
    utils/ImageOutputDev.cc:623:51: note: object of size 16 allocated by ‘operator new’
      623 |             writer = new PNGWriter(PNGWriter::GRAY);
          |                                                   ^
    utils/ImageOutputDev.cc:627:52: note: object of size 16 allocated by ‘operator new’
      627 |             writer = new PNGWriter(PNGWriter::RGB48);
          |                                                    ^
    utils/ImageOutputDev.cc:630:50: note: object of size 16 allocated by ‘operator new’
      630 |             writer = new PNGWriter(PNGWriter::RGB);
          |                                                  ^
    e7f0fd89