poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] speedup sequential file reading


From: apache2
Subject: Re: [PATCH] speedup sequential file reading
Date: Mon, 30 May 2022 11:13:52 +0200
User-agent: Mutt/1.9.3 (2018-01-21)

Re-reading my patch now I realized I had written ftell() instead of ftello(), 
but it should of course be:
diff --git a/libpoke/ios-dev-file.c b/libpoke/ios-dev-file.c
index 66b451a6..1ab310c4 100644
--- a/libpoke/ios-dev-file.c
+++ b/libpoke/ios-dev-file.c
@@ -230,8 +230,9 @@ ios_dev_file_pread (void *iod, void *buf, size_t count, 
ios_dev_off offset)

   /* We are using FILE* for buffering, rather than low-level fd, so we
      have to fake low-level pread by using fseeko.  */
-  if (fseeko (fio->file, offset, SEEK_SET) == -1)
-    return IOD_EOF;
+  if (ftello(fio->file) != offset)
+    if (fseeko (fio->file, offset, SEEK_SET) == -1)
+      return IOD_EOF;
   ret = fread (buf, 1, count, fio->file);

   if (ferror (fio->file))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]