Corrected little things.
This commit is contained in:
parent
ddd98ff9c4
commit
2c6b760fc9
|
@ -138,8 +138,8 @@ esac; done
|
|||
#******************************************************************************#
|
||||
# Check for defaults #
|
||||
#******************************************************************************#
|
||||
# MS-Windows things
|
||||
if [ ! $prefix_set ] && [ $(echo $target | grep mingw) ]; then
|
||||
# Cross-compiling things
|
||||
if [ ! $prefix_set ]; then
|
||||
prefix='${root}/usr/'"$target"
|
||||
fi
|
||||
|
||||
|
|
|
@ -18,9 +18,8 @@ int g1m_get_type_info(const char *path,
|
|||
unsigned int *platform, unsigned int *type);
|
||||
|
||||
/* get mcs type data */
|
||||
int g1m_mcstype_getlib(const unsigned char *groupname,
|
||||
const unsigned char *filename, unsigned int rawtype,
|
||||
unsigned int *type, int *id);
|
||||
int g1m_mcstype_getlib(const char *groupname, const char *filename,
|
||||
unsigned int rawtype, unsigned int *type, int *id);
|
||||
int g1m_mcstype_toraw(unsigned int type, int id,
|
||||
char *name, char *dirname, char *groupname);
|
||||
|
||||
|
|
|
@ -121,8 +121,8 @@ fail:
|
|||
int g1m_parse_fkey_cg_content(g1m_t *handle, FILE *stream,
|
||||
uint_fast32_t zonesize, uint32_t *pchecksum)
|
||||
{
|
||||
handle->type = 0x00;
|
||||
//handle->type = g1m_type_fkey;
|
||||
(void)handle;
|
||||
(void)stream;
|
||||
(void)zonesize;
|
||||
(void)pchecksum;
|
||||
|
|
|
@ -640,10 +640,11 @@ int g1m_parse_mcsfile_content(g1m_mcsfile_t **handle, FILE *stream,
|
|||
/* copy raw data */
|
||||
h->_group[16] = 0; strncpy(h->_group, (char*)groupname, 16);
|
||||
h->_dirname[8] = 0; strncpy(h->_dirname, (char*)dirname, 8);
|
||||
h->name[8] = 0; strncpy(h->name, (char*)filename, 8);
|
||||
|
||||
/* look for the raw type */
|
||||
unsigned int type; int id;
|
||||
if (g1m_mcstype_getlib(groupname, filename, raw_type, &type, &id))
|
||||
if (g1m_mcstype_getlib(h->_group, h->name, raw_type, &type, &h->id))
|
||||
goto notparsing;
|
||||
log_info("libg1m file type is 0x%02x", type);
|
||||
if (g1m_mcstype_uses_id(type)) {
|
||||
|
@ -661,7 +662,6 @@ int g1m_parse_mcsfile_content(g1m_mcsfile_t **handle, FILE *stream,
|
|||
/* read it */
|
||||
h->type = type;
|
||||
strncpy(h->name, (char*)filename, 8);
|
||||
h->id = id;
|
||||
int err = (*parse)(h, stream, filesize);
|
||||
|
||||
/* free if error, and return */
|
||||
|
|
|
@ -79,7 +79,7 @@ int g1m_parse_storage(g1m_t *handle, FILE *stream,
|
|||
SUB(fh, file)
|
||||
log_info("[%02d,%02" PRIu16 "] Is a %s file.", id, entry.uuid,
|
||||
(special == 0x05) ? "deleted" : "active");
|
||||
#if LOGLEVEL <= ll_inf
|
||||
#if LOGLEVEL <= ll_info
|
||||
FONTCHARACTER rawname[13]; rawname[12] = 0;
|
||||
memcpy(rawname, fh->name, 12 * sizeof(FONTCHARACTER));
|
||||
{
|
||||
|
@ -90,11 +90,13 @@ int g1m_parse_storage(g1m_t *handle, FILE *stream,
|
|||
}
|
||||
char name[25]; g1m_fcstombs(name, rawname, 0);
|
||||
log_info("- File name: %s", name);
|
||||
|
||||
if (be16toh(fh->directory_reference) == storage_entrytype_directory)
|
||||
log_info("- Is in directory #%" PRIu16,
|
||||
be16toh(fh->directory_number));
|
||||
else
|
||||
log_info("- Is in root.");
|
||||
#endif
|
||||
log_info("- Directory ref: %" PRIu16,
|
||||
be16toh(fh->directory_reference));
|
||||
log_info("- Directory num: %" PRIu16,
|
||||
be16toh(fh->directory_number));
|
||||
break;
|
||||
SUB(fgh, fragment)
|
||||
log_info("[%02d,%02" PRIu16 "] Is a fragment.", id, entry.uuid);
|
||||
|
|
|
@ -56,7 +56,7 @@ void g1m_free_mcsfile_content(g1m_mcsfile_t *handle)
|
|||
/* free the images */
|
||||
if (handle->type & (g1m_mcstype_pict | g1m_mcstype_capt)) {
|
||||
free(handle->image);
|
||||
if (handle->type & g1m_mcstype_capt)
|
||||
if (handle->type & g1m_mcstype_pict)
|
||||
free(handle->second_image);
|
||||
}
|
||||
|
||||
|
|
|
@ -210,24 +210,17 @@ static int get_number(const char *s, int *num, int isnum)
|
|||
* g1m_mcstype_getlib:
|
||||
* Get libg1m type from rawtype.
|
||||
*
|
||||
* @arg groupname the MCS group name.
|
||||
* @arg filename the filename.
|
||||
* @arg gname the MCS group name.
|
||||
* @arg fname the filename.
|
||||
* @arg rawtype the raw number type.
|
||||
* @arg type pointer to the real type field to fill.
|
||||
* @arg id pointer to the ID to fill.
|
||||
* @return if the type was not found (0 if yes).
|
||||
*/
|
||||
|
||||
int g1m_mcstype_getlib(const unsigned char *groupname,
|
||||
const unsigned char *name, unsigned int rawtype,
|
||||
unsigned int *type, int *id)
|
||||
int g1m_mcstype_getlib(const char *gname, const char *fname,
|
||||
unsigned int rawtype, unsigned int *type, int *id)
|
||||
{
|
||||
char gname[17]; gname[16] = 0;
|
||||
strncpy(gname, (char*)groupname, 16);
|
||||
char fname[9]; fname[8] = 0;
|
||||
strncpy(fname, (char*)name, 8);
|
||||
*id = 0;
|
||||
|
||||
/* log what we're looking for */
|
||||
log_info("Looking for type with '%s' group, '%s' name and 0x%02x raw type",
|
||||
gname, fname, rawtype);
|
||||
|
@ -250,7 +243,7 @@ int g1m_mcstype_getlib(const unsigned char *groupname,
|
|||
goto notfound;
|
||||
|
||||
/* look for type correspondance */
|
||||
struct type_corresp *t = g->types - 1;
|
||||
struct type_corresp *t = g->types - 1; int fid = 0;
|
||||
while ((++t)->dirname) {
|
||||
if (t->rawtype != rawtype)
|
||||
continue;
|
||||
|
@ -261,13 +254,12 @@ int g1m_mcstype_getlib(const unsigned char *groupname,
|
|||
size_t fl = strlen(t->name);
|
||||
if (strncmp(t->name, fname, fl))
|
||||
continue;
|
||||
int fid = 0;
|
||||
fid = 0;
|
||||
if ((t->flags & arg)
|
||||
&& get_number(&fname[fl], &fid, t->flags & arg_is_num))
|
||||
continue;
|
||||
*id |= fid;
|
||||
if (t->flags & weight_by_gid)
|
||||
*id |= (gid << 5);
|
||||
fid |= (gid << 5);
|
||||
break;
|
||||
}
|
||||
if (!t->dirname)
|
||||
|
@ -275,11 +267,14 @@ int g1m_mcstype_getlib(const unsigned char *groupname,
|
|||
|
||||
/* fill in info and return */
|
||||
if (type) *type = t->type;
|
||||
if (id) *id = fid;
|
||||
return (0);
|
||||
|
||||
notfound:
|
||||
log_info("Type with '%s' group, '%s' name and 0x%02x type "
|
||||
"wasn't recognized.", gname, fname, rawtype);
|
||||
if (type) *type = 0x00;
|
||||
if (id) *id = 0;
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue