X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fxml.c;h=4617e2ab4cbd6fa8a3e1bec379ccb33e6e1fcfd7;hb=2b14c2bfd6d0a7a17433dd8529cfc8b7d969c4b0;hp=ecb73b221454227e2175abfa1fa888438f0cde93;hpb=4c73e29d8d74a4e969782d2d40e209337414034c;p=wimlib diff --git a/src/xml.c b/src/xml.c index ecb73b22..4617e2ab 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) @@ -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; } }