From 3998f46d06ec5235ade776ec8615e081dd909920 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 28 Feb 2012 04:57:12 +0100 Subject: Being better at handling constant strings in Handle's writes. --- includes/Handle.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/Handle.h b/includes/Handle.h index 1b04556..fede9c7 100644 --- a/includes/Handle.h +++ b/includes/Handle.h @@ -40,7 +40,8 @@ class Handle { virtual const char * getName() = 0; virtual ssize_t read(void * buf, size_t count) throw (GeneralException); virtual ssize_t write(const void * buf, size_t count) throw (GeneralException); - void writeString(const char * str, ssize_t len = -1) { if (len < 0) len = strlen(str); forceWrite(str, len); } + template void writeString(const char str[L]) { writeString(str, L - 1); } + 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()); } void seek(off_t offset, int whence = SEEK_SET) { rseek(offset, whence); } virtual void rseek(off_t offset, int whence = SEEK_SET) throw (GeneralException); -- cgit v1.2.3