diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-08-13 06:50:21 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-08-13 06:50:21 +0200 |
commit | 60589fcd0c7afc4f4cf0d832fd603ae75bc9c71a (patch) | |
tree | d7595339d4470c2580e413a6867ab9272254e833 /includes | |
parent | 735604976485ab69cd813d13ef53505bc454c201 (diff) |
Cleaning up the Handle API a bit.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Handle.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/includes/Handle.h b/includes/Handle.h index fdadef5..b167256 100644 --- a/includes/Handle.h +++ b/includes/Handle.h @@ -44,9 +44,8 @@ class Handle { virtual bool canSeek(); virtual bool canRead(); virtual bool canWrite(); - virtual ssize_t read(void * buf, size_t count) throw (GeneralException); - virtual ssize_t write(const void * buf, size_t count) throw (GeneralException); - template <size_t L> void writeString(const char (&str)[L]) { writeString(str, L - 1); } + virtual ssize_t read(void * buf, size_t count) throw (GeneralException) __attribute__((warn_unused_result)); + virtual ssize_t write(const void * buf, size_t count) throw (GeneralException) __attribute__((warn_unused_result)); virtual void rseek(off_t offset, int whence = SEEK_SET) throw (GeneralException); virtual void wseek(off_t offset, int whence = SEEK_SET) throw (GeneralException); virtual off_t rtell() throw (GeneralException); @@ -77,12 +76,12 @@ class Handle { Future<void> writeI64(int64_t); // these need to be changed into Future<>s - ssize_t write(const String & str) { return write(str.to_charp(), str.strlen()); } - void writeString(const char * str, ssize_t len) { if (len < 0) len = strlen(str); forceWrite(str, len); } - void writeString(const String & str) { forceWrite(str.to_charp(), str.strlen()); } - ssize_t forceRead(void * buf, size_t count, Events::BaseEvent * evt = NULL) throw (GeneralException); - ssize_t forceWrite(const void * buf, size_t count, Events::BaseEvent * evt = NULL) throw (GeneralException); - ssize_t forceWrite(const String & str) { return forceWrite(str.to_charp(), str.strlen()); } + template <size_t L> + ssize_t writeString(const char (&str)[L]) { return writeString(str, L - 1); } + ssize_t writeString(const String & str) __attribute__((warn_unused_result)) { return forceWrite(str.to_charp(), str.strlen()); } + ssize_t writeString(const char * str, ssize_t len) __attribute__((warn_unused_result)) { return forceWrite(str, len); } + ssize_t forceRead(void * buf, size_t count, Events::BaseEvent * evt = NULL) throw (GeneralException) __attribute__((warn_unused_result)); + ssize_t forceWrite(const void * buf, size_t count, Events::BaseEvent * evt = NULL) throw (GeneralException) __attribute__((warn_unused_result)); protected: Handle() { } |