aboutsummaryrefslogtreecommitdiff
path: root/loader
diff options
context:
space:
mode:
authorMark Young <marky@lunarg.com>2017-05-09 10:31:12 -0600
committerMark Young <marky@lunarg.com>2017-05-09 11:01:03 -0600
commit1b9370ca411fc78c1912cd791a0d96b1b294c0d3 (patch)
treeff0b9199ad032028f00be5bf2356d63301f8f3cb /loader
parent63154a3434160178ef0132a874db6e62a5b9d73f (diff)
downloadusermoji-1b9370ca411fc78c1912cd791a0d96b1b294c0d3.tar.xz
loader: Code review fixes
Fix some potential issues discovered by Karl in the code review. Also, fix CMake warning on newly added VkLayer_standard_layer. The CMake generation code I had been using expected a project with the same name as the JSON. Change-Id: I8738ff03ac08bcfc13aa8d11c570a0b507de450a
Diffstat (limited to 'loader')
-rw-r--r--loader/loader.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/loader/loader.c b/loader/loader.c
index 2de36ef0..0e884c5d 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2017,7 +2017,7 @@ static bool verify_meta_layer_comp_layers(const struct loader_instance *inst, st
// Verify that all meta-layers in a layer list are valid.
static void verify_all_meta_layers(const struct loader_instance *inst, struct loader_layer_list *instance_layers) {
- for (uint32_t i = 0; i < instance_layers->count; i++) {
+ for (int32_t i = 0; i < (int32_t)instance_layers->count; i++) {
struct loader_layer_properties *prop = &instance_layers->list[i];
// If this is a meta-layer, make sure it is valid
@@ -2026,18 +2026,17 @@ static void verify_all_meta_layers(const struct loader_instance *inst, struct lo
"Removing meta-layer %s from instance layer list since it appears invalid.", prop->info.layerName);
// Delete the component layers
- prop->num_component_layers = 0;
loader_instance_heap_free(inst, prop->component_layer_names);
- prop->component_layer_names = NULL;
// Remove the current invalid meta-layer from the layer list
for (uint32_t j = i + 1; j < instance_layers->count; j++) {
- memcpy(&instance_layers->list[j - 1], &instance_layers->list[j], sizeof(struct loader_layer_properties));
+ // Use memmove since we are overlapping the source and destination addresses.
+ memmove(&instance_layers->list[j - 1], &instance_layers->list[j], sizeof(struct loader_layer_properties));
}
instance_layers->count--;
- // Re-verify the remaining list
- verify_all_meta_layers(inst, instance_layers);
+ // Decrement the loop index so we re-check this.
+ i--;
}
}
}