summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2012-04-13 19:31:23 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2012-04-13 19:31:28 +0200
commit56d91ddd2cd42b782cde0bb3fdf4eb9ebe7597be (patch)
treeabd2a51503f3a8845d1b381fca671958ce00da46 /includes
parent869b8141a8383171334129859789155f3ad42f90 (diff)
Fixing my constant-strings constructs (Thanks Kurtis!)
Diffstat (limited to 'includes')
-rw-r--r--includes/BString.h4
-rw-r--r--includes/Handle.h2
-rw-r--r--includes/SimpleMustache.h2
3 files changed, 4 insertions, 4 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); }