~ubuntu-branches/ubuntu/precise/wine1.3/precise

« back to all changes in this revision

Viewing changes to dlls/msxml3/schema.c

  • Committer: Package Import Robot
  • Author(s): Scott Ritchie
  • Date: 2012-01-17 09:00:34 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120117090034-eyhpp02jawlvrrkc
Tags: 1.3.37-0ubuntu1
* New upstream release
  - Many changes
* Convert to 3.0 source format
* debian/control:
  - Remove pre-multiarch amd64 build depends
  - Remove quilt build depends
  - Recommend proper gecko versions
* debian/rules:
  - Remove manual dh_quilt patch and unpatch
  - No need to uuencode/uudecode anymore with new source format

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
    SCHEMA_TYPE_XSD
88
88
} SCHEMA_TYPE;
89
89
 
90
 
typedef struct _schema_cache
 
90
typedef struct
91
91
{
92
 
    const struct IXMLDOMSchemaCollection2Vtbl* lpVtbl;
 
92
    DispatchEx dispex;
 
93
    IXMLDOMSchemaCollection2 IXMLDOMSchemaCollection2_iface;
 
94
    LONG ref;
 
95
 
93
96
    MSXML_VERSION version;
94
97
    xmlHashTablePtr cache;
95
 
    LONG ref;
 
98
 
 
99
    VARIANT_BOOL validateOnLoad;
96
100
} schema_cache;
97
101
 
98
102
typedef struct _cache_entry
573
577
    return DT_wstring_table[dt];
574
578
}
575
579
 
 
580
const char* debugstr_dt(XDR_DT dt)
 
581
{
 
582
    return debugstr_a(dt != DT_INVALID ? (const char*)DT_string_table[dt] : NULL);
 
583
}
 
584
 
576
585
HRESULT dt_validate(XDR_DT dt, xmlChar const* content)
577
586
{
578
587
    xmlDocPtr tmp_doc;
580
589
    xmlNsPtr ns;
581
590
    HRESULT hr;
582
591
 
583
 
    TRACE("(dt:%s, %s)\n", dt_to_str(dt), wine_dbgstr_a((char const*)content));
 
592
    TRACE("(dt:%s, %s)\n", debugstr_dt(dt), wine_dbgstr_a((char const*)content));
584
593
 
585
594
    if (!datatypes_schema)
586
595
    {
650
659
            }
651
660
            return hr;
652
661
        default:
653
 
            FIXME("need to handle dt:%s\n", dt_to_str(dt));
 
662
            FIXME("need to handle dt:%s\n", debugstr_dt(dt));
654
663
            return S_OK;
655
664
    }
