[libgsf] ole: fix TODO to avoid extra copy when reading



commit 661b0c8487bd5a671e8897812324b3ba199f9f31
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Wed Dec 19 21:37:32 2012 +0100

    ole: fix TODO to avoid extra copy when reading
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690524

 gsf/gsf-infile-msole.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/gsf/gsf-infile-msole.c b/gsf/gsf-infile-msole.c
index e290328..0649bda 100644
--- a/gsf/gsf-infile-msole.c
+++ b/gsf/gsf-infile-msole.c
@@ -706,14 +706,10 @@ gsf_infile_msole_read (GsfInput *input, size_t num_bytes, guint8 *buffer)
                count = ole->info->bb.size - offset;
                if (count > num_bytes)
                        count = num_bytes;
-               if (!ole_seek_block (ole, ole->bat.block [i], 0))
+               if (!ole_seek_block (ole, ole->bat.block [i], offset))
                        return NULL;
-               data = gsf_input_read (ole->input, count, NULL);
-               if (data == NULL)
+               if (!gsf_input_read (ole->input, count, ptr))
                        return NULL;
-
-               /* TODO : this could be optimized to avoid the copy */
-               memcpy (ptr, data + offset, count);
                offset = 0;
        }
        ole->cur_block = BAT_MAGIC_UNUSED;


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