summaryrefslogtreecommitdiffstats
path: root/pcilib/value.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-10-09 04:42:53 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-10-09 04:42:53 +0200
commitf13867f64fcba24ef2cb9d726b5ee1082ac1a8b9 (patch)
treed7186eb2a2c2d2e36c05cc702eb0ab0b3c877443 /pcilib/value.c
parent3b8e32c9bbe0d909c34303da0ad36ef0ef5be852 (diff)
downloadpcitool-f13867f64fcba24ef2cb9d726b5ee1082ac1a8b9.tar.gz
pcitool-f13867f64fcba24ef2cb9d726b5ee1082ac1a8b9.tar.bz2
pcitool-f13867f64fcba24ef2cb9d726b5ee1082ac1a8b9.tar.xz
pcitool-f13867f64fcba24ef2cb9d726b5ee1082ac1a8b9.zip
Implement enum view
Diffstat (limited to 'pcilib/value.c')
-rw-r--r--pcilib/value.c16
1 files changed, 13 insertions, 3 deletions
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;
}