Fixed SNC warnings

git-svn-id: http://pugixml.googlecode.com/svn/trunk@525 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine 2010-06-19 18:06:14 +00:00
parent 7b419ad9ec
commit 44134f448d
2 changed files with 46 additions and 36 deletions

View File

@ -47,6 +47,10 @@
# pragma warn -8066 // unreachable code
#endif
#ifdef __SNC__
# pragma diag_suppress=178 // function waS declared but never referenced
#endif
// uintptr_t
#if !defined(_MSC_VER) || _MSC_VER >= 1600
# include <stdint.h>
@ -309,42 +313,7 @@ namespace pugi
global_deallocate(page->memory);
}
PUGIXML_NO_INLINE void* allocate_memory_oob(size_t size, xml_memory_page*& out_page)
{
const size_t large_allocation_threshold = xml_memory_page_size / 4;
xml_memory_page* page = allocate_page(size <= large_allocation_threshold ? xml_memory_page_size : size);
if (!page) return 0;
if (size <= large_allocation_threshold)
{
_root->busy_size = _busy_size;
// insert page at the end of linked list
page->prev = _root;
_root->next = page;
_root = page;
_busy_size = size;
}
else
{
// insert page before the end of linked list
assert(_root->prev);
page->prev = _root->prev;
page->next = _root;
_root->prev->next = page;
_root->prev = page;
}
// allocate inside page
page->busy_size = size;
out_page = page;
return page->data;
}
void* allocate_memory_oob(size_t size, xml_memory_page*& out_page);
void* allocate_memory(size_t size, xml_memory_page*& out_page)
{
@ -427,6 +396,43 @@ namespace pugi
size_t _busy_size;
};
PUGIXML_NO_INLINE void* xml_allocator::allocate_memory_oob(size_t size, xml_memory_page*& out_page)
{
const size_t large_allocation_threshold = xml_memory_page_size / 4;
xml_memory_page* page = allocate_page(size <= large_allocation_threshold ? xml_memory_page_size : size);
if (!page) return 0;
if (size <= large_allocation_threshold)
{
_root->busy_size = _busy_size;
// insert page at the end of linked list
page->prev = _root;
_root->next = page;
_root = page;
_busy_size = size;
}
else
{
// insert page before the end of linked list
assert(_root->prev);
page->prev = _root->prev;
page->next = _root;
_root->prev->next = page;
_root->prev = page;
}
// allocate inside page
page->busy_size = size;
out_page = page;
return page->data;
}
/// A 'name=value' XML attribute structure.
struct xml_attribute_struct
{

View File

@ -44,6 +44,10 @@ typedef __int32 int32_t;
# pragma warning(disable: 4127) // conditional expression is constant
#endif
#ifdef __SNC__
# pragma diag_suppress=237 // controlling expression is constant
#endif
#include <algorithm>
#include <string>