Skip to content

Commit

Permalink
RAII: pdfrenderer.cpp: cidtogidmap
Browse files Browse the repository at this point in the history
  • Loading branch information
rfschtkt committed May 11, 2017
1 parent 2772f78 commit 936ca00
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions api/pdfrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,14 +570,13 @@ bool TessPDFRenderer::BeginDocumentHandler() {

// CIDTOGIDMAP
const int kCIDToGIDMapSize = 2 * (1 << 16);
unsigned char *cidtogidmap = new unsigned char[kCIDToGIDMapSize];
const std::unique_ptr</*non-const*/ unsigned char[]> cidtogidmap(new unsigned char[kCIDToGIDMapSize]);
for (int i = 0; i < kCIDToGIDMapSize; i++) {
cidtogidmap[i] = (i % 2) ? 1 : 0;
}
size_t len;
unsigned char *comp =
zlibCompress(cidtogidmap, kCIDToGIDMapSize, &len);
delete[] cidtogidmap;
zlibCompress(cidtogidmap.get(), kCIDToGIDMapSize, &len);
n = snprintf(buf, sizeof(buf),
"5 0 obj\n"
"<<\n"
Expand Down

0 comments on commit 936ca00

Please sign in to comment.