properly parse files with CRLF line-endings which were created in the past

2007-04-26  Mukund Sivaraman  <muks@mukund.org>

        * plug-ins/gfig/gfig-dobject.c: properly parse files with CRLF
        line-endings which were created in the past in Windows.

        * plug-ins/gfig/gfig.c: open files in binary mode so that the same
        line-endings are used on all platforms.


svn path=/trunk/; revision=22338
This commit is contained in:
Mukund Sivaraman 2007-04-26 10:08:08 +00:00 committed by Mukund Sivaraman
parent 1b9ce30a9b
commit d1e3313362
3 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2007-04-26 Mukund Sivaraman <muks@mukund.org>
* plug-ins/gfig/gfig-dobject.c: properly parse files with CRLF
line-endings which were created in the past in Windows.
* plug-ins/gfig/gfig.c: open files in binary mode so that the same
line-endings are used on all platforms.
2007-04-25 Michael Natterer <mitch@gimp.org>
* app/core/gimpbrush.c (gimp_brush_scale_size): removed bogus

View File

@ -944,6 +944,10 @@ get_line (gchar *buf,
if (slen > 0)
buf[slen - 1] = '\0';
/* Check and remove an '\r' too from Windows */
if ((slen > 1) && (buf[slen - 2] == '\r'))
buf[slen - 2] = '\0';
if (ferror (from))
{
g_warning (_("Error reading file"));
@ -1088,4 +1092,3 @@ d_pnt_add_line (GfigObject *obj,
}
}
}

View File

@ -428,7 +428,7 @@ gfig_load (const gchar *filename,
printf ("Loading %s (%s)\n", filename, name);
#endif /* DEBUG */
fp = g_fopen (filename, "r");
fp = g_fopen (filename, "rb");
if (!fp)
{
g_message (_("Could not open '%s' for reading: %s"),
@ -752,7 +752,7 @@ gfig_load_from_parasite (void)
fname = gimp_temp_name ("gfigtmp");
fp = g_fopen (fname, "w");
fp = g_fopen (fname, "wb");
if (!fp)
{
g_message (_("Error trying to open temporary file '%s' "
@ -787,7 +787,7 @@ gfig_save_callbk (void)
savename = gfig_context->current_obj->filename;
fp = g_fopen (savename, "w+");
fp = g_fopen (savename, "wb+");
if (!fp)
{