From 54a229b3864fe7867da69ef7427877094a256f1c Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Wed, 16 Mar 2011 08:58:55 +0100 Subject: Pass target string size when calling uca_get_property --- test/enum.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test/enum.c') diff --git a/test/enum.c b/test/enum.c index 8803ec4..1164399 100644 --- a/test/enum.c +++ b/test/enum.c @@ -30,7 +30,8 @@ int main(int argc, char *argv[]) /* take first camera */ struct uca_camera_t *cam = uca->cameras; - char string_value[256]; + const size_t num_bytes = 256; + char string_value[num_bytes]; uint32_t uint32_value; uint8_t uint8_value; @@ -41,21 +42,21 @@ int main(int argc, char *argv[]) printf("%s = ", prop->name); switch (prop->type) { case uca_string: - if (cam->get_property(cam, i, string_value) != UCA_ERR_PROP_INVALID) { + if (cam->get_property(cam, i, string_value, num_bytes) != UCA_ERR_PROP_INVALID) { printf("%s ", string_value); } else printf("n/a"); break; case uca_uint32t: - if (cam->get_property(cam, i, &uint32_value) != UCA_ERR_PROP_INVALID) { + if (cam->get_property(cam, i, &uint32_value, 0) != UCA_ERR_PROP_INVALID) { printf("%i %s", uint32_value, uca_unit_map[prop->unit]); } else printf("n/a"); break; case uca_uint8t: - if (cam->get_property(cam, i, &uint8_value) != UCA_ERR_PROP_INVALID) { + if (cam->get_property(cam, i, &uint8_value, 0) != UCA_ERR_PROP_INVALID) { printf("%i %s", uint8_value, uca_unit_map[prop->unit]); } else -- cgit v1.2.3