Bug 312154, Start script does not take care of running instance on solaris sparc.

benjamin: first-review+
Patch by leon.sha@sun.com
This commit is contained in:
leon.sha%sun.com 2005-12-26 03:10:35 +00:00
Родитель 56783051dc
Коммит 000415a456
2 изменённых файлов: 24 добавлений и 8 удалений

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

@ -80,6 +80,14 @@
#define MOZILLA_PROGRAM_PROP "_MOZILLA_PROGRAM"
#define MOZILLA_COMMANDLINE_PROP "_MOZILLA_COMMANDLINE"
#ifdef IS_BIG_ENDIAN
#define TO_LITTLE_ENDIAN32(x) \
((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
#else
#define TO_LITTLE_ENDIAN32(x) (x)
#endif
#ifdef MOZ_XUL_APP
const unsigned char kRemoteVersion[] = "5.1";
#else
@ -338,7 +346,7 @@ nsGTKRemoteService::HandleCommandLine(char* aBuffer, nsIDOMWindow* aWindow)
// [argc][offsetargv0][offsetargv1...]<workingdir>\0<argv[0]>\0argv[1]...\0
// (offset is from the beginning of the buffer)
PRInt32 argc = *NS_REINTERPRET_CAST(PRInt32*, aBuffer);
PRInt32 argc = TO_LITTLE_ENDIAN32(*NS_REINTERPRET_CAST(PRInt32*, aBuffer));
char *wd = aBuffer + ((argc + 1) * sizeof(PRInt32));
#ifdef DEBUG_bsmedberg
@ -360,7 +368,7 @@ nsGTKRemoteService::HandleCommandLine(char* aBuffer, nsIDOMWindow* aWindow)
PRInt32 *offset = NS_REINTERPRET_CAST(PRInt32*, aBuffer) + 1;
for (int i = 0; i < argc; ++i) {
argv[i] = aBuffer + offset[i];
argv[i] = aBuffer + TO_LITTLE_ENDIAN32(offset[i]);
#ifdef DEBUG_bsmedberg
printf(" argv[%i]:\t%s\n", i, argv[i]);
@ -472,7 +480,7 @@ nsGTKRemoteService::HandlePropertyChange(GtkWidget *aWidget,
return FALSE;
// Failed to get the data off the window or it was the wrong type?
if (!data || !*data)
if (!data || !TO_LITTLE_ENDIAN32(*NS_REINTERPRET_CAST(PRInt32*, data)))
return FALSE;
// cool, we got the property data.
@ -517,7 +525,7 @@ nsGTKRemoteService::HandlePropertyChange(GtkWidget *aWidget,
return FALSE;
// Failed to get the data off the window or it was the wrong type?
if (!data || !*data)
if (!data || !TO_LITTLE_ENDIAN32(*NS_REINTERPRET_CAST(PRInt32*, data)))
return FALSE;
// cool, we got the property data.

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

@ -67,6 +67,14 @@
#define MOZILLA_PROFILE_PROP "_MOZILLA_PROFILE"
#define MOZILLA_PROGRAM_PROP "_MOZILLA_PROGRAM"
#ifdef IS_BIG_ENDIAN
#define TO_LITTLE_ENDIAN32(x) \
((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
#else
#define TO_LITTLE_ENDIAN32(x) (x)
#endif
#ifndef MAX_PATH
#define MAX_PATH 1024
#endif
@ -691,19 +699,19 @@ XRemoteClient::DoSendCommandLine(Window aWindow, PRInt32 argc, char **argv,
if (!buffer)
return NS_ERROR_OUT_OF_MEMORY;
buffer[0] = argc;
buffer[0] = TO_LITTLE_ENDIAN32(argc);
char *bufend = (char*) (buffer + argc + 1);
bufend = estrcpy(cwdbuf, bufend);
for (int i = 0; i < argc; ++i) {
buffer[i + 1] = bufend - ((char*) buffer);
buffer[i + 1] = TO_LITTLE_ENDIAN32(bufend - ((char*) buffer));
bufend = estrcpy(argv[i], bufend);
}
#ifdef DEBUG_bsmedberg
PRInt32 debug_argc = *buffer;
PRInt32 debug_argc = TO_LITTLE_ENDIAN32(*buffer);
char *debug_workingdir = (char*) (buffer + argc + 1);
printf("Sending command line:\n"
@ -715,7 +723,7 @@ XRemoteClient::DoSendCommandLine(Window aWindow, PRInt32 argc, char **argv,
PRInt32 *debug_offset = buffer + 1;
for (int debug_i = 0; debug_i < debug_argc; ++debug_i)
printf(" argv[%i]:\t%s\n", debug_i,
((char*) buffer) + debug_offset[debug_i]);
((char*) buffer) + TO_LITTLE_ENDIAN32(debug_offset[debug_i]));
#endif
XChangeProperty (mDisplay, aWindow, mMozCommandLineAtom, XA_STRING, 8,