msxml3: Remove no longer used node data type helper.
This commit is contained in:
parent
05ea6855bf
commit
df434065d3
@ -65,30 +65,6 @@ MAKE_FUNCPTR(xsltParseStylesheetDoc);
|
||||
# undef MAKE_FUNCPTR
|
||||
#endif
|
||||
|
||||
/* TODO: get rid of these and use the enum */
|
||||
static const WCHAR szBinBase64[] = {'b','i','n','.','b','a','s','e','6','4',0};
|
||||
static const WCHAR szString[] = {'s','t','r','i','n','g',0};
|
||||
static const WCHAR szNumber[] = {'n','u','m','b','e','r',0};
|
||||
static const WCHAR szInt[] = {'I','n','t',0};
|
||||
static const WCHAR szFixed[] = {'F','i','x','e','d','.','1','4','.','4',0};
|
||||
static const WCHAR szBoolean[] = {'B','o','o','l','e','a','n',0};
|
||||
static const WCHAR szDateTime[] = {'d','a','t','e','T','i','m','e',0};
|
||||
static const WCHAR szDateTimeTZ[] = {'d','a','t','e','T','i','m','e','.','t','z',0};
|
||||
static const WCHAR szDate[] = {'D','a','t','e',0};
|
||||
static const WCHAR szTime[] = {'T','i','m','e',0};
|
||||
static const WCHAR szTimeTZ[] = {'T','i','m','e','.','t','z',0};
|
||||
static const WCHAR szI1[] = {'i','1',0};
|
||||
static const WCHAR szI2[] = {'i','2',0};
|
||||
static const WCHAR szI4[] = {'i','4',0};
|
||||
static const WCHAR szIU1[] = {'u','i','1',0};
|
||||
static const WCHAR szIU2[] = {'u','i','2',0};
|
||||
static const WCHAR szIU4[] = {'u','i','4',0};
|
||||
static const WCHAR szR4[] = {'r','4',0};
|
||||
static const WCHAR szR8[] = {'r','8',0};
|
||||
static const WCHAR szFloat[] = {'f','l','o','a','t',0};
|
||||
static const WCHAR szUUID[] = {'u','u','i','d',0};
|
||||
static const WCHAR szBinHex[] = {'b','i','n','.','h','e','x',0};
|
||||
|
||||
static const IID IID_xmlnode = {0x4f2f4ba2,0xb822,0x11df,{0x8b,0x8a,0x68,0x50,0xdf,0xd7,0x20,0x85}};
|
||||
|
||||
xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type )
|
||||
@ -767,188 +743,6 @@ HRESULT node_put_text(xmlnode *This, BSTR text)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static inline BYTE hex_to_byte(xmlChar c)
|
||||
{
|
||||
if(c <= '9') return c-'0';
|
||||
if(c <= 'F') return c-'A'+10;
|
||||
return c-'a'+10;
|
||||
}
|
||||
|
||||
static inline BYTE base64_to_byte(xmlChar c)
|
||||
{
|
||||
if(c == '+') return 62;
|
||||
if(c == '/') return 63;
|
||||
if(c <= '9') return c-'0'+52;
|
||||
if(c <= 'Z') return c-'A';
|
||||
return c-'a'+26;
|
||||
}
|
||||
|
||||
/* TODO: phasing this version out */
|
||||
static inline HRESULT VARIANT_from_xmlChar(xmlChar *str, VARIANT *v, BSTR type)
|
||||
{
|
||||
if(!type || !lstrcmpiW(type, szString) ||
|
||||
!lstrcmpiW(type, szNumber) || !lstrcmpiW(type, szUUID))
|
||||
{
|
||||
V_VT(v) = VT_BSTR;
|
||||
V_BSTR(v) = bstr_from_xmlChar(str);
|
||||
|
||||
if(!V_BSTR(v))
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
else if(!lstrcmpiW(type, szDateTime) || !lstrcmpiW(type, szDateTimeTZ) ||
|
||||
!lstrcmpiW(type, szDate) || !lstrcmpiW(type, szTime) ||
|
||||
!lstrcmpiW(type, szTimeTZ))
|
||||
{
|
||||
VARIANT src;
|
||||
WCHAR *p, *e;
|
||||
SYSTEMTIME st;
|
||||
DOUBLE date = 0.0;
|
||||
|
||||
st.wYear = 1899;
|
||||
st.wMonth = 12;
|
||||
st.wDay = 30;
|
||||
st.wDayOfWeek = st.wHour = st.wMinute = st.wSecond = st.wMilliseconds = 0;
|
||||
|
||||
V_VT(&src) = VT_BSTR;
|
||||
V_BSTR(&src) = bstr_from_xmlChar(str);
|
||||
|
||||
if(!V_BSTR(&src))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
p = V_BSTR(&src);
|
||||
e = p + SysStringLen(V_BSTR(&src));
|
||||
|
||||
if(p+4<e && *(p+4)=='-') /* parse date (yyyy-mm-dd) */
|
||||
{
|
||||
st.wYear = atoiW(p);
|
||||
st.wMonth = atoiW(p+5);
|
||||
st.wDay = atoiW(p+8);
|
||||
p += 10;
|
||||
|
||||
if(*p == 'T') p++;
|
||||
}
|
||||
|
||||
if(p+2<e && *(p+2)==':') /* parse time (hh:mm:ss.?) */
|
||||
{
|
||||
st.wHour = atoiW(p);
|
||||
st.wMinute = atoiW(p+3);
|
||||
st.wSecond = atoiW(p+6);
|
||||
p += 8;
|
||||
|
||||
if(*p == '.')
|
||||
{
|
||||
p++;
|
||||
while(isdigitW(*p)) p++;
|
||||
}
|
||||
}
|
||||
|
||||
SystemTimeToVariantTime(&st, &date);
|
||||
V_VT(v) = VT_DATE;
|
||||
V_DATE(v) = date;
|
||||
|
||||
if(*p == '+') /* parse timezone offset (+hh:mm) */
|
||||
V_DATE(v) += (DOUBLE)atoiW(p+1)/24 + (DOUBLE)atoiW(p+4)/1440;
|
||||
else if(*p == '-') /* parse timezone offset (-hh:mm) */
|
||||
V_DATE(v) -= (DOUBLE)atoiW(p+1)/24 + (DOUBLE)atoiW(p+4)/1440;
|
||||
|
||||
VariantClear(&src);
|
||||
}
|
||||
else if(!lstrcmpiW(type, szBinHex))
|
||||
{
|
||||
SAFEARRAYBOUND sab;
|
||||
int i, len;
|
||||
|
||||
len = xmlStrlen(str)/2;
|
||||
sab.lLbound = 0;
|
||||
sab.cElements = len;
|
||||
|
||||
V_VT(v) = (VT_ARRAY|VT_UI1);
|
||||
V_ARRAY(v) = SafeArrayCreate(VT_UI1, 1, &sab);
|
||||
|
||||
if(!V_ARRAY(v))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
for(i=0; i<len; i++)
|
||||
((BYTE*)V_ARRAY(v)->pvData)[i] = (hex_to_byte(str[2*i])<<4)
|
||||
+ hex_to_byte(str[2*i+1]);
|
||||
}
|
||||
else if(!lstrcmpiW(type, szBinBase64))
|
||||
{
|
||||
SAFEARRAYBOUND sab;
|
||||
int i, len;
|
||||
|
||||
len = xmlStrlen(str);
|
||||
if(str[len-2] == '=') i = 2;
|
||||
else if(str[len-1] == '=') i = 1;
|
||||
else i = 0;
|
||||
|
||||
sab.lLbound = 0;
|
||||
sab.cElements = len/4*3-i;
|
||||
|
||||
V_VT(v) = (VT_ARRAY|VT_UI1);
|
||||
V_ARRAY(v) = SafeArrayCreate(VT_UI1, 1, &sab);
|
||||
|
||||
if(!V_ARRAY(v))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
for(i=0; i<len/4; i++)
|
||||
{
|
||||
((BYTE*)V_ARRAY(v)->pvData)[3*i] = (base64_to_byte(str[4*i])<<2)
|
||||
+ (base64_to_byte(str[4*i+1])>>4);
|
||||
if(3*i+1 < sab.cElements)
|
||||
((BYTE*)V_ARRAY(v)->pvData)[3*i+1] = (base64_to_byte(str[4*i+1])<<4)
|
||||
+ (base64_to_byte(str[4*i+2])>>2);
|
||||
if(3*i+2 < sab.cElements)
|
||||
((BYTE*)V_ARRAY(v)->pvData)[3*i+2] = (base64_to_byte(str[4*i+2])<<6)
|
||||
+ base64_to_byte(str[4*i+3]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VARIANT src;
|
||||
HRESULT hres;
|
||||
|
||||
if(!lstrcmpiW(type, szInt) || !lstrcmpiW(type, szI4))
|
||||
V_VT(v) = VT_I4;
|
||||
else if(!lstrcmpiW(type, szFixed))
|
||||
V_VT(v) = VT_CY;
|
||||
else if(!lstrcmpiW(type, szBoolean))
|
||||
V_VT(v) = VT_BOOL;
|
||||
else if(!lstrcmpiW(type, szI1))
|
||||
V_VT(v) = VT_I1;
|
||||
else if(!lstrcmpiW(type, szI2))
|
||||
V_VT(v) = VT_I2;
|
||||
else if(!lstrcmpiW(type, szIU1))
|
||||
V_VT(v) = VT_UI1;
|
||||
else if(!lstrcmpiW(type, szIU2))
|
||||
V_VT(v) = VT_UI2;
|
||||
else if(!lstrcmpiW(type, szIU4))
|
||||
V_VT(v) = VT_UI4;
|
||||
else if(!lstrcmpiW(type, szR4))
|
||||
V_VT(v) = VT_R4;
|
||||
else if(!lstrcmpiW(type, szR8) || !lstrcmpiW(type, szFloat))
|
||||
V_VT(v) = VT_R8;
|
||||
else
|
||||
{
|
||||
FIXME("Type handling not yet implemented\n");
|
||||
V_VT(v) = VT_BSTR;
|
||||
}
|
||||
|
||||
V_VT(&src) = VT_BSTR;
|
||||
V_BSTR(&src) = bstr_from_xmlChar(str);
|
||||
|
||||
if(!V_BSTR(&src))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hres = VariantChangeTypeEx(v, &src, MAKELCID(MAKELANGID(
|
||||
LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT),0, V_VT(v));
|
||||
VariantClear(&src);
|
||||
return hres;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
BSTR EnsureCorrectEOL(BSTR sInput)
|
||||
{
|
||||
int nNum = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user