You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2001/03/30 19:21:08 UTC

cvs commit: apr-iconv/util Makefile.in iconv.c iconv_stream.c

wrowe       01/03/30 09:21:08

  Modified:    .        CHANGES Makefile.in
               build    rules.mk.in
               ces      utf-8.c
               lib      Makefile.in iconv.c iconv.h iconv_ccs.c iconv_ces.c
                        iconv_ces_euc.c iconv_ces_iso2022.c iconv_int.c
                        iconv_module.c iconv_uc.c
               util     Makefile.in iconv.c iconv_stream.c
  Log:
    *) A second pass at a working build system - now builds on linux,
       some namespace protection added.
       [jean-frederic clere <jf...@fujitsu-siemens.com>]
  
  Revision  Changes    Path
  1.4       +4 -0      apr-iconv/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr-iconv/CHANGES,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CHANGES	2001/03/24 04:07:31	1.3
  +++ CHANGES	2001/03/30 17:20:44	1.4
  @@ -1,5 +1,9 @@
   Changes with APR-ICONV a15
   
  +  *) A second pass at a working build system - now builds on linux,
  +     some namespace protection added.
  +     [jean-frederic clere <jf...@fujitsu-siemens.com>]
  +
     *) A first blush at a working build system.
        [jean-frederic clere <jf...@fujitsu-siemens.com>]
   
  
  
  
  1.2       +6 -8      apr-iconv/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr-iconv/Makefile.in,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Makefile.in	2001/03/24 04:15:44	1.1
  +++ Makefile.in	2001/03/30 17:20:45	1.2
  @@ -2,8 +2,8 @@
   # Top-level Makefile for APRICONV
   #
   
  -TARGET_LIB = libapriconv.la
  -TARGET_EXPORTS = apriconv.exports
  +TARGET_LIB = lib/libapriconv.la
  +TARGET_EXPORTS = lib/apriconv.exports
   
   TARGETS = delete-lib $(TARGET_LIB) delete-exports $(TARGET_EXPORTS)
   
  @@ -32,13 +32,11 @@
   	fi
   
   $(TARGET_LIB):
  -	@objects="`find $(SUBDIRS) -name '*.lo'`" ; \
  -	    echo $(LINK) $$objects ; \
  -	    $(LINK) -rpath $(libdir) $$objects
  +	(cd lib; make)
   
   delete-exports:
   	@if test -f $(TARGET_EXPORTS); then \
  -	    headers="`find include/*.h -newer $(TARGET_EXPORTS)`" ; \
  +	    headers="`find lib/*.h -newer $(TARGET_EXPORTS)`" ; \
   	    if test -n "$$headers"; then \
   		echo Found newer headers. Will rebuild $(TARGET_EXPORTS). ; \
   		echo $(RM) -f $(TARGET_EXPORTS) ; \
  @@ -47,11 +45,11 @@
   	fi
   
   $(TARGET_EXPORTS):
  -	$(AWK) -f @APR_SOURCE_DIR@/build/make_export.awk include/*.h > $@ ;
  +	$(AWK) -f @APR_SOURCE_DIR@/build/make_export.awk lib/*.h > $@ ;
   
   docs:
   	mkdir ./docs
  -	perl @APR_SOURCE_DIR@/build/scandoc.pl -i./build/default.pl -p./docs/ ./include/*.h
  +	perl @APR_SOURCE_DIR@/build/scandoc.pl -i./build/default.pl -p./docs/ ./lib/*.h
   
   
   .PHONY: delete-lib delete-exports
  
  
  
  1.2       +1 -1      apr-iconv/build/rules.mk.in
  
  Index: rules.mk.in
  ===================================================================
  RCS file: /home/cvs/apr-iconv/build/rules.mk.in,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- rules.mk.in	2001/03/24 04:15:45	1.1
  +++ rules.mk.in	2001/03/30 17:20:48	1.2
  @@ -132,7 +132,7 @@
   	fi
   
   local-clean:
  -	$(RM) -f *.o *.lo *.a *.la *.so $(CLEAN_TARGETS) $(PROGRAMS)
  +	$(RM) -f *.o *.lo *.a *.la *.so *.slo $(CLEAN_TARGETS) $(PROGRAMS)
   	$(RM) -rf .libs
   
   local-distclean: local-clean
  
  
  
  1.2       +0 -1      apr-iconv/ces/utf-8.c
  
  Index: utf-8.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/ces/utf-8.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- utf-8.c	2000/11/20 19:00:20	1.1
  +++ utf-8.c	2001/03/30 17:20:50	1.2
  @@ -64,7 +64,6 @@
   		n = 4;
   	} else
   		return -1;
  -iconv_warnx("ch=%08X, n=%d, left=%d", in, n, *outbytesleft);
   	if (*outbytesleft < n)
   		return 0;
   	cp = *outbuf;
  
  
  
  1.2       +10 -21    apr-iconv/lib/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/Makefile.in,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Makefile.in	2001/03/24 04:15:45	1.1
  +++ Makefile.in	2001/03/30 17:20:52	1.2
  @@ -1,25 +1,14 @@
  -LIB=		iconv
  -SHLIB_MAJOR=	1
  -SHLIB_MINOR=	0
  -SRCS=		iconv_module.c iconv.c iconv_int.c iconv_uc.c \
  -		iconv_ces.c iconv_ces_euc.c iconv_ces_iso2022.c
  +# Generated automatically from Makefile.in by configure.
  +libdir = /usr/local/lib
  +TARGET_LIB = libapriconv.la
  +TARGET_EXPORTS = apriconv.exports
  +OBJECTS=        iconv_module.lo iconv.lo iconv_int.lo iconv_uc.lo \
  +                iconv_ces.lo iconv_ces_euc.lo iconv_ces_iso2022.lo
   
  -LIBDIR=		${PREFIX}/lib
  +$(TARGET_LIB):	$(OBJECTS)
  +	$(LINK) -rpath $(libdir) $(OBJECTS)                                     
   
  -INCDIR=		${PREFIX}/include
  -INCS=		iconv.h
  -
  -CFLAGS+=	-DICONV_DEFAULT_PATH=\"${MODULEDIR}\"
  -MAN3=		iconv.3 iconv_open.3 iconv_close.3
  -
  -iconv.3:	iconv.3.in
  -		sed "s|@@MODULE_DIR@@|${MODULEDIR}|" ${.ALLSRC} > ${.TARGET}
  -
  -iconv_open.3:	iconv_open.3.in
  -		sed "s|@@MODULE_DIR@@|${MODULEDIR}|" ${.ALLSRC} > ${.TARGET}
  -
  -CLEANFILES=	lib${LIB}.a ${SHLIB_NAME} ${SHLIB_LINK} ${SOBJS} ${OBJS} \
  -		iconv.3 iconv_open.3
  -
  +all:		$(TARGET_LIB)
  + 
   # bring in rules.mk for standard functionality                                  
   @INCLUDE_RULES@
  
  
  
  1.2       +28 -7     apr-iconv/lib/iconv.c
  
  Index: iconv.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- iconv.c	2000/11/20 19:00:20	1.1
  +++ iconv.c	2001/03/30 17:20:53	1.2
  @@ -30,7 +30,8 @@
    *	iconv (Charset Conversion Library) v1.0
    */
   
  -#include <err.h>	/* warnx */
  +#ifndef HAVE_ICONV
  +
   #include <errno.h>	/* errno */
   #include <stdlib.h>	/* free, malloc */
   #include <string.h>
  @@ -45,20 +46,18 @@
   };
   
   size_t
  -iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft,
  +apr_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft,
   	char **outbuf, size_t *outbytesleft)
   {
   	struct iconv_converter *icp = (struct iconv_converter *)cd;
   	ssize_t res = -1;
   
   	if (icp == NULL) {
  -		iconv_warnx("iconv: invalid open conversion descriptor");
   		errno = EBADF;
   		return (size_t)(-1);
   	}
   	if (outbytesleft == NULL || *outbytesleft == 0 ||
   	    outbuf == NULL || *outbuf == 0) {
  -		iconv_warnx("iconv: lack of space in the output buffer");
   		errno = E2BIG;
   		return (size_t)(-1);
   	}
  @@ -69,7 +68,7 @@
   }
   
   iconv_t
  -iconv_open(const char *to, const char *from)
  +apr_iconv_open(const char *to, const char *from)
   {
   	struct iconv_converter_desc **idesc;
   	struct iconv_converter *icp;
  @@ -96,13 +95,12 @@
   }
   
   int
  -iconv_close(iconv_t cd)
  +apr_iconv_close(iconv_t cd)
   {
   	struct iconv_converter *icp = (struct iconv_converter *)cd;
   	int error = 0;
   
   	if (icp == NULL) {
  -		iconv_warnx("iconv_close: invalid handle");
   		errno = EBADF;
   		return -1;
   	}
  @@ -112,3 +110,26 @@
   	free(icp);
   	return error;
   }
  +
  +#else
  +
  +#include <iconv.h>
  +
  +iconv_t apr_iconv_open(const char *to_charset,
  +            const char *from_charset)
  +{
  +	return (iconv_open(to_charset, from_charset));
  +}
  +
  +size_t apr_iconv(iconv_t cd, const char **inbuf,
  +            size_t *inbytesleft, char **outbuf,
  +            size_t *outbytesleft)
  +{
  +	return (iconv(cd , inbuf, inbytesleft, outbuf, outbytesleft));
  +}
  +int apr_iconv_close(iconv_t cd)
  +{
  +	return (iconv_close(cd));
  +}
  +
  +#endif /* !defined(HAVE_ICONV) */
  
  
  
  1.3       +15 -6     apr-iconv/lib/iconv.h
  
  Index: iconv.h
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- iconv.h	2001/03/24 04:06:23	1.2
  +++ iconv.h	2001/03/30 17:20:53	1.3
  @@ -34,10 +34,18 @@
   
   #include <sys/types.h>	/* size_t */
   #include <stddef.h>	/* NULL */
  -#include <inttypes.h>
   
   #include "apr.h"
   
  +/* To be processed by configure */
  +#define ICONV_DEFAULT_PATH "/usr/local/lib/iconv"
  +#define EFTYPE -1234
  +/* To be processed by configure */
  +
  +/* apr additions */
  +#define issetugid() 0
  +/* apr additions */
  +
   /*
    * iconv_t:	charset conversion descriptor type
    */
  @@ -45,9 +53,9 @@
   
   /* __BEGIN_DECLS */
   
  -iconv_t	iconv_open(const char *, const char *);
  -size_t	iconv(iconv_t, const char **, size_t *, char **, size_t *);
  -int	iconv_close(iconv_t);
  +iconv_t	apr_iconv_open(const char *, const char *);
  +size_t	apr_iconv(iconv_t, const char **, size_t *, char **, size_t *);
  +int	apr_iconv_close(iconv_t);
   
   /* __END_DECLS */
   
  @@ -138,8 +146,9 @@
   #define UCS_CHAR_INVALID	 0xFFFE
   #define UCS_CHAR_NONE		 0xFFFF
   
  -typedef uint16_t ucs2_t;	/* Unicode character [D5] */
  -typedef uint32_t ucs4_t;	/* Unicode scalar character [D28] */
  +typedef apr_uint16_t ucs2_t;	/* Unicode character [D5] */
  +typedef apr_uint32_t ucs4_t;	/* Unicode scalar character [D28] */
  +typedef apr_uint16_t uint16_t;
   #define ucs_t    ucs4_t
   
   /*
  
  
  
  1.2       +0 -1      apr-iconv/lib/iconv_ccs.c
  
  Index: iconv_ccs.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_ccs.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- iconv_ccs.c	2000/11/20 19:00:20	1.1
  +++ iconv_ccs.c	2001/03/30 17:20:54	1.2
  @@ -30,7 +30,6 @@
    *	iconv (Charset Conversion Library) v1.0
    */
   
  -#include <err.h>	/* warnx */
   #include <errno.h>	/* errno */
   #include <stdlib.h>	/* free, malloc */
   #include <string.h>
  
  
  
  1.2       +2 -3      apr-iconv/lib/iconv_ces.c
  
  Index: iconv_ces.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_ces.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- iconv_ces.c	2000/11/20 19:00:20	1.1
  +++ iconv_ces.c	2001/03/30 17:20:54	1.2
  @@ -30,7 +30,6 @@
    *	iconv (Charset Conversion Library) v1.0
    */
   
  -#include <err.h>	/* warnx */
   #include <errno.h>	/* errno */
   #include <limits.h>	/* PATH_MAX */
   #include <stdlib.h>	/* free, malloc */
  @@ -56,7 +55,7 @@
   		iconv_mod_unload(mod);
   		return ENOMEM;
   	}
  -	bzero(ces, sizeof(*ces));
  +	memset(ces,0, sizeof(*ces));
   	ces->desc = (struct iconv_ces_desc*)mod->im_desc->imd_data;
   	ces->data = mod->im_data;
   	ces->mod = mod;
  @@ -100,7 +99,7 @@
   void
   iconv_ces_reset_func(struct iconv_ces *ces)
   {
  -	bzero(ces->data, sizeof(int));
  +	memset(ces->data, 0, sizeof(int));
   }
   
   /*ARGSUSED*/
  
  
  
  1.2       +1 -1      apr-iconv/lib/iconv_ces_euc.c
  
  Index: iconv_ces_euc.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_ces_euc.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- iconv_ces_euc.c	2000/11/20 19:00:20	1.1
  +++ iconv_ces_euc.c	2001/03/30 17:20:55	1.2
  @@ -59,7 +59,7 @@
   	state = (iconv_ces_euc_state_t *)malloc(stsz);
   	if (state == NULL)
   		return errno;
  -	bzero(state, stsz);
  +	memset(state, 0, stsz);
   	state->nccs = ces->mod->im_depcnt;
   	for (i = ces->mod->im_depcnt; i; i--, depmod = depmod->im_next)
   		state->ccs[i - 1] = depmod;
  
  
  
  1.2       +2 -2      apr-iconv/lib/iconv_ces_iso2022.c
  
  Index: iconv_ces_iso2022.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_ces_iso2022.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- iconv_ces_iso2022.c	2000/11/20 19:00:20	1.1
  +++ iconv_ces_iso2022.c	2001/03/30 17:20:56	1.2
  @@ -32,7 +32,7 @@
   
   #include <errno.h>
   #include <stdlib.h>	/* free, malloc */
  -#include <string.h>	/* bzero, memcmp, memcpy */
  +#include <string.h>	/* memset, memcmp, memcpy */
   
   #define ICONV_INTERNAL
   #include <iconv.h>
  @@ -83,7 +83,7 @@
   	state = (iconv_ces_iso2022_state_t *)malloc(stsz + shiftsz);
   	if (state == NULL)
   		return errno;
  -	bzero(state, stsz + shiftsz);
  +	memset(state, 0, stsz + shiftsz);
   	ces->data = state;
   	state->shift_tab = (int*)((char*)state + stsz);
   	state->org_shift_tab = ces->desc->data;
  
  
  
  1.2       +1 -1      apr-iconv/lib/iconv_int.c
  
  Index: iconv_int.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_int.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- iconv_int.c	2000/11/20 19:00:20	1.1
  +++ iconv_int.c	2001/03/30 17:20:56	1.2
  @@ -46,7 +46,7 @@
   
   	if (p == NULL)
   		return errno;
  -	bzero(p, size);
  +	memset(p, 0, size);
   	*pp = p;
   	return 0;
   }
  
  
  
  1.2       +2 -3      apr-iconv/lib/iconv_module.c
  
  Index: iconv_module.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_module.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- iconv_module.c	2000/11/20 19:00:20	1.1
  +++ iconv_module.c	2001/03/30 17:20:56	1.2
  @@ -78,6 +78,7 @@
   					return 0;
   				}
   			}
  +			free(ptr); /* otherwise memory leak */
   		}
   	}
   	return iconv_getpathname(buf, ICONV_DEFAULT_PATH, buffer);
  @@ -90,7 +91,6 @@
   
   	handle = dlopen(name, RTLD_LAZY);
   	if (handle == NULL) {
  -		warnx("cannot dlopen file %s: %s", name, dlerror());
   		return EINVAL;
   	}
   	data = dlsym(handle, symbol);
  @@ -100,7 +100,6 @@
   		return 0;
   	}
   	dlclose(handle);
  -	iconv_warnx("invalid file %s: no external symbol %s", name, symbol);
   	return EINVAL;
   }
   
  @@ -129,7 +128,7 @@
   		dlclose(handle);
   		return ENOMEM;
   	}
  -	bzero(mod, sizeof(*mod));
  +	memset(mod, 0, sizeof(*mod));
   	mod->im_handle = handle;
   	mod->im_desc = mdesc;
   	mod->im_args = args;
  
  
  
  1.2       +1 -1      apr-iconv/lib/iconv_uc.c
  
  Index: iconv_uc.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_uc.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- iconv_uc.c	2000/11/20 19:00:20	1.1
  +++ iconv_uc.c	2001/03/30 17:20:57	1.2
  @@ -32,7 +32,7 @@
   	ic = malloc(sizeof(*ic));
   	if (ic == NULL)
   		return ENOMEM;
  -	bzero(ic, sizeof(*ic));
  +	memset(ic, 0, sizeof(*ic));
   	error = iconv_ces_open(from, &ic->from);
   	if (error)
   		goto bad;
  
  
  
  1.2       +2 -1      apr-iconv/util/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr-iconv/util/Makefile.in,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Makefile.in	2001/03/24 04:15:45	1.1
  +++ Makefile.in	2001/03/30 17:21:05	1.2
  @@ -7,6 +7,7 @@
   all: $(PROGRAMS)
   
   iconv_OBJECTS = iconv.lo iconv_stream.lo
  -iconv_LDADD   = ../liblibiconv.la
  +# The -ldl is not OK...
  +iconv_LDADD   = ../lib/libapriconv.la -ldl
   iconv:	$(iconv_OBJECTS) $(iconv_LDADD)
   	$(LINK) $(iconv_OBJECTS) $(iconv_LDADD)
  
  
  
  1.2       +3 -3      apr-iconv/util/iconv.c
  
  Index: iconv.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/util/iconv.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- iconv.c	2000/11/20 19:00:21	1.1
  +++ iconv.c	2001/03/30 17:21:05	1.2
  @@ -92,11 +92,11 @@
   		errx(4, "missing source charset (-f <name>)");
   	if (to == NULL)
   		errx(5, "missing destination charset (-t <name>)");
  -	cd = iconv_open(to, from);
  +	cd = apr_iconv_open(to, from);
   	if ((int)cd < 0)
   		err(6, "unable to open specified convertor");
   	if (!(is = iconv_ostream_fopen(cd, stdout))) {
  -		iconv_close(cd);
  +		apr_iconv_close(cd);
   		exit(7);
   	}
   	if (input) {
  @@ -110,6 +110,6 @@
   	if (iconv_write(is, NULL, 0) < 0)
   		exit(9);
   	iconv_stream_close(is);
  -	iconv_close(cd);
  +	apr_iconv_close(cd);
   	return 0;
   }
  
  
  
  1.2       +1 -3      apr-iconv/util/iconv_stream.c
  
  Index: iconv_stream.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/util/iconv_stream.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- iconv_stream.c	2000/11/20 19:00:21	1.1
  +++ iconv_stream.c	2001/03/30 17:21:06	1.2
  @@ -30,7 +30,6 @@
    *	iconv (Charset Conversion Library) v1.0
    */
   
  -#include <err.h>	/* warnx */
   #include <errno.h>	/* E2BIG, EINVAL, errno */
   #include <stdio.h>	/* FILE, ferror, fwrite */
   #include <stdlib.h>	/* free, malloc */
  @@ -73,7 +72,7 @@
       size_t chars;
       if (!buf)
           insize = 0;
  -    chars = iconv(stream->cd, (const char **)&buf, &insize, &outbuf, &outsize);
  +    chars = apr_iconv(stream->cd, (const char **)&buf, &insize, &outbuf, &outsize);
       if ((int)chars < 0)
           return -1;
       stream->chars += chars;
  @@ -107,7 +106,6 @@
           do {
               left = stream->buffer + buf_size - stream->buf_ptr;
               if (!left) {
  -        	warnx("iconv_bwrite: lack of space in the output buffer");
           	errno = E2BIG;
                   return -1;
               }