[evince/wip/chpe/load-fd: 844/845] tiff: Remove trailing whitespaces
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/chpe/load-fd: 844/845] tiff: Remove trailing whitespaces
- Date: Wed, 17 Nov 2021 23:04:32 +0000 (UTC)
commit 61cc57de2fc5ad8559d90f6a04155af715b8eaca
Author: Christian Persch <chpe src gnome org>
Date: Thu Nov 18 00:03:14 2021 +0100
tiff: Remove trailing whitespaces
backend/tiff/tiff-document.c | 74 ++++++++++++++++++++++----------------------
1 file changed, 37 insertions(+), 37 deletions(-)
---
diff --git a/backend/tiff/tiff-document.c b/backend/tiff/tiff-document.c
index 38bb3bd8f..6dd6d88b0 100644
--- a/backend/tiff/tiff-document.c
+++ b/backend/tiff/tiff-document.c
@@ -46,7 +46,7 @@ struct _TiffDocument
TIFF *tiff;
gint n_pages;
TIFF2PSContext *ps_export_ctx;
-
+
gchar *uri;
};
@@ -85,11 +85,11 @@ tiff_document_load (EvDocument *document,
TiffDocument *tiff_document = TIFF_DOCUMENT (document);
gchar *filename;
TIFF *tiff;
-
+
filename = g_filename_from_uri (uri, NULL, error);
if (!filename)
return FALSE;
-
+
push_handlers ();
#ifdef G_OS_WIN32
@@ -108,12 +108,12 @@ tiff_document_load (EvDocument *document,
#endif
if (tiff) {
guint32 w, h;
-
+
/* FIXME: unused data? why bother here */
TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
}
-
+
if (!tiff) {
pop_handlers ();
@@ -125,12 +125,12 @@ tiff_document_load (EvDocument *document,
g_free (filename);
return FALSE;
}
-
+
tiff_document->tiff = tiff;
g_free (tiff_document->uri);
g_free (filename);
tiff_document->uri = g_strdup (uri);
-
+
pop_handlers ();
return TRUE;
}
@@ -139,24 +139,24 @@ static gboolean
tiff_document_save (EvDocument *document,
const char *uri,
GError **error)
-{
+{
TiffDocument *tiff_document = TIFF_DOCUMENT (document);
- return ev_xfer_uri_simple (tiff_document->uri, uri, error);
+ return ev_xfer_uri_simple (tiff_document->uri, uri, error);
}
static int
tiff_document_get_n_pages (EvDocument *document)
{
TiffDocument *tiff_document = TIFF_DOCUMENT (document);
-
+
g_return_val_if_fail (TIFF_IS_DOCUMENT (document), 0);
g_return_val_if_fail (tiff_document->tiff != NULL, 0);
-
+
if (tiff_document->n_pages == -1) {
push_handlers ();
tiff_document->n_pages = 0;
-
+
do {
tiff_document->n_pages ++;
}
@@ -200,24 +200,24 @@ tiff_document_get_page_size (EvDocument *document,
guint32 w, h;
gfloat x_res, y_res;
TiffDocument *tiff_document = TIFF_DOCUMENT (document);
-
+
g_return_if_fail (TIFF_IS_DOCUMENT (document));
g_return_if_fail (tiff_document->tiff != NULL);
-
+
push_handlers ();
if (TIFFSetDirectory (tiff_document->tiff, page->index) != 1) {
pop_handlers ();
return;
}
-
+
TIFFGetField (tiff_document->tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField (tiff_document->tiff, TIFFTAG_IMAGELENGTH, &h);
tiff_document_get_resolution (tiff_document, &x_res, &y_res);
h = h * (x_res / y_res);
-
+
*width = w;
*height = h;
-
+
pop_handlers ();
}
@@ -236,10 +236,10 @@ tiff_document_render (EvDocument *document,
cairo_surface_t *surface;
cairo_surface_t *rotated_surface;
static const cairo_user_data_key_t key;
-
+
g_return_val_if_fail (TIFF_IS_DOCUMENT (document), NULL);
g_return_val_if_fail (tiff_document->tiff != NULL, NULL);
-
+
push_handlers ();
if (TIFFSetDirectory (tiff_document->tiff, rc->page->index) != 1) {
pop_handlers ();
@@ -264,9 +264,9 @@ tiff_document_render (EvDocument *document,
}
tiff_document_get_resolution (tiff_document, &x_res, &y_res);
-
+
pop_handlers ();
-
+
/* Sanity check the doc */
if (width <= 0 || height <= 0) {
g_warning("Invalid width or height.");
@@ -277,16 +277,16 @@ tiff_document_render (EvDocument *document,
if (rowstride / 4 != width) {
g_warning("Overflow while rendering document.");
/* overflow, or cairo was changed in an unsupported way */
- return NULL;
+ return NULL;
}
-
+
if (height >= INT_MAX / rowstride) {
g_warning("Overflow while rendering document.");
/* overflow */
return NULL;
}
bytes = height * rowstride;
-
+
pixels = g_try_malloc (bytes);
if (!pixels) {
g_warning("Failed to allocate memory for rendering.");
@@ -332,7 +332,7 @@ tiff_document_render (EvDocument *document,
scaled_width, scaled_height,
rc->rotation);
cairo_surface_destroy (surface);
-
+
return rotated_surface;
}
@@ -349,7 +349,7 @@ tiff_document_get_thumbnail (EvDocument *document,
GdkPixbuf *pixbuf;
GdkPixbuf *scaled_pixbuf;
GdkPixbuf *rotated_pixbuf;
-
+
push_handlers ();
if (TIFFSetDirectory (tiff_document->tiff, rc->page->index) != 1) {
pop_handlers ();
@@ -367,27 +367,27 @@ tiff_document_get_thumbnail (EvDocument *document,
}
tiff_document_get_resolution (tiff_document, &x_res, &y_res);
-
+
pop_handlers ();
-
+
/* Sanity check the doc */
if (width <= 0 || height <= 0)
- return NULL;
+ return NULL;
if (width >= INT_MAX / 4)
/* overflow */
- return NULL;
+ return NULL;
rowstride = width * 4;
-
+
if (height >= INT_MAX / rowstride)
/* overflow */
- return NULL;
+ return NULL;
bytes = height * rowstride;
-
+
pixels = g_try_malloc (bytes);
if (!pixels)
return NULL;
-
+
if (!TIFFReadRGBAImageOriented (tiff_document->tiff,
width, height,
(uint32 *)pixels,
@@ -396,7 +396,7 @@ tiff_document_get_thumbnail (EvDocument *document,
return NULL;
}
- pixbuf = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8,
+ pixbuf = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8,
width, height, rowstride,
(GdkPixbufDestroyNotify) g_free, NULL);
pop_handlers ();
@@ -407,10 +407,10 @@ tiff_document_get_thumbnail (EvDocument *document,
scaled_width, scaled_height,
GDK_INTERP_BILINEAR);
g_object_unref (pixbuf);
-
+
rotated_pixbuf = gdk_pixbuf_rotate_simple (scaled_pixbuf, 360 - rc->rotation);
g_object_unref (scaled_pixbuf);
-
+
return rotated_pixbuf;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]