+        char block[BLOCK_SIZE];
+        for ( ;; )
+        {
+            ssize_t nRead = m_file.Read(block, WXSIZEOF(block));
+
+            if ( nRead == wxInvalidOffset )
+            {
+                // read error (error message already given in wxFile::Read)
+                return false;
+            }
+
+            if ( nRead == 0 )
+            {
+                // if no bytes have been read, presumably this is a
+                // valid-but-empty file
+                if ( bufSize == 0 )
+                    return true;
+
+                // otherwise we've finished reading the file
+                break;
+            }
+
+            // extend the buffer for new data
+            if ( !buf.extend(bufSize + nRead) )
+                return false;
+
+            // and append it to the buffer
+            memcpy(buf.data() + bufSize, block, nRead);
+            bufSize += nRead;
+        }