]> wimlib.net Git - wimlib/blobdiff - src/xml.c
Fix typo
[wimlib] / src / xml.c
index 09f567e368a8933502354847ae8e5016ac3e4519..9a0bded26bbfc4f863c9db2ecf820e8a794d5d7f 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -621,13 +621,6 @@ static int xml_write_windows_info(xmlTextWriter *writer,
                        return rc;
        }
 
-       if (windows_info->system_root) {
-               rc = xmlTextWriterWriteElement(writer, "SYSTEMROOT",
-                                               windows_info->system_root);
-                       if (rc < 0)
-                               return rc;
-       }
-
        if (windows_info->product_type) {
                rc = xmlTextWriterWriteElement(writer, "PRODUCTTYPE",
                                                windows_info->product_type);
@@ -669,6 +662,13 @@ static int xml_write_windows_info(xmlTextWriter *writer,
                        return rc;
        }
 
+       if (windows_info->system_root) {
+               rc = xmlTextWriterWriteElement(writer, "SYSTEMROOT",
+                                               windows_info->system_root);
+                       if (rc < 0)
+                               return rc;
+       }
+
        return xmlTextWriterEndElement(writer); /* </WINDOWS> */
 }
 
@@ -682,12 +682,12 @@ static int xml_write_time(xmlTextWriter *writer, const char *element_name,
                return rc;
 
        rc = xmlTextWriterWriteFormatElement(writer, "HIGHPART",
-                                       "0x%"PRIX32, (u32)(time >> 32));
+                                            "0x%08"PRIX32, (u32)(time >> 32));
        if (rc < 0)
                return rc;
 
        rc = xmlTextWriterWriteFormatElement(writer, "LOWPART",
-                                               "0x%"PRIX32, (u32)time);
+                                            "0x%08"PRIX32, (u32)time);
        if (rc < 0)
                return rc;
 
@@ -1443,7 +1443,7 @@ WIMLIBAPI bool wimlib_image_name_in_use(const WIMStruct *w, const char *name)
        int i;
 
        DEBUG("Checking to see if the image name `%s' is already in use", name);
-       if (!name || !w->wim_info)
+       if (!name || !*name || !w->wim_info)
                return false;
        for (i = 1; i <= w->wim_info->num_images; i++)
                if (strcmp(w->wim_info->images[i - 1].name, name) == 0)
@@ -1455,6 +1455,9 @@ WIMLIBAPI bool wimlib_image_name_in_use(const WIMStruct *w, const char *name)
 WIMLIBAPI int wimlib_extract_xml_data(WIMStruct *w, FILE *fp)
 {
        DEBUG("Extracting the XML data.");
+       if (!w->xml_data)
+               return WIMLIB_ERR_INVALID_PARAM;
+
        if (fwrite(w->xml_data, 1, w->hdr.xml_res_entry.size, fp) !=
                        w->hdr.xml_res_entry.size) {
                ERROR_WITH_ERRNO("Failed to extract XML data");