/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* pax ico format
*/
#include <paxlib.h>
#include <ccode.h>
#include <swap.h>
#include <tm.h>
#define ICO_MAGIC 0
#define ICO_PNG_COLORS 0
typedef struct Ico_header_s
{
} Ico_header_t;
typedef struct Ico_directory_s
{
typedef struct Ico_s
{
unsigned char* cur;
int mode;
int entries;
} Ico_t;
static int
{
if (!ico)
return -1;
return 0;
}
static int
ico_getprologue(Pax_t* pax, Paxformat_t* fp, register Paxarchive_t* ap, Paxfile_t* f, register unsigned char* p, size_t size)
{
size_t m;
size_t n;
return 0;
return 0;
return 0;
n = m * ICO_DIRECTORY;
return paxnospace(pax);
{
return 0;
}
return 1;
}
static int
{
register unsigned char* p;
int width;
int height;
{
return 0;
}
width = p[0] ? p[0] : 256;
sfsprintf(ico->name, sizeof(ico->name), "ico-%d-c%dp%db%dw%dh%d.ico", ap->entry, p[2], (int)swapget(3, p+4, 2), (int)swapget(3, p+6, 2), width, height);
f->linktype = PAX_NOLINK;
f->linkpath = 0;
return -1;
return 1;
}
static int
{
ssize_t n;
size_t z;
unsigned char* dir;
return 1;
return -1;
return -1;
return -1;
return -1;
if (n)
return 1;
}
static int
{
if (!ico)
{
if (!(ico = newof(0, Ico_t, 1, 0)) || !(ico->head = sfstropen()) || !(ico->data = sftmp(64 * 1024)))
return paxnospace(pax);
}
return 1;
}
static int
{
return 1;
}
static int
{
unsigned char* p;
int d;
ssize_t n;
size_t z;
return paxnospace(pax);
d = 1;
do
{
n = z;
{
return -1;
}
if (d)
{
if (n < ICO_HEADER + ICO_DIRECTORY)
{
return -1;
}
{
p += ICO_HEADER + ICO_DIRECTORY;
n -= ICO_HEADER + ICO_DIRECTORY;
z -= ICO_HEADER + ICO_DIRECTORY;
}
{
dir[3] = 0;
}
else
{
return -1;
}
d = 0;
}
} while (z -= n);
{
return -1;
}
return n;
}
static off_t
{
register unsigned char* p;
unsigned char* b;
int i;
p += ICO_HEADER;
{
p += ICO_DIRECTORY;
}
if (i < 0)
{
return -1;
}
return 1;
}
{
"ico",
0,
"windows icon file",
0,
0,
0,
0,
0,
0,
};