cleaned up stupid warnings. all is good.
authorBrenden Matthews <brenden1@rty.ca>
Mon, 25 Jul 2005 01:54:01 +0000 (01:54 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Mon, 25 Jul 2005 01:54:01 +0000 (01:54 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@15 7f574dfc-610e-0410-a909-a81674777703

ftp.c
linux.c
metarinfo.c

diff --git a/ftp.c b/ftp.c
index 28d101c..29919ea 100644 (file)
--- a/ftp.c
+++ b/ftp.c
@@ -399,7 +399,7 @@ int dataConnectFtp() {
     unsigned char ad[6], *cur, *adp, *portp;
     unsigned int temp[6];
     struct sockaddr_in dataAddr;
-    size_t dataAddrLen;
+    socklen_t dataAddrLen;
 
     dataFd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
     if (dataFd < 0) {
@@ -752,7 +752,7 @@ int getFtpSocket(const char *filename) {
  * closeFtpSocket
  */
 
-int closeFtpSocket(int socket) {
+int closeFtpSocket() {
     return(dataConnectEndFtp());
 }
 
@@ -808,7 +808,7 @@ int getFtp(ftpDataCallback callback, void *userData, const char *filename) {
         callback(userData, buf, len);
     } while (len != 0);
 
-    return(closeFtpSocket(dataFd));
+    return(closeFtpSocket());
 }
 
 /*
diff --git a/linux.c b/linux.c
index 08f3ee3..32e9f2c 100644 (file)
--- a/linux.c
+++ b/linux.c
@@ -209,14 +209,13 @@ inline void update_net_stats()
                ns->last_read_trans = t;
 
                /*** ip addr patch ***/
-
-               s = (char*)socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
+               i = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
                
                conf.ifc_buf = malloc(sizeof(struct ifreq) * 16);
                
                conf.ifc_len = sizeof(struct ifreq) * 16;
 
-               ioctl((long)s, SIOCGIFCONF, &conf);
+               ioctl((long)i, SIOCGIFCONF, &conf);
 
                for (k=0; k < conf.ifc_len / sizeof(struct ifreq); k++) {
                        struct net_stat *ns;    
@@ -224,7 +223,7 @@ inline void update_net_stats()
                        ns->addr = ((struct ifreq*)conf.ifc_buf)[k].ifr_ifru.ifru_addr;
                }
 
-               close((long)s);
+               close((long)i);
                
                free(conf.ifc_buf);
 
index 584a7a6..44e80ab 100644 (file)
@@ -2,6 +2,7 @@
 #include <string.h>
 #include "ftp.h"
 #include <math.h>
+#include <time.h>
 #include <pthread.h>
 #include "metarinfo.h"
 
@@ -69,7 +70,7 @@ const char*calculateShortWindDirectionString(int degree){
 
 void ftpData(void *userData, const char *data, int len)
 {
-
+       if(userData) {} // do nothing to make stupid warning go away
        if (len <= 0)
                return;
 
@@ -78,6 +79,7 @@ void ftpData(void *userData, const char *data, int len)
        }
 }
 
+extern unsigned int sleep(unsigned int);
 
 void *fetch_ftp( ) {
                // try three times if it fails
@@ -87,9 +89,10 @@ void *fetch_ftp( ) {
                        /* this happens too often, so i'll leave it commented fprintf(stderr, "METAR update failed for some reason, retry %i\n", tries); */
                        sleep(15); /* give it some time in case the server is busy or down */
                }
+
                tries++;
                if ( strlen(metar_station) != 8 ){
-                       fprintf(stderr,"You didn't supply a valid station code\n");     
+                       ERR("You didn't supply a valid METAR station code\n");
                        return NULL;
                }
                if (metar_server == NULL)
@@ -101,22 +104,21 @@ void *fetch_ftp( ) {
                initFtp();
                res = connectFtp(metar_server, 0);
                if (res < 0) {
-                       fprintf(stderr, "Couldn't connect to %s\n", metar_server);
+                       ERR("Couldn't connect to %s\n", metar_server);
                        return NULL;
                }
                res = changeFtpDirectory(metar_path);
                if (res < 0) {
-                       fprintf(stderr, "Metar update failed (couldn't CWD to %s)\n", metar_path);
+                       ERR("Metar update failed (couldn't CWD to %s)\n", metar_path);
                        disconnectFtp();
                        return NULL;
                }
                if (res == 0) {
-                       fprintf(stderr,
-                               "Metar update failed\n");
+                       ERR("Metar update failed\n");
                        return NULL;
                }
                if (getFtp(ftpData, NULL, metar_station) < 0) {
-                       fprintf(stderr, "Failed to get file %s\n", metar_station);
+                       ERR("Failed to get file %s\n", metar_station);
                }
                
                disconnectFtp();