1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-28 07:21:26 +03:00

Fix Windows compiler warnings in xmlCanonicPath

The code handling Windows paths assigned some char/xmlChar pointers
without explicit casts. Also remove an unused variable.
This commit is contained in:
Nick Wellnhofer 2017-10-09 13:32:20 +02:00
parent 5af594d8bc
commit 41c0a13fe7

9
uri.c
View File

@ -2394,8 +2394,7 @@ xmlCanonicPath(const xmlChar *path)
*/
#if defined(_WIN32) && !defined(__CYGWIN__)
int len = 0;
int i = 0;
xmlChar *p = NULL;
char *p = NULL;
#endif
xmlURIPtr uri;
xmlChar *ret;
@ -2477,7 +2476,7 @@ path_processing:
len = xmlStrlen(path);
if ((len > 2) && IS_WINDOWS_PATH(path)) {
/* make the scheme 'file' */
uri->scheme = xmlStrdup(BAD_CAST "file");
uri->scheme = (char *) xmlStrdup(BAD_CAST "file");
/* allocate space for leading '/' + path + string terminator */
uri->path = xmlMallocAtomic(len + 2);
if (uri->path == NULL) {
@ -2487,9 +2486,9 @@ path_processing:
/* Put in leading '/' plus path */
uri->path[0] = '/';
p = uri->path + 1;
strncpy(p, path, len + 1);
strncpy(p, (char *) path, len + 1);
} else {
uri->path = xmlStrdup(path);
uri->path = (char *) xmlStrdup(path);
if (uri->path == NULL) {
xmlFreeURI(uri);
return(NULL);