make NS_IsNativeUTF8 inline where it returns PR_TRUE/FALSE

RESOLVED FIXED

Status

()

--
trivial
RESOLVED FIXED
13 years ago
13 years ago

People

(Reporter: jshin1987, Assigned: jshin1987)

Tracking

({intl})

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

13 years ago
On OS X and BeOS, NS_IsNativeUTF8 always returns PR_TRUE while on Windows and OS2, it always returns PR_FALSE. Now that we really begin to use the function (e.g. bug  333703), we'd better make it inline on those platforms.
(Assignee)

Comment 1

13 years ago
Created attachment 218562 [details] [diff] [review]
patch

this is a simple patch to avoid macros as defined attachment 218455 [details] [diff] [review] (bug 333703)
Attachment #218562 - Flags: superreview?(darin)
Attachment #218562 - Flags: review?(darin)

Comment 2

13 years ago
Comment on attachment 218562 [details] [diff] [review]
patch

>Index: xpcom/io/nsNativeCharsetUtils.h

>+#if defined(XP_UNIX) && !defined(XP_MACOSX)
> NS_COM PRBool NS_IsNativeUTF8();
>+#else
>+inline NS_COM PRBool NS_IsNativeUTF8()
>+{
>+#if defined(XP_MACOSX) || defined(XP_BEOS)
>+    return PR_TRUE;
>+#else
>+    return PR_FALSE;
>+#endif
>+}
>+#endif

In the inline case, you should remove NS_COM.  That macro introduces
things like declspec(dllexport/dllimport) on Windows, and I think we
don't want that in this case.

Also, could you please add a /** ... */ comment block description to
this function.

r+sr=darin
Attachment #218562 - Flags: superreview?(darin)
Attachment #218562 - Flags: superreview+
Attachment #218562 - Flags: review?(darin)
Attachment #218562 - Flags: review+
(Assignee)

Comment 3

13 years ago
thanks for r/sr
checked into the trunk (a day ago) with the following rather long comment :

/* 
 * This function indicates whether the character encoding used in the file
 * system (more exactly what's used for |GetNativeFoo| and |SetNativeFoo|
 * of |nsILocalFile|) is UTF-8 or not. Knowing that helps us avoid an 
 * unncessary encoding conversion in some cases. For instance, to get the leaf
 * name in UTF-8 out of nsILocalFile, we can just use |GetNativeLeafName| rather
 * than using |GetLeafName| and converting the result to UTF-8 if the file 
 * system  encoding is UTF-8.
 * On Unix (but not on Mac OS X), it depends on the locale and is not known
 * in advance (at the compilation time) so that this function needs to be 
 * a real function. On Mac OS X and BeOS, it's always UTF-8 while on Windows 
 * and other platforms (e.g. OS2), it's never UTF-8.  
 */
                                                                                

	

                                                              
Status: NEW → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED
(Assignee)

Comment 4

13 years ago
I also got rid of NS_COM for the inline case.
You need to log in before you can comment on or make changes to this bug.