[Gpredict-svn] SF.net SVN: gpredict:[405] trunk/src/first-time.c
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <cs...@us...> - 2009-08-08 21:30:23
|
Revision: 405 http://gpredict.svn.sourceforge.net/gpredict/?rev=405&view=rev Author: csete Date: 2009-08-08 21:30:15 +0000 (Sat, 08 Aug 2009) Log Message: ----------- Removed redundant erro check. Modified Paths: -------------- trunk/src/first-time.c Modified: trunk/src/first-time.c =================================================================== --- trunk/src/first-time.c 2009-08-08 15:14:07 UTC (rev 404) +++ trunk/src/first-time.c 2009-08-08 21:30:15 UTC (rev 405) @@ -519,56 +519,48 @@ g_key_file_set_string (target, "Satellite", "TLE2", tle2); /* convert configuration data struct to charachter string */ - cfgstr = g_key_file_to_data (target, &length, &err); + cfgstr = g_key_file_to_data (target, &length, NULL); /* this function never reports error */ + /* create and open a file for writing */ + cfgfile = g_io_channel_new_file (targetfilename, "w", &err); + if (err != NULL) { sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create satellite data file (%s)."), + _("%s: Could not create satellite file (%s)."), __FUNCTION__, err->message); g_clear_error (&err); *error |= FTC_ERROR_STEP_05; } else { - /* create and open a file for writing */ - cfgfile = g_io_channel_new_file (targetfilename, "w", &err); + g_io_channel_write_chars (cfgfile, + cfgstr, + length, + &written, + &err); + g_io_channel_shutdown (cfgfile, TRUE, NULL); + g_io_channel_unref (cfgfile); + if (err != NULL) { sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Could not create satellite file (%s)."), + _("%s: Error writing satellite data (%s)."), __FUNCTION__, err->message); g_clear_error (&err); *error |= FTC_ERROR_STEP_05; } + else if (length != written) { + sat_log_log (SAT_LOG_LEVEL_WARN, + _("%s: Wrote only %d out of %d chars for satellite data."), + __FUNCTION__, written, length); + } else { - g_io_channel_write_chars (cfgfile, - cfgstr, - length, - &written, - &err); - - g_io_channel_shutdown (cfgfile, TRUE, NULL); - g_io_channel_unref (cfgfile); - - if (err != NULL) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Error writing satellite data (%s)."), - __FUNCTION__, err->message); - g_clear_error (&err); - *error |= FTC_ERROR_STEP_05; - } - else if (length != written) { - sat_log_log (SAT_LOG_LEVEL_WARN, - _("%s: Wrote only %d out of %d chars for satellite data."), - __FUNCTION__, written, length); - } - else { - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Satellite data written for %s."), - __FUNCTION__, satellites[i]); - newsats++; - } + sat_log_log (SAT_LOG_LEVEL_MSG, + _("%s: Satellite data written for %s."), + __FUNCTION__, satellites[i]); + newsats++; } } + g_key_file_free (target); g_free (cfgstr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |