summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorebelanger2012-07-17 05:30:05 +0000
committerebelanger2012-07-17 05:30:05 +0000
commit6ec2771a3445423dc5c196d88858e311eb3f891a (patch)
treebdcec6c39e477b03e98baa72e05e1afdbd16c934
parent65779e01d6c3d598aaa961bb8bed11c7e54aa50a (diff)
downloadaur-6ec2771a3445423dc5c196d88858e311eb3f891a.tar.gz
upgpkg: directfb 1.6.1-1
Upstream update, Remove sysfsutils depends, Add build patch, Remove old patches git-svn-id: file:///srv/repos/svn-community/svn@73919 9fca08f4-af9d-4005-b8df-a31f2cc04f65
-rw-r--r--.SRCINFO13
-rw-r--r--DirectFB-1.4.9-libpng-1.5.patch252
-rw-r--r--DirectFB-1.6.1-zlib-include.patch12
-rw-r--r--PKGBUILD16
-rw-r--r--directfb-missing_include.patch376
5 files changed, 24 insertions, 645 deletions
diff --git a/.SRCINFO b/.SRCINFO
index f3283cd5d203..eb68d724c148 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -2,7 +2,7 @@
# Mon Sep 26 02:32:35 UTC 2016
pkgbase = directfb
pkgdesc = A thin library that provides hardware graphics acceleration, input device handling and abstraction, integrated windowing system on top of the Linux Framebuffer Device
- pkgver = 1.5.3
+ pkgver = 1.6.1
pkgrel = 1
url = http://www.directfb.org
arch = i686
@@ -11,16 +11,13 @@ pkgbase = directfb
depends = gcc-libs
depends = libjpeg
depends = sdl
- depends = sysfsutils
depends = libpng
depends = freetype2
options = !libtool
- source = http://www.directfb.org/downloads/Core/DirectFB-1.5/DirectFB-1.5.3.tar.gz
- source = DirectFB-1.4.9-libpng-1.5.patch
- source = directfb-missing_include.patch
- md5sums = 54a9ec931c8e3c82adb924194e65120e
- md5sums = 82f552ae306871382a6a8e05cffee723
- md5sums = 6b7ceca416c28a3791a145c15bf6f462
+ source = http://www.directfb.org/downloads/Core/DirectFB-1.6/DirectFB-1.6.1.tar.gz
+ source = DirectFB-1.6.1-zlib-include.patch
+ sha1sums = 121c7fd1e81ccb41962986126e1d69f188c2f2c2
+ sha1sums = f2309edd87c772a7894d4b648d56197d91790cad
pkgname = directfb
diff --git a/DirectFB-1.4.9-libpng-1.5.patch b/DirectFB-1.4.9-libpng-1.5.patch
deleted file mode 100644
index 65470ea8f66d..000000000000
--- a/DirectFB-1.4.9-libpng-1.5.patch
+++ /dev/null
@@ -1,252 +0,0 @@
-From 83180b25e90721e717bf37c5332c22713508786e Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Sun, 20 Feb 2011 19:18:19 -0500
-Subject: [PATCH] png: add support for libpng 1.5.x
-
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
- .../idirectfbimageprovider_png.c | 56 ++++++++++++-------
- 1 files changed, 35 insertions(+), 21 deletions(-)
-
-diff --git a/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c b/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c
-index 6d65ea3..7d82c5c 100644
---- a/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c
-+++ b/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c
-@@ -207,7 +207,7 @@ Construct( IDirectFBImageProvider *thiz,
- if (!data->png_ptr)
- goto error;
-
-- if (setjmp( data->png_ptr->jmpbuf )) {
-+ if (setjmp( png_jmpbuf( data->png_ptr ))) {
- D_ERROR( "ImageProvider/PNG: Error reading header!\n" );
- goto error;
- }
-@@ -292,7 +292,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz,
- rect = dst_data->area.wanted;
- }
-
-- if (setjmp( data->png_ptr->jmpbuf )) {
-+ if (setjmp( png_jmpbuf( data->png_ptr ))) {
- D_ERROR( "ImageProvider/PNG: Error during decoding!\n" );
-
- if (data->stage < STAGE_IMAGE)
-@@ -327,6 +327,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz,
- }
- else {
- CoreSurfaceBufferLock lock;
-+ png_byte bit_depth = png_get_bit_depth( data->png_ptr, data->info_ptr );
-
- ret = dfb_surface_lock_buffer( dst_surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock );
- if (ret)
-@@ -334,7 +335,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz,
-
- switch (data->color_type) {
- case PNG_COLOR_TYPE_PALETTE:
-- if (dst_surface->config.format == DSPF_LUT8 && data->info_ptr->bit_depth == 8) {
-+ if (dst_surface->config.format == DSPF_LUT8 && bit_depth == 8) {
- /*
- * Special indexed PNG to LUT8 loading.
- */
-@@ -377,7 +378,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz,
- }
- else {
- if (data->color_type == PNG_COLOR_TYPE_GRAY) {
-- int num = 1 << data->info_ptr->bit_depth;
-+ int num = 1 << bit_depth;
-
- for (x=0; x<num; x++) {
- int value = x * 255 / (num - 1);
-@@ -386,7 +387,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz,
- }
- }
-
-- switch (data->info_ptr->bit_depth) {
-+ switch (bit_depth) {
- case 8:
- for (y=0; y<data->height; y++) {
- u8 *S = data->image + data->pitch * y;
-@@ -441,7 +442,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz,
-
- default:
- D_ERROR( "ImageProvider/PNG: Unsupported indexed bit depth %d!\n",
-- data->info_ptr->bit_depth );
-+ bit_depth );
- }
-
- dfb_scale_linear_32( image_argb, data->width, data->height,
-@@ -594,16 +595,26 @@ png_info_callback( png_structp png_read_ptr,
- NULL, NULL, NULL );
-
- if (png_get_valid( data->png_ptr, data->info_ptr, PNG_INFO_tRNS )) {
-+ png_bytep trans;
-+ png_color_16p trans_color;
-+ int num_trans;
-+
-+ png_get_tRNS( data->png_ptr, data->info_ptr, &trans, &num_trans, &trans_color );
-+
- data->color_keyed = true;
-
- /* generate color key based on palette... */
- if (data->color_type == PNG_COLOR_TYPE_PALETTE) {
- u32 key;
-- png_colorp palette = data->info_ptr->palette;
-- png_bytep trans = data->info_ptr->trans_alpha;
-- int num_colors = MIN( MAXCOLORMAPSIZE,
-- data->info_ptr->num_palette );
-- u8 cmap[3][num_colors];
-+ png_colorp palette;
-+ int num_colors;
-+ u8 *cmap[3];
-+
-+ png_get_PLTE( data->png_ptr, data->info_ptr, &palette, &num_colors );
-+ num_colors = MIN( MAXCOLORMAPSIZE, num_colors );
-+ cmap[0] = alloca (num_colors);
-+ cmap[1] = alloca (num_colors);
-+ cmap[2] = alloca (num_colors);
-
- for (i=0; i<num_colors; i++) {
- cmap[0][i] = palette[i].red;
-@@ -613,7 +624,7 @@ png_info_callback( png_structp png_read_ptr,
-
- key = FindColorKey( num_colors, &cmap[0][0] );
-
-- for (i=0; i<data->info_ptr->num_trans; i++) {
-+ for (i=0; i<num_trans; i++) {
- if (!trans[i]) {
- palette[i].red = (key & 0xff0000) >> 16;
- palette[i].green = (key & 0x00ff00) >> 8;
-
---
-1.7.4.1
-
-From 7a2a36fada3ecdd7f48fcfd782a552598477a8f5 Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Sun, 20 Feb 2011 19:38:50 -0500
-Subject: [PATCH] tools: add support for libpng 1.5.x
-
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
- tools/directfb-csource.c | 20 +++++++++++++-------
- tools/mkdfiff.c | 2 +-
- tools/mkdgifft.cpp | 2 +-
- 3 files changed, 15 insertions(+), 9 deletions(-)
-
-diff --git a/tools/directfb-csource.c b/tools/directfb-csource.c
-index 8f2cbf0..487ea3c 100644
---- a/tools/directfb-csource.c
-+++ b/tools/directfb-csource.c
-@@ -338,7 +338,7 @@ static DFBResult load_image (const char *filename,
- if (!png_ptr)
- goto cleanup;
-
-- if (setjmp (png_ptr->jmpbuf)) {
-+ if (setjmp (png_jmpbuf (png_ptr))) {
- if (desc->preallocated[0].data) {
- free (desc->preallocated[0].data);
- desc->preallocated[0].data = NULL;
-@@ -405,17 +405,22 @@ static DFBResult load_image (const char *filename,
- }
-
- switch (src_format) {
-- case DSPF_LUT8:
-- if (info_ptr->num_palette) {
-+ case DSPF_LUT8: {
-+ png_colorp png_palette;
-+ int num_palette;
-+
-+ png_get_PLTE( png_ptr, info_ptr, &png_palette, &num_palette );
-+
-+ if (num_palette) {
- png_byte *alpha;
- int i, num;
-
-- *palette_size = MIN (info_ptr->num_palette, 256);
-+ *palette_size = MIN (num_palette, 256);
- for (i = 0; i < *palette_size; i++) {
- palette[i].a = 0xFF;
-- palette[i].r = info_ptr->palette[i].red;
-- palette[i].g = info_ptr->palette[i].green;
-- palette[i].b = info_ptr->palette[i].blue;
-+ palette[i].r = png_palette[i].red;
-+ palette[i].g = png_palette[i].green;
-+ palette[i].b = png_palette[i].blue;
- }
- if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) {
- png_get_tRNS (png_ptr, info_ptr, &alpha, &num, NULL);
-@@ -424,6 +429,7 @@ static DFBResult load_image (const char *filename,
- }
- }
- break;
-+ }
- case DSPF_RGB32:
- png_set_filler (png_ptr, 0xFF,
- #ifdef WORDS_BIGENDIAN
-diff --git a/tools/mkdfiff.c b/tools/mkdfiff.c
-index 68a3b4f..edb58a7 100644
---- a/tools/mkdfiff.c
-+++ b/tools/mkdfiff.c
-@@ -97,7 +97,7 @@ load_image (const char *filename,
- if (!png_ptr)
- goto cleanup;
-
-- if (setjmp (png_ptr->jmpbuf)) {
-+ if (setjmp (png_jmpbuf (png_ptr))) {
- if (desc->preallocated[0].data) {
- free (desc->preallocated[0].data);
- desc->preallocated[0].data = NULL;
-diff --git a/tools/mkdgifft.cpp b/tools/mkdgifft.cpp
-index 96e4220..d4b6bf4 100644
---- a/tools/mkdgifft.cpp
-+++ b/tools/mkdgifft.cpp
-@@ -595,7 +595,7 @@ load_image (const char *filename,
- if (!png_ptr)
- goto cleanup;
-
-- if (setjmp (png_ptr->jmpbuf)) {
-+ if (setjmp (png_jmpbuf (png_ptr))) {
- if (desc->preallocated[0].data) {
- free (desc->preallocated[0].data);
- desc->preallocated[0].data = NULL;
---
-1.7.4.1
-
---- a/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c 2012-02-14 19:04:52.000000000 -0500
-+++ b/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c 2012-02-14 19:07:18.000000000 -0500
-@@ -710,10 +709,15 @@
-
- switch (data->color_type) {
- case PNG_COLOR_TYPE_PALETTE: {
-- png_colorp palette = data->info_ptr->palette;
-- png_bytep trans = data->info_ptr->trans_alpha;
-- int num_trans = data->info_ptr->num_trans;
-- int num_colors = MIN( MAXCOLORMAPSIZE, data->info_ptr->num_palette );
-+ png_colorp palette;
-+ png_bytep trans;
-+ png_color_16p trans_color;
-+ int num_trans;
-+ int num_colors;
-+
-+ png_get_PLTE( data->png_ptr, data->info_ptr, &palette, &num_colors );
-+ num_colors = MIN( MAXCOLORMAPSIZE, num_colors );
-+ png_get_tRNS( data->png_ptr, data->info_ptr, &trans, &num_trans, &trans_color );
-
- for (i=0; i<num_colors; i++) {
- data->colors[i].a = (i < num_trans) ? trans[i] : 0xff;
---- a/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c.old 2012-02-14 22:40:30.000000000 -0500
-+++ b/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c 2012-02-14 23:37:19.000000000 -0500
-@@ -638,12 +638,10 @@
- data->color_key = key;
- }
- else {
-- /* ...or based on trans rgb value */
-- png_color_16p trans = &data->info_ptr->trans_color;
-
-- data->color_key = (((trans->red & 0xff00) << 8) |
-- ((trans->green & 0xff00)) |
-- ((trans->blue & 0xff00) >> 8));
-+ data->color_key = (((trans_color->red & 0xff00) << 8) |
-+ ((trans_color->green & 0xff00)) |
-+ ((trans_color->blue & 0xff00) >> 8));
- }
- }
-
diff --git a/DirectFB-1.6.1-zlib-include.patch b/DirectFB-1.6.1-zlib-include.patch
new file mode 100644
index 000000000000..e4f24a5cf21c
--- /dev/null
+++ b/DirectFB-1.6.1-zlib-include.patch
@@ -0,0 +1,12 @@
+diff -Naur DirectFB-1.6.0-orig/src/core/surface.c DirectFB-1.6.0/src/core/surface.c
+--- DirectFB-1.6.0-orig/src/core/surface.c 2012-06-20 02:21:36.029994460 -0400
++++ DirectFB-1.6.0/src/core/surface.c 2012-06-20 02:22:48.533330819 -0400
+@@ -28,6 +28,8 @@
+
+ #include <config.h>
+
++#include <zlib.h>
++
+ #include <direct/debug.h>
+
+ #include <core/core.h>
diff --git a/PKGBUILD b/PKGBUILD
index 7ae94041335d..be60e67daabf 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,25 +3,23 @@
# Maintainer: Eric Bélanger <eric@archlinux.org>
pkgname=directfb
-pkgver=1.5.3
+pkgver=1.6.1
pkgrel=1
pkgdesc="A thin library that provides hardware graphics acceleration, input device handling and abstraction, integrated windowing system on top of the Linux Framebuffer Device"
arch=('i686' 'x86_64')
url="http://www.directfb.org"
license=('LGPL')
-depends=('gcc-libs' 'libjpeg' 'sdl' 'sysfsutils' 'libpng' 'freetype2')
+depends=('gcc-libs' 'libjpeg' 'sdl' 'libpng' 'freetype2')
options=('!libtool')
source=(http://www.directfb.org/downloads/Core/DirectFB-${pkgver%.*}/DirectFB-${pkgver}.tar.gz \
- DirectFB-1.4.9-libpng-1.5.patch directfb-missing_include.patch)
-md5sums=('54a9ec931c8e3c82adb924194e65120e'
- '82f552ae306871382a6a8e05cffee723'
- '6b7ceca416c28a3791a145c15bf6f462')
+ DirectFB-1.6.1-zlib-include.patch)
+sha1sums=('121c7fd1e81ccb41962986126e1d69f188c2f2c2'
+ 'f2309edd87c772a7894d4b648d56197d91790cad')
build() {
cd "${srcdir}/DirectFB-${pkgver}"
- patch -p1 -i ../DirectFB-1.4.9-libpng-1.5.patch
- patch -p1 -i ../directfb-missing_include.patch
- CFLAGS+="-fno-inline" ./configure --prefix=/usr --sysconfdir=/etc --enable-static \
+ patch -p1 -i ../DirectFB-1.6.1-zlib-include.patch
+ ./configure --prefix=/usr --sysconfdir=/etc --enable-static \
--enable-zlib --enable-x11 --enable-sdl --disable-vnc --disable-osx \
--enable-video4linux2 --enable-voodoo
make
diff --git a/directfb-missing_include.patch b/directfb-missing_include.patch
deleted file mode 100644
index 4b1af5a30a2c..000000000000
--- a/directfb-missing_include.patch
+++ /dev/null
@@ -1,376 +0,0 @@
---- /dev/null 2012-02-14 14:47:01.028967126 -0500
-+++ b/lib/voodoo/link.h 2012-02-14 21:19:05.000000000 -0500
-@@ -0,0 +1,85 @@
-+/*
-+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
-+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
-+
-+ All rights reserved.
-+
-+ Written by Denis Oliver Kropp <dok@directfb.org>,
-+ Andreas Hundt <andi@fischlustig.de>,
-+ Sven Neumann <neo@directfb.org>,
-+ Ville Syrjälä <syrjala@sci.fi> and
-+ Claudio Ciccani <klan@users.sf.net>.
-+
-+ This library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2 of the License, or (at your option) any later version.
-+
-+ This library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with this library; if not, write to the
-+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ Boston, MA 02111-1307, USA.
-+*/
-+
-+#ifndef __VOODOO__LINK_H__
-+#define __VOODOO__LINK_H__
-+
-+#include <voodoo/types.h>
-+
-+
-+typedef struct {
-+ void *ptr;
-+ size_t length;
-+ size_t done;
-+} VoodooChunk;
-+
-+
-+struct __V_VoodooLink {
-+ void *priv;
-+ u32 code;
-+
-+ void (*Close)( VoodooLink *link );
-+
-+ /* See 'read(2)', blocking */
-+ ssize_t (*Read) ( VoodooLink *link,
-+ void *buffer,
-+ size_t count );
-+
-+ /* See 'write(2)', blocking */
-+ ssize_t (*Write)( VoodooLink *link,
-+ const void *buffer,
-+ size_t count );
-+
-+
-+ /* For later... */
-+ DirectResult (*SendReceive)( VoodooLink *link,
-+ VoodooChunk *send,
-+ size_t num_send,
-+ VoodooChunk *recv,
-+ size_t num_recv );
-+
-+ DirectResult (*WakeUp) ( VoodooLink *link );
-+
-+ DirectResult (*WaitForData)( VoodooLink *link,
-+ int timeout_ms );
-+};
-+
-+
-+DirectResult VOODOO_API voodoo_link_init_connect( VoodooLink *link,
-+ const char *hostname,
-+ int port,
-+ bool raw );
-+
-+DirectResult VOODOO_API voodoo_link_init_local ( VoodooLink *link,
-+ const char *path,
-+ bool raw );
-+
-+DirectResult VOODOO_API voodoo_link_init_fd ( VoodooLink *link,
-+ int fd[2] );
-+
-+#endif
---- /dev/null 2012-02-14 14:47:01.028967126 -0500
-+++ b/lib/voodoo/packet.h 2012-02-14 21:37:45.000000000 -0500
-@@ -0,0 +1,285 @@
-+/*
-+ (c) Copyright 2001-2011 The world wide DirectFB Open Source Community (directfb.org)
-+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
-+
-+ All rights reserved.
-+
-+ Written by Denis Oliver Kropp <dok@directfb.org>,
-+ Andreas Hundt <andi@fischlustig.de>,
-+ Sven Neumann <neo@directfb.org>,
-+ Ville Syrjälä <syrjala@sci.fi> and
-+ Claudio Ciccani <klan@users.sf.net>.
-+
-+ This library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2 of the License, or (at your option) any later version.
-+
-+ This library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with this library; if not, write to the
-+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ Boston, MA 02111-1307, USA.
-+*/
-+
-+#ifndef __VOODOO__PACKET_H__
-+#define __VOODOO__PACKET_H__
-+
-+extern "C" {
-+#include <direct/fastlz.h>
-+#include <direct/list.h>
-+#include <direct/mem.h>
-+#include <direct/memcpy.h>
-+
-+
-+#include <voodoo/types.h>
-+}
-+
-+
-+typedef enum {
-+ VPHF_NONE = 0x00000000,
-+
-+ VPHF_COMPRESSED = 0x00000001,
-+
-+ VPHF_ALL = 0x00000001
-+} VoodooPacketHeaderFlags;
-+
-+
-+typedef struct {
-+ u32 size;
-+ u32 flags;
-+ u32 uncompressed;
-+ u32 align;
-+} VoodooPacketHeader;
-+
-+
-+class VoodooPacket {
-+public:
-+ DirectLink link;
-+ bool sending;
-+
-+private:
-+ void *data;
-+ void *current;
-+ VoodooPacketHeader header;
-+
-+ VoodooPacket( u32 size,
-+ void *data )
-+ :
-+ sending(false),
-+ data(data),
-+ current(data)
-+ {
-+ memset( &link, 0, sizeof(link) );
-+
-+ header.size = size;
-+ header.flags = VPHF_NONE;
-+ header.uncompressed = size;
-+ }
-+
-+ VoodooPacket( u32 size,
-+ u32 flags,
-+ u32 uncompressed,
-+ void *data )
-+ :
-+ sending(false),
-+ data(data),
-+ current(data)
-+ {
-+ memset( &link, 0, sizeof(link) );
-+
-+ header.size = size;
-+ header.flags = VPHF_COMPRESSED;
-+ header.uncompressed = uncompressed;
-+ }
-+
-+ ~VoodooPacket() {};
-+
-+public:
-+/*
-+ static VoodooPacket *
-+ New( u32 size )
-+ {
-+ VoodooPacket *packet = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + size );
-+
-+ if (!packet) {
-+ D_OOM();
-+ return NULL;
-+ }
-+
-+ return new (packet) VoodooPacket( size, packet + 1 );
-+
-+
-+ if (data)
-+ this->data = data;
-+ else
-+ this->data = header + 1;
-+ }
-+*/
-+ static VoodooPacket *
-+ New( u32 size,
-+ void *data )
-+ {
-+ return new VoodooPacket( size, data );
-+ }
-+
-+ static VoodooPacket *
-+ Reset( VoodooPacket *packet,
-+ u32 size,
-+ void *data )
-+ {
-+ return new (packet) VoodooPacket( size, data );
-+ }
-+
-+ static VoodooPacket *
-+ New( void *header,
-+ u32 size )
-+ {
-+ VoodooPacketHeader *h = (VoodooPacketHeader*) header;
-+
-+ h->size = size;
-+ h->flags = VPHF_NONE;
-+ h->uncompressed = size;
-+
-+ return new VoodooPacket( size, (char*) header + sizeof(VoodooPacketHeader) );
-+ }
-+
-+ static VoodooPacket *
-+ New( u32 size )
-+ {
-+ VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + VOODOO_PACKET_MAX );
-+
-+ if (!p) {
-+ D_OOM();
-+ return NULL;
-+ }
-+
-+ return new (p) VoodooPacket( size, p + 1 );
-+ }
-+
-+ static VoodooPacket *
-+ Compressed( VoodooPacket *packet )
-+ {
-+ VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + packet->header.size * 4 / 3 );
-+
-+ if (!p) {
-+ D_OOM();
-+ return NULL;
-+ }
-+
-+ int compressed = direct_fastlz_compress( packet->data, packet->header.uncompressed, p + 1 );
-+
-+ if ((size_t) compressed < packet->header.uncompressed)
-+ return new (p) VoodooPacket( compressed, VPHF_COMPRESSED, packet->header.uncompressed, p + 1 );
-+
-+ D_FREE( p );
-+
-+ return packet;
-+ }
-+
-+ static VoodooPacket *
-+ Copy( VoodooPacket *packet )
-+ {
-+ VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + packet->header.size );
-+
-+ if (!p) {
-+ D_OOM();
-+ return NULL;
-+ }
-+
-+ direct_memcpy( p + 1, packet->data_start(), packet->header.size );
-+
-+ return new (p) VoodooPacket( packet->header.size, packet->header.flags, packet->header.uncompressed, p + 1 );
-+ }
-+
-+ static VoodooPacket *
-+ Copy( u32 size,
-+ u32 flags,
-+ u32 uncompressed,
-+ void *data )
-+ {
-+ VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + size );
-+
-+ if (!p) {
-+ D_OOM();
-+ return NULL;
-+ }
-+
-+ direct_memcpy( p + 1, data, size );
-+
-+ return new (p) VoodooPacket( size, flags, uncompressed, p + 1 );
-+ }
-+
-+ inline u32
-+ size() const
-+ {
-+ return header.size;
-+ }
-+
-+ inline u32
-+ flags() const
-+ {
-+ return header.flags;
-+ }
-+
-+ inline u32
-+ uncompressed() const
-+ {
-+ return header.uncompressed;
-+ }
-+
-+ inline const void *
-+ data_header() const
-+ {
-+ D_ASSERT( data == this + 1 );
-+
-+ return &header;
-+ }
-+
-+ inline const void *
-+ data_start() const
-+ {
-+ return data;
-+ }
-+
-+ inline void *
-+ data_raw() const
-+ {
-+ return current;
-+ }
-+
-+
-+ inline bool
-+ append( size_t size )
-+ {
-+ D_ASSERT( data == this + 1 );
-+
-+ if (header.size + size > VOODOO_PACKET_MAX)
-+ return false;
-+
-+ current = (char*) data + header.size;
-+
-+ header.size += size;
-+ header.uncompressed += size;
-+
-+ return true;
-+ }
-+
-+ inline void
-+ reset( size_t size )
-+ {
-+ D_ASSERT( data == this + 1 );
-+
-+ current = (char*) data;
-+
-+ header.size = size;
-+ header.uncompressed = size;
-+ }
-+};
-+
-+
-+#endif