summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/BString.h4
-rw-r--r--includes/Handle.h2
-rw-r--r--includes/SimpleMustache.h2
-rw-r--r--src/HttpServer.cc2
4 files changed, 5 insertions, 5 deletions
diff --git a/includes/BString.h b/includes/BString.h
index b388777..09e0d40 100644
--- a/includes/BString.h
+++ b/includes/BString.h
@@ -16,8 +16,8 @@ class String : private std::string {
public:
String() : std::string() { }
String(const char * str) : std::string(str ? str : "") { }
- template<ssize_t L>
- String(const char str[L]) : std::string(str, L) { }
+ template<size_t L>
+ String(const char (&str)[L]) : std::string(str, L - 1) { }
String(const char * str, size_t n) : std::string(str ? str : "", str ? n : 0) { }
String(char c) { set("%c", c); }
String(int32_t i) { set("%i", i); }
diff --git a/includes/Handle.h b/includes/Handle.h
index 5634583..7c502ea 100644
--- a/includes/Handle.h
+++ b/includes/Handle.h
@@ -40,7 +40,7 @@ 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);
- template <ssize_t L> void writeString(const char str[L]) { writeString(str, L - 1); }
+ template <size_t L> 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); }
diff --git a/includes/SimpleMustache.h b/includes/SimpleMustache.h
index 6156923..52a2603 100644
--- a/includes/SimpleMustache.h
+++ b/includes/SimpleMustache.h
@@ -81,7 +81,7 @@ class SimpleMustache {
setTemplate(b);
}
template<size_t S>
- void setTemplate(const char str[S]) { setTemplate((const uint8_t *) str, S); }
+ void setTemplate(const char (&str)[S]) { setTemplate((const uint8_t *) str, S - 1); }
void setTemplate(const char * str, ssize_t s) { setTemplate((const uint8_t *) str, s); }
void setTemplate(const String & str) { setTemplate((const uint8_t *) str.to_charp(), str.strlen()); }
void render(IO<Handle> h, Context * ctx) const { AAssert(ctx, "Please pass on a context to render"); render_r(h, ctx, "", m_fragments.begin(), false, -1); }
diff --git a/src/HttpServer.cc b/src/HttpServer.cc
index 751b01a..23af486 100644
--- a/src/HttpServer.cc
+++ b/src/HttpServer.cc
@@ -36,7 +36,7 @@ class HttpWorker : public Task {
~HttpWorker();
static void buildErrorTemplate(IO<Handle> h) { m_errorTemplate.setTemplate(h); }
template<size_t S>
- static void buildErrorTemplate(const char str[S]) { m_errorTemplate.setTemplate(str, S); }
+ static void buildErrorTemplate(const char (&str)[S]) { m_errorTemplate.setTemplate(str, S - 1); }
static void buildErrorTemplate(const char * str, ssize_t s) { m_errorTemplate.setTemplate(str, s); }
static void buildErrorTemplate(const String & str) { m_errorTemplate.setTemplate(str); }
private: