[glom] Document: Don't put a gssize in a gsize.



commit c8f552d6e72fa7bb4c8cdb2abcb5f7499f320026
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Mar 29 14:22:35 2016 +0200

    Document: Don't put a gssize in a gsize.

 glom/libglom/document/bakery/document.cc |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/glom/libglom/document/bakery/document.cc b/glom/libglom/document/bakery/document.cc
index 2eaff3b..d3ad770 100644
--- a/glom/libglom/document/bakery/document.cc
+++ b/glom/libglom/document/bakery/document.cc
@@ -235,7 +235,6 @@ bool Document::read_from_disk(int& failure_code)
 
   // Read data from the input uri:
   guint buffer[BYTES_TO_PROCESS] = {0, }; // For each chunk.
-  gsize bytes_read = 0;
   std::string data; //We use a std::string because we might not get whole UTF8 characters at a time. This 
might not be necessary.
 
   try
@@ -243,13 +242,14 @@ bool Document::read_from_disk(int& failure_code)
     bool bContinue = true;
     while(bContinue)
     {
-      bytes_read = stream->read(buffer, BYTES_TO_PROCESS);
+      auto bytes_read = stream->read(buffer, BYTES_TO_PROCESS);
 
       if(bytes_read == 0)
         bContinue = false; //stop because we reached the end.
       else
       {
         // Add the text to the string:
+        // TODO_Performance: Avoid reallocations.
         data += std::string((char*)buffer, bytes_read);
       }
     }


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