VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/Xml.c')
-rw-r--r--src/Common/Xml.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Common/Xml.c b/src/Common/Xml.c
index d733dac1..6abbed6d 100644
--- a/src/Common/Xml.c
+++ b/src/Common/Xml.c
@@ -9,9 +9,13 @@
contained in the file License.txt included in VeraCrypt binary and source
code distribution packages.
*/
-
+#if !defined(_UEFI)
#include <windows.h>
#include <stdio.h>
+#else
+#include "Tcdefs.h"
+#pragma warning( disable : 4706 ) // assignment within conditional expression
+#endif
#include "Xml.h"
@@ -59,7 +63,7 @@ char *XmlFindElement (char *xmlNode, char *nodeName)
}
-char *XmlFindElementByAttributeValue (char *xml, char *nodeName, char *attrName, char *attrValue)
+char *XmlFindElementByAttributeValue (char *xml, char *nodeName, const char *attrName, const char *attrValue)
{
char attr[2048];
@@ -76,7 +80,7 @@ char *XmlFindElementByAttributeValue (char *xml, char *nodeName, char *attrName,
}
-char *XmlGetAttributeText (char *xmlNode, char *xmlAttrName, char *xmlAttrValue, int xmlAttrValueSize)
+char *XmlGetAttributeText (char *xmlNode, const char *xmlAttrName, char *xmlAttrValue, int xmlAttrValueSize)
{
char *t = xmlNode;
char *e = xmlNode;
@@ -105,7 +109,7 @@ char *XmlGetAttributeText (char *xmlNode, char *xmlAttrName, char *xmlAttrValue,
if (t == NULL || t > e) return NULL;
- t = strchr (t, '"') + 1;
+ t = ((char*)strchr (t, '"')) + 1;
e = strchr (t, '"');
l = (int)(e - t);
if (e == NULL || l > xmlAttrValueSize) return NULL;
@@ -128,9 +132,10 @@ char *XmlGetNodeText (char *xmlNode, char *xmlText, int xmlTextSize)
if (t[0] != '<')
return NULL;
- t = strchr (t, '>') + 1;
- if (t == (char *)1) return NULL;
+ t = (char*) strchr (t, '>');
+ if (t == NULL) return NULL;
+ t++;
e = strchr (e, '<');
if (e == NULL) return NULL;
@@ -255,7 +260,8 @@ wchar_t *XmlQuoteTextW (const wchar_t *textSrc, wchar_t *textDst, int textDstMax
return textDst;
}
-
+#if !defined(_UEFI)
+#pragma warning( default : 4706 )
int XmlWriteHeader (FILE *file)
{
return fputws (L"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<VeraCrypt>", file);
@@ -266,3 +272,4 @@ int XmlWriteFooter (FILE *file)
{
return fputws (L"\n</VeraCrypt>", file);
}
+#endif !defined(_UEFI)