filters
xcf-seek.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "config.h"
00020
00021 #include <stdio.h>
00022 #include <errno.h>
00023
00024 #include <glib-object.h>
00025
00026 #include "core/core-types.h"
00027
00028 #include "xcf-private.h"
00029 #include "xcf-seek.h"
00030
00031 #include "gimp-intl.h"
00032
00033 bool
00034 xcf_seek_pos (XcfInfo *info,
00035 Q_UINT32 pos,
00036 GError **error)
00037 {
00038 if (info->cp != pos)
00039 {
00040 info->cp = pos;
00041 if (fseek (info->fp, info->cp, SEEK_SET) == -1)
00042 {
00043 g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
00044 _("Could not seek in XCF file: %s"),
00045 g_strerror (errno));
00046
00047 return FALSE;
00048 }
00049 }
00050
00051 return TRUE;
00052 }
00053
00054 bool
00055 xcf_seek_end (XcfInfo *info,
00056 GError **error)
00057 {
00058 if (fseek (info->fp, 0, SEEK_END) == -1)
00059 {
00060 g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
00061 _("Could not seek in XCF file: %s"),
00062 g_strerror (errno));
00063
00064 return FALSE;
00065 }
00066
00067 info->cp = ftell (info->fp);
00068
00069 if (fseek (info->fp, 0, SEEK_END) == -1)
00070 {
00071 g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
00072 _("Could not seek in XCF file: %s"),
00073 g_strerror (errno));
00074
00075 return FALSE;
00076 }
00077
00078 return TRUE;
00079 }
|