Switch to unified view

a/src/utils/transcode.cpp b/src/utils/transcode.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: transcode.cpp,v 1.10 2007-05-30 12:31:19 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: transcode.cpp,v 1.11 2007-06-19 07:52:33 dockes Exp $ (C) 2004 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
30
30
31
#include <iconv.h>
31
#include <iconv.h>
32
32
33
#include "transcode.h"
33
#include "transcode.h"
34
#include "debuglog.h"
34
#include "debuglog.h"
35
#include "autoconfig.h"
35
36
36
#if !defined(_LIBICONV_VERSION)
37
#ifdef RCL_ICONV_INBUF_CONST
37
#define CHARPP (char **)
38
#define ICV_P2_TYPE const char**
38
#else
39
#else
39
#define CHARPP
40
#define ICV_P2_TYPE char**
40
#endif
41
#endif
41
42
42
bool transcode(const string &in, string &out, const string &icode,
43
bool transcode(const string &in, string &out, const string &icode,
43
           const string &ocode, int *ecnt)
44
           const string &ocode, int *ecnt)
44
{
45
{
...
...
64
    size_t osiz;
65
    size_t osiz;
65
    op = obuf;
66
    op = obuf;
66
    osiz = OBSIZ;
67
    osiz = OBSIZ;
67
    int isiz0=isiz;
68
    int isiz0=isiz;
68
69
69
    if(iconv(ic, CHARPP&ip, &isiz, &op, &osiz) == (size_t)-1 && 
70
    if(iconv(ic, (ICV_P2_TYPE)&ip, &isiz, &op, &osiz) == (size_t)-1 && 
70
       errno != E2BIG) {
71
       errno != E2BIG) {
71
#if 0
72
#if 0
72
        out.erase();
73
        out.erase();
73
        out = string("iconv failed for ") + icode + " -> " + ocode +
74
        out = string("iconv failed for ") + icode + " -> " + ocode +
74
        " : " + strerror(errno);
75
        " : " + strerror(errno);