Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/msxml3/saxreader.c | 14 +++++++++++++- dlls/msxml3/tests/saxreader.c | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c index e8d5b271d7..05c774b9e0 100644 --- a/dlls/msxml3/saxreader.c +++ b/dlls/msxml3/saxreader.c @@ -100,6 +100,10 @@ static const WCHAR FeatureNamespacePrefixesW[] = { '/','n','a','m','e','s','p','a','c','e','-','p','r','e','f','i','x','e','s',0 };
+static const WCHAR ExhaustiveErrorsW[] = { + 'e','x','h','a','u','s','t','i','v','e','-','e','r','r','o','r','s',0 +}; + struct saxreader_feature_pair { saxreader_feature feature; @@ -107,6 +111,7 @@ struct saxreader_feature_pair };
static const struct saxreader_feature_pair saxreader_feature_map[] = { + { ExhaustiveErrors, ExhaustiveErrorsW }, { ExternalGeneralEntities, FeatureExternalGeneralEntitiesW }, { ExternalParameterEntities, FeatureExternalParameterEntitiesW }, { LexicalHandlerParEntities, FeatureLexicalHandlerParEntitiesW }, @@ -3216,7 +3221,13 @@ static HRESULT WINAPI isaxxmlreader_getFeature( TRACE("(%p)->(%s %p)\n", This, debugstr_w(feature_name), value);
feature = get_saxreader_feature(feature_name); - if (feature == Namespaces || feature == NamespacePrefixes) + + if (This->version < MSXML4 && feature == ExhaustiveErrors) + return E_INVALIDARG; + + if (feature == Namespaces || + feature == NamespacePrefixes || + feature == ExhaustiveErrors) return get_feature_value(This, feature, value);
FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(feature_name), value); @@ -3238,6 +3249,7 @@ static HRESULT WINAPI isaxxmlreader_putFeature( /* accepted cases */ if ((feature == ExternalGeneralEntities && value == VARIANT_FALSE) || (feature == ExternalParameterEntities && value == VARIANT_FALSE) || + (feature == ExhaustiveErrors && value == VARIANT_FALSE) || feature == Namespaces || feature == NamespacePrefixes) { diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index 9ebed62871..29492fa1d8 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -2789,6 +2789,20 @@ static void test_saxreader_features(void) continue; }
+ value = VARIANT_TRUE; + hr = ISAXXMLReader_getFeature(reader, _bstr_("exhaustive-errors"), &value); + if (IsEqualGUID(entry->guid, &CLSID_SAXXMLReader40) || + IsEqualGUID(entry->guid, &CLSID_SAXXMLReader60)) + { + ok(hr == S_OK, "Failed to get feature value, hr %#x.\n", hr); + ok(value == VARIANT_FALSE, "Unexpected default feature value.\n"); + + hr = ISAXXMLReader_putFeature(reader, _bstr_("exhaustive-errors"), VARIANT_FALSE); + ok(hr == S_OK, "Failed to put feature value, hr %#x.\n", hr); + } + else + ok(hr == E_INVALIDARG, "Unexpected return value %#x.\n", hr); + name = feature_names; while (*name) {
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/msxml3/saxreader.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c index 05c774b9e0..2a30475e08 100644 --- a/dlls/msxml3/saxreader.c +++ b/dlls/msxml3/saxreader.c @@ -3247,16 +3247,17 @@ static HRESULT WINAPI isaxxmlreader_putFeature( feature = get_saxreader_feature(feature_name);
/* accepted cases */ - if ((feature == ExternalGeneralEntities && value == VARIANT_FALSE) || - (feature == ExternalParameterEntities && value == VARIANT_FALSE) || - (feature == ExhaustiveErrors && value == VARIANT_FALSE) || + if ((feature == ExhaustiveErrors && value == VARIANT_FALSE) || feature == Namespaces || feature == NamespacePrefixes) { return set_feature_value(This, feature, value); }
- if (feature == LexicalHandlerParEntities || feature == ProhibitDTD) + if (feature == LexicalHandlerParEntities || + feature == ProhibitDTD || + feature == ExternalGeneralEntities || + feature == ExternalParameterEntities) { FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); return set_feature_value(This, feature, value);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/msxml3/saxreader.c | 13 ++++++++++--- dlls/msxml3/tests/saxreader.c | 22 +++++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c index 2a30475e08..df721f9c62 100644 --- a/dlls/msxml3/saxreader.c +++ b/dlls/msxml3/saxreader.c @@ -104,6 +104,10 @@ static const WCHAR ExhaustiveErrorsW[] = { 'e','x','h','a','u','s','t','i','v','e','-','e','r','r','o','r','s',0 };
+static const WCHAR SchemaValidationW[] = { + 's','c','h','e','m','a','-','v','a','l','i','d','a','t','i','o','n',0 +}; + struct saxreader_feature_pair { saxreader_feature feature; @@ -117,7 +121,8 @@ static const struct saxreader_feature_pair saxreader_feature_map[] = { { LexicalHandlerParEntities, FeatureLexicalHandlerParEntitiesW }, { NamespacePrefixes, FeatureNamespacePrefixesW }, { Namespaces, FeatureNamespacesW }, - { ProhibitDTD, FeatureProhibitDTDW } + { ProhibitDTD, FeatureProhibitDTDW }, + { SchemaValidation, SchemaValidationW }, };
static saxreader_feature get_saxreader_feature(const WCHAR *name) @@ -3222,12 +3227,13 @@ static HRESULT WINAPI isaxxmlreader_getFeature(
feature = get_saxreader_feature(feature_name);
- if (This->version < MSXML4 && feature == ExhaustiveErrors) + if (This->version < MSXML4 && (feature == ExhaustiveErrors || feature == SchemaValidation)) return E_INVALIDARG;
if (feature == Namespaces || feature == NamespacePrefixes || - feature == ExhaustiveErrors) + feature == ExhaustiveErrors || + feature == SchemaValidation) return get_feature_value(This, feature, value);
FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(feature_name), value); @@ -3248,6 +3254,7 @@ static HRESULT WINAPI isaxxmlreader_putFeature(
/* accepted cases */ if ((feature == ExhaustiveErrors && value == VARIANT_FALSE) || + (feature == SchemaValidation && value == VARIANT_FALSE) || feature == Namespaces || feature == NamespacePrefixes) { diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index 29492fa1d8..3ed332edb6 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -2789,19 +2789,35 @@ static void test_saxreader_features(void) continue; }
- value = VARIANT_TRUE; - hr = ISAXXMLReader_getFeature(reader, _bstr_("exhaustive-errors"), &value); if (IsEqualGUID(entry->guid, &CLSID_SAXXMLReader40) || IsEqualGUID(entry->guid, &CLSID_SAXXMLReader60)) { + value = VARIANT_TRUE; + hr = ISAXXMLReader_getFeature(reader, _bstr_("exhaustive-errors"), &value); ok(hr == S_OK, "Failed to get feature value, hr %#x.\n", hr); ok(value == VARIANT_FALSE, "Unexpected default feature value.\n"); + hr = ISAXXMLReader_putFeature(reader, _bstr_("exhaustive-errors"), VARIANT_FALSE); + ok(hr == S_OK, "Failed to put feature value, hr %#x.\n", hr);
+ value = VARIANT_TRUE; + hr = ISAXXMLReader_getFeature(reader, _bstr_("schema-validation"), &value); + ok(hr == S_OK, "Failed to get feature value, hr %#x.\n", hr); + ok(value == VARIANT_FALSE, "Unexpected default feature value.\n"); hr = ISAXXMLReader_putFeature(reader, _bstr_("exhaustive-errors"), VARIANT_FALSE); ok(hr == S_OK, "Failed to put feature value, hr %#x.\n", hr); } else - ok(hr == E_INVALIDARG, "Unexpected return value %#x.\n", hr); + { + value = 123; + hr = ISAXXMLReader_getFeature(reader, _bstr_("exhaustive-errors"), &value); + ok(hr == E_INVALIDARG, "Failed to get feature value, hr %#x.\n", hr); + ok(value == 123, "Unexpected value %d.\n", value); + + value = 123; + hr = ISAXXMLReader_getFeature(reader, _bstr_("schema-validation"), &value); + ok(hr == E_INVALIDARG, "Failed to get feature value, hr %#x.\n", hr); + ok(value == 123, "Unexpected value %d.\n", value); + }
name = feature_names; while (*name)
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/msxml3/bsc.c | 4 +- dlls/msxml3/dispex.c | 4 +- dlls/msxml3/factory.c | 2 +- dlls/msxml3/httprequest.c | 10 ++--- dlls/msxml3/main.c | 2 +- dlls/msxml3/msxml_private.h | 2 + dlls/msxml3/mxwriter.c | 96 ++++++++++++++++++++++----------------------- dlls/msxml3/saxreader.c | 6 +-- dlls/msxml3/xmldoc.c | 4 +- dlls/msxml3/xmlview.c | 2 +- 10 files changed, 67 insertions(+), 65 deletions(-)
diff --git a/dlls/msxml3/bsc.c b/dlls/msxml3/bsc.c index 05977a610b..df4cf37346 100644 --- a/dlls/msxml3/bsc.c +++ b/dlls/msxml3/bsc.c @@ -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; diff --git a/dlls/msxml3/dispex.c b/dlls/msxml3/dispex.c index d0520f3577..bd29a212c8 100644 --- a/dlls/msxml3/dispex.c +++ b/dlls/msxml3/dispex.c @@ -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]);
diff --git a/dlls/msxml3/factory.c b/dlls/msxml3/factory.c index 115a5240a5..445cfbf730 100644 --- a/dlls/msxml3/factory.c +++ b/dlls/msxml3/factory.c @@ -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;
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c index e3b521c2d6..40a976438d 100644 --- a/dlls/msxml3/httprequest.c +++ b/dlls/msxml3/httprequest.c @@ -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);
diff --git a/dlls/msxml3/main.c b/dlls/msxml3/main.c index 0d056ea981..debd84e090 100644 --- a/dlls/msxml3/main.c +++ b/dlls/msxml3/main.c @@ -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) diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h index 94ef66b23d..d7039275ce 100644 --- a/dlls/msxml3/msxml_private.h +++ b/dlls/msxml3/msxml_private.h @@ -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, diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c index 585abac7c2..10be2508b2 100644 --- a/dlls/msxml3/mxwriter.c +++ b/dlls/msxml3/mxwriter.c @@ -225,7 +225,7 @@ static xml_encoding parse_encoding_name(const WCHAR *encoding) int min, max, n, c;
min = 0; - max = sizeof(xml_encoding_map)/sizeof(struct xml_encoding_data) - 1; + max = ARRAY_SIZE(xml_encoding_map) - 1;
while (min <= max) { @@ -515,21 +515,21 @@ static WCHAR *get_escaped_string(const WCHAR *str, escape_mode mode, int *len) { case '<': memcpy(ptr, ltW, sizeof(ltW)); - ptr += sizeof(ltW)/sizeof(WCHAR); + ptr += ARRAY_SIZE(ltW); break; case '&': memcpy(ptr, ampW, sizeof(ampW)); - ptr += sizeof(ampW)/sizeof(WCHAR); + ptr += ARRAY_SIZE(ampW); break; case '>': memcpy(ptr, gtW, sizeof(gtW)); - ptr += sizeof(gtW)/sizeof(WCHAR); + ptr += ARRAY_SIZE(gtW); break; case '"': if (mode == EscapeValue) { memcpy(ptr, equotW, sizeof(equotW)); - ptr += sizeof(equotW)/sizeof(WCHAR); + ptr += ARRAY_SIZE(equotW); break; } /* fallthrough for text mode */ @@ -557,26 +557,26 @@ static void write_prolog_buffer(mxwriter *writer) static const WCHAR noW[] = {'n','o','"','?','>'};
/* version */ - write_output_buffer(writer, versionW, sizeof(versionW)/sizeof(WCHAR)); + write_output_buffer(writer, versionW, ARRAY_SIZE(versionW)); write_output_buffer_quoted(writer, writer->version, -1);
/* encoding */ - write_output_buffer(writer, encodingW, sizeof(encodingW)/sizeof(WCHAR)); + write_output_buffer(writer, encodingW, ARRAY_SIZE(encodingW));
if (writer->dest) write_output_buffer(writer, writer->encoding, -1); else - write_output_buffer(writer, utf16W, sizeof(utf16W)/sizeof(WCHAR) - 1); + write_output_buffer(writer, utf16W, ARRAY_SIZE(utf16W) - 1); write_output_buffer(writer, quotW, 1);
/* standalone */ - write_output_buffer(writer, standaloneW, sizeof(standaloneW)/sizeof(WCHAR)); + write_output_buffer(writer, standaloneW, ARRAY_SIZE(standaloneW)); if (writer->props[MXWriter_Standalone] == VARIANT_TRUE) - write_output_buffer(writer, yesW, sizeof(yesW)/sizeof(WCHAR)); + write_output_buffer(writer, yesW, ARRAY_SIZE(yesW)); else - write_output_buffer(writer, noW, sizeof(noW)/sizeof(WCHAR)); + write_output_buffer(writer, noW, ARRAY_SIZE(noW));
- write_output_buffer(writer, crlfW, sizeof(crlfW)/sizeof(WCHAR)); + write_output_buffer(writer, crlfW, ARRAY_SIZE(crlfW)); writer->newline = TRUE; }
@@ -628,7 +628,7 @@ static void write_node_indent(mxwriter *writer) /* This is to workaround PI output logic that always puts newline chars, document prolog PI does that too. */ if (!writer->newline) - write_output_buffer(writer, crlfW, sizeof(crlfW)/sizeof(WCHAR)); + write_output_buffer(writer, crlfW, ARRAY_SIZE(crlfW)); while (indent--) write_output_buffer(writer, tabW, 1);
@@ -1445,7 +1445,7 @@ static HRESULT WINAPI SAXContentHandler_processingInstruction( if (!target) return E_INVALIDARG;
write_node_indent(This); - write_output_buffer(This, openpiW, sizeof(openpiW)/sizeof(WCHAR)); + write_output_buffer(This, openpiW, ARRAY_SIZE(openpiW));
if (*target) write_output_buffer(This, target, ntarget); @@ -1456,7 +1456,7 @@ static HRESULT WINAPI SAXContentHandler_processingInstruction( write_output_buffer(This, data, ndata); }
- write_output_buffer(This, closepiW, sizeof(closepiW)/sizeof(WCHAR)); + write_output_buffer(This, closepiW, ARRAY_SIZE(closepiW)); This->newline = TRUE;
return S_OK; @@ -1524,7 +1524,7 @@ static HRESULT WINAPI SAXLexicalHandler_startDTD(ISAXLexicalHandler *iface,
if (!name) return E_INVALIDARG;
- write_output_buffer(This, doctypeW, sizeof(doctypeW)/sizeof(WCHAR)); + write_output_buffer(This, doctypeW, ARRAY_SIZE(doctypeW));
if (*name) { @@ -1534,7 +1534,7 @@ static HRESULT WINAPI SAXLexicalHandler_startDTD(ISAXLexicalHandler *iface,
if (publicId) { - write_output_buffer(This, publicW, sizeof(publicW)/sizeof(WCHAR)); + write_output_buffer(This, publicW, ARRAY_SIZE(publicW)); write_output_buffer_quoted(This, publicId, publicId_len);
if (!systemId) return E_INVALIDARG; @@ -1549,13 +1549,13 @@ static HRESULT WINAPI SAXLexicalHandler_startDTD(ISAXLexicalHandler *iface, } else if (systemId) { - write_output_buffer(This, systemW, sizeof(systemW)/sizeof(WCHAR)); + write_output_buffer(This, systemW, ARRAY_SIZE(systemW)); write_output_buffer_quoted(This, systemId, systemId_len); if (*systemId) write_output_buffer(This, spaceW, 1); }
- write_output_buffer(This, openintW, sizeof(openintW)/sizeof(WCHAR)); + write_output_buffer(This, openintW, ARRAY_SIZE(openintW));
return S_OK; } @@ -1567,7 +1567,7 @@ static HRESULT WINAPI SAXLexicalHandler_endDTD(ISAXLexicalHandler *iface)
TRACE("(%p)\n", This);
- write_output_buffer(This, closedtdW, sizeof(closedtdW)/sizeof(WCHAR)); + write_output_buffer(This, closedtdW, ARRAY_SIZE(closedtdW));
return S_OK; } @@ -1594,7 +1594,7 @@ static HRESULT WINAPI SAXLexicalHandler_startCDATA(ISAXLexicalHandler *iface) TRACE("(%p)\n", This);
write_node_indent(This); - write_output_buffer(This, scdataW, sizeof(scdataW)/sizeof(WCHAR)); + write_output_buffer(This, scdataW, ARRAY_SIZE(scdataW)); This->cdata = TRUE;
return S_OK; @@ -1607,7 +1607,7 @@ static HRESULT WINAPI SAXLexicalHandler_endCDATA(ISAXLexicalHandler *iface)
TRACE("(%p)\n", This);
- write_output_buffer(This, ecdataW, sizeof(ecdataW)/sizeof(WCHAR)); + write_output_buffer(This, ecdataW, ARRAY_SIZE(ecdataW)); This->cdata = FALSE;
return S_OK; @@ -1626,10 +1626,10 @@ static HRESULT WINAPI SAXLexicalHandler_comment(ISAXLexicalHandler *iface, const close_element_starttag(This); write_node_indent(This);
- write_output_buffer(This, copenW, sizeof(copenW)/sizeof(WCHAR)); + write_output_buffer(This, copenW, ARRAY_SIZE(copenW)); if (nchars) write_output_buffer(This, chars, nchars); - write_output_buffer(This, ccloseW, sizeof(ccloseW)/sizeof(WCHAR)); + write_output_buffer(This, ccloseW, ARRAY_SIZE(ccloseW));
return S_OK; } @@ -1679,14 +1679,14 @@ static HRESULT WINAPI SAXDeclHandler_elementDecl(ISAXDeclHandler *iface,
if (!name || !model) return E_INVALIDARG;
- write_output_buffer(This, elementW, sizeof(elementW)/sizeof(WCHAR)); + write_output_buffer(This, elementW, ARRAY_SIZE(elementW)); if (n_name) { write_output_buffer(This, name, n_name); - write_output_buffer(This, spaceW, sizeof(spaceW)/sizeof(WCHAR)); + write_output_buffer(This, spaceW, ARRAY_SIZE(spaceW)); } if (n_model) write_output_buffer(This, model, n_model); - write_output_buffer(This, closetagW, sizeof(closetagW)/sizeof(WCHAR)); + write_output_buffer(This, closetagW, ARRAY_SIZE(closetagW));
return S_OK; } @@ -1704,31 +1704,31 @@ static HRESULT WINAPI SAXDeclHandler_attributeDecl(ISAXDeclHandler *iface, debugstr_wn(attr, n_attr), n_attr, debugstr_wn(type, n_type), n_type, debugstr_wn(Default, n_default), n_default, debugstr_wn(value, n_value), n_value);
- write_output_buffer(This, attlistW, sizeof(attlistW)/sizeof(WCHAR)); + write_output_buffer(This, attlistW, ARRAY_SIZE(attlistW)); if (n_element) { write_output_buffer(This, element, n_element); - write_output_buffer(This, spaceW, sizeof(spaceW)/sizeof(WCHAR)); + write_output_buffer(This, spaceW, ARRAY_SIZE(spaceW)); }
if (n_attr) { write_output_buffer(This, attr, n_attr); - write_output_buffer(This, spaceW, sizeof(spaceW)/sizeof(WCHAR)); + write_output_buffer(This, spaceW, ARRAY_SIZE(spaceW)); }
if (n_type) { write_output_buffer(This, type, n_type); - write_output_buffer(This, spaceW, sizeof(spaceW)/sizeof(WCHAR)); + write_output_buffer(This, spaceW, ARRAY_SIZE(spaceW)); }
if (n_default) { write_output_buffer(This, Default, n_default); - write_output_buffer(This, spaceW, sizeof(spaceW)/sizeof(WCHAR)); + write_output_buffer(This, spaceW, ARRAY_SIZE(spaceW)); }
if (n_value) write_output_buffer_quoted(This, value, n_value);
- write_output_buffer(This, closetagW, sizeof(closetagW)/sizeof(WCHAR)); + write_output_buffer(This, closetagW, ARRAY_SIZE(closetagW));
return S_OK; } @@ -1743,16 +1743,16 @@ static HRESULT WINAPI SAXDeclHandler_internalEntityDecl(ISAXDeclHandler *iface,
if (!name || !value) return E_INVALIDARG;
- write_output_buffer(This, entityW, sizeof(entityW)/sizeof(WCHAR)); + write_output_buffer(This, entityW, ARRAY_SIZE(entityW)); if (n_name) { write_output_buffer(This, name, n_name); - write_output_buffer(This, spaceW, sizeof(spaceW)/sizeof(WCHAR)); + write_output_buffer(This, spaceW, ARRAY_SIZE(spaceW)); }
if (n_value) write_output_buffer_quoted(This, value, n_value);
- write_output_buffer(This, closetagW, sizeof(closetagW)/sizeof(WCHAR)); + write_output_buffer(This, closetagW, ARRAY_SIZE(closetagW));
return S_OK; } @@ -1768,26 +1768,26 @@ static HRESULT WINAPI SAXDeclHandler_externalEntityDecl(ISAXDeclHandler *iface,
if (!name || !systemId) return E_INVALIDARG;
- write_output_buffer(This, entityW, sizeof(entityW)/sizeof(WCHAR)); + write_output_buffer(This, entityW, ARRAY_SIZE(entityW)); if (n_name) { write_output_buffer(This, name, n_name); - write_output_buffer(This, spaceW, sizeof(spaceW)/sizeof(WCHAR)); + write_output_buffer(This, spaceW, ARRAY_SIZE(spaceW)); }
if (publicId) { - write_output_buffer(This, publicW, sizeof(publicW)/sizeof(WCHAR)); + write_output_buffer(This, publicW, ARRAY_SIZE(publicW)); write_output_buffer_quoted(This, publicId, n_publicId); - write_output_buffer(This, spaceW, sizeof(spaceW)/sizeof(WCHAR)); + write_output_buffer(This, spaceW, ARRAY_SIZE(spaceW)); write_output_buffer_quoted(This, systemId, n_systemId); } else { - write_output_buffer(This, systemW, sizeof(systemW)/sizeof(WCHAR)); + write_output_buffer(This, systemW, ARRAY_SIZE(systemW)); write_output_buffer_quoted(This, systemId, n_systemId); }
- write_output_buffer(This, closetagW, sizeof(closetagW)/sizeof(WCHAR)); + write_output_buffer(This, closetagW, ARRAY_SIZE(closetagW));
return S_OK; } @@ -2299,30 +2299,30 @@ static HRESULT WINAPI SAXDTDHandler_notationDecl(ISAXDTDHandler *iface, if (!name || !n_name) return E_INVALIDARG;
- write_output_buffer(This, notationW, sizeof(notationW)/sizeof(WCHAR)); + write_output_buffer(This, notationW, ARRAY_SIZE(notationW)); write_output_buffer(This, name, n_name);
if (!publicid && !systemid) return E_INVALIDARG;
- write_output_buffer(This, spaceW, sizeof(spaceW)/sizeof(WCHAR)); + write_output_buffer(This, spaceW, ARRAY_SIZE(spaceW)); if (publicid) { - write_output_buffer(This, publicW, sizeof(publicW)/sizeof(WCHAR)); + write_output_buffer(This, publicW, ARRAY_SIZE(publicW)); write_output_buffer_quoted(This, publicid, n_publicid); if (systemid) { - write_output_buffer(This, spaceW, sizeof(spaceW)/sizeof(WCHAR)); + write_output_buffer(This, spaceW, ARRAY_SIZE(spaceW)); write_output_buffer_quoted(This, systemid, n_systemid); } } else { - write_output_buffer(This, systemW, sizeof(systemW)/sizeof(WCHAR)); + write_output_buffer(This, systemW, ARRAY_SIZE(systemW)); write_output_buffer_quoted(This, systemid, n_systemid); }
- write_output_buffer(This, closetagW, sizeof(closetagW)/sizeof(WCHAR)); + write_output_buffer(This, closetagW, ARRAY_SIZE(closetagW));
return S_OK; } diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c index df721f9c62..04fab81708 100644 --- a/dlls/msxml3/saxreader.c +++ b/dlls/msxml3/saxreader.c @@ -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 */ diff --git a/dlls/msxml3/xmldoc.c b/dlls/msxml3/xmldoc.c index 6f4c73e73f..d0c65a44a3 100644 --- a/dlls/msxml3/xmldoc.c +++ b/dlls/msxml3/xmldoc.c @@ -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; diff --git a/dlls/msxml3/xmlview.c b/dlls/msxml3/xmlview.c index 2bf58f8d99..f1299ef957 100644 --- a/dlls/msxml3/xmlview.c +++ b/dlls/msxml3/xmlview.c @@ -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;