Sathish Kumar wrote:
char *str = "/usr/local/mozilla";

Your compiler lets you get away with this? I'd make that "const char*"


nsEmbedString eStr((const PRUnichar *) str,
strlen(str));

Eww, no! PRUnichar uses UTF-16 encoding, so this will not work. I'm almost surprised that this does not crash (accessing memory after the \0 of the string, because PRUnichar* is terminated by two zero bytes).


nsILocalFile *lFile = NULL;

NS_NewLocalFile(eStr, PR_FALSE, &lFile);

Why not use nsEmbedCString and NS_NewNativeLocalFile? apparently the native encoding will always be ascii-compatible (even though the interface does not explicitly guarantee it).


result = NS_InitXPCOM2(&serviceManager, (nsIFile *)
lFile, nsnull);

Upcasts don't need to be explicit (i.e. you don't need the (nsIFile*) here)


Example.cc: In instantiation of
`nsCOMPtr<nsIComponentRegistrar>':
Example.cc:15: instantiated from here
Example.cc:15: `sizeof' applied to incomplete type
`nsIComponentRegistrar'

#include "nsIComponentRegistrar.h" _______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to