ICU-7672 remove deprecated calls in uconv, also fix manpage warnings.

X-SVN-Rev: 28021
This commit is contained in:
Steven R. Loomis 2010-05-05 16:35:39 +00:00
parent cebd9d6b91
commit 1875b3fdbc
2 changed files with 11 additions and 43 deletions

View File

@ -2,7 +2,7 @@
.\"
.\" uconv.1: manual page for the uconv utility.
.\"
.\" Copyright (C) 2000-2005 IBM, Inc. and others.
.\" Copyright (C) 2000-2010 IBM, Inc. and others.
.\"
.\" Manual page by Yves Arrouye <yves@realnames.com>.
.\"
@ -431,12 +431,6 @@ inaccurate or unavailable, in which case
.BR uconv
will report the offset in the output stream at which the error
occured.
.\" .SH FILES
.\" .TP 15
.\" .B @pkgicudatadir@/@PACKAGE@/@VERSION@/uconvmsg.dat
.\" Compiled resource bundle containing localized messages printed
.\" by
.\" .BR uconv .
.SH AUTHORS
Jonas Utterstroem
.br

View File

@ -1,6 +1,6 @@
/*****************************************************************************
*
* Copyright (C) 1999-2009, International Business Machines
* Copyright (C) 1999-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************/
@ -377,56 +377,30 @@ static int printTransliterators(UBool canon)
printf("no transliterators available because of UCONFIG_NO_TRANSLITERATION, see uconfig.h\n");
return 1;
#else
int32_t numtrans = utrans_countAvailableIDs(), i;
int buflen = 512;
char *buf = (char *) uprv_malloc(buflen);
char staticbuf[512];
UErrorCode status = U_ZERO_ERROR;
UEnumeration *ids = utrans_openIDs(&status);
int32_t i, numtrans = uenum_count(ids, &status);
char sepchar = canon ? '\n' : ' ';
if (!buf) {
buf = staticbuf;
buflen = sizeof(staticbuf);
}
for (i = 0; U_SUCCESS(status)&& (i < numtrans); ++i) {
int32_t len;
const char *nextTrans = uenum_next(ids, &len, &status);
for (i = 0; i < numtrans; ++i) {
int32_t len = utrans_getAvailableID(i, buf, buflen);
if (len >= buflen - 1) {
if (buf != staticbuf) {
buflen <<= 1;
if (buflen < len) {
buflen = len + 64;
}
buf = (char *) uprv_realloc(buf, buflen);
if (!buf) {
buf = staticbuf;
buflen = sizeof(staticbuf);
}
}
utrans_getAvailableID(i, buf, buflen);
if (len >= buflen) {
uprv_strcpy(buf + buflen - 4, "..."); /* Truncate the name. */
}
}
printf("%s", buf);
printf("%s", nextTrans);
if (i < numtrans - 1) {
putchar(sepchar);
}
}
uenum_close(ids);
/* Add a terminating newline if needed. */
if (sepchar != '\n') {
putchar('\n');
}
/* Free temporary data. */
if (buf != staticbuf) {
uprv_free(buf);
}
/* Success. */
return 0;