+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'.
+
Fri Jan 5 11:25:42 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (PACKAGE): move $enable_debug down below
+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'.
+
Fri Jan 5 11:25:42 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (PACKAGE): move $enable_debug down below
+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'.
+
Fri Jan 5 11:25:42 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (PACKAGE): move $enable_debug down below
+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'.
+
Fri Jan 5 11:25:42 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (PACKAGE): move $enable_debug down below
+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'.
+
Fri Jan 5 11:25:42 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (PACKAGE): move $enable_debug down below
+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'.
+
Fri Jan 5 11:25:42 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (PACKAGE): move $enable_debug down below
+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'.
+
Fri Jan 5 11:25:42 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (PACKAGE): move $enable_debug down below
+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'.
+
Fri Jan 5 11:25:42 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (PACKAGE): move $enable_debug down below
#ifdef G_OS_WIN32
gint i, clen, total_len, wclen, first;
- const gint len = len < 0 ? strlen (opsysstring) : len;
wchar_t *wcs, wc;
gchar *result, *bp;
const wchar_t *wcp;
+ if (len == -1)
+ len = strlen (opsysstring);
+
wcs = g_new (wchar_t, len);
wclen = MultiByteToWideChar (CP_ACP, 0, opsysstring, len, wcs, len);
#ifdef G_OS_WIN32
gint i, mask, clen, mblen;
- const gint len = len < 0 ? strlen (utf8string) : len;
wchar_t *wcs, *wcp;
gchar *result;
guchar *cp, *end, c;
gint n;
+ if (len == -1)
+ len = strlen (utf8string);
+
/* First convert to wide chars */
cp = (guchar *) utf8string;
end = cp + len;
*/
guint thread_id; /* If non-NULL has a reader thread, or has
* had.*/
+ HANDLE thread_handle;
HANDLE data_avail_event;
HANDLE space_avail_event;
CRITICAL_SECTION mutex;
channel->thread_id = 0;
channel->data_avail_event = NULL;
channel->space_avail_event = NULL;
+ InitializeCriticalSection (&channel->mutex);
}
static void
gchar *msg = g_win32_error_message (GetLastError ());
g_error ("Error creating event: %s", msg);
}
- InitializeCriticalSection (&channel->mutex);
}
static unsigned __stdcall
nbytes = (*channel->reader) (channel->fd, buffer, nbytes);
- if (nbytes <= 0)
- break;
-
LOCK (channel->mutex);
+
if (channel->debug)
g_print ("thread %#x: got %d bytes, rdp=%d, wrp=%d\n",
channel->thread_id, nbytes, channel->rdp, channel->wrp);
+
+ if (nbytes <= 0)
+ break;
+
channel->wrp = (channel->wrp + nbytes) % BUFFER_SIZE;
if (channel->debug)
g_print ("thread %#x: rdp=%d, wrp=%d, setting data available\n",
UNLOCK (channel->mutex);
}
- LOCK (channel->mutex);
channel->running = FALSE;
if (channel->debug)
g_print ("thread %#x: got EOF, rdp=%d, wrp=%d, setting data available\n",
g_io_channel_unref((GIOChannel *) channel);
+#if 0
/* All of the Microsoft docs say we should explicitly
* end the thread...
*/
_endthreadex(1);
-
+#endif
+
+ CloseHandle (channel->thread_handle);
+
return 0;
}
{
channel->reader = reader;
- if (_beginthreadex (NULL, 0, reader_thread, channel, 0,
- &channel->thread_id) == 0)
+#if 0
+ if ((channel->thread_handle =
+ _beginthreadex (NULL, 0, reader_thread, channel, 0,
+ &channel->thread_id)) == 0)
g_warning ("Error creating reader thread: %s", strerror (errno));
+#else
+ if ((channel->thread_handle =
+ CreateThread (NULL, 0, reader_thread, channel, 0,
+ &channel->thread_id)) == 0)
+ {
+ gchar *msg = g_win32_error_message (GetLastError ());
+ g_warning ("Error creating reader thread: %s", msg);
+ g_free (msg);
+ }
+#endif
WaitForSingleObject (channel->space_avail_event, INFINITE);
}
if (channel->debug)
g_print ("waiting for data from thread %#x\n", channel->thread_id);
WaitForSingleObject (channel->data_avail_event, INFINITE);
+ if (channel->debug)
+ g_print ("done waiting for data from thread %#x\n", channel->thread_id);
LOCK (channel->mutex);
if (channel->rdp == channel->wrp && !channel->running)
{
{
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
+ if (win32_channel->debug)
+ g_print ("thread %#x: freeing channel, fd: %d\n",
+ win32_channel->thread_id,
+ win32_channel->fd);
+
if (win32_channel->buffer)
{
CloseHandle (win32_channel->data_avail_event);
{
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
+ if (win32_channel->debug)
+ g_print ("thread %#x: closing fd %d\n",
+ win32_channel->thread_id,
+ win32_channel->fd);
+ LOCK (win32_channel->mutex);
+ if (win32_channel->running)
+ {
+ if (win32_channel->debug)
+ g_print ("thread %#x: running, terminating it\n",
+ win32_channel->thread_id);
+ TerminateThread (win32_channel->thread_handle, 0);
+ if (win32_channel->debug)
+ g_print ("thread %#x: terminated, setting id to 0, closing handle\n",
+ win32_channel->thread_id);
+ win32_channel->thread_id = 0;
+ CloseHandle (win32_channel->thread_handle);
+ win32_channel->running = FALSE;
+ SetEvent (win32_channel->data_avail_event);
+ }
+ UNLOCK (win32_channel->mutex);
+ if (win32_channel->debug)
+ g_print ("closing fd %d\n", win32_channel->fd);
close (win32_channel->fd);
- return;
+ if (win32_channel->debug)
+ g_print ("closed fd %d, setting to -1\n",
+ win32_channel->fd);
+ win32_channel->fd = -1;
}
static int
{
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
+ if (win32_channel->debug)
+ g_print ("thread %#x: closing socket %d\n",
+ win32_channel->thread_id,
+ win32_channel->fd);
closesocket (win32_channel->fd);
+ win32_channel->fd = -1;
}
static int
g_io_channel_win32_poll
g_io_channel_win32_set_debug
g_io_channel_write
+ g_io_create_watch
g_list_alloc
g_list_append
g_list_concat
g_tree_traverse
g_tuples_destroy
g_tuples_index
+ g_ucs4_to_utf16
g_ucs4_to_utf8
g_unichar_break_type
g_unichar_digit_value
g_unicode_canonical_decomposition
g_unicode_canonical_ordering
g_usleep
+ g_utf16_to_ucs4
+ g_utf16_to_utf8
g_utf8_find_next_char
g_utf8_find_prev_char
g_utf8_get_char
g_utf8_strlen
g_utf8_strncpy
g_utf8_to_ucs4
+ g_utf8_to_ucs4_fast
+ g_utf8_to_utf16
g_utf8_validate
g_vsnprintf
g_win32_closedir
#ifdef G_OS_WIN32
gint i, clen, total_len, wclen, first;
- const gint len = len < 0 ? strlen (opsysstring) : len;
wchar_t *wcs, wc;
gchar *result, *bp;
const wchar_t *wcp;
+ if (len == -1)
+ len = strlen (opsysstring);
+
wcs = g_new (wchar_t, len);
wclen = MultiByteToWideChar (CP_ACP, 0, opsysstring, len, wcs, len);
#ifdef G_OS_WIN32
gint i, mask, clen, mblen;
- const gint len = len < 0 ? strlen (utf8string) : len;
wchar_t *wcs, *wcp;
gchar *result;
guchar *cp, *end, c;
gint n;
+ if (len == -1)
+ len = strlen (utf8string);
+
/* First convert to wide chars */
cp = (guchar *) utf8string;
end = cp + len;
*/
guint thread_id; /* If non-NULL has a reader thread, or has
* had.*/
+ HANDLE thread_handle;
HANDLE data_avail_event;
HANDLE space_avail_event;
CRITICAL_SECTION mutex;
channel->thread_id = 0;
channel->data_avail_event = NULL;
channel->space_avail_event = NULL;
+ InitializeCriticalSection (&channel->mutex);
}
static void
gchar *msg = g_win32_error_message (GetLastError ());
g_error ("Error creating event: %s", msg);
}
- InitializeCriticalSection (&channel->mutex);
}
static unsigned __stdcall
nbytes = (*channel->reader) (channel->fd, buffer, nbytes);
- if (nbytes <= 0)
- break;
-
LOCK (channel->mutex);
+
if (channel->debug)
g_print ("thread %#x: got %d bytes, rdp=%d, wrp=%d\n",
channel->thread_id, nbytes, channel->rdp, channel->wrp);
+
+ if (nbytes <= 0)
+ break;
+
channel->wrp = (channel->wrp + nbytes) % BUFFER_SIZE;
if (channel->debug)
g_print ("thread %#x: rdp=%d, wrp=%d, setting data available\n",
UNLOCK (channel->mutex);
}
- LOCK (channel->mutex);
channel->running = FALSE;
if (channel->debug)
g_print ("thread %#x: got EOF, rdp=%d, wrp=%d, setting data available\n",
g_io_channel_unref((GIOChannel *) channel);
+#if 0
/* All of the Microsoft docs say we should explicitly
* end the thread...
*/
_endthreadex(1);
-
+#endif
+
+ CloseHandle (channel->thread_handle);
+
return 0;
}
{
channel->reader = reader;
- if (_beginthreadex (NULL, 0, reader_thread, channel, 0,
- &channel->thread_id) == 0)
+#if 0
+ if ((channel->thread_handle =
+ _beginthreadex (NULL, 0, reader_thread, channel, 0,
+ &channel->thread_id)) == 0)
g_warning ("Error creating reader thread: %s", strerror (errno));
+#else
+ if ((channel->thread_handle =
+ CreateThread (NULL, 0, reader_thread, channel, 0,
+ &channel->thread_id)) == 0)
+ {
+ gchar *msg = g_win32_error_message (GetLastError ());
+ g_warning ("Error creating reader thread: %s", msg);
+ g_free (msg);
+ }
+#endif
WaitForSingleObject (channel->space_avail_event, INFINITE);
}
if (channel->debug)
g_print ("waiting for data from thread %#x\n", channel->thread_id);
WaitForSingleObject (channel->data_avail_event, INFINITE);
+ if (channel->debug)
+ g_print ("done waiting for data from thread %#x\n", channel->thread_id);
LOCK (channel->mutex);
if (channel->rdp == channel->wrp && !channel->running)
{
{
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
+ if (win32_channel->debug)
+ g_print ("thread %#x: freeing channel, fd: %d\n",
+ win32_channel->thread_id,
+ win32_channel->fd);
+
if (win32_channel->buffer)
{
CloseHandle (win32_channel->data_avail_event);
{
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
+ if (win32_channel->debug)
+ g_print ("thread %#x: closing fd %d\n",
+ win32_channel->thread_id,
+ win32_channel->fd);
+ LOCK (win32_channel->mutex);
+ if (win32_channel->running)
+ {
+ if (win32_channel->debug)
+ g_print ("thread %#x: running, terminating it\n",
+ win32_channel->thread_id);
+ TerminateThread (win32_channel->thread_handle, 0);
+ if (win32_channel->debug)
+ g_print ("thread %#x: terminated, setting id to 0, closing handle\n",
+ win32_channel->thread_id);
+ win32_channel->thread_id = 0;
+ CloseHandle (win32_channel->thread_handle);
+ win32_channel->running = FALSE;
+ SetEvent (win32_channel->data_avail_event);
+ }
+ UNLOCK (win32_channel->mutex);
+ if (win32_channel->debug)
+ g_print ("closing fd %d\n", win32_channel->fd);
close (win32_channel->fd);
- return;
+ if (win32_channel->debug)
+ g_print ("closed fd %d, setting to -1\n",
+ win32_channel->fd);
+ win32_channel->fd = -1;
}
static int
{
GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
+ if (win32_channel->debug)
+ g_print ("thread %#x: closing socket %d\n",
+ win32_channel->thread_id,
+ win32_channel->fd);
closesocket (win32_channel->fd);
+ win32_channel->fd = -1;
}
static int
g_io_channel_win32_poll
g_io_channel_win32_set_debug
g_io_channel_write
+ g_io_create_watch
g_list_alloc
g_list_append
g_list_concat
g_tree_traverse
g_tuples_destroy
g_tuples_index
+ g_ucs4_to_utf16
g_ucs4_to_utf8
g_unichar_break_type
g_unichar_digit_value
g_unicode_canonical_decomposition
g_unicode_canonical_ordering
g_usleep
+ g_utf16_to_ucs4
+ g_utf16_to_utf8
g_utf8_find_next_char
g_utf8_find_prev_char
g_utf8_get_char
g_utf8_strlen
g_utf8_strncpy
g_utf8_to_ucs4
+ g_utf8_to_ucs4_fast
+ g_utf8_to_utf16
g_utf8_validate
g_vsnprintf
g_win32_closedir
#include <errno.h>
#include <glib.h>
+#ifdef G_OS_UNIX
#include <unistd.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
+#ifdef G_OS_WIN32
+#include <fcntl.h> /* For _O_BINARY used by pipe() macro */
+#endif
+
#define ITERS 10000
#define INCREMENT 10
#define NTHREADS 4
gio-test.exe \
hash-test.exe \
list-test.exe \
+ mainloop-test.exe\
markup-test.exe \
node-test.exe \
queue-test.exe \
thread-test.exe \
threadpool-test.exe\
tree-test.exe \
- type-test.exe
+ type-test.exe \
+ unicode-encoding.exe
all: $(TESTS)
gio-test.exe \
hash-test.exe \
list-test.exe \
+ mainloop-test.exe\
markup-test.exe \
node-test.exe \
queue-test.exe \
thread-test.exe \
threadpool-test.exe\
tree-test.exe \
- type-test.exe
+ type-test.exe \
+ unicode-encoding.exe
all : $(TESTS)
gint n_chars;
gchar *utf8_result;
- if (!(utf16_expected_tmp = (gunichar2 *)g_convert (utf8, -1, "UTF-16", "UTF-8",
+#ifdef G_OS_WIN32
+#define TARGET "UTF-16LE"
+#else
+#define TARGET "UTF-16"
+#endif
+
+ if (!(utf16_expected_tmp = (gunichar2 *)g_convert (utf8, -1, TARGET, "UTF-8",
NULL, &bytes_written, NULL)))
{
fail ("line %d: could not convert to UTF-16 via g_convert\n", line);
}
else if (utf16_expected_tmp[0] == 0xfffe) /* ANTI-BOM */
{
- fail ("line %d: conversion via iconv to \"UTF-16\" is not native-endian\n");
+ fail ("line %d: conversion via iconv to \"UTF-16\" is not native-endian\n", line);
return;
}
else
if (!srcdir)
srcdir = ".";
- testfile = g_strconcat (srcdir, "/", "utf8.txt", NULL);
+ testfile = g_strconcat (srcdir, G_DIR_SEPARATOR_S "utf8.txt", NULL);
g_file_get_contents (testfile, &contents, NULL, &error);
if (error)
p++;
end = p;
- while (*end && *end != '\n')
+ while (*end && (*end != '\r' && *end != '\n'))
end++;
- if (!*p || *p == '#' || *p == '\n')
+ if (!*p || *p == '#' || *p == '\r' || *p == '\n')
goto next_line;
tmp = g_strstrip (g_strndup (p, end - p));
next_line:
p = end;
+ if (*p && *p == '\r')
+ p++;
if (*p && *p == '\n')
p++;