/*-*-C-*-
 * ResEd toolbox utilities
 */

#include "resed.h"

#include "resformat.h"

#include "wimp.h"
#include "toolbox.h"


/*
 * Determine the size of an object
 */

int toolbox_object_size (ResourceFileObjectTemplateHeaderPtr object)
{
    int size;
    RelocationTablePtr relocs = object->relocationtableoffset != -1 ? 
        (RelocationTablePtr) ((char *) object + object->relocationtableoffset)
            : NULL;
    size = offsetof(ResourceFileObjectTemplateHeaderRec, hdr)
        + object->hdr.totalsize;
    if (relocs)
        size += sizeof(int) + relocs->numrelocations * sizeof(RelocationRec);
    return size;
}
