Fix broken method in NSDateFormatter class.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32023 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Stefan Bidigaray 2011-02-10 01:52:16 +00:00
parent a0b3425130
commit ac4a764b44
5 changed files with 2835 additions and 16605 deletions

View file

@ -1,3 +1,11 @@
2011-02-09 Stefan Bidigaray <stefanbidi@gmail.com>
* configure:
* configure.ac:
* Headers/Additions/GNUstepBase/config.h.in:
* Source/NSDateFormatter.m: ([-dateFormatFromTemplate:options:locale:])
Fix completely broken method using unicode/udatpg.h.
2011-02-07 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSLocale.m: Fix canonical identifiers to return the input

View file

@ -624,6 +624,9 @@
/* Define to 1 if you have the <unicode/udat.h> header file. */
#undef HAVE_UNICODE_UDAT_H
/* Define to 1 if you have the <unicode/udatpg.h> header file. */
#undef HAVE_UNICODE_UDATPG_H
/* Define to 1 if you have the <unicode/uregex.h> header file. */
#undef HAVE_UNICODE_UREGEX_H

View file

@ -40,6 +40,9 @@
#if defined(HAVE_UNICODE_UDAT_H)
#include <unicode/udat.h>
#endif
#if defined(HAVE_UNICODE_UDATPG_H)
#include <unicode/udatpg.h>
#endif
@ -880,14 +883,34 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
options: (NSUInteger) opts
locale: (NSLocale *) locale
{
NSString *result;
NSDateFormatter *fmt = [[self alloc] init];
#if GS_USE_ICU == 1
unichar pat[BUFFER_SIZE];
unichar skel[BUFFER_SIZE];
int32_t patLen;
int32_t skelLen;
UDateTimePatternGenerator *datpg;
UErrorCode err = U_ZERO_ERROR;
[fmt setLocale: locale];
result = [fmt dateFormat];
RELEASE(fmt);
datpg = udatpg_open ([[locale localeIdentifier] UTF8String], &err);
if (U_FAILURE(err))
return nil;
return result;
if ((patLen = [template length]) > BUFFER_SIZE)
patLen = BUFFER_SIZE;
[template getCharacters: pat range: NSMakeRange(0, patLen)];
skelLen = udatpg_getSkeleton (datpg, pat, patLen, skel, BUFFER_SIZE, &err);
if (U_FAILURE(err))
return nil;
patLen =
udatpg_getBestPattern (datpg, skel, skelLen, pat, BUFFER_SIZE, &err);
udatpg_close (datpg);
return [NSString stringWithCharacters: pat length: patLen];
#else
return nil;
#endif
}
- (BOOL) doesRelativeDateFormatting

19392
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -2690,7 +2690,7 @@ if test $enable_icu = yes; then
AC_CHECK_ICU(4.0, have_icu=yes, have_icu=no)
if test "$have_icu" = "yes"; then
AC_MSG_RESULT(yes)
AC_CHECK_HEADERS(unicode/uloc.h unicode/ulocdata.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h unicode/unum.h unicode/udat.h)
AC_CHECK_HEADERS(unicode/uloc.h unicode/ulocdata.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h unicode/unum.h unicode/udat.h unicode/udatpg.h)
LIBS="$LIBS $ICU_LIBS"
LDFLAGS="$LDFLAGS $ICU_LDFLAGS"
HAVE_ICU=1