Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsStandardURL.cpp File Reference
#include "nsStandardURL.h"
#include "nsDependentSubstring.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include "nsEscape.h"
#include "nsILocalFile.h"
#include "nsIObjectInputStream.h"
#include "nsIObjectOutputStream.h"
#include "nsICharsetConverterManager.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIIDNService.h"
#include "nsNetUtil.h"
#include "prlog.h"
#include "nsAutoPtr.h"

Go to the source code of this file.

Defines

#define LOG(args)   PR_LOG(gStandardURLLog, PR_LOG_DEBUG, args)
#define LOG_ENABLED()   PR_LOG_TEST(gStandardURLLog, PR_LOG_DEBUG)
#define ENSURE_MUTABLE()
#define NS_NET_PREF_ESCAPEUTF8   "network.standard-url.escape-utf8"
#define NS_NET_PREF_ENABLEIDN   "network.enableIDN"
#define NS_NET_PREF_ALWAYSENCODEINUTF8   "network.standard-url.encode-utf8"
#define NS_NET_PREF_SHOWPUNYCODE   "network.IDN_show_punycode"
#define NS_NET_PREF_IDNWHITELIST   "network.IDN.whitelist."
#define GET_SEGMENT_ENCODER(name)   nsSegmentEncoder name(gAlwaysEncodeInUTF8 ? nsnull : mOriginCharset.get())
#define PREF_CHANGED(p)   ((pref == nsnull) || !strcmp(pref, p))
#define GOT_PREF(p, b)   (NS_SUCCEEDED(prefs->GetBoolPref(p, &b)))

Functions

static NS_DEFINE_CID (kThisImplCID, NS_THIS_STANDARDURL_IMPL_CID)
static NS_DEFINE_CID (kStandardURLCID, NS_STANDARDURL_CID)
static nsresult EncodeString (nsIUnicodeEncoder *encoder, const nsAFlatString &str, nsACString &result)
 if (aIID.Equals(kThisImplCID)) foundInterface
PRBool IsUTFCharset (const char *aCharset)

Define Documentation

Value:
PR_BEGIN_MACRO \
    if (!mMutable) { \
        NS_ERROR("attempt to modify an immutable nsStandardURL"); \
        return NS_ERROR_ABORT; \
    } \
  PR_END_MACRO

Definition at line 80 of file nsStandardURL.cpp.

#define GET_SEGMENT_ENCODER (   name)    nsSegmentEncoder name(gAlwaysEncodeInUTF8 ? nsnull : mOriginCharset.get())

Definition at line 258 of file nsStandardURL.cpp.

#define GOT_PREF (   p,
  b 
)    (NS_SUCCEEDED(prefs->GetBoolPref(p, &b)))
#define LOG (   args)    PR_LOG(gStandardURLLog, PR_LOG_DEBUG, args)

Definition at line 75 of file nsStandardURL.cpp.

#define LOG_ENABLED ( )    PR_LOG_TEST(gStandardURLLog, PR_LOG_DEBUG)

Definition at line 76 of file nsStandardURL.cpp.

#define NS_NET_PREF_ALWAYSENCODEINUTF8   "network.standard-url.encode-utf8"

Definition at line 139 of file nsStandardURL.cpp.

#define NS_NET_PREF_ENABLEIDN   "network.enableIDN"

Definition at line 138 of file nsStandardURL.cpp.

#define NS_NET_PREF_ESCAPEUTF8   "network.standard-url.escape-utf8"

Definition at line 137 of file nsStandardURL.cpp.

#define NS_NET_PREF_IDNWHITELIST   "network.IDN.whitelist."

Definition at line 141 of file nsStandardURL.cpp.

#define NS_NET_PREF_SHOWPUNYCODE   "network.IDN_show_punycode"

Definition at line 140 of file nsStandardURL.cpp.

#define PREF_CHANGED (   p)    ((pref == nsnull) || !strcmp(pref, p))

Function Documentation

static nsresult EncodeString ( nsIUnicodeEncoder encoder,
const nsAFlatString str,
nsACString &  result 
) [static]

Definition at line 91 of file nsStandardURL.cpp.

{
    nsresult rv;
    PRInt32 len = str.Length();
    PRInt32 maxlen;

    rv = encoder->GetMaxLength(str.get(), len, &maxlen);
    if (NS_FAILED(rv))
        return rv;

    char buf[256], *p = buf;
    if (PRUint32(maxlen) > sizeof(buf) - 1) {
        p = (char *) malloc(maxlen + 1);
        if (!p)
            return NS_ERROR_OUT_OF_MEMORY;
    }

    rv = encoder->Convert(str.get(), &len, p, &maxlen);
    if (NS_FAILED(rv))
        goto end;
    if (rv == NS_ERROR_UENC_NOMAPPING) {
        NS_WARNING("unicode conversion failed");
        rv = NS_ERROR_UNEXPECTED;
        goto end;
    }
    p[maxlen] = 0;
    result = p;

    rv = encoder->Finish(p, &len);
    if (NS_FAILED(rv))
        goto end;
    p[len] = 0;
    result += p;

end:
    encoder->Reset();

    if (p != buf)
        free(p);
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

if ( aIID.  EqualskThisImplCID)
PRBool IsUTFCharset ( const char *  aCharset) [inline]

Definition at line 2506 of file nsStandardURL.cpp.

{
    return ((aCharset[0] == 'U' || aCharset[0] == 'u') &&
            (aCharset[1] == 'T' || aCharset[1] == 't') &&
            (aCharset[2] == 'F' || aCharset[2] == 'f'));
}
static NS_DEFINE_CID ( kThisImplCID  ,
NS_THIS_STANDARDURL_IMPL_CID   
) [static]
static NS_DEFINE_CID ( kStandardURLCID  ,
NS_STANDARDURL_CID   
) [static]