Mac-related fixed for wallet.

This commit is contained in:
rjc%netscape.com 1999-03-27 02:08:17 +00:00
parent 8053580964
commit d4befbdfbe
2 changed files with 40 additions and 9 deletions

View File

@ -1,13 +1,25 @@
#include "xp_mcom.h" //#include "xp_mcom.h"
#define XP_STRSTR strstr
#define XP_STRTOUL strtoul
#include "platform.h"
#include "xp_core.h"
#include "xp_mem.h"
//#include "xp_debug.h"
#include "xp_str.h"
#include "xp_list.h"
#include "prprf.h"
#include <string.h>
#include "xp_file.h" #include "xp_file.h"
#include "plarenas.h" #include "plarenas.h"
#include "jsotypes.h" #include "jsotypes.h"
#include "plstr.h" #include "plstr.h"
#include "seccomon.h" #include "seccomon.h"
#include "xpgetstr.h" #include "xpgetstr.h"
#define PORT_Strlen(s) strlen(s)
#define HTML_DLGS_URL "file:///y|/htmldlgs.html" #define HTML_DLGS_URL "file:///y|/htmldlgs.html"
#define XP_DIALOG_CANCEL_BUTTON (1<<0) #define XP_DIALOG_CANCEL_BUTTON (1<<0)
#define XP_DIALOG_OK_BUTTON (1<<2) #define XP_DIALOG_OK_BUTTON (1<<2)
@ -201,7 +213,12 @@ XP_GetDialogStrings(int stringnum)
header->arena = arena; header->arena = arena;
header->basestringnum = stringnum; header->basestringnum = stringnum;
#ifdef XP_MAC
goto loser;
#else
src = XP_GetString(stringnum); src = XP_GetString(stringnum);
#endif
len = PORT_Strlen(src); len = PORT_Strlen(src);
size = len + 1; size = len + 1;
dst = header->contents = dst = header->contents =

View File

@ -25,7 +25,6 @@
#include "wallet.h" #include "wallet.h"
#include "nsINetService.h" #include "nsINetService.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMHTMLDocument.h" #include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLCollection.h" #include "nsIDOMHTMLCollection.h"
@ -51,6 +50,9 @@ static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID); static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
#include "htmldlgs.h" #include "htmldlgs.h"
#include "prtypes.h"
#include "prlong.h"
#include "prinrval.h"
/***************************************************/ /***************************************************/
/* The following declarations define the data base */ /* The following declarations define the data base */
@ -146,7 +148,7 @@ PRInt64 timings [timing_max];
char timingID [timing_max]; char timingID [timing_max];
PRInt32 timing_index = 0; PRInt32 timing_index = 0;
PRInt64 stopwatch = 0; PRInt64 stopwatch = LL_Zero();
PRInt64 stopwatchBase; PRInt64 stopwatchBase;
PRBool stopwatchRunning = FALSE; PRBool stopwatchRunning = FALSE;
@ -159,7 +161,9 @@ void
wallet_DumpTiming() { wallet_DumpTiming() {
PRInt32 i; PRInt32 i;
for (i=1; i<timing_index; i++) { for (i=1; i<timing_index; i++) {
#ifndef XP_MAC
fprintf(stdout, "time %c = %ld\n", timingID[i], (timings[i] - timings[i-1])/100); fprintf(stdout, "time %c = %ld\n", timingID[i], (timings[i] - timings[i-1])/100);
#endif
if (i%20 == 0) { if (i%20 == 0) {
wallet_Pause(); wallet_Pause();
} }
@ -171,20 +175,24 @@ void
wallet_AddTiming(char c) { wallet_AddTiming(char c) {
if (timing_index<timing_max) { if (timing_index<timing_max) {
timingID[timing_index] = c; timingID[timing_index] = c;
timings[timing_index++] = PR_IntervalNow(); #ifndef XP_MAC
timings[timing_index++] = PR_IntervalNow(); // note: PR_IntervalNow returns a 32 bit value!
#endif
} }
} }
void void
wallet_ClearStopwatch() { wallet_ClearStopwatch() {
stopwatch = 0; stopwatch = LL_Zero();
stopwatchRunning = FALSE; stopwatchRunning = FALSE;
} }
void void
wallet_ResumeStopwatch() { wallet_ResumeStopwatch() {
if (!stopwatchRunning) { if (!stopwatchRunning) {
stopwatchBase = PR_IntervalNow(); #ifndef XP_MAC
stopwatchBase = PR_IntervalNow(); // note: PR_IntervalNow returns a 32 bit value!
#endif
stopwatchRunning = TRUE; stopwatchRunning = TRUE;
} }
} }
@ -192,7 +200,9 @@ wallet_ResumeStopwatch() {
void void
wallet_PauseStopwatch() { wallet_PauseStopwatch() {
if (stopwatchRunning) { if (stopwatchRunning) {
stopwatch += (PR_IntervalNow() - stopwatchBase); #ifndef XP_MAC
stopwatch += (PR_IntervalNow() - stopwatchBase); // note: PR_IntervalNow returns a 32 bit value!
#endif
stopwatchRunning = FALSE; stopwatchRunning = FALSE;
} }
} }
@ -200,10 +210,14 @@ wallet_PauseStopwatch() {
void void
wallet_DumpStopwatch() { wallet_DumpStopwatch() {
if (stopwatchRunning) { if (stopwatchRunning) {
stopwatch += (PR_IntervalNow() - stopwatchBase); #ifndef XP_MAC
stopwatch += (PR_IntervalNow() - stopwatchBase); // note: PR_IntervalNow returns a 32 bit value!
stopwatchBase = PR_IntervalNow(); stopwatchBase = PR_IntervalNow();
#endif
} }
#ifndef XP_MAC
fprintf(stdout, "stopwatch = %ld\n", stopwatch/100); fprintf(stdout, "stopwatch = %ld\n", stopwatch/100);
#endif
} }
#endif /* DEBUG */ #endif /* DEBUG */