Commit f6d58e69 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mshtml/tests: Test return values in more places (Coverity).

parent 196a9774
...@@ -7742,7 +7742,8 @@ static void doc_write(IHTMLDocument2 *doc, BOOL ln, const char *text) ...@@ -7742,7 +7742,8 @@ static void doc_write(IHTMLDocument2 *doc, BOOL ln, const char *text)
dim.lLbound = 0; dim.lLbound = 0;
dim.cElements = 1; dim.cElements = 1;
sa = SafeArrayCreate(VT_VARIANT, 1, &dim); sa = SafeArrayCreate(VT_VARIANT, 1, &dim);
SafeArrayAccessData(sa, (void**)&var); hres = SafeArrayAccessData(sa, (void**)&var);
ok(hres == S_OK, "Failed to access array data: %08x\n", hres);
V_VT(var) = VT_BSTR; V_VT(var) = VT_BSTR;
V_BSTR(var) = a2bstr(text); V_BSTR(var) = a2bstr(text);
SafeArrayUnaccessData(sa); SafeArrayUnaccessData(sa);
...@@ -7764,7 +7765,8 @@ static void doc_complex_write(IHTMLDocument2 *doc) ...@@ -7764,7 +7765,8 @@ static void doc_complex_write(IHTMLDocument2 *doc)
HRESULT hres; HRESULT hres;
sa = SafeArrayCreate(VT_VARIANT, 1, &dim); sa = SafeArrayCreate(VT_VARIANT, 1, &dim);
SafeArrayAccessData(sa, (void**)&args); hres = SafeArrayAccessData(sa, (void**)&args);
ok(hres == S_OK, "Failed to access array data: %08x\n", hres);
V_VT(args) = VT_BSTR; V_VT(args) = VT_BSTR;
V_BSTR(args) = a2bstr("<body i4val=\""); V_BSTR(args) = a2bstr("<body i4val=\"");
......
...@@ -3129,6 +3129,7 @@ static void doc_load_string(IHTMLDocument2 *doc, const char *str) ...@@ -3129,6 +3129,7 @@ static void doc_load_string(IHTMLDocument2 *doc, const char *str)
{ {
IPersistStreamInit *init; IPersistStreamInit *init;
IStream *stream; IStream *stream;
HRESULT hres;
HGLOBAL mem; HGLOBAL mem;
SIZE_T len; SIZE_T len;
...@@ -3138,9 +3139,11 @@ static void doc_load_string(IHTMLDocument2 *doc, const char *str) ...@@ -3138,9 +3139,11 @@ static void doc_load_string(IHTMLDocument2 *doc, const char *str)
len = strlen(str); len = strlen(str);
mem = GlobalAlloc(0, len); mem = GlobalAlloc(0, len);
memcpy(mem, str, len); memcpy(mem, str, len);
CreateStreamOnHGlobal(mem, TRUE, &stream); hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init); hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
IPersistStreamInit_Load(init, stream); IPersistStreamInit_Load(init, stream);
IPersistStreamInit_Release(init); IPersistStreamInit_Release(init);
......
...@@ -1259,6 +1259,7 @@ static void load_string(IHTMLDocument2 *doc, const char *str) ...@@ -1259,6 +1259,7 @@ static void load_string(IHTMLDocument2 *doc, const char *str)
{ {
IPersistStreamInit *init; IPersistStreamInit *init;
IStream *stream; IStream *stream;
HRESULT hres;
HGLOBAL mem; HGLOBAL mem;
SIZE_T len; SIZE_T len;
...@@ -1266,9 +1267,11 @@ static void load_string(IHTMLDocument2 *doc, const char *str) ...@@ -1266,9 +1267,11 @@ static void load_string(IHTMLDocument2 *doc, const char *str)
len = strlen(str); len = strlen(str);
mem = GlobalAlloc(0, len); mem = GlobalAlloc(0, len);
memcpy(mem, str, len); memcpy(mem, str, len);
CreateStreamOnHGlobal(mem, TRUE, &stream); hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init); hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
IPersistStreamInit_Load(init, stream); IPersistStreamInit_Load(init, stream);
IPersistStreamInit_Release(init); IPersistStreamInit_Release(init);
...@@ -2325,7 +2328,8 @@ static void test_script_run(void) ...@@ -2325,7 +2328,8 @@ static void test_script_run(void)
V_VT(&var) = VT_BSTR; V_VT(&var) = VT_BSTR;
V_BSTR(&var) = NULL; V_BSTR(&var) = NULL;
dispex_propput(document, id, 0, &var, NULL); hres = dispex_propput(document, id, 0, &var, NULL);
ok(hres == S_OK, "dispex_propput failed: %08x\n", hres);
VariantInit(&var); VariantInit(&var);
memset(&dp, 0, sizeof(dp)); memset(&dp, 0, sizeof(dp));
...@@ -2823,7 +2827,8 @@ static void report_data(ProtocolHandler *This) ...@@ -2823,7 +2827,8 @@ static void report_data(ProtocolHandler *This)
IServiceProvider_Release(service_provider); IServiceProvider_Release(service_provider);
ok(hres == S_OK, "Could not get IHttpNegotiate interface: %08x\n", hres); ok(hres == S_OK, "Could not get IHttpNegotiate interface: %08x\n", hres);
IUri_GetDisplayUri(This->uri, &url); hres = IUri_GetDisplayUri(This->uri, &url);
ok(hres == S_OK, "Failed to get display uri: %08x\n", hres);
hres = IHttpNegotiate_BeginningTransaction(http_negotiate, url, emptyW, 0, &addl_headers); hres = IHttpNegotiate_BeginningTransaction(http_negotiate, url, emptyW, 0, &addl_headers);
ok(hres == S_OK, "BeginningTransaction failed: %08x\n", hres); ok(hres == S_OK, "BeginningTransaction failed: %08x\n", hres);
SysFreeString(url); SysFreeString(url);
......
...@@ -3144,6 +3144,7 @@ static IHTMLDocument2 *create_doc_with_string(const char *str) ...@@ -3144,6 +3144,7 @@ static IHTMLDocument2 *create_doc_with_string(const char *str)
IPersistStreamInit *init; IPersistStreamInit *init;
IStream *stream; IStream *stream;
IHTMLDocument2 *doc; IHTMLDocument2 *doc;
HRESULT hres;
HGLOBAL mem; HGLOBAL mem;
SIZE_T len; SIZE_T len;
...@@ -3155,9 +3156,11 @@ static IHTMLDocument2 *create_doc_with_string(const char *str) ...@@ -3155,9 +3156,11 @@ static IHTMLDocument2 *create_doc_with_string(const char *str)
len = strlen(str); len = strlen(str);
mem = GlobalAlloc(0, len); mem = GlobalAlloc(0, len);
memcpy(mem, str, len); memcpy(mem, str, len);
CreateStreamOnHGlobal(mem, TRUE, &stream); hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init); hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
IPersistStreamInit_Load(init, stream); IPersistStreamInit_Load(init, stream);
IPersistStreamInit_Release(init); IPersistStreamInit_Release(init);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment