value must be a double, not a flaot
[psensor.git] / src / lib / hdd_hddtemp.c
index 5c89a1f..65964a1 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  * 02110-1301 USA
  */
+
+/* Part of the code in this file is based on GNOME sensors applet code
+ * hddtemp-plugin.c see http://sensors-applet.sourceforge.net/
+ */
+
 #include <locale.h>
 #include <libintl.h>
 #define _(str) gettext(str)
 
-/*
- * Following code is based on GNOME sensors applet code
- * hddtemp-plugin.c see http://sensors-applet.sourceforge.net/
- */
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -38,9 +39,9 @@
 
 static const char *PROVIDER_NAME = "hddtemp";
 
-#define HDDTEMP_SERVER_IP_ADDRESS "127.0.0.1"
-#define HDDTEMP_PORT_NUMBER 7634
-#define HDDTEMP_OUTPUT_BUFFER_LENGTH 4048
+static const char *HDDTEMP_SERVER_IP_ADDRESS = "127.0.0.1";
+static const int HDDTEMP_PORT_NUMBER = 7634;
+static const int HDDTEMP_OUTPUT_BUFFER_LENGTH = 4048;
 
 struct hdd_info {
        char *name;
@@ -176,11 +177,12 @@ static char *next_hdd_info(char *string, struct hdd_info *info)
 struct psensor **hddtemp_psensor_list_add(struct psensor **sensors,
                                          int values_max_length)
 {
-       char *hddtemp_output = fetch();
-       char *c;
+       char *hddtemp_output, *c;
        struct hdd_info info;
        struct psensor **result;
 
+       hddtemp_output = fetch();
+
        if (!hddtemp_output)
                return sensors;
 
@@ -228,7 +230,7 @@ static void update(struct psensor **sensors, struct hdd_info *info)
                    && (*sensor_cur)->type & SENSOR_TYPE_HDDTEMP
                    && !strcmp((*sensor_cur)->id + 8, info->name))
                        psensor_set_current_value(*sensor_cur,
-                                                 (float)info->temp);
+                                                 (double)info->temp);
 
                sensor_cur++;
        }