Skip to content

Commit 09f0582

Browse files
committed
Remove function iconv_open_into
修改: include/cppp/reiconv.hpp.in 修改: lib/iconv.cpp
1 parent 04a3e58 commit 09f0582

File tree

2 files changed

+5
-90
lines changed

2 files changed

+5
-90
lines changed

include/cppp/reiconv.hpp.in

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,24 @@ extern "C++"
3333
{
3434
extern @DLL_VARIABLE@ int reiconv_version; /* Likewise */
3535

36-
/* Define iconv_t ourselves. */
3736
#undef iconv_t
37+
/* Define iconv_t ourselves. */
3838
typedef void* iconv_t;
3939

40+
#undef iconv_open
4041
/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
4142
encoding ‘tocode’. */
4243
extern @DLL_VARIABLE@ iconv_t iconv_open (const char* tocode, const char* fromcode);
4344

45+
#undef iconv
4446
/* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes
4547
starting at ‘*inbuf’, writing at most ‘*outbytesleft’ bytes starting at
4648
‘*outbuf’.
4749
Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount.
4850
Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */
4951
extern @DLL_VARIABLE@ size_t iconv (iconv_t cd, char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
5052

53+
#undef iconv_close
5154
/* Frees resources allocated for conversion descriptor ‘cd’. */
5255
extern @DLL_VARIABLE@ int iconv_close (iconv_t cd);
5356

@@ -59,12 +62,6 @@ extern "C++"
5962
mbstate_t dummy2;
6063
} iconv_allocation_t;
6164

62-
/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
63-
encoding ‘tocode’ into preallocated memory. Returns an error indicator
64-
(0 or -1 with errno set). */
65-
extern @DLL_VARIABLE@ int iconv_open_into (const char* tocode, const char* fromcode,
66-
iconv_allocation_t* resultp);
67-
6865
/* Control of attributes. */
6966
extern @DLL_VARIABLE@ int iconvctl (iconv_t cd, int request, void* argument);
7067

@@ -159,10 +156,6 @@ extern "C++"
159156
void* data),
160157
void* data);
161158

162-
/* Canonicalize an encoding name.
163-
The result is either a canonical encoding name, or name itself. */
164-
extern @DLL_VARIABLE@ const char * iconv_canonicalize (const char * name);
165-
166159
/*
167160
* This C function converts an entire string from one encoding to another,
168161
* using iconv. Easier to use than iconv() itself, and supports autodetect

lib/iconv.cpp

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -281,30 +281,6 @@ namespace cppp{namespace base{namespace reiconv
281281
typedef int verify_size_1[2 * (sizeof (struct conv_struct) <= sizeof (iconv_allocation_t)) - 1];
282282
typedef int verify_size_2[2 * (sizeof (struct wchar_conv_struct) <= sizeof (iconv_allocation_t)) - 1];
283283

284-
int iconv_open_into (const char* tocode, const char* fromcode,
285-
iconv_allocation_t* resultp)
286-
{
287-
struct conv_struct * cd;
288-
unsigned int from_index;
289-
int from_wchar;
290-
unsigned int from_surface;
291-
unsigned int to_index;
292-
int to_wchar;
293-
unsigned int to_surface;
294-
int discard_ilseq;
295-
296-
#include "iconv_open1.h"
297-
298-
cd = (struct conv_struct *) resultp;
299-
300-
#include "iconv_open2.h"
301-
302-
return 0;
303-
invalid:
304-
errno = EINVAL;
305-
return -1;
306-
}
307-
308284
/* Bit mask of all valid surfaces. */
309285
#define ALL_SURFACES (ICONV_SURFACE_EBCDIC_ZOS_UNIX)
310286

@@ -510,61 +486,7 @@ namespace cppp{namespace base{namespace reiconv
510486
# include "canonical_local.h"
511487
#endif
512488
};
513-
514-
const char * iconv_canonicalize (const char * name)
515-
{
516-
const char* code;
517-
char buf[MAX_WORD_LENGTH+10+1];
518-
const char* cp;
519-
char* bp;
520-
const struct alias * ap;
521-
unsigned int count;
522-
unsigned int index;
523-
const char* pool;
524-
525-
/* Before calling aliases_lookup, convert the input string to upper case,
526-
* and check whether it's entirely ASCII (we call gperf with option "-7"
527-
* to achieve a smaller table) and non-empty. If it's not entirely ASCII,
528-
* or if it's too long, it is not a valid encoding name.
529-
*/
530-
for (code = name;;) {
531-
/* Search code in the table. */
532-
for (cp = code, bp = buf, count = MAX_WORD_LENGTH+10+1; ; cp++, bp++) {
533-
unsigned char c = (unsigned char) *cp;
534-
if (c >= 0x80)
535-
goto invalid;
536-
if (c >= 'a' && c <= 'z')
537-
c -= 'a'-'A';
538-
*bp = c;
539-
if (c == '\0')
540-
break;
541-
if (--count == 0)
542-
goto invalid;
543-
}
544-
for (;;) {
545-
if (bp-buf >= 8 && memcmp(bp-8,"//IGNORE",8)==0) {
546-
bp -= 8;
547-
*bp = '\0';
548-
continue;
549-
}
550-
break;
551-
}
552-
pool = stringpool;
553-
ap = aliases_lookup(buf,bp-buf);
554-
if (ap == NULL) {
555-
pool = stringpool2;
556-
ap = aliases2_lookup(buf);
557-
if (ap == NULL)
558-
goto invalid;
559-
}
560-
index = ap->encoding_index;
561-
break;
562-
}
563-
return all_canonical[index] + pool;
564-
invalid:
565-
return name;
566-
}
567-
489+
568490
/* version number: (major<<8) + minor */
569491
int reiconv_version = (3 << 8) + 0;
570492

0 commit comments

Comments
 (0)