[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unicodeio.c: accidental extern function: unicode_to_mb
From: |
Bruno Haible |
Subject: |
Re: unicodeio.c: accidental extern function: unicode_to_mb |
Date: |
Wed, 21 Sep 2005 21:30:24 +0200 |
User-agent: |
KMail/1.5 |
Hi Jim,
Jim Meyering wrote:
> Since unicode_to_mb is not declared in any other file
> that I can see, nor is it used elsewhere in gnulib,
> I suspect it really should have file scope.
No. On the contrary. The declaration is missing in unicodeio.h.
I didn't write this function with two callback arguments, just for the case
when used to print to a stdio stream. The function unicode_to_mb is used
in tar-1.13.25. Also it would make no sense to declare fwrite_success_callback()
in unicodeio.h without declaring unicode_to_mb.
Groveling in cvs logs, I can see that tar-1.13.25's unicodeio.h had the
declaration in unicodeio.h. On its way from tar to coreutils, the
declaration was apparently lost. Later, when gnulib was created, the file
came from coreutils.
I have added the missing declaration now.
Bruno
*** unicodeio.h 14 May 2005 06:03:58 -0000 1.7
--- unicodeio.h 21 Sep 2005 19:32:03 -0000
***************
*** 1,6 ****
/* Unicode character output to streams with locale dependent encoding.
! Copyright (C) 2000-2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 1,6 ----
/* Unicode character output to streams with locale dependent encoding.
! Copyright (C) 2000-2003, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 21,26 ****
--- 21,39 ----
# include <stddef.h>
# include <stdio.h>
+
+ /* Converts the Unicode character CODE to its multibyte representation
+ in the current locale and calls the SUCCESS callback on the resulting
+ byte sequence. If an error occurs, invokes the FAILURE callback instead,
+ passing it CODE and an English error string.
+ Returns whatever the callback returned.
+ Assumes that the locale doesn't change between two calls. */
+ extern long unicode_to_mb (unsigned int code,
+ long (*success) (const char *buf, size_t buflen,
+ void *callback_arg),
+ long (*failure) (unsigned int code, const char *msg,
+ void *callback_arg),
+ void *callback_arg);
/* Outputs the Unicode character CODE to the output stream STREAM.
Upon failure, exit if exit_on_error is true, otherwise output a fallback