X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/4c77d5e0aec3c7aab32965ca4e02abb17bb6108f..8c0604067586d37324e75ee2939038ecde370fa1:/src/dem.c?ds=sidebyside diff --git a/src/dem.c b/src/dem.c index e8a7698f..b82510ec 100644 --- a/src/dem.c +++ b/src/dem.c @@ -1,3 +1,24 @@ +/* + * viking -- GPS Data and Topo Analyzer, Explorer, and Manager + * + * Copyright (C) 2003-2008, Evan Battaglia + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include #include #include @@ -6,7 +27,6 @@ #include #include #include -#include #include @@ -266,7 +286,7 @@ static void *unzip_hgt_file(gchar *zip_file, gulong *unzip_size) local_file_header = (struct _lfh *) zip_file; if (local_file_header->sig != 0x04034b50) { - g_warning("%s(): wrong format\n", __PRETTY_FUNCTION__); + g_warning("%s(): wrong format", __PRETTY_FUNCTION__); g_free(unzip_data); goto end; } @@ -345,7 +365,7 @@ static VikDEM *vik_dem_read_srtm_hgt(FILE *f, const gchar *basename, gboolean zi else if (file_size == (num_rows_1sec * num_rows_1sec * sizeof(gint16))) arcsec = 1; else { - g_warning("%s(): file %s does not have right size\n", __PRETTY_FUNCTION__, basename); + g_warning("%s(): file %s does not have right size", __PRETTY_FUNCTION__, basename); munmap(dem_file, file_size); g_ptr_array_free(dem->columns, TRUE); g_free(dem); @@ -393,7 +413,7 @@ VikDEM *vik_dem_new_from_file(const gchar *file) const gchar *basename = a_file_basename(file); /* FILE IO */ - f = fopen(file, "r"); + f = g_fopen(file, "r"); if ( !f ) return NULL; @@ -403,6 +423,7 @@ VikDEM *vik_dem_new_from_file(const gchar *file) gboolean is_zip_file = (strlen(basename) == 15); rv = vik_dem_read_srtm_hgt(f, basename, is_zip_file); fclose(f); + f = NULL; return(rv); } @@ -441,6 +462,7 @@ VikDEM *vik_dem_new_from_file(const gchar *file) /* TODO - class C records (right now says 'Invalid' and dies) */ fclose(f); + f = NULL; /* 24k scale */ if ( rv->horiz_units == VIK_DEM_HORIZ_UTM_METERS && rv->n_columns >= 2 )