added test for iconv parm 2 constness
This commit is contained in:
parent
18b3573358
commit
c4b099e8d3
@ -20,3 +20,7 @@
|
|||||||
|
|
||||||
/* Compile the inotify interface */
|
/* Compile the inotify interface */
|
||||||
#undef RCL_USE_INOTIFY
|
#undef RCL_USE_INOTIFY
|
||||||
|
|
||||||
|
/* iconv parameter 2 is const char** */
|
||||||
|
#undef RCL_ICONV_INBUF_CONST
|
||||||
|
|
||||||
|
|||||||
749
src/configure
vendored
749
src/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -113,7 +113,7 @@ fi
|
|||||||
|
|
||||||
##### Look for iconv. We first look for libiconv in /usr/local/lib:/usr/lib
|
##### Look for iconv. We first look for libiconv in /usr/local/lib:/usr/lib
|
||||||
## then in libc (Linux, solaris)
|
## then in libc (Linux, solaris)
|
||||||
AC_LANG(C)
|
AC_LANG(C++)
|
||||||
LIBICONV=""
|
LIBICONV=""
|
||||||
S_LDFLAGS=$LDFLAGS
|
S_LDFLAGS=$LDFLAGS
|
||||||
dir=/usr/local/lib
|
dir=/usr/local/lib
|
||||||
@ -143,6 +143,18 @@ fi
|
|||||||
#echo LIBICONV $LIBICONV
|
#echo LIBICONV $LIBICONV
|
||||||
#echo INCICONV $INCICONV
|
#echo INCICONV $INCICONV
|
||||||
|
|
||||||
|
CPPFLAGS="$CPPFLAGS $INCICONV"
|
||||||
|
AC_MSG_CHECKING(for type of inbuf parameter to iconv)
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <iconv.h>
|
||||||
|
],[
|
||||||
|
iconv(0,(const char **)0,(size_t *)0,(char **)0,(size_t *)0);
|
||||||
|
], rcl_iconv_inbuf_const="1", rcl_iconv_inbuf_const="0")
|
||||||
|
if test X$rcl_iconv_inbuf_const = X1 ; then
|
||||||
|
AC_DEFINE(RCL_ICONV_INBUF_CONST, 1, [iconv parameter 2 is const char**])
|
||||||
|
fi
|
||||||
|
|
||||||
#### Look for Xapian
|
#### Look for Xapian
|
||||||
AC_PATH_PROG(XAPIAN_CONFIG, xapian-config, no)
|
AC_PATH_PROG(XAPIAN_CONFIG, xapian-config, no)
|
||||||
if test "$XAPIAN_CONFIG" = "no" ; then
|
if test "$XAPIAN_CONFIG" = "no" ; then
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: csguess.cpp,v 1.5 2006-01-23 13:32:28 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: csguess.cpp,v 1.6 2007-06-19 07:52:33 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -51,6 +51,12 @@ using std::string;
|
|||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
|
||||||
#include "csguess.h"
|
#include "csguess.h"
|
||||||
|
#include "autoconfig.h"
|
||||||
|
#ifdef RCL_ICONV_INBUF_CONST
|
||||||
|
#define ICV_P2_TYPE const char**
|
||||||
|
#else
|
||||||
|
#define ICV_P2_TYPE char**
|
||||||
|
#endif
|
||||||
|
|
||||||
// The values from estraier were 32768, 256, 0.001
|
// The values from estraier were 32768, 256, 0.001
|
||||||
const int ICONVCHECKSIZ = 32768;
|
const int ICONVCHECKSIZ = 32768;
|
||||||
@ -73,13 +79,7 @@ static int transcodeErrCnt(const char *ptr, int size,
|
|||||||
while(isiz > 0){
|
while(isiz > 0){
|
||||||
osiz = 2*ICONVCHECKSIZ;
|
osiz = 2*ICONVCHECKSIZ;
|
||||||
wp = obuf;
|
wp = obuf;
|
||||||
if(iconv(ic,
|
if(iconv(ic, (ICV_P2_TYPE)&rp, &isiz, &wp, &osiz) == (size_t)-1){
|
||||||
#if defined(_LIBICONV_VERSION)
|
|
||||||
(const char **)&rp,
|
|
||||||
#else
|
|
||||||
(char **)&rp,
|
|
||||||
#endif
|
|
||||||
&isiz, &wp, &osiz) == (size_t)-1){
|
|
||||||
if(errno == EILSEQ || errno == EINVAL){
|
if(errno == EILSEQ || errno == EINVAL){
|
||||||
rp++;
|
rp++;
|
||||||
isiz--;
|
isiz--;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: transcode.cpp,v 1.10 2007-05-30 12:31:19 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: transcode.cpp,v 1.11 2007-06-19 07:52:33 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -32,11 +32,12 @@ using std::string;
|
|||||||
|
|
||||||
#include "transcode.h"
|
#include "transcode.h"
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#if !defined(_LIBICONV_VERSION)
|
#ifdef RCL_ICONV_INBUF_CONST
|
||||||
#define CHARPP (char **)
|
#define ICV_P2_TYPE const char**
|
||||||
#else
|
#else
|
||||||
#define CHARPP
|
#define ICV_P2_TYPE char**
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool transcode(const string &in, string &out, const string &icode,
|
bool transcode(const string &in, string &out, const string &icode,
|
||||||
@ -66,7 +67,7 @@ bool transcode(const string &in, string &out, const string &icode,
|
|||||||
osiz = OBSIZ;
|
osiz = OBSIZ;
|
||||||
int isiz0=isiz;
|
int isiz0=isiz;
|
||||||
|
|
||||||
if(iconv(ic, CHARPP&ip, &isiz, &op, &osiz) == (size_t)-1 &&
|
if(iconv(ic, (ICV_P2_TYPE)&ip, &isiz, &op, &osiz) == (size_t)-1 &&
|
||||||
errno != E2BIG) {
|
errno != E2BIG) {
|
||||||
#if 0
|
#if 0
|
||||||
out.erase();
|
out.erase();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user