[gnome-utils/gnome-3-0] font-viewer: Add missing check



commit 5491799d3b022aa04bd6abc4b00e3e0b0768b286
Author: Marek Kasik <mkasik redhat com>
Date:   Thu Jun 30 10:24:40 2011 +0200

    font-viewer: Add missing check
    
    Add missing check and fix return value of vfs_stream_read() (#653571).

 font-viewer/ftstream-vfs.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/font-viewer/ftstream-vfs.c b/font-viewer/ftstream-vfs.c
index a433199..deefc54 100644
--- a/font-viewer/ftstream-vfs.c
+++ b/font-viewer/ftstream-vfs.c
@@ -39,8 +39,11 @@ vfs_stream_read (FT_Stream stream,
     GFileInputStream *handle = stream->descriptor.pointer;
     gssize bytes_read = 0;
 
+    if (!count && offset > stream->size)
+        return 1;
+
     if (!g_seekable_seek (G_SEEKABLE (handle), offset, G_SEEK_SET, NULL, NULL))
-        return 0;
+        return (count ? 0 : 1);
 
     if (count > 0) {
         bytes_read = g_input_stream_read (G_INPUT_STREAM (handle), buffer,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]