mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix compiler warnings
This commit is contained in:
parent
ab6b724835
commit
8d0f0cef93
@ -313,6 +313,7 @@ PDFDoc_create_outline(PDFDoc *self, PyObject *args) {
|
||||
try {
|
||||
page = self->doc->GetPage(pagenum - 1);
|
||||
} catch (const PdfError &err) {
|
||||
(void)err;
|
||||
PyErr_Format(PyExc_ValueError, "Invalid page number: %u", pagenum - 1); goto error;
|
||||
}
|
||||
PdfDestination dest(page, left, top, zoom);
|
||||
@ -490,6 +491,7 @@ PDFDoc_alter_links(PDFDoc *self, PyObject *args) {
|
||||
try {
|
||||
page = self->doc->GetPage(pagenum - 1);
|
||||
} catch(const PdfError &err) {
|
||||
(void)err;
|
||||
PyErr_Format(PyExc_ValueError, "No page number %d in the PDF file", pagenum);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ replace_font_references_in_resources(PdfDictionary &resources, const std::unorde
|
||||
try {
|
||||
r = ref_map.at(key);
|
||||
} catch (const std::out_of_range &err) { (void)err; continue; }
|
||||
PdfReference new_ref(static_cast<uint32_t>(r & 0xffffffff), r >> 32);
|
||||
PdfReference new_ref(static_cast<pdf_objnum>(r & 0xffffffff), static_cast<pdf_gennum>(r >> 32));
|
||||
new_font.AddKey(k.first.GetName(), new_ref);
|
||||
changed = true;
|
||||
}
|
||||
@ -325,12 +325,12 @@ merge_fonts(PDFDoc *self, PyObject *args) {
|
||||
c++;
|
||||
unsigned long num, gen;
|
||||
if (!PyArg_ParseTuple(key, "kk", &num, &gen)) return NULL;
|
||||
uint64_t k = ref_as_integer(num, gen);
|
||||
PdfReference ref(num, gen);
|
||||
uint64_t k = ref_as_integer(static_cast<pdf_objnum>(num), static_cast<pdf_gennum>(gen));
|
||||
PdfReference ref(num, static_cast<pdf_gennum>(gen));
|
||||
PdfObject *font = objects.GetObject(ref);
|
||||
if (font) remove_font(objects, font);
|
||||
if (!PyArg_ParseTuple(value, "kk", &num, &gen)) return NULL;
|
||||
uint64_t v = ref_as_integer(num, gen);
|
||||
uint64_t v = ref_as_integer(num, static_cast<pdf_gennum>(gen));
|
||||
ref_map[k] = v;
|
||||
}
|
||||
if (c > 0) replace_font_references(self, ref_map);
|
||||
@ -341,7 +341,7 @@ merge_fonts(PDFDoc *self, PyObject *args) {
|
||||
const char *data, *tounicode_data;
|
||||
Py_ssize_t sz, tounicode_sz;
|
||||
if (!PyArg_ParseTuple(PyTuple_GET_ITEM(items, i), "(ll)(ll)O!O!s#s#", &num, &gen, &t0num, &t0gen, &PyList_Type, &W, &PyList_Type, &W2, &data, &sz, &tounicode_data, &tounicode_sz)) return NULL;
|
||||
PdfReference ref(num, gen);
|
||||
PdfReference ref(num, static_cast<pdf_gennum>(gen));
|
||||
PdfObject *font = objects.GetObject(ref);
|
||||
if (font) {
|
||||
if (PyObject_IsTrue(W)) {
|
||||
@ -362,7 +362,7 @@ merge_fonts(PDFDoc *self, PyObject *args) {
|
||||
}
|
||||
}
|
||||
if (tounicode_sz) {
|
||||
PdfObject *t0font = objects.GetObject(PdfReference(t0num, t0gen));
|
||||
PdfObject *t0font = objects.GetObject(PdfReference(t0num, static_cast<pdf_gennum>(t0gen)));
|
||||
if (t0font) {
|
||||
PdfObject *s = t0font->GetIndirectKey("ToUnicode");
|
||||
if (!s) { PyErr_SetString(PyExc_ValueError, "Type0 font has no ToUnicode stream"); return NULL; }
|
||||
|
@ -97,7 +97,7 @@ dedup_images(PDFDoc *self, PyObject *args) {
|
||||
const PdfReference &r = ref_map.at(x.second->GetReference());
|
||||
new_xobject.AddKey(x.first.GetName(), r);
|
||||
changed = true;
|
||||
} catch (const std::out_of_range &err) { continue; }
|
||||
} catch (const std::out_of_range &err) { (void)err; continue; }
|
||||
}
|
||||
}
|
||||
if (changed) resources.AddKey("XObject", new_xobject);
|
||||
|
@ -61,7 +61,7 @@ create(PDFOutlineItem *self, PyObject *args) {
|
||||
PdfString title = podofo_convert_pystring(title_buf);
|
||||
try {
|
||||
page = self->doc->GetPage(num - 1);
|
||||
} catch(const PdfError &err) { page = NULL; }
|
||||
} catch(const PdfError &err) { (void)err; page = NULL; }
|
||||
if (page == NULL) { PyErr_Format(PyExc_ValueError, "Invalid page number: %u", num); goto error; }
|
||||
PdfDestination dest(page, left, top, zoom);
|
||||
if (PyObject_IsTrue(as_child)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user