656
665
}
679
688
{
680
689
    xmlParserInputPtr input;
681
690
 
682
 
    TRACE("(%s, %s, %p)\n", wine_dbgstr_a(URL), wine_dbgstr_a(ID), ctxt);
 
691
    TRACE("(%s %s %p)\n", wine_dbgstr_a(URL), wine_dbgstr_a(ID), ctxt);
683
692
 
684
693
    assert(MSXML_hInstance != NULL);
685
694
    assert(datatypes_rsrc != NULL);
741
750
static LONG cache_entry_add_ref(cache_entry* entry)
742
751
{
743
752
    LONG ref = InterlockedIncrement(&entry->ref);
744
 
    TRACE("%p new ref %d\n", entry, ref);
 
753
    TRACE("(%p)->(%d)\n", entry, ref);
745
754
    return ref;
746
755
}
747
756
 
748
757
static LONG cache_entry_release(cache_entry* entry)
749
758
{
750
759
    LONG ref = InterlockedDecrement(&entry->ref);
751
 
    TRACE("%p new ref %d\n", entry, ref);
 
760
    TRACE("(%p)->(%d)\n", entry, ref);
752
761
 
753
762
    if (ref == 0)
754
763
    {
773
782
 
774
783
static inline schema_cache* impl_from_IXMLDOMSchemaCollection2(IXMLDOMSchemaCollection2* iface)
775
784
{
776
 
    return (schema_cache*)((char*)iface - FIELD_OFFSET(schema_cache, lpVtbl));
 
785
    return CONTAINING_RECORD(iface, schema_cache, IXMLDOMSchemaCollection2_iface);
777
786
}
778
787
 
779
788
static inline SCHEMA_TYPE schema_type_from_xmlDocPtr(xmlDocPtr schema)
953
962
    {
954
963
        *ppvObject = iface;
955
964
    }
 
965
    else if (dispex_query_interface(&This->dispex, riid, ppvObject))
 
966
    {
 
967
        return *ppvObject ? S_OK : E_NOINTERFACE;
 
968
    }
956
969
    else
957
970
    {
958
971
        FIXME("interface %s not implemented\n", debugstr_guid(riid));
969
982
{
970
983
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
971
984
    LONG ref = InterlockedIncrement(&This->ref);
972
 
    TRACE("%p new ref %d\n", This, ref);
 
985
    TRACE("(%p)->(%d)\n", This, ref);
973
986
    return ref;
974
987
}
975
988
 
982
995
{
983
996
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
984
997
    LONG ref = InterlockedDecrement(&This->ref);
985
 
    TRACE("%p new ref %d\n", This, ref);
 
998
    TRACE("(%p)->(%d)\n", This, ref);
986
999
 
987
1000
    if (ref == 0)
988
1001
    {
989
1002
        xmlHashFree(This->cache, cache_free);
 
1003
        release_dispex(&This->dispex);
990
1004
        heap_free(This);
991
1005
    }
992
1006
 
997
1011
                                                    UINT* pctinfo)
998
1012
{
999
1013
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1000
 
 
1001
 
    TRACE("(%p)->(%p)\n", This, pctinfo);
1002
 
 
1003
 
    *pctinfo = 1;
1004
 
 
1005
 
    return S_OK;
 
1014
    return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
1006
1015
}
1007
1016
 
1008
1017
static HRESULT WINAPI schema_cache_GetTypeInfo(IXMLDOMSchemaCollection2* iface,
1009
1018
                                               UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo)
1010
1019
{
1011
1020
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1012
 
    HRESULT hr;
1013
 
 
1014
 
    TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
1015
 
 
1016
 
    hr = get_typeinfo(IXMLDOMSchemaCollection_tid, ppTInfo);
1017
 
 
1018
 
    return hr;
 
1021
    return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
 
1022
        iTInfo, lcid, ppTInfo);
1019
1023
}
1020
1024
 
1021
1025
static HRESULT WINAPI schema_cache_GetIDsOfNames(IXMLDOMSchemaCollection2* iface,
1023
1027
                                                 UINT cNames, LCID lcid, DISPID* rgDispId)
1024
1028
{
1025
1029
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1026
 
    ITypeInfo* typeinfo;
1027
 
    HRESULT hr;
1028
 
 
1029
 
    TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
1030
 
          lcid, rgDispId);
1031
 
 
1032
 
    if(!rgszNames || cNames == 0 || !rgDispId)
1033
 
        return E_INVALIDARG;
1034
 
 
1035
 
    hr = get_typeinfo(IXMLDOMSchemaCollection_tid, &typeinfo);
1036
 
    if(SUCCEEDED(hr))
1037
 
    {
1038
 
        hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
1039
 
        ITypeInfo_Release(typeinfo);
1040
 
    }
1041
 
 
1042
 
    return hr;
 
1030
    return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
 
1031
        riid, rgszNames, cNames, lcid, rgDispId);
1043
1032
}
1044
1033
 
1045
1034
static HRESULT WINAPI schema_cache_Invoke(IXMLDOMSchemaCollection2* iface,
1049
1038
                                          UINT* puArgErr)
1050
1039
{
1051
1040
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1052
 
    ITypeInfo* typeinfo;
1053
 
    HRESULT hr;
1054
 
 
1055
 
    TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
1056
 
          lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1057
 
 
1058
 
    hr = get_typeinfo(IXMLDOMSchemaCollection_tid, &typeinfo);
1059
 
    if(SUCCEEDED(hr))
1060
 
    {
1061
 
        hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
1062
 
                pVarResult, pExcepInfo, puArgErr);
1063
 
        ITypeInfo_Release(typeinfo);
1064
 
    }
1065
 
 
1066
 
    return hr;
 
1041
    return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
 
1042
        dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1067
1043
}
1068
1044
 
1069
1045
static HRESULT WINAPI schema_cache_add(IXMLDOMSchemaCollection2* iface, BSTR uri, VARIANT var)
1165
1141
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1166
1142
    xmlChar* name;
1167
1143
    cache_entry* entry;
1168
 
    TRACE("(%p)->(%s, %p)\n", This, wine_dbgstr_w(uri), node);
 
1144
    TRACE("(%p)->(%s %p)\n", This, wine_dbgstr_w(uri), node);
1169
1145
 
1170
1146
    if (!node)
1171
1147
        return E_POINTER;
