Commit d4f1cf4e authored by Marc Lehmann's avatar Marc Lehmann
Browse files

*** empty log message ***

parent 3689589e
Tue Apr 13 02:27:26 CEST 1999 Marc Lehmann <pcg@goof.com>
* libgimp/parasite.[ch]: Removed the parasite load/save functions.
* app/paraslitelist.[ch]: Same as above, for the list load/save
functions.
Mon Apr 12 23:44:14 MEST 1999 Sven Neumann <sven@gimp.org>
* app/crop.c: The "From Selection" functionality is back and works
......
......@@ -216,41 +216,6 @@ parasite_list_find(ParasiteList *list, const char *name)
static int saved_bytes;
static void
save_a_parasite(char *key, Parasite *p, FILE *fp)
{
if (parasite_is_persistent(p))
saved_bytes += parasite_save(p, fp);
}
int
parasite_list_save(ParasiteList *list, FILE *fp)
{
guint32 num;
num = parasite_list_persistent_length (list);
num = GINT32_TO_BE(num);
fwrite(&num, 4, 1, fp);
saved_bytes = 4;
parasite_list_foreach(list, (GHFunc)save_a_parasite, fp);
return saved_bytes;
}
void
parasite_list_load(ParasiteList *list, FILE *fp)
{
Parasite *p;
guint32 num;
num = 0;
fread(&num, 4, 1, fp);
num = GINT32_FROM_BE(num);
while (num--)
{
p = parasite_load(fp);
parasite_list_add(list, p);
parasite_free(p);
}
}
void
parasite_shift_parent(Parasite *p)
{
......
......@@ -47,8 +47,6 @@ void parasite_list_foreach (ParasiteList *list, GHFunc function,
gpointer user_data);
Parasite *parasite_list_find (ParasiteList *list, const char *name);
int parasite_list_save (ParasiteList *list, FILE *fp);
void parasite_list_load (ParasiteList *list, FILE *fp);
void parasite_shift_parent (Parasite *p);
#endif /* __GIMP_PARASITE_H__ */
......@@ -216,41 +216,6 @@ parasite_list_find(ParasiteList *list, const char *name)
static int saved_bytes;
static void
save_a_parasite(char *key, Parasite *p, FILE *fp)
{
if (parasite_is_persistent(p))
saved_bytes += parasite_save(p, fp);
}
int
parasite_list_save(ParasiteList *list, FILE *fp)
{
guint32 num;
num = parasite_list_persistent_length (list);
num = GINT32_TO_BE(num);
fwrite(&num, 4, 1, fp);
saved_bytes = 4;
parasite_list_foreach(list, (GHFunc)save_a_parasite, fp);
return saved_bytes;
}
void
parasite_list_load(ParasiteList *list, FILE *fp)
{
Parasite *p;
guint32 num;
num = 0;
fread(&num, 4, 1, fp);
num = GINT32_FROM_BE(num);
while (num--)
{
p = parasite_load(fp);
parasite_list_add(list, p);
parasite_free(p);
}
}
void
parasite_shift_parent(Parasite *p)
{
......
......@@ -47,8 +47,6 @@ void parasite_list_foreach (ParasiteList *list, GHFunc function,
gpointer user_data);
Parasite *parasite_list_find (ParasiteList *list, const char *name);
int parasite_list_save (ParasiteList *list, FILE *fp);
void parasite_list_load (ParasiteList *list, FILE *fp);
void parasite_shift_parent (Parasite *p);
#endif /* __GIMP_PARASITE_H__ */
......@@ -75,65 +75,6 @@ parasite_new (const char *name, guint32 flags,
return p;
}
Parasite *
parasite_load(FILE *fp)
{
guint32 tmp;
Parasite *p;
p = g_new(Parasite, 1);
tmp = 0;
fread(&tmp, 4, 1, fp);
tmp = GUINT32_FROM_BE(tmp);
if (tmp > 0)
{
p->name = g_malloc(tmp);
fread(p->name, tmp, 1, fp);
}
else
{
g_free (p);
return NULL;
}
fread(&tmp, 4, 1, fp);
p->flags = GUINT32_FROM_BE(tmp);
tmp = 0;
fread(&tmp, 4, 1, fp);
p->size = GUINT32_FROM_BE(tmp);
if (p->size > 0)
{
p->data = g_malloc(p->size);
fread(p->data, p->size, 1, fp);
}
else
p->data = NULL;
return p;
}
int
parasite_save(const Parasite *p, FILE *fp)
{
gint32 len, bytes = 0;
guint32 tmp;
len = strlen(p->name) + 1;
tmp = GUINT32_TO_BE(len);
fwrite(&tmp, 4, 1, fp);
bytes += 4;
if (len > 0)
fwrite(p->name, len, 1, fp);
bytes += len;
tmp = GUINT32_TO_BE(p->flags);
fwrite(&tmp, 4, 1, fp);
bytes += 4;
tmp = GUINT32_TO_BE(p->size);
fwrite(&tmp, 4, 1, fp);
bytes += 4;
if (p->size > 0)
fwrite(p->data, 1, p->size, fp);
bytes += p->size;
return bytes;
}
void
parasite_free (Parasite *parasite)
{
......
......@@ -38,8 +38,6 @@ extern "C" {
Parasite *parasite_new (const char *name, guint32 flags,
guint32 size, const void *data);
Parasite *parasite_load (FILE *fp);
int parasite_save (const Parasite *p, FILE *fp);
void parasite_free (Parasite *parasite);
Parasite *parasite_copy (const Parasite *parasite);
......
......@@ -75,65 +75,6 @@ parasite_new (const char *name, guint32 flags,
return p;
}
Parasite *
parasite_load(FILE *fp)
{
guint32 tmp;
Parasite *p;
p = g_new(Parasite, 1);
tmp = 0;
fread(&tmp, 4, 1, fp);
tmp = GUINT32_FROM_BE(tmp);
if (tmp > 0)
{
p->name = g_malloc(tmp);
fread(p->name, tmp, 1, fp);
}
else
{
g_free (p);
return NULL;
}
fread(&tmp, 4, 1, fp);
p->flags = GUINT32_FROM_BE(tmp);
tmp = 0;
fread(&tmp, 4, 1, fp);
p->size = GUINT32_FROM_BE(tmp);
if (p->size > 0)
{
p->data = g_malloc(p->size);
fread(p->data, p->size, 1, fp);
}
else
p->data = NULL;
return p;
}
int
parasite_save(const Parasite *p, FILE *fp)
{
gint32 len, bytes = 0;
guint32 tmp;
len = strlen(p->name) + 1;
tmp = GUINT32_TO_BE(len);
fwrite(&tmp, 4, 1, fp);
bytes += 4;
if (len > 0)
fwrite(p->name, len, 1, fp);
bytes += len;
tmp = GUINT32_TO_BE(p->flags);
fwrite(&tmp, 4, 1, fp);
bytes += 4;
tmp = GUINT32_TO_BE(p->size);
fwrite(&tmp, 4, 1, fp);
bytes += 4;
if (p->size > 0)
fwrite(p->data, 1, p->size, fp);
bytes += p->size;
return bytes;
}
void
parasite_free (Parasite *parasite)
{
......
......@@ -38,8 +38,6 @@ extern "C" {
Parasite *parasite_new (const char *name, guint32 flags,
guint32 size, const void *data);
Parasite *parasite_load (FILE *fp);
int parasite_save (const Parasite *p, FILE *fp);
void parasite_free (Parasite *parasite);
Parasite *parasite_copy (const Parasite *parasite);
......
......@@ -75,65 +75,6 @@ parasite_new (const char *name, guint32 flags,
return p;
}
Parasite *
parasite_load(FILE *fp)
{
guint32 tmp;
Parasite *p;
p = g_new(Parasite, 1);
tmp = 0;
fread(&tmp, 4, 1, fp);
tmp = GUINT32_FROM_BE(tmp);
if (tmp > 0)
{
p->name = g_malloc(tmp);
fread(p->name, tmp, 1, fp);
}
else
{
g_free (p);
return NULL;
}
fread(&tmp, 4, 1, fp);
p->flags = GUINT32_FROM_BE(tmp);
tmp = 0;
fread(&tmp, 4, 1, fp);
p->size = GUINT32_FROM_BE(tmp);
if (p->size > 0)
{
p->data = g_malloc(p->size);
fread(p->data, p->size, 1, fp);
}
else
p->data = NULL;
return p;
}
int
parasite_save(const Parasite *p, FILE *fp)
{
gint32 len, bytes = 0;
guint32 tmp;
len = strlen(p->name) + 1;
tmp = GUINT32_TO_BE(len);
fwrite(&tmp, 4, 1, fp);
bytes += 4;
if (len > 0)
fwrite(p->name, len, 1, fp);
bytes += len;
tmp = GUINT32_TO_BE(p->flags);
fwrite(&tmp, 4, 1, fp);
bytes += 4;
tmp = GUINT32_TO_BE(p->size);
fwrite(&tmp, 4, 1, fp);
bytes += 4;
if (p->size > 0)
fwrite(p->data, 1, p->size, fp);
bytes += p->size;
return bytes;
}
void
parasite_free (Parasite *parasite)
{
......
......@@ -38,8 +38,6 @@ extern "C" {
Parasite *parasite_new (const char *name, guint32 flags,
guint32 size, const void *data);
Parasite *parasite_load (FILE *fp);
int parasite_save (const Parasite *p, FILE *fp);
void parasite_free (Parasite *parasite);
Parasite *parasite_copy (const Parasite *parasite);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment