summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-12-08 04:06:37 +0000
committerarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-12-08 04:06:37 +0000
commit2e4f6c54a879a625e57cf6a679e2fa7bd3810730 (patch)
treefbaedab7c52990684abde1a56e8c6384698a966e
parent389d1c2893754193da41256a82f6c3c4c9a03097 (diff)
Work around clang static analysis false positives using extra assertions.
git-svn-id: http://pugixml.googlecode.com/svn/trunk@943 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--src/pugixml.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index c1720f1..37c7c02 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -323,6 +323,7 @@ PUGI__NS_BEGIN
// prepare page structure
xml_memory_page* page = xml_memory_page::construct(page_memory);
+ assert(page);
page->memory = memory;
page->allocator = _root->allocator;
@@ -1550,6 +1551,8 @@ PUGI__NS_BEGIN
PUGI__FN bool strcpy_insitu(char_t*& dest, uintptr_t& header, uintptr_t header_mask, const char_t* source)
{
+ assert(header);
+
size_t source_length = strlength(source);
if (source_length == 0)
@@ -1882,7 +1885,7 @@ PUGI__NS_BEGIN
case 1: return strconv_pcdata_impl<opt_false, opt_true>::parse;
case 2: return strconv_pcdata_impl<opt_true, opt_false>::parse;
case 3: return strconv_pcdata_impl<opt_true, opt_true>::parse;
- default: return 0; // should not get here
+ default: assert(false); return 0; // should not get here
}
}
@@ -2059,7 +2062,7 @@ PUGI__NS_BEGIN
case 13: return strconv_attribute_impl<opt_true>::parse_wnorm;
case 14: return strconv_attribute_impl<opt_false>::parse_wnorm;
case 15: return strconv_attribute_impl<opt_true>::parse_wnorm;
- default: return 0; // should not get here
+ default: assert(false); return 0; // should not get here
}
}
@@ -5225,6 +5228,7 @@ namespace pugi
// prepare page structure
impl::xml_memory_page* page = impl::xml_memory_page::construct(page_memory);
+ assert(page);
page->busy_size = impl::xml_memory_page_size;
@@ -8843,6 +8847,7 @@ PUGI__NS_BEGIN
char_t* c = static_cast<char_t*>(_alloc->allocate_nothrow((length + 1) * sizeof(char_t)));
if (!c) throw_error_oom();
+ assert(c); // workaround for clang static analysis
memcpy(c, value.begin, length * sizeof(char_t));
c[length] = 0;