static char *read_splashfile(char *filename, int *file_sizep, int *file_typep)

{

    GError *err = NULL;

    gboolean res;

    gchar *content;

    int file_type = -1;

    unsigned int filehead = 0;

    int bmp_bpp;



    res = g_file_get_contents(filename, &content, (gsize *)file_sizep, &err);

    if (res == FALSE) {

        error_report("failed to read splash file '%s'", filename);

        g_error_free(err);

        return NULL;

    }



    /* check file size */

    if (*file_sizep < 30) {

        goto error;

    }



    /* check magic ID */

    filehead = ((content[0] & 0xff) + (content[1] << 8)) & 0xffff;

    if (filehead == 0xd8ff) {

        file_type = JPG_FILE;

    } else if (filehead == 0x4d42) {

        file_type = BMP_FILE;

    } else {

        goto error;

    }



    /* check BMP bpp */

    if (file_type == BMP_FILE) {

        bmp_bpp = (content[28] + (content[29] << 8)) & 0xffff;

        if (bmp_bpp != 24) {

            goto error;

        }

    }



    /* return values */

    *file_typep = file_type;



    return content;



error:

    error_report("splash file '%s' format not recognized; must be JPEG "

                 "or 24 bit BMP", filename);

    g_free(content);

    return NULL;

}

static char *read_splashfile(char *filename, int *file_sizep, int *file_typep)

{

    GError *err = NULL;

    gboolean res;

    gchar *content;

    int file_type = -1;

    unsigned int filehead = 0;

    int bmp_bpp;



    res = g_file_get_contents(filename, &content, (gsize *)file_sizep, &err);

    if (res == FALSE) {

        error_report("failed to read splash file '%s'", filename);

        g_error_free(err);

        return NULL;

    }



    

    if (*file_sizep < 30) {

        goto error;

    }



    

    filehead = ((content[0] & 0xff) + (content[1] << 8)) & 0xffff;

    if (filehead == 0xd8ff) {

        file_type = JPG_FILE;

    } else if (filehead == 0x4d42) {

        file_type = BMP_FILE;

    } else {

        goto error;

    }



    

    if (file_type == BMP_FILE) {

        bmp_bpp = (content[28] + (content[29] << 8)) & 0xffff;

        if (bmp_bpp != 24) {

            goto error;

        }

    }



    

    *file_typep = file_type;



    return content;



error:

    error_report("splash file '%s' format not recognized; must be JPEG "

                 "or 24 bit BMP", filename);

    g_free(content);

    return NULL;

}

static char *read_splashfile(char *filename, int *file_sizep, int *file_typep)     res = g_file_get_contents(filename, &content, (gsize *)file_sizep, &err);
static char *FUNC_0(char *VAR_0, int *VAR_1, int *VAR_2)

{

    GError *err = NULL;

    gboolean res;

    gchar *content;

    int VAR_3 = -1;

    unsigned int VAR_4 = 0;

    int VAR_5;



    res = g_file_get_contents(VAR_0, &content, (gsize *)VAR_1, &err);

    if (res == FALSE) {

        error_report("failed to read splash file '%s'", VAR_0);

        g_error_free(err);

        return NULL;

    }



    

    if (*VAR_1 < 30) {

        goto error;

    }



    

    VAR_4 = ((content[0] & 0xff) + (content[1] << 8)) & 0xffff;

    if (VAR_4 == 0xd8ff) {

        VAR_3 = JPG_FILE;

    } else if (VAR_4 == 0x4d42) {

        VAR_3 = BMP_FILE;

    } else {

        goto error;

    }



    

    if (VAR_3 == BMP_FILE) {

        VAR_5 = (content[28] + (content[29] << 8)) & 0xffff;

        if (VAR_5 != 24) {

            goto error;

        }

    }



    

    *VAR_2 = VAR_3;



    return content;



error:

    error_report("splash file '%s' format not recognized; must be JPEG "

                 "or 24 bit BMP", VAR_0);

    g_free(content);

    return NULL;

}

static char *FUNC_0(char *VAR_0, int *VAR_1, int *VAR_2)
{ GError *err = NULL; gboolean res; gchar *content; int VAR_3 = -1; unsigned int VAR_4 = 0; int VAR_5; res = g_file_get_contents(VAR_0, &content, (gsize *)VAR_1, &err); if (res == FALSE) { error_report("failed to read splash file '%s'", VAR_0); g_error_free(err); return NULL; } if (*VAR_1 < 30) { goto error; } VAR_4 = ((content[0] & 0xff) + (content[1] << 8)) & 0xffff; if (VAR_4 == 0xd8ff) { VAR_3 = JPG_FILE; } else if (VAR_4 == 0x4d42) { VAR_3 = BMP_FILE; } else { goto error; } if (VAR_3 == BMP_FILE) { VAR_5 = (content[28] + (content[29] << 8)) & 0xffff; if (VAR_5 != 24) { goto error; } } *VAR_2 = VAR_3; return content; error:
error_report("splash file '%s' format not recognized; must be JPEG " "or 24 bit BMP", VAR_0); g_free(content); return NULL; }