1
0
mirror of https://github.com/OlafvdSpek/ctemplate.git synced 2025-09-28 19:05:49 +08:00

Fix G++ 4.7 issues

This commit is contained in:
olafvdspek@gmail.com 2012-03-23 14:41:17 +00:00
parent b44faf9896
commit bc838ba7c3
3 changed files with 6 additions and 6 deletions

View File

@ -97,8 +97,8 @@ static bool ascii_isspace(char c) {
}
#define strsuffix(str, suffix) \
( strlen(str) > (sizeof(""suffix"")-1) && \
strcmp(str + strlen(str) - (sizeof(suffix)-1), suffix) == 0 )
( strlen(str) > (sizeof("" suffix "") - 1) && \
strcmp(str + strlen(str) - (sizeof(suffix) - 1), suffix) == 0 )
using std::endl;
using std::string;

View File

@ -554,7 +554,7 @@ void TemplateDictionary::SetTemplateGlobalValueWithoutCopy(
const TemplateString& dict_name, const TemplateString& sub_name,
size_t index, const char* suffix) {
char index_str[64];
snprintf(index_str, sizeof(index_str), "%"PRIuS, index);
snprintf(index_str, sizeof(index_str), "%" PRIuS, index);
return (PrintableTemplateString(dict_name) + "/" +
PrintableTemplateString(sub_name) + "#" + index_str + suffix);
}
@ -861,7 +861,7 @@ class TemplateDictionary::DictionaryPrinter {
string GetDictNum(size_t index, size_t size) const {
char buf[64]; // big enough for two ints
snprintf(buf, sizeof(buf), "%"PRIuS" of %"PRIuS, index, size);
snprintf(buf, sizeof(buf), "%" PRIuS" of %" PRIuS, index, size);
return buf;
}

View File

@ -93,8 +93,8 @@ using HTMLPARSER_NAMESPACE::HtmlParser;
// Check whether the string of length len is identical to the literal.
// The ""s ensure literal is actually a string literal
#define STR_IS(str, len, literal) \
((len) == sizeof(""literal"")-1 && \
memcmp(str, literal, sizeof(""literal"")-1) == 0)
((len) == sizeof("" literal "") - 1 && \
memcmp(str, literal, sizeof("" literal "") - 1) == 0)
TemplateModifier::~TemplateModifier() {}