/*
********************************************************************************
-* Copyright (C) 2005-2006, International Business Machines
+* Copyright (C) 2005-2009, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
#include "cmemory.h"
#include "uresimp.h"
#include "windtfmt.h"
-#include "wintz.h"
+#include "wintzimpl.h"
# define WIN32_LEAN_AND_MEAN
# define VC_EXTRALEAN
#define STACK_BUFFER_SIZE 64
-UnicodeString *getTimeDateFormat(const Calendar *cal, const Locale *locale, UErrorCode &status)
+UnicodeString* Win32DateFormat::getTimeDateFormat(const Calendar *cal, const Locale *locale, UErrorCode &status) const
{
UnicodeString *result = NULL;
const char *type = cal->getType();
}
if (U_FAILURE(status)) {
- UChar defaultPattern[] = {0x007B, 0x0031, 0x007D, 0x0020, 0x007B, 0x0030, 0x007D, 0x0000}; // "{1} {0}"
+ static const UChar defaultPattern[] = {0x007B, 0x0031, 0x007D, 0x0020, 0x007B, 0x0030, 0x007D, 0x0000}; // "{1} {0}"
return new UnicodeString(defaultPattern, ARRAY_SIZE(defaultPattern));
}
int32_t resStrLen = 0;
- const UChar *resStr = ures_getStringByIndex(patBundle, (int32_t)DateFormat::kDateTime, &resStrLen, &status);
+ int32_t glueIndex = DateFormat::kDateTime;
+ int32_t patSize = ures_getSize(patBundle);
+ if (patSize >= (DateFormat::kDateTimeOffset + DateFormat::kShort + 1)) {
+ // Get proper date time format
+ glueIndex = (int32_t)(DateFormat::kDateTimeOffset + (fDateStyle - DateFormat::kDateOffset));
+ }
+ const UChar *resStr = ures_getStringByIndex(patBundle, glueIndex, &resStrLen, &status);
result = new UnicodeString(TRUE, resStr, resStrLen);