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
This commit is contained in:
arseny.kapoulkine@gmail.com 2012-12-08 04:06:37 +00:00
parent 389d1c2893
commit 2e4f6c54a8

View file

@ -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;