Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/urlmon/usrmarshal.c | 155 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 151 insertions(+), 4 deletions(-)
Jacek Caban jacek@codeweavers.com writes:
+static HRESULT marshal_stgmed(STGMEDIUM *stgmed, RemSTGMEDIUM **ret) +{
- RemSTGMEDIUM *rem_stgmed;
- IStream *stream = NULL;
- ULONG size = 0;
- HRESULT hres;
- if((stgmed->tymed == TYMED_ISTREAM && stgmed->u.pstm) || stgmed->pUnkForRelease) {
hres = CreateStreamOnHGlobal(NULL, TRUE, &stream);
if(FAILED(hres))
return hres;
- }
- switch(stgmed->tymed) {
- case TYMED_NULL:
break;
- case TYMED_ISTREAM:
if(stgmed->u.pstm)
hres = CoMarshalInterface(stream, &IID_IStream, (IUnknown*)stgmed->u.pstm,
MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
break;
- default:
FIXME("unsupported tymed %u\n", stgmed->tymed);
break;
- }
- if(SUCCEEDED(hres) && stgmed->pUnkForRelease)
hres = CoMarshalInterface(stream, &IID_IUnknown, stgmed->pUnkForRelease,
MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
This is causing a warning, and it's not clear to me what would be the correct default value for hres.
gcc -m32 -c -o usrmarshal.o usrmarshal.c -I. -I../../include -D__WINESRC__ -D_URLMON_ -D_REENTRANT -fPIC -Wall \ -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers \ -Wno-packed-not-aligned -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits \ -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op -gdwarf-2 \ -gstrict-dwarf -fno-omit-frame-pointer -Werror -g -O2 -fno-diagnostics-show-caret usrmarshal.c: In function ‘IBindStatusCallback_OnDataAvailable_Proxy’: usrmarshal.c:115:7: error: ‘hres’ may be used uninitialized in this function [-Werror=maybe-uninitialized] usrmarshal.c:94:13: note: ‘hres’ was declared here usrmarshal.c: At top level: cc1: all warnings being treated as errors Makefile:726: recipe for target 'usrmarshal.o' failed
On 13.11.2017 22:57, Alexandre Julliard wrote:
Jacek Caban jacek@codeweavers.com writes:
+static HRESULT marshal_stgmed(STGMEDIUM *stgmed, RemSTGMEDIUM **ret) +{
- RemSTGMEDIUM *rem_stgmed;
- IStream *stream = NULL;
- ULONG size = 0;
- HRESULT hres;
- if((stgmed->tymed == TYMED_ISTREAM && stgmed->u.pstm) || stgmed->pUnkForRelease) {
hres = CreateStreamOnHGlobal(NULL, TRUE, &stream);
if(FAILED(hres))
return hres;
- }
- switch(stgmed->tymed) {
- case TYMED_NULL:
break;
- case TYMED_ISTREAM:
if(stgmed->u.pstm)
hres = CoMarshalInterface(stream, &IID_IStream, (IUnknown*)stgmed->u.pstm,
MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
break;
- default:
FIXME("unsupported tymed %u\n", stgmed->tymed);
break;
- }
- if(SUCCEEDED(hres) && stgmed->pUnkForRelease)
hres = CoMarshalInterface(stream, &IID_IUnknown, stgmed->pUnkForRelease,
MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
This is causing a warning, and it's not clear to me what would be the correct default value for hres.
Indeed, I wonder why my GCC didn't catch it. I sent a fixed version.
Thanks, Jacek