From fa24d51304316f8d9901368164a133232834ead4 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Sat, 17 Nov 2007 13:15:25 +0000 Subject: [PATCH] Fix variable get_img_width/height return value Fix the functions to conform to the documentation: -1 means non-imaging device, 0 means variable. Internally, -1 is used to represent variable height (to be noticably different from the memset-imposed default of zero). --- libfprint/imgdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libfprint/imgdev.c b/libfprint/imgdev.c index f072959..8ba6bb8 100644 --- a/libfprint/imgdev.c +++ b/libfprint/imgdev.c @@ -68,6 +68,9 @@ int fpi_imgdev_get_img_width(struct fp_img_dev *imgdev) if (width > 0 && imgdrv->enlarge_factor > 1) width *= imgdrv->enlarge_factor; + else if (width == -1) + width = 0; + return width; } @@ -77,8 +80,11 @@ int fpi_imgdev_get_img_height(struct fp_img_dev *imgdev) struct fp_img_driver *imgdrv = fpi_driver_to_img_driver(drv); int height = imgdrv->img_height; - if (height > 0 && imgdrv->enlarge_factor > 1) + if (height > 0 && imgdrv->enlarge_factor > 1) height *= imgdrv->enlarge_factor; + else if (height == -1) + height = 0; + return height; }