diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cameras/ipe.c | 4 | ||||
-rw-r--r-- | src/cameras/pco.c | 4 | ||||
-rw-r--r-- | src/cameras/pf.c | 8 | ||||
-rw-r--r-- | src/uca-cam.c | 2 | ||||
-rw-r--r-- | src/uca-cam.h | 5 |
5 files changed, 13 insertions, 10 deletions
diff --git a/src/cameras/ipe.c b/src/cameras/ipe.c index d1a331c..d6a8f8e 100644 --- a/src/cameras/ipe.c +++ b/src/cameras/ipe.c @@ -19,14 +19,14 @@ static uint32_t uca_ipe_set_property(struct uca_camera_t *cam, enum uca_property return UCA_NO_ERROR; } -static uint32_t uca_ipe_get_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data) +static uint32_t uca_ipe_get_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data, size_t num) { pcilib_t *handle = GET_HANDLE(cam); pcilib_register_value_t value = 0; switch (property) { case UCA_PROP_NAME: - strcpy((char *) data, "IPE PCIe based on CMOSIS CMV2000"); + strncpy((char *) data, "IPE PCIe based on CMOSIS CMV2000", bytes); break; case UCA_PROP_WIDTH: diff --git a/src/cameras/pco.c b/src/cameras/pco.c index 4f793dc..a789762 100644 --- a/src/cameras/pco.c +++ b/src/cameras/pco.c @@ -82,7 +82,7 @@ static uint32_t uca_pco_set_property(struct uca_camera_t *cam, enum uca_property } -static uint32_t uca_pco_get_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data) +static uint32_t uca_pco_get_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data, size_t num) { struct pco_edge_t *pco = GET_PCO(cam); struct uca_grabber_t *grabber = cam->grabber; @@ -99,7 +99,7 @@ static uint32_t uca_pco_get_property(struct uca_camera_t *cam, enum uca_property * one.*/ pco_read_property(pco, GET_CAMERA_NAME, &name, sizeof(name)); pco_read_property(pco, GET_CAMERA_NAME, &name, sizeof(name)); - strcpy((char *) data, name.szName); + strncpy((char *) data, name.szName, num); } break; diff --git a/src/cameras/pf.c b/src/cameras/pf.c index 5b0679e..c1267e3 100644 --- a/src/cameras/pf.c +++ b/src/cameras/pf.c @@ -107,7 +107,7 @@ static uint32_t uca_pf_set_property(struct uca_camera_t *cam, enum uca_property_ } -static uint32_t uca_pf_get_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data) +static uint32_t uca_pf_get_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data, size_t num) { TOKEN t; /* You gotta love developers who name types capitalized... */ PFValue value; @@ -133,7 +133,7 @@ static uint32_t uca_pf_get_property(struct uca_camera_t *cam, enum uca_property_ set_void(data, uint32_t, (uint32_t) floor(atof(value.value.p)+0.5)); } else { - strcpy((char *) data, value.value.p); + strncpy((char *) data, value.value.p, num); } break; @@ -219,8 +219,8 @@ uint32_t uca_pf_init(struct uca_camera_t **cam, struct uca_grabber_t *grabber) val = UCA_TRIGGER_FREERUN; grabber->set_property(grabber, UCA_GRABBER_TRIGGER_MODE, &val); - uca_pf_get_property(uca, UCA_PROP_WIDTH, &uca->frame_width); - uca_pf_get_property(uca, UCA_PROP_HEIGHT, &uca->frame_height); + uca_pf_get_property(uca, UCA_PROP_WIDTH, &uca->frame_width, 0); + uca_pf_get_property(uca, UCA_PROP_HEIGHT, &uca->frame_height, 0); grabber->set_property(grabber, UCA_GRABBER_WIDTH, &uca->frame_width); grabber->set_property(grabber, UCA_GRABBER_HEIGHT, &uca->frame_height); diff --git a/src/uca-cam.c b/src/uca-cam.c index 5d7741d..7c351d1 100644 --- a/src/uca-cam.c +++ b/src/uca-cam.c @@ -7,7 +7,7 @@ uint32_t uca_cam_alloc(struct uca_camera_t *cam, uint32_t n_buffers) { uint32_t bitdepth; - cam->get_property(cam, UCA_PROP_BITDEPTH, &bitdepth); + cam->get_property(cam, UCA_PROP_BITDEPTH, &bitdepth, 0); const int pixel_size = bitdepth == 8 ? 1 : 2; if (cam->grabber != NULL) return cam->grabber->alloc(cam->grabber, pixel_size, n_buffers); diff --git a/src/uca-cam.h b/src/uca-cam.h index 7a18b3d..f668e54 100644 --- a/src/uca-cam.h +++ b/src/uca-cam.h @@ -113,9 +113,12 @@ typedef uint32_t (*uca_cam_set_property) (struct uca_camera_t *cam, enum uca_pro * * \param[out] data Where to store the property's value * + * \param[in] num Number of bytes of string storage. Ignored for uca_uint8t + * and uca_uint32t properties. + * * \return UCA_ERR_PROP_INVALID if property is not supported on the camera */ -typedef uint32_t (*uca_cam_get_property) (struct uca_camera_t *cam, enum uca_property_ids property, void *data); +typedef uint32_t (*uca_cam_get_property) (struct uca_camera_t *cam, enum uca_property_ids property, void *data, size_t num); /** * Begin recording. |