コード例 #1
0
ファイル: region.c プロジェクト: AndreRH/wine
/*****************************************************************************
 * GdipCreateRegionRgnData [GDIPLUS.@]
 */
GpStatus WINGDIPAPI GdipCreateRegionRgnData(GDIPCONST BYTE *data, INT size, GpRegion **region)
{
    const struct region_data_header *region_data_header;
    struct memory_buffer mbuf;
    GpStatus status;
    INT count;

    TRACE("(%p, %d, %p)\n", data, size, region);

    if (!data || !size)
        return InvalidParameter;

    init_memory_buffer(&mbuf, data, size);

    region_data_header = buffer_read(&mbuf, sizeof(*region_data_header));
    if (!region_data_header || !VALID_MAGIC(region_data_header->header.magic))
        return InvalidParameter;

    status = GdipCreateRegion(region);
    if (status != Ok)
        return status;

    count = 0;
    status = read_element(&mbuf, *region, &(*region)->node, &count);
    if (status == Ok && !count)
        status = InvalidParameter;

    if (status != Ok)
    {
        GdipDeleteRegion(*region);
        *region = NULL;
    }

    return status;
}
コード例 #2
0
ファイル: region.c プロジェクト: gena-moscow/wine-patched
GpStatus WINGDIPAPI GdipCreateRegionRgnData(GDIPCONST BYTE *data, INT size, GpRegion **region)
{
    GpStatus status;
    struct memory_buffer mbuf;
    const struct region_header *region_header;
    INT count;

    if (!data || !size) return InvalidParameter;

    TRACE("%p, %d, %p\n", data, size, region);

    init_memory_buffer(&mbuf, data, size);

    region_header = buffer_read(&mbuf, sizeof(struct region_header));
    if (!region_header || region_header->magic != VERSION_MAGIC)
        return InvalidParameter;

    status = GdipCreateRegion(region);
    if (status != Ok) return status;

    count = 0;
    status = read_element(&mbuf, *region, &(*region)->node, &count);
    if (status == Ok && !count)
        status = InvalidParameter;

    if (status != Ok)
        GdipDeleteRegion(*region);

    return status;
}