Hello all!

I meet quite stupid problem - I cannot compare nsStrings then I'm using Spandalone XPCOM.

There are no any operator == defined for nsString.
Then I'm trying to implement it by myself I cannot call wcscmp (I'm using Linux) - like:
inline bool operator == (const nsString& i_Str1, const nsString& i_Str2) {
    return wcscmp(i_Str1.get(),i_Str2.get()) == 0;
}
because it give me error that cannot convert `const PRUnichar*' to `const wchar_t*'

And it is truth, because according to nscore.h (lines 334 - 345) PRUnichar is not a wchar_t - but PRUnit16

#ifndef __PRUNICHAR__
#define __PRUNICHAR__
  /* For now, don't use wchar_t on Unix because it breaks the Netscape
   * commercial build.  When this is fixed there will be no need for the
   * |NS_REINTERPRET_CAST| in nsLiteralString.h either.
   */
  #if defined(HAVE_CPP_2BYTE_WCHAR_T) && defined(NS_WIN32)
    typedef wchar_t PRUnichar;
  #else
    typedef PRUint16 PRUnichar;
  #endif
#endif


probably there is some more easy way for comparing nsStrings exist?

Thank you for advice!
Alexey Kakunin
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to