Commit 445588ba authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

msxml3/tests: Fix string format warnings.

parent 6ff83ba5
......@@ -31,27 +31,20 @@
/* Deprecated Error Code */
#define XML_E_INVALIDATROOTLEVEL 0xc00ce556
static void append_str(char **str, const char *data)
{
sprintf(*str, data);
*str += strlen(*str);
}
static void create_xml_file(LPCSTR filename)
{
char data[1024];
char *ptr = data;
DWORD dwNumberOfBytesWritten;
HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
append_str(&ptr, "<?xml version=\"1.0\" ?>\n");
append_str(&ptr, "<BankAccount>\n");
append_str(&ptr, " <Number>1234</Number>\n");
append_str(&ptr, " <Name>Captain Ahab</Name>\n");
append_str(&ptr, "</BankAccount>");
static const char data[] =
"<?xml version=\"1.0\" ?>\n"
"<BankAccount>\n"
" <Number>1234</Number>\n"
" <Name>Captain Ahab</Name>\n"
"</BankAccount>";
WriteFile(hf, data, ptr - data, &dwNumberOfBytesWritten, NULL);
WriteFile(hf, data, sizeof(data) - 1, &dwNumberOfBytesWritten, NULL);
CloseHandle(hf);
}
......
......@@ -228,27 +228,20 @@ static void test_xmlelem(void)
IXMLDocument_Release(doc);
}
static void append_str(char **str, const char *data)
{
sprintf(*str, data);
*str += strlen(*str);
}
static void create_xml_file(LPCSTR filename)
{
char data[1024];
char *ptr = data;
DWORD dwNumberOfBytesWritten;
HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
append_str(&ptr, "<?xml version=\"1.0\" ?>\n");
append_str(&ptr, "<BankAccount>\n");
append_str(&ptr, " <Number>1234</Number>\n");
append_str(&ptr, " <Name>Captain Ahab</Name>\n");
append_str(&ptr, "</BankAccount>\n");
static const char data[] =
"<?xml version=\"1.0\" ?>\n"
"<BankAccount>\n"
" <Number>1234</Number>\n"
" <Name>Captain Ahab</Name>\n"
"</BankAccount>\n";
WriteFile(hf, data, ptr - data, &dwNumberOfBytesWritten, NULL);
WriteFile(hf, data, sizeof(data) - 1, &dwNumberOfBytesWritten, NULL);
CloseHandle(hf);
}
......
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