diff --git a/include/boost/interprocess/detail/win32_api.hpp b/include/boost/interprocess/detail/win32_api.hpp index b591ef6..bc700d7 100644 --- a/include/boost/interprocess/detail/win32_api.hpp +++ b/include/boost/interprocess/detail/win32_api.hpp @@ -1717,16 +1717,17 @@ class eventlog_handle_closer // requested record in the buffer. template inline bool find_record_in_buffer( const void* pBuffer, unsigned long dwBytesRead, const CharT *provider_name - , unsigned int id_to_find, interprocess_eventlogrecord *&pevent_log_record) + , unsigned int id_to_find, const interprocess_eventlogrecord *&pevent_log_record) { const unsigned char * pRecord = static_cast(pBuffer); const unsigned char * pEndOfRecords = pRecord + dwBytesRead; while (pRecord < pEndOfRecords){ - interprocess_eventlogrecord *pTypedRecord = (interprocess_eventlogrecord*)(void*)pRecord; + const interprocess_eventlogrecord *pTypedRecord = (const interprocess_eventlogrecord*)(const void*)pRecord; // Check provider, written at the end of the fixed-part of the record - if (0 == winapi_traits::cmp(provider_name, (CharT*)(void*)(pRecord + sizeof(interprocess_eventlogrecord)))) + const CharT *const pName = static_cast(static_cast(pRecord + sizeof(interprocess_eventlogrecord))); + if (0 == winapi_traits::cmp(provider_name, pName)) { // Check event id if(id_to_find == (pTypedRecord->EventID & 0xFFFF)){ @@ -1794,7 +1795,7 @@ inline bool get_last_bootup_time(std::string &stamp) } else { - interprocess_eventlogrecord *pTypedRecord; + const interprocess_eventlogrecord *pTypedRecord; // Print the contents of each record in the buffer. if(find_record_in_buffer(heap_deleter.get(), dwBytesRead, provider_name, event_id, pTypedRecord)){ char stamp_str[sizeof(unsigned long)*3+1]; @@ -1860,7 +1861,7 @@ inline bool get_last_bootup_time(std::wstring &stamp) } else { - interprocess_eventlogrecord *pTypedRecord; + const interprocess_eventlogrecord *pTypedRecord; // Print the contents of each record in the buffer. if(find_record_in_buffer(heap_deleter.get(), dwBytesRead, provider_name, event_id, pTypedRecord)){ wchar_t stamp_str[sizeof(unsigned long)*3+1]; diff --git a/test/memory_algorithm_test_template.hpp b/test/memory_algorithm_test_template.hpp index 34e8236..06d8861 100644 --- a/test/memory_algorithm_test_template.hpp +++ b/test/memory_algorithm_test_template.hpp @@ -532,7 +532,9 @@ bool test_clear_free_memory(Allocator &a) for(std::size_t j = 0; j < memsize; ++j){ if(static_cast((char*)ptr)[j]){ std::cout << "Zero memory test failed. in buffer " << i - << " byte " << j << " first address " << (void*) first_addr << " offset " << ((char*)ptr+j) - (char*)first_addr << " memsize: " << memsize << std::endl; + << " byte " << j << " first address " << (const void*) first_addr + << " offset " << ((const char*)ptr+j) - (const char*)first_addr + << " memsize: " << memsize << std::endl; return false; } }