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