1217
1193
{
1218
1194
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1219
1195
    cache_index_data data = {index,len};
1220
 
    TRACE("(%p)->(%i, %p)\n", This, index, len);
 
1196
    TRACE("(%p)->(%i %p)\n", This, index, len);
1221
1197
 
1222
1198
    if (!len)
1223
1199
        return E_POINTER;
1261
1237
static HRESULT WINAPI schema_cache_get__newEnum(IXMLDOMSchemaCollection2* iface,
1262
1238
                                                IUnknown** ppUnk)
1263
1239
{
1264
 
    FIXME("stub\n");
 
1240
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
 
1241
    FIXME("(%p)->(%p): stub\n", This, ppUnk);
1265
1242
    if (ppUnk)
1266
1243
        *ppUnk = NULL;
1267
1244
    return E_NOTIMPL;
1269
1246
 
1270
1247
static HRESULT WINAPI schema_cache_validate(IXMLDOMSchemaCollection2* iface)
1271
1248
{
1272
 
    FIXME("stub\n");
 
1249
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
 
1250
    FIXME("(%p): stub\n", This);
1273
1251
    return E_NOTIMPL;
1274
1252
}
1275
1253
 
1276
1254
static HRESULT WINAPI schema_cache_put_validateOnLoad(IXMLDOMSchemaCollection2* iface,
1277
 
                                                      VARIANT_BOOL validateOnLoad)
 
1255
                                                      VARIANT_BOOL value)
1278
1256
{
1279
 
    FIXME("stub\n");
 
1257
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
 
1258
    FIXME("(%p)->(%d): stub\n", This, value);
 
1259
 
 
1260
    This->validateOnLoad = value;
 
1261
    /* it's ok to disable it, cause we don't validate on load anyway */
 
1262
    if (value == VARIANT_FALSE) return S_OK;
 
1263
 
1280
1264
    return E_NOTIMPL;
1281
1265
}
1282
1266
 
1283
1267
static HRESULT WINAPI schema_cache_get_validateOnLoad(IXMLDOMSchemaCollection2* iface,
1284
 
                                                      VARIANT_BOOL* validateOnLoad)
 
1268
                                                      VARIANT_BOOL* value)
1285
1269
{
1286
 
    FIXME("stub\n");
1287
 
    return E_NOTIMPL;
 
1270
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
 
1271
    TRACE("(%p)->(%p)\n", This, value);
 
1272
 
 
1273
    if (!value) return E_POINTER;
 
1274
    *value = This->validateOnLoad;
 
1275
 
 
1276
    return S_OK;
1288
1277
}
1289
1278
 
1290
1279
static HRESULT WINAPI schema_cache_getSchema(IXMLDOMSchemaCollection2* iface,
1291
1280
                                             BSTR namespaceURI, ISchema** schema)
1292
1281
{
1293
 
    FIXME("stub\n");
 
1282
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
 
1283
    FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(namespaceURI), schema);
1294
1284
    if (schema)
1295
1285
        *schema = NULL;
1296
1286
    return E_NOTIMPL;
1299
1289
static HRESULT WINAPI schema_cache_getDeclaration(IXMLDOMSchemaCollection2* iface,
1300
1290
                                                  IXMLDOMNode* node, ISchemaItem** item)
1301
1291
{
1302
 
    FIXME("stub\n");
 
1292
    schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
 
1293
    FIXME("(%p)->(%p %p): stub\n", This, node, item);
1303
1294
    if (item)
1304
1295
        *item = NULL;
1305
1296
    return E_NOTIMPL;
1306
1297
}
1307
1298
 
1308
 
static const struct IXMLDOMSchemaCollection2Vtbl schema_cache_vtbl =
 
1299
static const struct IXMLDOMSchemaCollection2Vtbl XMLDOMSchemaCollection2Vtbl =
1309
1300
{
1310
1301
    schema_cache_QueryInterface,
1311
1302
    schema_cache_AddRef,
1414
1405
    return dt;
1415
1406
}
1416
1407
 
1417
 
HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* pUnkOuter, void** ppObj)
 
1408
static const tid_t schemacache_iface_tids[] = {
 
1409
    IXMLDOMSchemaCollection2_tid,
 
1410
    0
 
1411
};
 
1412
 
 
1413
static dispex_static_data_t schemacache_dispex = {
 
1414
    NULL,
 
1415
    IXMLDOMSchemaCollection2_tid,
 
1416
    NULL,
 
1417
    schemacache_iface_tids
 
1418
};
 
1419
 
 
1420
HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* outer, void** obj)
1418
1421
{
1419
1422
    schema_cache* This = heap_alloc(sizeof(schema_cache));
1420
1423
    if (!This)
1421
1424
        return E_OUTOFMEMORY;
1422
1425
 
1423
 
    This->lpVtbl = &schema_cache_vtbl;
 
1426
    TRACE("(%d %p %p)\n", version, outer, obj);
 
1427
 
 
1428
    This->IXMLDOMSchemaCollection2_iface.lpVtbl = &XMLDOMSchemaCollection2Vtbl;
1424
1429
    This->cache = xmlHashCreate(DEFAULT_HASHTABLE_SIZE);
1425
1430
    This->ref = 1;
1426
1431
    This->version = version;
 
1432
    This->validateOnLoad = VARIANT_TRUE;
 
1433
    init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMSchemaCollection2_iface, &schemacache_dispex);
1427
1434
 
1428
 
    *ppObj = &This->lpVtbl;
 
1435
    *obj = &This->IXMLDOMSchemaCollection2_iface;
1429
1436
    return S_OK;
1430
1437
}
1431
1438