From af643aef5908f54f0f66485fb9f6ee461a776735 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 15:58:00 +0000 Subject: [PATCH] Work around broken mbstowcs() implementation on Cygwin. (Lode Leroy) (Logical change 1.266) --- libntfs/unistr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 0b9e12c3..2054a8b4 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -1,7 +1,7 @@ /* * unistr.c - Unicode string handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -454,6 +454,11 @@ int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len) ins_len = mbsrtowcs(NULL, (const char **)&s, 0, &mbstate); #else ins_len = mbstowcs(NULL, s, 0); +#endif +#ifdef __CYGWIN32__ + /* Eeek!!! Cygwin has broken mbstowcs() implementation!!! */ + if (!ins_len) + ins_len = strlen(ins); #endif if (ins_len == -1) return ins_len;