[Gpredict-svn] SF.net SVN: gpredict:[544] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <cs...@us...> - 2009-12-21 13:59:55
|
Revision: 544 http://gpredict.svn.sourceforge.net/gpredict/?rev=544&view=rev Author: csete Date: 2009-12-21 13:59:47 +0000 (Mon, 21 Dec 2009) Log Message: ----------- Fixed bug 2918672: Trailing whitespace and newline in satellite names. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-12-21 00:52:22 UTC (rev 543) +++ trunk/ChangeLog 2009-12-21 13:59:47 UTC (rev 544) @@ -5,7 +5,11 @@ * doc/notes/time_keeping.txt: Applied patch 2916646 from Paul Schulz: Minor fixes to documentation. + * src/tle-update.c: + Fixed bug 2918672: Trailing whitespace and newline in satellite names. + Fixed indentation. + 2009-12-02 Alexandru Csete <oz9aec at gmail.com> * src/gtk-event-list-popup.[ch]: Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-12-21 00:52:22 UTC (rev 543) +++ trunk/NEWS 2009-12-21 13:59:47 UTC (rev 544) @@ -9,12 +9,13 @@ * Feature request 2778735: Visual indicator for RX/TX/TRX. * Feature request 2689352: Mutual Contact Window AOS/LOS. - Fixed bug 2877974: Incorrect uplink Doppler. -- Applied patch 2876485: Fix a memory leak in the rotator controller (Thanks to - Charles Suprin AA1VS). -- Applied patch 2877878: Change Flag to Lock in tle-update (thanks Charles Suprin AA1VS). -- Applied patch 2877918: Fixes segfault in TLE updater (thanks Charles Suprin AA1VS). -- Applied patch 2881367: Updated Flags to Locks (thanks Charles Suprin AA1VS). -- Applied patch 2893617: Patches for fixing Windows build (thanks Valentin Yakovenkov). +- Fixed bug 2918672: Trailing whitespace and newline in satellite names. +- Applied patch 2876485: Fix a memory leak in the rotator controller (Thanks to Charles Suprin AA1VS). +- Applied patch 2877878: Change Flag to Lock in tle-update (thanks to Charles Suprin AA1VS). +- Applied patch 2877918: Fixes segfault in TLE updater (thanks to Charles Suprin AA1VS). +- Applied patch 2881367: Updated Flags to Locks (thanks to Charles Suprin AA1VS). +- Applied patch 2893617: Patches for fixing Windows build (thanks to Valentin Yakovenkov). +- Applied patch 2916646: Minor fixes to documentation (thanks to Paul Schulz). - Slightly improved UI for the single-satellite view. Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2009-12-21 00:52:22 UTC (rev 543) +++ trunk/src/tle-update.c 2009-12-21 13:59:47 UTC (rev 544) @@ -126,7 +126,7 @@ sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s: A TLE update process is already running. Aborting."), __FUNCTION__); - + return; } @@ -136,7 +136,7 @@ /* open directory and read files one by one */ cache_dir = g_dir_open (dir, 0, &err); - + if (err != NULL) { /* send an error message */ @@ -524,9 +524,9 @@ /*if (tle_in_progress)*/ if (g_static_mutex_trylock(&tle_in_progress)==FALSE) { sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: A TLE update process is already running. Aborting."), - __FUNCTION__); - + _("%s: A TLE update process is already running. Aborting."), + __FUNCTION__); + return; } @@ -637,19 +637,19 @@ /* continue update if we have fetched at least one file */ if (success > 0) { - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Fetched %d files from network; updating..."), - __FUNCTION__, success); + sat_log_log (SAT_LOG_LEVEL_MSG, + _("%s: Fetched %d files from network; updating..."), + __FUNCTION__, success); /* call update_from_files */ cache = sat_file_name ("cache"); tle_update_from_files (cache, NULL, silent, progress, label1, label2); g_free (cache); - + } else { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not fetch any new TLE files from network; aborting..."), - __FUNCTION__); + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Could not fetch any new TLE files from network; aborting..."), + __FUNCTION__); } } @@ -689,7 +689,7 @@ g_free (cache); /* clear busy flag */ - /* tle_in_progress = FALSE; */ + /* tle_in_progress = FALSE; */ g_static_mutex_unlock(&tle_in_progress); } @@ -754,99 +754,99 @@ /* read category name for catfile */ catfile = g_fopen (catpath, "r"); - if (catfile!=NULL) { - b = fgets (category, 80, catfile); - fclose (catfile); - } - else { - /* FIXME not sure what goes here AA1VS */ - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s:%s: Failed to open %s"), - __FILE__, __FUNCTION__, catpath); - return (retcode); - } + if (catfile!=NULL) { + b = fgets (category, 80, catfile); + fclose (catfile); + } + else { + /* FIXME not sure what goes here AA1VS */ + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s:%s: Failed to open %s"), + __FILE__, __FUNCTION__, catpath); + return (retcode); + } /* reopen a new catfile and write category name */ catfile = g_fopen (catpath, "w"); - if (catfile!=NULL) { + if (catfile!=NULL) { - fputs (category, catfile); - - /* .cat file now contains the category name; + fputs (category, catfile); + + /* .cat file now contains the category name; satellite catnums will be added during update in the while loop */ - /* read 3 lines at a time */ - while (fgets (tle_str[0], 80, fp)) { - /* read second and third lines */ - b = fgets (tle_str[1], 80, fp); - b = fgets (tle_str[2], 80, fp); - - tle_str[1][69] = '\0'; - tle_str[2][69] = '\0'; - - /* copy catnum and convert to integer */ - for (i = 2; i < 7; i++) { - catstr[i-2] = tle_str[1][i]; - } - catstr[5] = '\0'; - catnr = (guint) g_ascii_strtod (catstr, NULL); - - - if (Get_Next_Tle_Set (tle_str, &tle) != 1) { - /* TLE data not good */ - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s:%s: Invalid data for %d"), - __FILE__, __FUNCTION__, catnr); - } - else { - /* DATA OK, phew... */ - /* sat_log_log (SAT_LOG_LEVEL_DEBUG, */ - /* _("%s: Good data for %d"), */ - /* __FUNCTION__, */ - /* catnr); */ - - /* store catalog number in catfile */ - buff = g_strdup_printf ("%d\n", catnr); - fputs (buff, catfile); - g_free (buff); - - /* add data to hash table */ - key = g_try_new0 (guint, 1); - *key = catnr; - - /* check if satellite already in hash table */ - if (g_hash_table_lookup (data, key) == NULL) { - - /* create new_tle structure */ - ntle = g_try_new (new_tle_t, 1); - ntle->catnum = catnr; - ntle->epoch = tle.epoch; - ntle->satname = g_strdup (tle_str[0]); - ntle->line1 = g_strdup (tle_str[1]); - ntle->line2 = g_strdup (tle_str[2]); - ntle->srcfile = g_strdup (fnam); - ntle->isnew = TRUE; /* flag will be reset when using data */ - - - g_hash_table_insert (data, key, ntle); - retcode++; - } - else { - g_free (key); - } - } - - } - - /* close category file */ - fclose (catfile); - } - else { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s:%s: Failed to open %s"), - __FILE__, __FUNCTION__, catpath); - } + /* read 3 lines at a time */ + while (fgets (tle_str[0], 80, fp)) { + /* read second and third lines */ + b = fgets (tle_str[1], 80, fp); + b = fgets (tle_str[2], 80, fp); + tle_str[1][69] = '\0'; + tle_str[2][69] = '\0'; + + /* copy catnum and convert to integer */ + for (i = 2; i < 7; i++) { + catstr[i-2] = tle_str[1][i]; + } + catstr[5] = '\0'; + catnr = (guint) g_ascii_strtod (catstr, NULL); + + + if (Get_Next_Tle_Set (tle_str, &tle) != 1) { + /* TLE data not good */ + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s:%s: Invalid data for %d"), + __FILE__, __FUNCTION__, catnr); + } + else { + /* DATA OK, phew... */ + /* sat_log_log (SAT_LOG_LEVEL_DEBUG, */ + /* _("%s: Good data for %d"), */ + /* __FUNCTION__, */ + /* catnr); */ + + /* store catalog number in catfile */ + buff = g_strdup_printf ("%d\n", catnr); + fputs (buff, catfile); + g_free (buff); + + /* add data to hash table */ + key = g_try_new0 (guint, 1); + *key = catnr; + + /* check if satellite already in hash table */ + if (g_hash_table_lookup (data, key) == NULL) { + + /* create new_tle structure */ + ntle = g_try_new (new_tle_t, 1); + ntle->catnum = catnr; + ntle->epoch = tle.epoch; + ntle->satname = g_strdup (g_strchomp(tle_str[0])); + ntle->line1 = g_strdup (tle_str[1]); + ntle->line2 = g_strdup (tle_str[2]); + ntle->srcfile = g_strdup (fnam); + ntle->isnew = TRUE; /* flag will be reset when using data */ + + + g_hash_table_insert (data, key, ntle); + retcode++; + } + else { + g_free (key); + } + } + + } + + /* close category file */ + fclose (catfile); + } + else { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s:%s: Failed to open %s"), + __FILE__, __FUNCTION__, catpath); + } + g_free (catpath); /* close input TLE file */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |