From f13867f64fcba24ef2cb9d726b5ee1082ac1a8b9 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Fri, 9 Oct 2015 04:42:53 +0200 Subject: Implement enum view --- pcilib/value.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'pcilib/value.c') diff --git a/pcilib/value.c b/pcilib/value.c index cbf347b..b039e5f 100644 --- a/pcilib/value.c +++ b/pcilib/value.c @@ -57,6 +57,16 @@ int pcilib_set_value_from_int(pcilib_t *ctx, pcilib_value_t *value, long ival) { return 0; } +int pcilib_set_value_from_static_string(pcilib_t *ctx, pcilib_value_t *value, const char *str) { + pcilib_clean_value(ctx, value); + + value->type = PCILIB_TYPE_STRING; + value->sval = str; + + return 0; +} + + /* double pcilib_value_get_float(pcilib_value_t *val) { pcilib_value_t copy; @@ -108,7 +118,7 @@ int pcilib_convert_value_type(pcilib_t *ctx, pcilib_value_t *val, pcilib_value_t case PCILIB_TYPE_STRING: switch (val->type) { case PCILIB_TYPE_STRING: - break; + return 0; case PCILIB_TYPE_DOUBLE: sprintf(val->str, (val->format?val->format:"%lf"), val->fval); val->format = NULL; @@ -132,7 +142,7 @@ int pcilib_convert_value_type(pcilib_t *ctx, pcilib_value_t *val, pcilib_value_t val->format = NULL; break; case PCILIB_TYPE_DOUBLE: - break; + return 0; case PCILIB_TYPE_LONG: val->fval = val->ival; val->format = NULL; @@ -155,7 +165,7 @@ int pcilib_convert_value_type(pcilib_t *ctx, pcilib_value_t *val, pcilib_value_t val->format = NULL; break; case PCILIB_TYPE_LONG: - break; + return 0; default: return PCILIB_ERROR_NOTSUPPORTED; } -- cgit v1.2.3