Bug 338732 - Make nsIDateTimeFormat header frozen-linkage friendly (use nsAString instead of nsString), r=smontagu

This commit is contained in:
benjamin%smedbergs.us 2006-05-22 13:20:59 +00:00
Родитель cdd0652bc4
Коммит 20c55e3005
7 изменённых файлов: 33 добавлений и 32 удалений

Просмотреть файл

@ -42,7 +42,7 @@
#include "nsISupports.h"
#include "nscore.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsILocale.h"
#include "nsIScriptableDateFormat.h"
#include "prtime.h"
@ -67,28 +67,28 @@ public:
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const time_t timetTime,
nsString& stringOut) = 0;
nsAString& stringOut) = 0;
// performs a locale sensitive date formatting operation on the struct tm parameter
NS_IMETHOD FormatTMTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const struct tm* tmTime,
nsString& stringOut) = 0;
nsAString& stringOut) = 0;
// performs a locale sensitive date formatting operation on the PRTime parameter
NS_IMETHOD FormatPRTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRTime prTime,
nsString& stringOut) = 0;
nsAString& stringOut) = 0;
// performs a locale sensitive date formatting operation on the PRExplodedTime parameter
NS_IMETHOD FormatPRExplodedTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRExplodedTime* explodedTime,
nsString& stringOut) = 0;
nsAString& stringOut) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDateTimeFormat, NS_IDATETIMEFORMAT_IID)

Просмотреть файл

@ -321,7 +321,7 @@ nsresult nsDateTimeFormatMac::FormatTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const time_t timetTime,
nsString& stringOut)
nsAString& stringOut)
{
return FormatTMTime(locale, dateFormatSelector, timeFormatSelector, localtime(&timetTime), stringOut);
}
@ -340,7 +340,7 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const struct tm* tmTime,
nsString& stringOut)
nsAString& stringOut)
{
DateTimeRec macDateTime;
Str255 timeString, dateString;
@ -352,11 +352,12 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
// return, nothing to format
if (dateFormatSelector == kDateFormatNone && timeFormatSelector == kTimeFormatNone) {
stringOut.SetLength(0);
stringOut.Truncate();
return NS_OK;
}
stringOut.AssignWithConversion(asctime(tmTime)); // set the default string, in case for API/conversion errors
// set the default string, in case for API/conversion errors
CopyASCIItoUTF16(nsDependentCString(asctime(tmTime)), stringOut);
// convert struct tm to input format of mac toolbox call
NS_ASSERTION(tmTime->tm_mon >= 0, "tm is not set correctly");
@ -458,7 +459,7 @@ nsresult nsDateTimeFormatMac::FormatPRTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRTime prTime,
nsString& stringOut)
nsAString& stringOut)
{
PRExplodedTime explodedTime;
PR_ExplodeTime(prTime, PR_LocalTimeParameters, &explodedTime);
@ -471,7 +472,7 @@ nsresult nsDateTimeFormatMac::FormatPRExplodedTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRExplodedTime* explodedTime,
nsString& stringOut)
nsAString& stringOut)
{
struct tm tmTime;
memset( &tmTime, 0, sizeof(tmTime) );

Просмотреть файл

@ -55,27 +55,27 @@ public:
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const time_t timetTime,
nsString& stringOut);
nsAString& stringOut);
// performs a locale sensitive date formatting operation on the struct tm parameter
NS_IMETHOD FormatTMTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const struct tm* tmTime,
nsString& stringOut);
nsAString& stringOut);
// performs a locale sensitive date formatting operation on the PRTime parameter
NS_IMETHOD FormatPRTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRTime prTime,
nsString& stringOut);
nsAString& stringOut);
// performs a locale sensitive date formatting operation on the PRExplodedTime parameter
NS_IMETHOD FormatPRExplodedTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRExplodedTime* explodedTime,
nsString& stringOut);
nsAString& stringOut);
nsDateTimeFormatMac() {}

Просмотреть файл

