diff --git a/src/calibre/utils/podofo/doc.cpp b/src/calibre/utils/podofo/doc.cpp index d9cef4c423..83aaa40e1f 100644 --- a/src/calibre/utils/podofo/doc.cpp +++ b/src/calibre/utils/podofo/doc.cpp @@ -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; } diff --git a/src/calibre/utils/podofo/fonts.cpp b/src/calibre/utils/podofo/fonts.cpp index dabfafe5c2..0454bcc20b 100644 --- a/src/calibre/utils/podofo/fonts.cpp +++ b/src/calibre/utils/podofo/fonts.cpp @@ -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(r & 0xffffffff), r >> 32); + PdfReference new_ref(static_cast(r & 0xffffffff), static_cast(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(num), static_cast(gen)); + PdfReference ref(num, static_cast(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(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(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(t0gen))); if (t0font) { PdfObject *s = t0font->GetIndirectKey("ToUnicode"); if (!s) { PyErr_SetString(PyExc_ValueError, "Type0 font has no ToUnicode stream"); return NULL; } diff --git a/src/calibre/utils/podofo/images.cpp b/src/calibre/utils/podofo/images.cpp index fddb21b4b7..fcde85d2c5 100644 --- a/src/calibre/utils/podofo/images.cpp +++ b/src/calibre/utils/podofo/images.cpp @@ -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); diff --git a/src/calibre/utils/podofo/outline.cpp b/src/calibre/utils/podofo/outline.cpp index 134198dc0e..42c6c7b810 100644 --- a/src/calibre/utils/podofo/outline.cpp +++ b/src/calibre/utils/podofo/outline.cpp @@ -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)) {