@@ -1717,16 +1717,17 @@ class eventlog_handle_closer
17171717// requested record in the buffer.
17181718template<class CharT>
17191719inline 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];
0 commit comments