mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
RAII: pdfrenderer.cpp: cidtogidmap
This commit is contained in:
parent
2772f78170
commit
936ca00c44
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user