1
/* The GIMP -- an image manipulation program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
#include <string.h> /* strlen */
27
#include "xcf-write.h"
30
#include "gimp-intl.h"
33
xcf_write_int32 (FILE *fp,
38
GError *tmp_error = NULL;
44
for (i = 0; i < count; i++)
46
tmp = g_htonl (data[i]);
47
xcf_write_int8 (fp, (guint8*) &tmp, 4, &tmp_error);
50
g_propagate_error (error, tmp_error);
61
xcf_write_float (FILE *fp,
66
return xcf_write_int32 (fp, (guint32 *)((void *)data), count, error);
70
xcf_write_int8 (FILE *fp,
81
bytes = fwrite ((gchar*) data, sizeof (gchar), count, fp);
85
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
86
_("Error writing XCF: %s"), g_strerror (errno));
99
xcf_write_string (FILE *fp,
104
GError *tmp_error = NULL;
110
for (i = 0; i < count; i++)
113
tmp = strlen (data[i]) + 1;
117
xcf_write_int32 (fp, &tmp, 1, &tmp_error);
120
g_propagate_error (error, tmp_error);
125
xcf_write_int8 (fp, (guint8*) data[i], tmp, &tmp_error);
128
g_propagate_error (error, tmp_error);