summaryrefslogtreecommitdiff
path: root/py/stream.h
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-08-20 21:32:17 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-08-20 22:02:41 +0300
commit0cd9ab77550eada4def492a3a25286ead71a3b24 (patch)
treee1beb1f24e8aff42d943cee873a7c324187b56e9 /py/stream.h
parent168350cd9849b0ab56867c487cfd78ca68c2b228 (diff)
py/objstringio: Fix regression with handling SEEK_SET.
For SEEK_SET, offset should be treated as unsigned, to allow full-width stream sizes (e.g. 32-bit instead of 31-bit). This is now fully documented in stream.h. Also, seek symbolic constants are added.
Diffstat (limited to 'py/stream.h')
-rw-r--r--py/stream.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/py/stream.h b/py/stream.h
index 401ae313c..fbe3d7d85 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -50,10 +50,18 @@
// Argument structure for MP_STREAM_SEEK
struct mp_stream_seek_t {
+ // If whence == MP_SEEK_SET, offset should be treated as unsigned.
+ // This allows dealing with full-width stream sizes (16, 32, 64,
+ // etc. bits). For other seek types, should be treated as signed.
mp_off_t offset;
int whence;
};
+// seek ioctl "whence" values
+#define MP_SEEK_SET (0)
+#define MP_SEEK_CUR (1)
+#define MP_SEEK_END (2)
+
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_read_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_read1_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_readinto_obj);