зеркало из https://github.com/mozilla/pjs.git
Part of Messenger Mac landing
This commit is contained in:
Родитель
a0ce53652e
Коммит
55d7f55ccf
|
@ -34,12 +34,13 @@
|
||||||
#ifdef MORK_OBSOLETE
|
#ifdef MORK_OBSOLETE
|
||||||
|
|
||||||
#include <Types.h>
|
#include <Types.h>
|
||||||
|
#include "plstr.h"
|
||||||
|
|
||||||
static void // copied almost verbatim from the IronDoc debugger sources:
|
static void // copied almost verbatim from the IronDoc debugger sources:
|
||||||
mork_mac_break_string(register const char* inMessage) /*i*/
|
mork_mac_break_string(register const char* inMessage) /*i*/
|
||||||
{
|
{
|
||||||
Str255 pascalStr; // to hold Pascal string version of inMessage
|
Str255 pascalStr; // to hold Pascal string version of inMessage
|
||||||
mork_u4 length = XP_STRLEN(inMessage);
|
mork_u4 length = PL_strlen(inMessage);
|
||||||
|
|
||||||
// if longer than maximum 255 bytes, just copy 255 bytes worth
|
// if longer than maximum 255 bytes, just copy 255 bytes worth
|
||||||
pascalStr[ 0 ] = (length > 255)? 255 : length;
|
pascalStr[ 0 ] = (length > 255)? 255 : length;
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
|
|
||||||
// { %%%%% begin platform defs peculiar to Mork %%%%%
|
// { %%%%% begin platform defs peculiar to Mork %%%%%
|
||||||
#ifdef XP_MAC
|
#ifdef XP_MAC
|
||||||
#define MORK_OBSOLETE 1
|
|
||||||
#define MORK_MAC 1
|
#define MORK_MAC 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -74,7 +73,6 @@
|
||||||
#ifdef MORK_OBSOLETE
|
#ifdef MORK_OBSOLETE
|
||||||
#include "xp_file.h"
|
#include "xp_file.h"
|
||||||
#include "ctype.h"
|
#include "ctype.h"
|
||||||
|
|
||||||
#define MORK_ISPRINT(c) isprint(c)
|
#define MORK_ISPRINT(c) isprint(c)
|
||||||
|
|
||||||
#define MORK_FILETELL(file) XP_FileTell(file)
|
#define MORK_FILETELL(file) XP_FileTell(file)
|
||||||
|
|
|
@ -34,12 +34,13 @@
|
||||||
#ifdef MORK_OBSOLETE
|
#ifdef MORK_OBSOLETE
|
||||||
|
|
||||||
#include <Types.h>
|
#include <Types.h>
|
||||||
|
#include "plstr.h"
|
||||||
|
|
||||||
static void // copied almost verbatim from the IronDoc debugger sources:
|
static void // copied almost verbatim from the IronDoc debugger sources:
|
||||||
mork_mac_break_string(register const char* inMessage) /*i*/
|
mork_mac_break_string(register const char* inMessage) /*i*/
|
||||||
{
|
{
|
||||||
Str255 pascalStr; // to hold Pascal string version of inMessage
|
Str255 pascalStr; // to hold Pascal string version of inMessage
|
||||||
mork_u4 length = XP_STRLEN(inMessage);
|
mork_u4 length = PL_strlen(inMessage);
|
||||||
|
|
||||||
// if longer than maximum 255 bytes, just copy 255 bytes worth
|
// if longer than maximum 255 bytes, just copy 255 bytes worth
|
||||||
pascalStr[ 0 ] = (length > 255)? 255 : length;
|
pascalStr[ 0 ] = (length > 255)? 255 : length;
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
|
|
||||||
// { %%%%% begin platform defs peculiar to Mork %%%%%
|
// { %%%%% begin platform defs peculiar to Mork %%%%%
|
||||||
#ifdef XP_MAC
|
#ifdef XP_MAC
|
||||||
#define MORK_OBSOLETE 1
|
|
||||||
#define MORK_MAC 1
|
#define MORK_MAC 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -74,7 +73,6 @@
|
||||||
#ifdef MORK_OBSOLETE
|
#ifdef MORK_OBSOLETE
|
||||||
#include "xp_file.h"
|
#include "xp_file.h"
|
||||||
#include "ctype.h"
|
#include "ctype.h"
|
||||||
|
|
||||||
#define MORK_ISPRINT(c) isprint(c)
|
#define MORK_ISPRINT(c) isprint(c)
|
||||||
|
|
||||||
#define MORK_FILETELL(file) XP_FileTell(file)
|
#define MORK_FILETELL(file) XP_FileTell(file)
|
||||||
|
|
|
@ -236,9 +236,12 @@ protected:
|
||||||
static int FindInCache(nsMsgDatabase* pMessageDB);
|
static int FindInCache(nsMsgDatabase* pMessageDB);
|
||||||
PRBool MatchDbName(nsFileSpec &dbName); // returns TRUE if they match
|
PRBool MatchDbName(nsFileSpec &dbName); // returns TRUE if they match
|
||||||
|
|
||||||
#ifdef XP_PC // this should go away when we can provide our own file stream to MDB/Mork
|
#if defined(XP_PC) || defined(XP_MAC) // this should go away when we can provide our own file stream to MDB/Mork
|
||||||
static void UnixToNative(char*& ioPath);
|
static void UnixToNative(char*& ioPath);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(XP_MAC)
|
||||||
|
static void NativeToUnix(char*& ioPath);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Flag handling routines
|
// Flag handling routines
|
||||||
virtual nsresult SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag,
|
virtual nsresult SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag,
|
||||||
|
|
|
@ -74,7 +74,7 @@ nsMailDatabase::~nsMailDatabase()
|
||||||
|
|
||||||
char *nativeFolderName = nsCRT::strdup((const char *) folderName);
|
char *nativeFolderName = nsCRT::strdup((const char *) folderName);
|
||||||
|
|
||||||
#ifdef XP_PC
|
#if defined(XP_PC) || defined(XP_MAC)
|
||||||
UnixToNative(nativeFolderName);
|
UnixToNative(nativeFolderName);
|
||||||
#endif
|
#endif
|
||||||
stat (nativeFolderName, &st);
|
stat (nativeFolderName, &st);
|
||||||
|
@ -221,6 +221,7 @@ void nsMailDatabase::UpdateFolderFlag(nsIMessage *mailHdr, PRBool bSet,
|
||||||
nsIOFileStream *fileStream = (m_folderStream) ? m_folderStream : *ppFileStream;
|
nsIOFileStream *fileStream = (m_folderStream) ? m_folderStream : *ppFileStream;
|
||||||
//#ifdef GET_FILE_STUFF_TOGETHER
|
//#ifdef GET_FILE_STUFF_TOGETHER
|
||||||
#ifdef XP_MAC
|
#ifdef XP_MAC
|
||||||
|
/* ducarroz: Do we still need this ??
|
||||||
// This is a horrible hack and we should make sure we don't need it anymore.
|
// This is a horrible hack and we should make sure we don't need it anymore.
|
||||||
// It has to do with multiple people having the same file open, I believe, but the
|
// It has to do with multiple people having the same file open, I believe, but the
|
||||||
// mac file system only has one handle, and they compete for the file position.
|
// mac file system only has one handle, and they compete for the file position.
|
||||||
|
@ -231,6 +232,7 @@ void nsMailDatabase::UpdateFolderFlag(nsIMessage *mailHdr, PRBool bSet,
|
||||||
fid = gIncorporateFID;
|
fid = gIncorporateFID;
|
||||||
savedPosition = ftell(gIncorporateFID); // so we can restore it.
|
savedPosition = ftell(gIncorporateFID); // so we can restore it.
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
#endif // XP_MAC
|
#endif // XP_MAC
|
||||||
PRUint32 offset;
|
PRUint32 offset;
|
||||||
(void)mailHdr->GetStatusOffset(&offset);
|
(void)mailHdr->GetStatusOffset(&offset);
|
||||||
|
@ -313,9 +315,11 @@ void nsMailDatabase::UpdateFolderFlag(nsIMessage *mailHdr, PRBool bSet,
|
||||||
SetReparse(TRUE);
|
SetReparse(TRUE);
|
||||||
}
|
}
|
||||||
#ifdef XP_MAC
|
#ifdef XP_MAC
|
||||||
|
/* ducarroz: Do we still need this ??
|
||||||
// Restore the file position
|
// Restore the file position
|
||||||
if (savedPosition >= 0)
|
if (savedPosition >= 0)
|
||||||
XP_FileSeek(fid, savedPosition, SEEK_SET);
|
XP_FileSeek(fid, savedPosition, SEEK_SET);
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -327,7 +331,7 @@ void nsMailDatabase::UpdateFolderFlag(nsIMessage *mailHdr, PRBool bSet,
|
||||||
}
|
}
|
||||||
//#endif // GET_FILE_STUFF_TOGETHER
|
//#endif // GET_FILE_STUFF_TOGETHER
|
||||||
#ifdef XP_MAC
|
#ifdef XP_MAC
|
||||||
if (!m_folderStream && fid != gIncorporateFID)
|
if (!m_folderStream /*&& fid != gIncorporateFID*/) /* ducarroz: Do we still need this ?? */
|
||||||
#else
|
#else
|
||||||
if (!m_folderStream)
|
if (!m_folderStream)
|
||||||
#endif
|
#endif
|
||||||
|
@ -339,7 +343,7 @@ void nsMailDatabase::UpdateFolderFlag(nsIMessage *mailHdr, PRBool bSet,
|
||||||
nsresult ret = NS_OK;
|
nsresult ret = NS_OK;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *nativeFileName = nsCRT::strdup(m_folderName);
|
char *nativeFileName = nsCRT::strdup(m_folderName);
|
||||||
#ifdef XP_PC
|
#if defined(XP_PC) || defined(XP_MAC)
|
||||||
UnixToNative(nativeFileName);
|
UnixToNative(nativeFileName);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -435,7 +439,7 @@ nsresult nsMailDatabase::SetFolderInfoValid(nsFileSpec &folderName, int num, int
|
||||||
nsresult err;
|
nsresult err;
|
||||||
|
|
||||||
char *nativeFileName = nsCRT::strdup(folderName);
|
char *nativeFileName = nsCRT::strdup(folderName);
|
||||||
#ifdef XP_PC
|
#if defined(XP_PC) || defined(XP_MAC)
|
||||||
UnixToNative(nativeFileName);
|
UnixToNative(nativeFileName);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,12 @@
|
||||||
#include "nsILocale.h"
|
#include "nsILocale.h"
|
||||||
#include "nsLocaleCID.h"
|
#include "nsLocaleCID.h"
|
||||||
#include "nsILocaleFactory.h"
|
#include "nsILocaleFactory.h"
|
||||||
|
|
||||||
|
#if defined(XP_MAC) && defined(CompareString)
|
||||||
|
#undef CompareString
|
||||||
|
#endif
|
||||||
#include "nsICollation.h"
|
#include "nsICollation.h"
|
||||||
|
|
||||||
#include "nsCollationCID.h"
|
#include "nsCollationCID.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPref.h"
|
||||||
|
|
||||||
|
@ -436,8 +441,71 @@ void nsMsgDatabase::UnixToNative(char*& ioPath)
|
||||||
*cp = *(cp + 1);
|
*cp = *(cp + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* XP_PC */
|
#endif /* XP_PC */
|
||||||
|
|
||||||
|
#ifdef XP_MAC
|
||||||
|
// this code is stolen from nsFileSpecMac. Since MDB requires a native path, for
|
||||||
|
// the time being, we'll just take the Unix/Canonical form and munge it
|
||||||
|
void nsMsgDatabase::UnixToNative(char*& ioPath)
|
||||||
|
// This just does string manipulation. It doesn't check reality, or canonify, or
|
||||||
|
// anything
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
// Relying on the fact that the unix path is always longer than the mac path:
|
||||||
|
size_t len = strlen(ioPath);
|
||||||
|
char* result = new char[len + 2]; // ... but allow for the initial colon in a partial name
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
char* dst = result;
|
||||||
|
const char* src = ioPath;
|
||||||
|
if (*src == '/') // * full path
|
||||||
|
src++;
|
||||||
|
else if (strchr(src, '/')) // * partial path, and not just a leaf name
|
||||||
|
*dst++ = ':';
|
||||||
|
strcpy(dst, src);
|
||||||
|
|
||||||
|
while ( *dst != 0)
|
||||||
|
{
|
||||||
|
if (*dst == '/')
|
||||||
|
*dst++ = ':';
|
||||||
|
else
|
||||||
|
*dst++;
|
||||||
|
}
|
||||||
|
PR_Free(ioPath);
|
||||||
|
ioPath = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nsMsgDatabase::NativeToUnix(char*& ioPath)
|
||||||
|
// This just does string manipulation. It doesn't check reality, or canonify, or
|
||||||
|
// anything
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
size_t len = strlen(ioPath);
|
||||||
|
char* result = new char[len + 2]; // ... but allow for the initial colon in a partial name
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
char* dst = result;
|
||||||
|
const char* src = ioPath;
|
||||||
|
if (*src == ':') // * partial path, and not just a leaf name
|
||||||
|
src++;
|
||||||
|
else if (strchr(src, ':')) // * full path
|
||||||
|
*dst++ = '/';
|
||||||
|
strcpy(dst, src);
|
||||||
|
|
||||||
|
while ( *dst != 0)
|
||||||
|
{
|
||||||
|
if (*dst == ':')
|
||||||
|
*dst++ = '/';
|
||||||
|
else
|
||||||
|
*dst++;
|
||||||
|
}
|
||||||
|
PR_Free(ioPath);
|
||||||
|
ioPath = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* XP_MAC */
|
||||||
|
|
||||||
// Open the MDB database synchronously. If successful, this routine
|
// Open the MDB database synchronously. If successful, this routine
|
||||||
// will set up the m_mdbStore and m_mdbEnv of the database object
|
// will set up the m_mdbStore and m_mdbEnv of the database object
|
||||||
// so other database calls can work.
|
// so other database calls can work.
|
||||||
|
@ -454,8 +522,15 @@ NS_IMETHODIMP nsMsgDatabase::OpenMDB(const char *dbName, PRBool create)
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *nativeFileName = nsCRT::strdup(dbName);
|
char *nativeFileName = nsCRT::strdup(dbName);
|
||||||
|
|
||||||
|
#if defined(XP_MAC)
|
||||||
|
char * unixPath = nsCRT::strdup(dbName);
|
||||||
|
NativeToUnix(unixPath);
|
||||||
|
m_dbName = nsCRT::strdup(unixPath);
|
||||||
|
delete [] unixPath;
|
||||||
|
#else
|
||||||
m_dbName = nsCRT::strdup(dbName);
|
m_dbName = nsCRT::strdup(dbName);
|
||||||
#ifdef XP_PC
|
#endif
|
||||||
|
#if defined(XP_PC) || defined(XP_MAC)
|
||||||
UnixToNative(nativeFileName);
|
UnixToNative(nativeFileName);
|
||||||
#endif
|
#endif
|
||||||
if (stat(nativeFileName, &st))
|
if (stat(nativeFileName, &st))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче