OS/2 only code to handle DBCS properly in nsFileSpec
This commit is contained in:
mkaply%us.ibm.com 2001-02-07 04:32:24 +00:00
Родитель 68c2f1719b
Коммит 217f553161
1 изменённых файлов: 8 добавлений и 6 удалений

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

@ -47,6 +47,10 @@
#include <mbstring.h>
#endif
#ifdef XP_OS2
extern unsigned char* _mbsrchr( const unsigned char*, int);
#endif
#ifdef XP_MAC
#include <Aliases.h>
#include <TextUtils.h>
@ -318,8 +322,7 @@ void nsSimpleCharString::LeafReplace(char inSeparator, const char* inLeafName)
return;
}
char* chars = mData->mString;
#if defined(XP_WIN)
// XXX OS/2 should use strrchr() of DBCS verison, too
#if defined(XP_WIN) || defined(XP_OS2)
char* lastSeparator = (char*) _mbsrchr((const unsigned char*) chars, inSeparator);
#else
char* lastSeparator = strrchr(chars, inSeparator);
@ -331,8 +334,7 @@ void nsSimpleCharString::LeafReplace(char inSeparator, const char* inLeafName)
char savedCh = *lastSeparator;
char *savedLastSeparator = lastSeparator;
*lastSeparator = '\0';
#if defined(XP_WIN)
// XXX OS/2 should use strrchr() of DBCS verison, too
#if defined(XP_WIN) || defined(XP_OS2)
lastSeparator = (char*) _mbsrchr((const unsigned char*) chars, inSeparator);
#else
lastSeparator = strrchr(chars, inSeparator);
@ -371,7 +373,7 @@ char* nsSimpleCharString::GetLeaf(char inSeparator) const
return nsnull;
char* chars = mData->mString;
#if defined(XP_WIN)
#if defined(XP_WIN) || defined(XP_OS2)
const char* lastSeparator = (const char*) _mbsrchr((const unsigned char *) chars, inSeparator);
#else
const char* lastSeparator = strrchr(chars, inSeparator);
@ -388,7 +390,7 @@ char* nsSimpleCharString::GetLeaf(char inSeparator) const
// So now, separator was the last character. Poke in a null instead.
*(char*)lastSeparator = '\0'; // Should use const_cast, but Unix has old compiler.
#if defined(XP_WIN)
#if defined(XP_WIN) || defined(XP_OS2)
leafPointer = (const char*) _mbsrchr((const unsigned char *) chars, inSeparator);
#else
leafPointer = strrchr(chars, inSeparator);