Skip to content

Commit c3aa95b

Browse files
committed
Fix -Wcast-qual warnings
1 parent 195a5e2 commit c3aa95b

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

include/boost/interprocess/detail/win32_api.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,16 +1717,17 @@ class eventlog_handle_closer
17171717
// requested record in the buffer.
17181718
template<class CharT>
17191719
inline bool find_record_in_buffer( const void* pBuffer, unsigned long dwBytesRead, const CharT *provider_name
1720-
, unsigned int id_to_find, interprocess_eventlogrecord *&pevent_log_record)
1720+
, unsigned int id_to_find, const interprocess_eventlogrecord *&pevent_log_record)
17211721
{
17221722
const unsigned char * pRecord = static_cast<const unsigned char*>(pBuffer);
17231723
const unsigned char * pEndOfRecords = pRecord + dwBytesRead;
17241724
17251725
while (pRecord < pEndOfRecords){
1726-
interprocess_eventlogrecord *pTypedRecord = (interprocess_eventlogrecord*)(void*)pRecord;
1726+
const interprocess_eventlogrecord *pTypedRecord = (const interprocess_eventlogrecord*)(const void*)pRecord;
17271727
// Check provider, written at the end of the fixed-part of the record
17281728
1729-
if (0 == winapi_traits<CharT>::cmp(provider_name, (CharT*)(void*)(pRecord + sizeof(interprocess_eventlogrecord))))
1729+
const CharT *const pName = static_cast<const CharT*>(static_cast<const void*>(pRecord + sizeof(interprocess_eventlogrecord)));
1730+
if (0 == winapi_traits<CharT>::cmp(provider_name, pName))
17301731
{
17311732
// Check event id
17321733
if(id_to_find == (pTypedRecord->EventID & 0xFFFF)){
@@ -1794,7 +1795,7 @@ inline bool get_last_bootup_time(std::string &stamp)
17941795
}
17951796
else
17961797
{
1797-
interprocess_eventlogrecord *pTypedRecord;
1798+
const interprocess_eventlogrecord *pTypedRecord;
17981799
// Print the contents of each record in the buffer.
17991800
if(find_record_in_buffer(heap_deleter.get(), dwBytesRead, provider_name, event_id, pTypedRecord)){
18001801
char stamp_str[sizeof(unsigned long)*3+1];
@@ -1860,7 +1861,7 @@ inline bool get_last_bootup_time(std::wstring &stamp)
18601861
}
18611862
else
18621863
{
1863-
interprocess_eventlogrecord *pTypedRecord;
1864+
const interprocess_eventlogrecord *pTypedRecord;
18641865
// Print the contents of each record in the buffer.
18651866
if(find_record_in_buffer(heap_deleter.get(), dwBytesRead, provider_name, event_id, pTypedRecord)){
18661867
wchar_t stamp_str[sizeof(unsigned long)*3+1];

test/memory_algorithm_test_template.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,9 @@ bool test_clear_free_memory(Allocator &a)
532532
for(std::size_t j = 0; j < memsize; ++j){
533533
if(static_cast<char*>((char*)ptr)[j]){
534534
std::cout << "Zero memory test failed. in buffer " << i
535-
<< " byte " << j << " first address " << (void*) first_addr << " offset " << ((char*)ptr+j) - (char*)first_addr << " memsize: " << memsize << std::endl;
535+
<< " byte " << j << " first address " << (const void*) first_addr
536+
<< " offset " << ((const char*)ptr+j) - (const char*)first_addr
537+
<< " memsize: " << memsize << std::endl;
536538
return false;
537539
}
538540
}

0 commit comments

Comments
 (0)