]> Pileus Git - aweather/commitdiff
Fix win32 compile issues
authorAndy Spencer <andy753421@gmail.com>
Wed, 11 Nov 2009 09:20:38 +0000 (09:20 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 11 Nov 2009 09:28:06 +0000 (09:28 +0000)
configure.ac
src/.gitignore
src/Makefile.am
src/plugins/Makefile.am
src/wsr88ddec.c

index 4b8999cb0f80c6746f5b5640670411035ce113bc..c450e2244d59f644fdc2734ce38e2d6730226f49 100644 (file)
@@ -11,7 +11,8 @@ AC_PROG_LIBTOOL
 PKG_PROG_PKG_CONFIG
 
 # Check for required packages
-PKG_CHECK_MODULES(GIS, libgis = $VERSION)
+PKG_CHECK_MODULES(GLIB, glib-2.0)
+PKG_CHECK_MODULES(GIS,  libgis = $VERSION)
 
 # Define odd RSL install location
 AC_CHECK_LIB(rsl, RSL_wsr88d_to_radar, RSL_LIBS="-lrsl")
index 488081715d85f0b50be1f1b910da29200509f584..49f0566d2b1482bc6641745931acafd898b57382 100644 (file)
@@ -1,3 +1,4 @@
+*.exe
 *.la
 *.lo
 *.o
index c955106bbb16b09f19d10b6ac3e9c3e49c5e6187..b0ea82cbb609e94b6b606ad89b6ae9d450eeabaa 100644 (file)
@@ -1,18 +1,18 @@
 SUBDIRS = plugins
 
-AM_CFLAGS   = -Wall --std=gnu99 
-AM_CPPFLAGS = $(GIS_CFLAGS)
-LIBS        = $(GIS_LIBS)
+AM_CFLAGS = -Wall --std=gnu99 
 
 bin_PROGRAMS = aweather wsr88ddec
 aweather_SOURCES  = main.c \
        aweather-gui.c      aweather-gui.h \
        aweather-location.c aweather-location.h
-aweather_CPPFLAGS = $(AM_CPPFLAGS) \
-                   -DPKGDATADIR="\"$(pkgdatadir)\"" -DPLUGINSDIR="\"$(pkglibdir)\""
+aweather_CPPFLAGS = -DPKGDATADIR="\"$(pkgdatadir)\"" -DPLUGINSDIR="\"$(pkglibdir)\""
+aweather_CFLAGS   = $(GIS_CFLAGS) $(AM_CFLAGS)
+aweather_LDADD    = $(GIS_LIBS)
 
-wsr88ddec       = wsr88ddec.c
-wsr88ddec_LDADD = -lbz2
+wsr88ddec         = wsr88ddec.c
+wsr88ddec_CFLAGS  = $(GLIB_CFLAGS) $(AM_CFLAGS)
+wsr88ddec_LDADD   = $(GLIB_LIBS) -lbz2
 
 CLEANFILES = gmon.out valgrind.out
 MAINTAINERCLEANFILES = Makefile.in
index 1954b488af0f1fd5d8d41c0391f706e03160ec71..0f10732d4d5a4a16a0f35c6fc9be71aa6d687d79 100644 (file)
@@ -1,6 +1,6 @@
 AM_CFLAGS   = -Wall --std=gnu99  -I../
 AM_CPPFLAGS = $(GIS_CFLAGS)
-AM_LDFLAGS  = -module -avoid-version
+AM_LDFLAGS  = -module -avoid-version -no-undefined
 LIBS        = $(GIS_LIBS)
 
 pluginsdir  = $(pkglibdir)
index 50152722da65859c4e4829a39acc9abf504acb59..3771ba6d098a6265105d4172df5e467997b4584a 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <err.h>
-#include <arpa/inet.h>
+#include <glib.h>
 #include <bzlib.h>
 
-#define debug(...) fprintf(stderr, __VA_ARGS__);
-
 char *bunzip2(char *input, int input_len, int *output_len)
 {
-       bz_stream *stream = calloc(1, sizeof(bz_stream));
+       bz_stream *stream = g_new0(bz_stream, 1);
 
        switch (BZ2_bzDecompressInit(stream, 0, 0)) {
-       case BZ_CONFIG_ERROR: err(1, "the library has been mis-compiled");
-       case BZ_PARAM_ERROR:  err(1, "Parameter error");
-       case BZ_MEM_ERROR:    err(1, "insufficient memory is available");
-       //case BZ_OK:           debug("success\n"); break;
-       //default:              debug("unknown\n"); break;
+       case BZ_CONFIG_ERROR: g_error("the library has been mis-compiled");
+       case BZ_PARAM_ERROR:  g_error("Parameter error");
+       case BZ_MEM_ERROR:    g_error("insufficient memory is available");
+       //case BZ_OK:           g_debug("success\n"); break;
+       //default:              g_debug("unknown\n"); break;
        }
 
        int   status;
@@ -44,11 +38,11 @@ char *bunzip2(char *input, int input_len, int *output_len)
                stream->next_in   = input       + stream->total_in_lo32;
                stream->avail_in  = input_len   - stream->total_in_lo32;
                output_size *= 2;
-               output       = realloc(output, output_size);
-               //debug("alloc %d\n", output_size);
+               output       = g_realloc(output, output_size);
+               //g_debug("alloc %d\n", output_size);
                stream->next_out  = output      + stream->total_out_lo32;
                stream->avail_out = output_size - stream->total_out_lo32;
-               //debug("decompressing..\n"
+               //g_debug("decompressing..\n"
                //      "  next_in   = %p\n"
                //      "  avail_in  = %u\n"
                //      "  next_out  = %p\n"
@@ -59,7 +53,7 @@ char *bunzip2(char *input, int input_len, int *output_len)
                //      stream->avail_out);
        } while ((status = BZ2_bzDecompress(stream)) == BZ_OK && output_size < 1024*1024);
 
-       // debug("done with status %d = %d\n", status, BZ_STREAM_END);
+       // g_debug("done with status %d = %d\n", status, BZ_STREAM_END);
 
        *output_len = stream->total_out_lo32;
        BZ2_bzDecompressEnd(stream);
@@ -69,48 +63,48 @@ char *bunzip2(char *input, int input_len, int *output_len)
 int main(int argc, char **argv)
 {
        if (argc != 3) {
-               printf("usage: %s <input> <output>\n", argv[0]);
+               g_print("usage: %s <input> <output>\n", argv[0]);
                return 0;
        }
 
        FILE *input  = fopen(argv[1], "r");
        FILE *output = fopen(argv[2], "w+");
-       if (!input)  err(1, "error opening input");
-       if (!output) err(1, "error opening output");
+       if (!input)  g_error("error opening input");
+       if (!output) g_error("error opening output");
 
        int st;
        int size = 0;
-       char *buf = malloc(24);
+       char *buf = g_malloc(24);
 
        /* Clear header */
-       //debug("reading header\n");
+       //g_debug("reading header\n");
        if (!fread (buf, 24, 1, input))
-               err(1, "error reading header");
+               g_error("error reading header");
        if (!fwrite(buf, 24, 1, output))
-               err(1, "error writing header");
+               g_error("error writing header");
 
-       //debug("reading body\n");
+       //g_debug("reading body\n");
        while ((st = fread(&size, 1, 4, input))) {
-               //debug("size=%08x\n", size);
-               //debug("read %u bytes\n", st);
+               //g_debug("size=%08x\n", size);
+               //g_debug("read %u bytes\n", st);
                //fwrite(&size, 1, 4, output); // DEBUG
-               size = abs(ntohl(size));
+               size = ABS(g_ntohl(size));
                if (size < 0)
                        return 0;
-               //debug("size = %x\n", size);
+               //g_debug("size = %x\n", size);
                if (size > 20*1024*1024)
-                       err(1, "sanity check failed, buf is to big: %d", size);
-               buf = realloc(buf, size);
+                       g_error("sanity check failed, buf is to big: %d", size);
+               buf = g_realloc(buf, size);
                if (!fread(buf, size, 1, input))
-                       err(1, "error reading data");
+                       g_error("error reading data");
                //fwrite(buf, 1, size, output); // DEBUG
 
                int dec_len;
                char *dec = bunzip2(buf, size, &dec_len);
-               // debug("decompressed %u bytes\n", dec_len);
+               // g_debug("decompressed %u bytes\n", dec_len);
                if (!fwrite(dec, 1, dec_len, output))
-                       err(1, "error writing data");
-               free(dec);
+                       g_error("error writing data");
+               g_free(dec);
        }
 
        return 0;