[Gpredict-svn] SF.net SVN: gpredict:[937] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <aa...@us...> - 2011-10-26 18:25:37
|
Revision: 937 http://gpredict.svn.sourceforge.net/gpredict/?rev=937&view=rev Author: aa1vs Date: 2011-10-26 18:25:30 +0000 (Wed, 26 Oct 2011) Log Message: ----------- Read .sat files only when there is data to compare. Modified Paths: -------------- trunk/ChangeLog trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-10-23 16:43:23 UTC (rev 936) +++ trunk/ChangeLog 2011-10-26 18:25:30 UTC (rev 937) @@ -1,3 +1,9 @@ +2011-10-26 Charles Suprin <hamaa1vs at gmail.com> + + * src/tle-update.c + Read .sat files only when there is data to compare. + + 2011-10-23 Charles Suprin <hamaa1vs at gmail.com> * src/gtk-sat-map-groundtrack.c Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-10-23 16:43:23 UTC (rev 936) +++ trunk/src/tle-update.c 2011-10-26 18:25:30 UTC (rev 937) @@ -1136,44 +1136,42 @@ GKeyFile *satdata; gchar *tlestr1, *tlestr2, *rawtle, *satname, *satnickname; gboolean updateddata; + + /* get catalog number for this satellite */ + catstr = g_strsplit (fname, ".sat", 0); + catnr = (guint) g_ascii_strtod (catstr[0], NULL); + + /* see if we have new data for this satellite */ + key = g_try_new0 (guint, 1); + *key = catnr; + ntle = (new_tle_t *) g_hash_table_lookup (data, key); + g_free (key); - /* open input file (file containing old tle) */ - path = g_strconcat (ldname, G_DIR_SEPARATOR_S, fname, NULL); - satdata = g_key_file_new (); - if (!g_key_file_load_from_file (satdata, path, G_KEY_FILE_KEEP_COMMENTS, &error)) { + if (ntle == NULL) { + /* no new data found for this sat => obsolete */ + nodata++; + + /* check if obsolete sats should be deleted */ + /**** FIXME: This is dangereous, so we omit it */ sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Error loading %s (%s)"), - __FUNCTION__, path, error->message); - g_clear_error (&error); - - skipped++; - + _("%s: No new TLE data found for %d. Satellite might be obsolete."), + __FUNCTION__, catnr); } - - else { - - /* get catalog number for this satellite */ - catstr = g_strsplit (fname, ".sat", 0); - catnr = (guint) g_ascii_strtod (catstr[0], NULL); - - /* see if we have new data for this satellite */ - key = g_try_new0 (guint, 1); - *key = catnr; - ntle = (new_tle_t *) g_hash_table_lookup (data, key); - g_free (key); - - if (ntle == NULL) { - /* no new data found for this sat => obsolete */ - nodata++; - - /* check if obsolete sats should be deleted */ - /**** FIXME: This is dangereous, so we omit it */ + else { + /* open input file (file containing old tle) */ + path = g_strconcat (ldname, G_DIR_SEPARATOR_S, fname, NULL); + satdata = g_key_file_new (); + if (!g_key_file_load_from_file (satdata, path, G_KEY_FILE_KEEP_COMMENTS, &error)) { sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: No new TLE data found for %d. Satellite might be obsolete."), - __FUNCTION__, catnr); - } - else { + _("%s: Error loading %s (%s)"), + __FUNCTION__, path, error->message); + g_clear_error (&error); + + skipped++; + + } else { + /* This satellite is not new */ ntle->isnew = FALSE; @@ -1286,10 +1284,12 @@ skipped++; } } - g_strfreev (catstr); + + g_key_file_free (satdata); + g_free (path); + } - g_key_file_free (satdata); - g_free (path); + g_strfreev (catstr); /* update out parameters */ *sat_upd = updated; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |