]> sigrok.org Git - libsigrok.git/commitdiff
metex14: Pass 'info' as a void pointer.
authorUwe Hermann <redacted>
Sat, 1 Dec 2012 18:01:07 +0000 (19:01 +0100)
committerUwe Hermann <redacted>
Sun, 2 Dec 2012 13:21:17 +0000 (14:21 +0100)
This is done so that the function prototype of all sr_*_parse() DMM
functions is the same, which will be needed later.

hardware/common/dmm/metex14.c
libsigrok-internal.h

index 9c6fd62e0f6b1f672268dd6887ff3472b9ed3108..5e99fefffddd0cac26aad4cc566c44db9183b56a 100644 (file)
@@ -268,29 +268,34 @@ SR_PRIV gboolean sr_metex14_packet_valid(const uint8_t *buf)
 /**
  * Parse a protocol packet.
  *
- * @param buf Buffer containing the protocol packet.
+ * @param buf Buffer containing the protocol packet. Must not be NULL.
  * @param floatval Pointer to a float variable. That variable will be modified
- *                 in-place depending on the protocol packet.
+ *                 in-place depending on the protocol packet. Must not be NULL.
  * @param analog Pointer to a struct sr_datafeed_analog. The struct will be
  *               filled with data according to the protocol packet.
+ *               Must not be NULL.
+ * @param info Pointer to a struct metex14_info. The struct will be filled
+ *             with data according to the protocol packet. Must not be NULL.
  *
  * @return SR_OK upon success, SR_ERR upon failure. Upon errors, the
  *         'analog' variable contents are undefined and should not be used.
  */
 SR_PRIV int sr_metex14_parse(const uint8_t *buf, float *floatval,
-                            struct sr_datafeed_analog *analog,
-                            struct metex14_info *info)
+                            struct sr_datafeed_analog *analog, void *info)
 {
        int ret;
+       struct metex14_info *info_local;
+
+       info_local = (struct metex14_info *)info;
 
        if ((ret = parse_value(buf, floatval)) != SR_OK) {
                sr_err("Error parsing value: %d.", ret);
                return ret;
        }
 
-       memset(info, 0x00, sizeof(struct metex14_info));
-       parse_flags((const char *)buf, info);
-       handle_flags(analog, floatval, info);
+       memset(info_local, 0x00, sizeof(struct metex14_info));
+       parse_flags((const char *)buf, info_local);
+       handle_flags(analog, floatval, info_local);
 
        return SR_OK;
 }
index 40510b4d0c4e600f0ccb413afd56fda96fc6ea51..8fc73dc7dc1a05d191c18da73ce64f1b7f7c21a2 100644 (file)
@@ -202,7 +202,6 @@ struct metex14_info {
 
 SR_PRIV gboolean sr_metex14_packet_valid(const uint8_t *buf);
 SR_PRIV int sr_metex14_parse(const uint8_t *buf, float *floatval,
-                            struct sr_datafeed_analog *analog,
-                            struct metex14_info *info);
+                            struct sr_datafeed_analog *analog, void *info);
 
 #endif