Commit 6b7e1131 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Use ARRAY_SIZE() macro.

parent a62bed3b
......@@ -251,9 +251,9 @@ HRESULT create_uri(const WCHAR *url, IUri **uri)
if (!PathIsURLW(url))
{
WCHAR fullpath[MAX_PATH];
DWORD needed = sizeof(fileUrl)/sizeof(WCHAR);
DWORD needed = ARRAY_SIZE(fileUrl);
if (!PathSearchAndQualifyW(url, fullpath, sizeof(fullpath)/sizeof(WCHAR)))
if (!PathSearchAndQualifyW(url, fullpath, ARRAY_SIZE(fullpath)))
{
WARN("can't find path\n");
return E_FAIL;
......
......@@ -208,11 +208,11 @@ void release_typelib(void)
heap_free(iter);
}
for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
for(i=0; i < ARRAY_SIZE(typeinfos); i++)
if(typeinfos[i])
ITypeInfo_Release(typeinfos[i]);
for(i=0; i < sizeof(typelib)/sizeof(*typelib); i++)
for(i=0; i < ARRAY_SIZE(typelib); i++)
if(typelib[i])
ITypeLib_Release(typelib[i]);
......
......@@ -100,7 +100,7 @@ static MSXML_VERSION get_msxml_version(const GUID *clsid)
{
unsigned int i;
for (i = 0; i < sizeof(clsid_versions_table)/sizeof(struct clsid_version_t); i++)
for (i = 0; i < ARRAY_SIZE(clsid_versions_table); i++)
if (IsEqualGUID(clsid, clsid_versions_table[i].clsid))
return clsid_versions_table[i].version;
......
......@@ -516,7 +516,7 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac
if (This->request->use_utf8_content)
{
lstrcpyW(ptr, content_type_utf8W);
ptr += sizeof(content_type_utf8W)/sizeof(WCHAR)-1;
ptr += ARRAY_SIZE(content_type_utf8W) - 1;
}
if (base_uri)
......@@ -535,13 +535,13 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac
ptr += SysStringLen(entry->header);
lstrcpyW(ptr, colspaceW);
ptr += sizeof(colspaceW)/sizeof(WCHAR)-1;
ptr += ARRAY_SIZE(colspaceW) - 1;
lstrcpyW(ptr, entry->value);
ptr += SysStringLen(entry->value);
lstrcpyW(ptr, crlfW);
ptr += sizeof(crlfW)/sizeof(WCHAR)-1;
ptr += ARRAY_SIZE(crlfW) - 1;
}
*add_headers = buff;
......@@ -1030,8 +1030,8 @@ static HRESULT httprequest_setRequestHeader(httprequest *This, BSTR header, BSTR
entry->value = SysAllocString(value);
/* header length including null terminator */
This->reqheader_size += SysStringLen(entry->header) + sizeof(colspaceW)/sizeof(WCHAR) +
SysStringLen(entry->value) + sizeof(crlfW)/sizeof(WCHAR) - 1;
This->reqheader_size += SysStringLen(entry->header) + ARRAY_SIZE(colspaceW) +
SysStringLen(entry->value) + ARRAY_SIZE(crlfW) - 1;
list_add_head(&This->reqheaders, &entry->entry);
......
......@@ -69,7 +69,7 @@ void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg,
{
enum __wine_debug_class dbcl;
char buff[200];
const int max_size = sizeof(buff) / sizeof(buff[0]);
const int max_size = ARRAY_SIZE(buff);
int len;
switch (lvl)
......
......@@ -31,6 +31,8 @@
# error You must include config.h to use this header
#endif
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
typedef enum {
MSXML_DEFAULT = 0,
MSXML2 = 20,
......
......@@ -130,7 +130,7 @@ static saxreader_feature get_saxreader_feature(const WCHAR *name)
int min, max, n, c;
min = 0;
max = sizeof(saxreader_feature_map)/sizeof(struct saxreader_feature_pair) - 1;
max = ARRAY_SIZE(saxreader_feature_map) - 1;
while (min <= max)
{
......@@ -678,7 +678,7 @@ static void format_error_message_from_id(saxlocator *This, HRESULT hr)
{
WCHAR msg[1024];
if(!FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM,
NULL, hr, 0, msg, sizeof(msg)/sizeof(msg[0]), NULL))
NULL, hr, 0, msg, ARRAY_SIZE(msg), NULL))
{
FIXME("MSXML errors not yet supported.\n");
msg[0] = '\0';
......@@ -1420,7 +1420,7 @@ static BSTR saxreader_get_unescaped_value(const xmlChar *buf, int len)
WCHAR *src;
/* leave first '&' from a reference as a value */
src = dest + (sizeof(ampescW)/sizeof(WCHAR) - 1);
src = dest + ARRAY_SIZE(ampescW) - 1;
dest++;
/* move together with null terminator */
......
......@@ -374,9 +374,9 @@ static HRESULT WINAPI xmldoc_put_URL(IXMLDocument *iface, BSTR p)
if (!PathIsURLW(p))
{
WCHAR fullpath[MAX_PATH];
DWORD needed = sizeof(url) / sizeof(WCHAR);
DWORD needed = ARRAY_SIZE(url);
if (!PathSearchAndQualifyW(p, fullpath, sizeof(fullpath) / sizeof(WCHAR)))
if (!PathSearchAndQualifyW(p, fullpath, ARRAY_SIZE(fullpath)))
{
ERR("can't find path\n");
return E_FAIL;
......
......@@ -434,7 +434,7 @@ static inline HRESULT handle_xml_load(BindStatusCallback *This)
/* TODO: fix parsing processing instruction value */
if((p = strstrW(V_BSTR(&var), hrefW))) {
p += sizeof(hrefW)/sizeof(WCHAR)-1;
p += ARRAY_SIZE(hrefW) - 1;
if(*p!='\'' && *p!='\"') p = NULL;
else {
href = p+1;
......
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