Commit Graph

10 Commits

Author SHA1 Message Date
Tor Lillqvist
deb68e1592 Get len using strlen() if arg is negative in the Win32 code, too.
2001-01-06  Tor Lillqvist  <tml@iki.fi>

	* gconvert.c (g_locale_to_utf8, g_locale_from_utf8): Get len using
	strlen() if arg is negative in the Win32 code, too.

	* giowin32.c: Changes necessary to be able to run
	mainloop-test. We can't close the fd that our (internal) reader
	thread is sitting doing a blocking read() from. We must terminate
	the thread first. Keep track of thread handle, and close it when
	thread is dying. Start reader thread with the lower-level
	CreateThread() instead of _beginthreadex() from the C runtime, in
	order to be able to use TerminateThread(). Hopefuly this isn't
	harmful.

	* glib.def: Update.

	* tests/makefile.{mingw,msc}.in (TESTS): Add mainloop-test and
	unicode-encoding.

	* tests/mainloop-test.c: Portability: <unistd.h>, need <fcntl.h>
	on Win32.

	* tests/unicode-encoding.c (process): Add missing "line" argument
	to fail(). On Win32, convert UTF-16LE, as libiconv'c ivonf always
	converts to UTF-16BE if we ask for unspecific UTF-16.
	(main) Handle also '\r'.
2001-01-06 03:09:46 +00:00
Owen Taylor
956f00ed96 move $enable_debug down below checks for GCC to avoid setting CFLAGS
Fri Jan  5 11:25:42 2001  Owen Taylor  <otaylor@redhat.com>

	* configure.in (PACKAGE): move $enable_debug down below
	checks for GCC to avoid setting CFLAGS prematurely,
	change checks to avoid adding -g twice.

	* gutf8.c (g_ucs4_to_utf8): Support len < 0 to mean
	0 termination.

	* gutf8.c (g_utf8_to_ucs4): Terminate result with 0.

	* tests/mainloop-test.c (main): Fix uses of
	g_main_loop_destroy().

	* tests/unicode-encoding.c tests/Makefile.am tests/utf8.txt:
	Tests for unicode-conversion code.

	* gconvert.c (g_convert, g_convert_with_fallback): work around
	a couple of GNU libc bugs.

	* gconvert.[ch] (g_{locale,filename}_{to,from}_utf8): Standardize
	arguments to match g_convert(). Document.

	* gunicode.[ch]:
	  - Implement conversion functions to and from UTF-16
	  - Standardize unicode conversion functions on prototype like
	    g_convert.
	  - Add a lot of error checking to unicode conversion functions.

	* gunicode.[ch] (g_utf8_to_ucs4_fast): Add fast, non-checking
	variant of g_utf8_to_ucs4.

	* gutf8.c (g_utf8_validate):
	 - add g_return_if_fail (str != NULL).
	 - add checks for overlong strings, non-valid Unicode characters (>= 110000)
	   and single surrogates.
2001-01-05 21:22:47 +00:00
Havoc Pennington
b0baf3db03 make static
2000-12-13  Havoc Pennington  <hp@redhat.com>

	* gconvert.c (open_converter): make static

	* gutf8.c (g_utf8_validate): Simplify logic a bit, maybe
	speeding it up - now we just return FALSE if we had to bail out
	for any reason before getting to the end of the string, as defined
	by a nul byte if len was -1, defined by the len otherwise. This
	also fixes a bug where nul bytes were not treated as invalid
	when the length was specified.
2000-12-13 23:54:51 +00:00
Tor Lillqvist
50c62ba8a9 Add USE_LIBICONV.
2000-11-13  Tor Lillqvist  <tml@iki.fi>

	* config.h.win32.in: Add USE_LIBICONV.

	* gconvert.c: Check G_OS_WIN32 only after including glib.h.

	* glib.def: Update.
2000-11-13 18:03:57 +00:00
Owen Taylor
292152dae2 Create wrapper functions for iconv() so that we can transparently use the
Sun Nov 12 18:34:32 2000  Owen Taylor  <otaylor@redhat.com>

	* gconvert.[ch]: Create wrapper functions for iconv()
	so that we can transparently use the native iconv,
	libiconv, or (in the future) a mini-iconv included
	with glib.

	* glib-config-2.0.in glib-2.0.pc.in: Include @ICONV_LIBS@

	* INSTALL: Added note about libiconv.

	* configure.in: Add checks for libiconv from pango. If
	EILSEQ is not defined in errno.h add define for it into
	glibconfig.h so g_iconv can use it. (Note, recompiling
	from a system without EILSEQ to a system with EILSEQ
	will break binary compatibility)
2000-11-12 23:44:28 +00:00
Robert Brady
8bda01029f Remove g_filename_{to,from}_utf8
2000-11-12  Robert Brady  <robert@suse.co.uk>

	* gstrfuncs.c, gstrfuncs.h: Remove g_filename_{to,from}_utf8

	* gconvert.c, gconvert.h: Add g_filename_{to,from}_utf8 and
	g_locale_{to.from}_utf8.  The locale_ variant honours
	nl_langinfo(CODESET), the filename_ variant uses UTF-8 unless
	asked otherwise.

	(g_convert): Add G_CONVERT_ERROR_PARTIAL_INPUT error, if bytesread
	!= length and no bytesread pointer passed.
2000-11-12 21:23:55 +00:00
Owen Taylor
1bfc515a37 Change ERROR_OTHER to ERROR_FAILED, add some dummy marking with _().
Mon Sep 11 10:03:24 2000  Owen Taylor  <otaylor@redhat.com>

	* glib.h convert.c (g_convert_with_fallback): Change
	ERROR_OTHER to ERROR_FAILED, add some dummy marking with _().

	* docs/reference/glib/glib-sections.txt
	docs/reference/glib/glib-docs.sgml Update for g_convert,
	g_unicode_validate.
2000-10-19 15:21:04 +00:00
Havoc Pennington
349eaa6a25 fix indentation (GConvertError): generic error is conventionally called
2000-09-28  Havoc Pennington  <hp@pobox.com>

* glib.h (GThreadPriority): fix indentation
(GConvertError): generic error is conventionally called
_FAILED rather than _OTHER, at least at the moment,
according to GError docs in docs/reference.

* gconvert.c: s/_OTHER/_FAILED/
2000-09-29 02:56:43 +00:00
Elliot Lee
86ce799cdf Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com> Define g_alloca() as an
Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com>
	* glib.h configure.in: Define g_alloca() as an alloca-that-works-anywhere.
	* gconvert.c: Fix warnings which could have caused problems on 64-bit platforms.
2000-09-17 22:18:48 +00:00
Owen Taylor
a212f93df2 Havoc Pennington's implementation of convenient character set conversion
Sun Sep 10 12:37:40 2000  Owen Taylor  <otaylor@redhat.com>

	* glib.h gconvert.c (g_convert): Havoc Pennington's implementation
	of convenient character set conversion using iconv, with
	the addition of GError. We probably need a fallback that
	just does conversions between, say UTF-8,16,32 and ISO-8859-1
	for targets without iconv at all.

	Also add g_convert_with_fallback() to take care of conversions
	where we accept some loss going to the target encoding.
2000-09-11 03:03:18 +00:00