@ -170,7 +170,7 @@ nsresult nsDateTimeFormatUnix::FormatTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const time_t timetTime,
nsString& stringOut)
nsAString& stringOut)
{
struct tm tmTime;
memcpy(&tmTime, localtime(&timetTime), sizeof(struct tm));
@ -182,7 +182,7 @@ nsresult nsDateTimeFormatUnix::FormatTMTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const struct tm* tmTime,
nsString& stringOut)
nsAString& stringOut)
{
#define NSDATETIME_FORMAT_BUFFER_LEN 80
char strOut[NSDATETIME_FORMAT_BUFFER_LEN*2]; // buffer for date and time
@ -275,7 +275,7 @@ nsresult nsDateTimeFormatUnix::FormatPRTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRTime prTime,
nsString& stringOut)
nsAString& stringOut)
{
PRExplodedTime explodedTime;
PR_ExplodeTime(prTime, PR_LocalTimeParameters, &explodedTime);
@ -288,7 +288,7 @@ nsresult nsDateTimeFormatUnix::FormatPRExplodedTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRExplodedTime* explodedTime,
nsString& stringOut)
nsAString& stringOut)
{
struct tm tmTime;
/* be safe and set all members of struct tm to zero

Просмотреть файл

@ -56,28 +56,28 @@ public:
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const time_t timetTime,
nsString& stringOut);
nsAString& stringOut);
// performs a locale sensitive date formatting operation on the struct tm parameter
NS_IMETHOD FormatTMTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const struct tm* tmTime,
nsString& stringOut);
nsAString& stringOut);
// performs a locale sensitive date formatting operation on the PRTime parameter
NS_IMETHOD FormatPRTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRTime prTime,
nsString& stringOut);
nsAString& stringOut);
// performs a locale sensitive date formatting operation on the PRExplodedTime parameter
NS_IMETHOD FormatPRExplodedTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRExplodedTime* explodedTime,
nsString& stringOut);
nsAString& stringOut);
nsDateTimeFormatUnix() {mLocale.Truncate();mAppLocale.Truncate();}

Просмотреть файл

@ -128,7 +128,7 @@ nsresult nsDateTimeFormatWin::FormatTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const time_t timetTime,
nsString& stringOut)
nsAString& stringOut)
{
return FormatTMTime(locale, dateFormatSelector, timeFormatSelector, localtime( &timetTime ), stringOut);
}
@ -138,7 +138,7 @@ nsresult nsDateTimeFormatWin::FormatTMTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const struct tm* tmTime,
nsString& stringOut)
nsAString& stringOut)
{
SYSTEMTIME system_time;
DWORD dwFlags_Date = 0, dwFlags_Time = 0;
@ -228,7 +228,7 @@ nsresult nsDateTimeFormatWin::FormatTMTime(nsILocale* locale,
NS_ASSERTION(NSDATETIMEFORMAT_BUFFER_LEN >= (PRUint32) (timeLen + 1), "internal time buffer is not large enough");
// Copy the result
stringOut.SetLength(0);
stringOut.Truncate();
if (dateLen != 0 && timeLen != 0) {
stringOut.Assign(dateBuffer, dateLen);
stringOut.Append((PRUnichar *)(L" "), 1);
@ -249,7 +249,7 @@ nsresult nsDateTimeFormatWin::FormatPRTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRTime prTime,
nsString& stringOut)
nsAString& stringOut)
{
PRExplodedTime explodedTime;
PR_ExplodeTime(prTime, PR_LocalTimeParameters, &explodedTime);
@ -262,7 +262,7 @@ nsresult nsDateTimeFormatWin::FormatPRExplodedTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRExplodedTime* explodedTime,
nsString& stringOut)
nsAString& stringOut)
{
struct tm tmTime;
memset( &tmTime, 0, sizeof(tmTime) );

Просмотреть файл

@ -56,28 +56,28 @@ public:
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const time_t timetTime,
nsString& stringOut);
nsAString& stringOut);
// performs a locale sensitive date formatting operation on the struct tm parameter
NS_IMETHOD FormatTMTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const struct tm* tmTime,
nsString& stringOut);
nsAString& stringOut);
// performs a locale sensitive date formatting operation on the PRTime parameter
NS_IMETHOD FormatPRTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRTime prTime,
nsString& stringOut);
nsAString& stringOut);
// performs a locale sensitive date formatting operation on the PRExplodedTime parameter
NS_IMETHOD FormatPRExplodedTime(nsILocale* locale,
const nsDateFormatSelector dateFormatSelector,
const nsTimeFormatSelector timeFormatSelector,
const PRExplodedTime* explodedTime,
nsString& stringOut);
nsAString& stringOut);
nsDateTimeFormatWin() {mLocale.SetLength(0);mAppLocale.SetLength(0);}