From 44134f448d7d96f21751c55defab6ef8a32afab8 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sat, 19 Jun 2010 18:06:14 +0000 Subject: Fixed SNC warnings git-svn-id: http://pugixml.googlecode.com/svn/trunk@525 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 78 ++++++++++++++++++++++++++++++------------------------- src/pugixpath.cpp | 4 +++ 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 3f871f1..51b7791 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -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 @@ -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 { diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp index dfc5637..17674fb 100644 --- a/src/pugixpath.cpp +++ b/src/pugixpath.cpp @@ -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 #include -- cgit v1.2.3