mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-16 00:21:50 +00:00
* configure.ac: Add check for zlib and libpng. Do not clobber LIBS
and AUX_LIBS for libwrap check. * configure: Regenerate. * config.h.in (HAVE_LIBZ,HAVE_ZLIB): Update autoconf test to canonical name. (HAVE_LIBPNG): Add new test for libpng. * GSWeb.framework/GSWPngImageInfo.h/m: New files. * GSWeb.framework/GSWeb.h (GSWPngImageInfo): Add declaration and include. * GSWeb.framework/GNUmakefile (GSWPngImageInfo.h/m): Add files. * GSWeb.framework/GSWImageInfo.m (GSWPngImageInfo): Remove reference to class. * GSWeb.framework/GSWResponse.m (HAVE_LIBZ,HAVE_ZLIB): Update references. * GSWeb.framework/NSData+Compress.h/m (HAVE_LIBZ,HAVE_ZLIB): Ditto. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@28183 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b6bbd5b0cb
commit
0bb2a9f983
12 changed files with 3163 additions and 1617 deletions
15
ChangeLog
15
ChangeLog
|
@ -15,6 +15,21 @@
|
|||
|
||||
* Examples/WebBookStore1/BookStore.eomodeld/index.eomodeld:
|
||||
Update adaptor name.
|
||||
|
||||
* configure.ac: Add check for zlib and libpng. Do not clobber LIBS
|
||||
and AUX_LIBS for libwrap check.
|
||||
* configure: Regenerate.
|
||||
* config.h.in (HAVE_LIBZ,HAVE_ZLIB): Update autoconf test to canonical
|
||||
name.
|
||||
(HAVE_LIBPNG): Add new test for libpng.
|
||||
* GSWeb.framework/GSWPngImageInfo.h/m: New files.
|
||||
* GSWeb.framework/GSWeb.h (GSWPngImageInfo): Add declaration and include.
|
||||
* GSWeb.framework/GNUmakefile (GSWPngImageInfo.h/m): Add files.
|
||||
* GSWeb.framework/GSWImageInfo.m (GSWPngImageInfo): Remove reference to
|
||||
class.
|
||||
* GSWeb.framework/GSWResponse.m (HAVE_LIBZ,HAVE_ZLIB): Update references.
|
||||
* GSWeb.framework/NSData+Compress.h/m (HAVE_LIBZ,HAVE_ZLIB): Ditto.
|
||||
|
||||
|
||||
2009-04-05 David Ayers <ayers@fsfe.org>
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ GSWHyperlink.m \
|
|||
GSWImage.m \
|
||||
GSWImageButton.m \
|
||||
GSWImageInfo.m \
|
||||
GSWPngImageInfo.m \
|
||||
GSWJavaScript.m \
|
||||
GSWNestedList.m \
|
||||
GSWParam.m \
|
||||
|
@ -258,6 +259,7 @@ GSWHyperlink.h \
|
|||
GSWImage.h \
|
||||
GSWImageButton.h \
|
||||
GSWImageInfo.h \
|
||||
GSWPngImageInfo.h \
|
||||
GSWInput.h \
|
||||
GSWJavaScript.h \
|
||||
GSWKeyValueAssociation.h \
|
||||
|
|
|
@ -39,9 +39,6 @@ RCS_ID("$Id: GSWImageInfo.m 25027 2009-04-05 13:00:10Z ayers $")
|
|||
@interface GSWGifImageInfo : GSWImageInfo
|
||||
-(id)initWithContentsOfFile: (NSString *)path;
|
||||
@end
|
||||
@interface GSWPngImageInfo : GSWImageInfo
|
||||
-(id)initWithContentsOfFile: (NSString *)path;
|
||||
@end
|
||||
|
||||
@implementation GSWJpegImageInfo
|
||||
-(id)initWithContentsOfFile: (NSString *)path
|
||||
|
@ -59,14 +56,6 @@ RCS_ID("$Id: GSWImageInfo.m 25027 2009-04-05 13:00:10Z ayers $")
|
|||
return self;
|
||||
}
|
||||
@end
|
||||
@implementation GSWPngImageInfo
|
||||
-(id)initWithContentsOfFile: (NSString *)path
|
||||
{
|
||||
NSLog(@"TODO:[%@ %@] %s:%d",NSStringFromClass([self class]),NSStringFromSelector(_cmd),__FILE__,__LINE__);
|
||||
DESTROY(self);
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSWImageInfo
|
||||
static NSDictionary *extensionClassDict = nil;
|
||||
|
|
40
GSWeb.framework/GSWPngImageInfo.h
Normal file
40
GSWeb.framework/GSWPngImageInfo.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/** GSWPngImageInfo.h - <title>GSWeb: Class GSWPngImageInfo</title>
|
||||
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
Written by: David Ayers <ayers@fsfe.org>
|
||||
Date: April 2009
|
||||
|
||||
$Revision: 26815 $
|
||||
$Date: 2009-04-05 13:00:10 +0200$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
</license>
|
||||
**/
|
||||
|
||||
// $Id: GSWImageInfo.h 26815 2009-04-05 13:00:10Z ayers $
|
||||
|
||||
#ifndef _GSWPngImageInfo_h__
|
||||
#define _GSWPngImageInfo_h__
|
||||
|
||||
@interface GSWPngImageInfo : GSWImageInfo
|
||||
-(id)initWithContentsOfFile: (NSString *)path;
|
||||
@end
|
||||
|
||||
|
||||
#endif //_GSWPngImageInfo_h__
|
113
GSWeb.framework/GSWPngImageInfo.m
Normal file
113
GSWeb.framework/GSWPngImageInfo.m
Normal file
|
@ -0,0 +1,113 @@
|
|||
/** GSWPngImageInfo.m - <title>GSWeb: Class GSWImageInfo</title>
|
||||
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
Written by: David Ayers <ayers@fsfe.org>
|
||||
Date: April 2009
|
||||
|
||||
$Revision: 26815 $
|
||||
$Date: 2009-04-05 13:00:10 +0200$
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
<license>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
</license>
|
||||
**/
|
||||
|
||||
#include "config.h"
|
||||
RCS_ID("$Id: GSWImageInfo.m 25027 2009-04-05 13:00:10Z ayers $")
|
||||
|
||||
#ifdef HAVE_LIBPNG
|
||||
#include <png.h>
|
||||
#endif
|
||||
|
||||
#include "GSWeb.h"
|
||||
|
||||
#ifdef HAVE_LIBPNG
|
||||
typedef struct
|
||||
{
|
||||
NSData *data;
|
||||
unsigned int offset;
|
||||
} reader_struct_t;
|
||||
|
||||
static void
|
||||
reader_func(png_structp png_struct,
|
||||
png_bytep data,
|
||||
png_size_t length)
|
||||
{
|
||||
reader_struct_t *r = png_get_io_ptr(png_struct);
|
||||
|
||||
if (r->offset + length > [r->data length])
|
||||
{
|
||||
png_error(png_struct, "end of buffer");
|
||||
return;
|
||||
}
|
||||
memcpy(data, [r->data bytes] + r->offset, length);
|
||||
r->offset += length;
|
||||
}
|
||||
#endif
|
||||
|
||||
@implementation GSWPngImageInfo
|
||||
-(id)initWithContentsOfFile: (NSString *)path
|
||||
{
|
||||
#ifdef HAVE_LIBPNG
|
||||
#warning HAVE_LIBPNG
|
||||
if ((self = [super init]))
|
||||
{
|
||||
NSData *data = [NSData dataWithContentsOfFile: path];
|
||||
const png_bytep bytes = (png_bytep)[data bytes];
|
||||
size_t len = [data length];
|
||||
|
||||
if (!png_sig_cmp(bytes,0,len))
|
||||
{
|
||||
png_structp png_struct;
|
||||
png_infop png_info, png_end_info;
|
||||
reader_struct_t reader;
|
||||
|
||||
png_struct = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
png_info = png_create_info_struct(png_struct);
|
||||
png_end_info = png_create_info_struct(png_struct);
|
||||
|
||||
if (setjmp(png_jmpbuf(png_struct)))
|
||||
{
|
||||
png_destroy_read_struct(&png_struct, &png_info, &png_end_info);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
||||
reader.data = data;
|
||||
reader.offset = 0;
|
||||
|
||||
png_set_read_fn(png_struct, &reader, reader_func);
|
||||
png_read_info(png_struct, png_info);
|
||||
|
||||
DESTROY(_widthString);
|
||||
DESTROY(_heightString);
|
||||
_width = png_get_image_width(png_struct, png_info);
|
||||
_height = png_get_image_height(png_struct, png_info);
|
||||
|
||||
png_destroy_read_struct(&png_struct, &png_info, &png_end_info);
|
||||
}
|
||||
}
|
||||
#else
|
||||
GSOnceMLog(@"PNG support not configured for GSWeb.");
|
||||
DESTROY(self);
|
||||
#endif
|
||||
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
|
@ -262,7 +262,7 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
|
|||
|
||||
LOGObjectFnStart();
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifdef HAVE_LIBZ
|
||||
dataLength=[self _contentLength];
|
||||
NSDebugMLog(@"dataLength=%d",dataLength);
|
||||
// Now we see if we can gzip the content
|
||||
|
|
|
@ -150,6 +150,7 @@
|
|||
@class GSWRecording;
|
||||
@class GSWInputStreamData;
|
||||
@class GSWImageInfo;
|
||||
@class GSWPngImageInfo;
|
||||
|
||||
#include "GSWDefines.h"
|
||||
#include "GSWConstants.h"
|
||||
|
@ -210,6 +211,7 @@
|
|||
#include "GSWImage.h"
|
||||
#include "GSWImageButton.h"
|
||||
#include "GSWImageInfo.h"
|
||||
#include "GSWPngImageInfo.h"
|
||||
#include "GSWJavaScript.h"
|
||||
#include "GSWNestedList.h"
|
||||
#include "GSWParam.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#ifndef _NSData_Compress_h__
|
||||
#define _NSData_Compress_h__
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifdef HAVE_LIBZ
|
||||
//====================================================================
|
||||
@interface NSData (GSWZLib)
|
||||
-(NSData*)deflate;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
RCS_ID("$Id$")
|
||||
|
||||
#include "GSWeb.h"
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifdef HAVE_LIBZ
|
||||
#include <zlib.h>
|
||||
|
||||
void GZPutLong(void* ptr,uLong value)
|
||||
|
|
|
@ -25,9 +25,10 @@
|
|||
#define included_config_h
|
||||
|
||||
|
||||
#undef HAVE_LIBZ
|
||||
#undef HAVE_LIBPNG
|
||||
#undef HAVE_LIBWRAP
|
||||
#undef HAVE_GDL2
|
||||
#define HAVE_ZLIB 1
|
||||
|
||||
#define RCS_ID(name) \
|
||||
static const char rcsId[] = name; \
|
||||
|
|
26
configure.ac
26
configure.ac
|
@ -53,10 +53,20 @@ if test "$GDL2" = yes; then
|
|||
fi
|
||||
AC_SUBST(GDL2)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for zlib
|
||||
# AC_CHECL_LIB sets HAVE_LIBZ instead of HAVE_ZLIB
|
||||
#--------------------------------------------------------------------
|
||||
AC_CHECK_HEADERS(zlib.h)
|
||||
if test $ac_cv_header_zlib_h = yes; then
|
||||
AC_CHECK_LIB(z, gzseek)
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for libwrap
|
||||
#--------------------------------------------------------------------
|
||||
saved_LIBS="$LIBS"
|
||||
WRAP_LIBS=""
|
||||
AC_CHECK_LIB(wrap, main, wrap_ok=yes, wrap_ok=no)
|
||||
if test "$wrap_ok" = yes; then
|
||||
LIBS="-lwrap"
|
||||
|
@ -81,13 +91,13 @@ if test "$wrap_ok" = yes; then
|
|||
fi
|
||||
|
||||
if test "$wrap_ok" = yes; then
|
||||
AUX_LIBS="$AUX_LIBS $LIBS"
|
||||
WRAP_LIBS="$LIBS"
|
||||
HAVE_LIBWRAP=1
|
||||
AC_DEFINE(HAVE_LIBWRAP)
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(LIBWRAP,$wrap_ok)
|
||||
LIBS="$saved_LIBS"
|
||||
LIBS="$saved_LIBS $WRAP_LIBS"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check recent libxml for XML parser
|
||||
|
@ -113,6 +123,17 @@ else
|
|||
CFLAGS="$saved_CFLAGS"
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Find additional image libs
|
||||
#--------------------------------------------------------------------
|
||||
AC_ARG_ENABLE(png,
|
||||
[ --disable-png Disable PNG support],,
|
||||
enable_png=yes)
|
||||
|
||||
if test $enable_png = yes; then
|
||||
AC_CHECK_LIB(png, png_sig_cmp)
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Record the version
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -127,6 +148,7 @@ AC_SUBST(MINOR_VERSION)
|
|||
AC_SUBST(SUBMINOR_VERSION)
|
||||
AC_SUBST(GCC_VERSION)
|
||||
|
||||
AUX_LIBS="$LIBS"
|
||||
AC_SUBST(AUX_INCS)
|
||||
AC_SUBST(AUX_LIBS)
|
||||
|
||||
|
|
Loading…
Reference in a new issue