From 0d6716a77303bebcccacd86023289f4bb339803c Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Sat, 1 Jul 2017 09:06:47 +0100 Subject: [PATCH] Add method for dynamically checking version info Suggestion by aragon@phat.za.net for python-zint --- backend/library.c | 8 ++++++-- backend/zint.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/library.c b/backend/library.c index 54162e0c..ebaf0294 100644 --- a/backend/library.c +++ b/backend/library.c @@ -983,8 +983,8 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int error_number = ZINT_ERROR_INVALID_OPTION; } - if ((symbol->eci < 3) || (symbol->eci > 26) || (symbol->eci == 14) || (symbol->eci == 19) || (symbol->eci == 25)) { - strcpy(symbol->errtxt, "Invalid or unsupported ECI mode (B18)"); + if ((symbol->eci < 3) || (symbol->eci > 999999)) { + strcpy(symbol->errtxt, "Invalid ECI mode (B18)"); error_number = ZINT_ERROR_INVALID_OPTION; } @@ -1304,3 +1304,7 @@ int ZBarcode_Render(struct zint_symbol *symbol, const float width, const float h // Send the request to the render_plot method return render_plot(symbol, width, height); } + +int ZBarcode_Version() { + return (ZINT_VERSION_MAJOR * 10000) + (ZINT_VERSION_MINOR * 100) + ZINT_VERSION_RELEASE; +} \ No newline at end of file diff --git a/backend/zint.h b/backend/zint.h index 8f291acf..369dcb8f 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -274,6 +274,7 @@ extern "C" { ZINT_EXTERN int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, char *filename, int rotate_angle); ZINT_EXTERN int ZBarcode_ValidID(int symbol_id); + ZINT_EXTERN int ZBarcode_Version(); #ifdef __cplusplus }