X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fxml.c;h=1dd4d8398a7efa573b3b43c0060126411d283568;hb=a0114ec301a99e4bd5605bbef9631d8c21285636;hp=ecb73b221454227e2175abfa1fa888438f0cde93;hpb=4c73e29d8d74a4e969782d2d40e209337414034c;p=wimlib diff --git a/src/xml.c b/src/xml.c index ecb73b22..1dd4d839 100644 --- a/src/xml.c +++ b/src/xml.c @@ -1241,7 +1241,7 @@ calculate_dentry_statistics(struct wim_dentry *dentry, void *arg) /* * Calculate what to put in the , , , and - * elements of each . + * elements of the specified WIM image. */ void xml_update_image_info(WIMStruct *wim, int image) @@ -1261,7 +1261,7 @@ xml_update_image_info(WIMStruct *wim, int image) for_dentry_in_tree(wim->image_metadata[image - 1]->root_dentry, calculate_dentry_statistics, image_info); - image_info->last_modification_time = get_wim_timestamp(); + image_info->last_modification_time = now_as_wim_timestamp(); } /* Adds an image to the XML information. */ @@ -1292,7 +1292,7 @@ xml_add_image(WIMStruct *wim, const tchar *name) wim->wim_info = wim_info; image_info->index = wim_info->num_images; - image_info->creation_time = get_wim_timestamp(); + image_info->creation_time = now_as_wim_timestamp(); xml_update_image_info(wim, image_info->index); return 0; @@ -1668,23 +1668,18 @@ wimlib_set_image_name(WIMStruct *wim, int image, const tchar *name) tchar *p; int i; - DEBUG("Setting the name of image %d to %"TS, image, name); - if (name == NULL) name = T(""); - if (image < 1 || image > wim->hdr.image_count) { - ERROR("%d is not a valid image", image); + if (image < 1 || image > wim->hdr.image_count) return WIMLIB_ERR_INVALID_IMAGE; - } - for (i = 1; i <= wim->hdr.image_count; i++) { - if (i == image) - continue; - if (!tstrcmp(wim->wim_info->images[i - 1].name, name)) { - ERROR("The name \"%"TS"\" is already in use in the WIM!", - name); - return WIMLIB_ERR_IMAGE_NAME_COLLISION; + if (*name) { + for (i = 1; i <= wim->hdr.image_count; i++) { + if (i == image) + continue; + if (!tstrcmp(wim->wim_info->images[i - 1].name, name)) + return WIMLIB_ERR_IMAGE_NAME_COLLISION; } }