#235 Fix error: conversion from ‘const CByteDynBuffer’ to ‘const void*’ is ambiguous

open
nobody
None
5
2013-11-14
2013-10-26
porneL
No

gcc (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1 complains:

7zip/CPP/7zip/Common/StreamObjects.cpp: In member function void CDynBufSeqOutStream::CopyToBuffer(CByteBuffer&) const:
7zip/CPP/7zip/Common/StreamObjects.cpp:81:30: error: conversion from const CByteDynBuffer to const void* is ambiguous
   memcpy(dest, _buffer, _size);
                              ^
7zip/CPP/7zip/Common/StreamObjects.cpp:81:30: note: candidates are:
In file included from 7zip/CPP/7zip/Common/StreamObjects.cpp:7:0:
7zip/CPP/7zip/Common/StreamObjects.h:52:3: note: CByteDynBuffer::operator const Byte*() const
   operator const Byte*() const { return _buf; };
   ^
7zip/CPP/7zip/Common/StreamObjects.h:51:3: note: CByteDynBuffer::operator Byte*() const
   operator Byte*() const { return _buf; };
   ^

This patch adds a cast memcpy(dest, (const Byte*)_buffer, _size) to choose one way of conversion.

1 Attachments

Discussion