зеркало из https://github.com/mozilla/pjs.git
Ensure that string literals are used as |const char*| rather than |char*|. r=jag sr=brendan b=107052
This commit is contained in:
Родитель
f21244ac4e
Коммит
261f76a8ba
|
@ -1531,7 +1531,7 @@ nsScriptSecurityManager::IsCapabilityEnabled(const char *capability,
|
|||
#define PROPERTIES_URL "chrome://communicator/locale/security/security.properties"
|
||||
|
||||
nsresult
|
||||
Localize(char *genericString, nsString &result)
|
||||
Localize(const char *genericString, nsString &result)
|
||||
{
|
||||
nsresult ret;
|
||||
|
||||
|
|
|
@ -394,10 +394,10 @@ static void
|
|||
StripCommentDelimiters(nsString& aCommentString)
|
||||
{
|
||||
PRInt32 offset;
|
||||
static char* kCommentStart = "<!";
|
||||
static char* kCommentEnd = "->";
|
||||
static char* kCommentAlternateEnd = "--!>";
|
||||
static char kMinus = '-';
|
||||
static const char kCommentStart[] = "<!";
|
||||
static const char kCommentEnd[] = "->";
|
||||
static const char kCommentAlternateEnd[] = "--!>";
|
||||
static const char kMinus = '-';
|
||||
|
||||
offset = aCommentString.Find(kCommentStart);
|
||||
if (-1 != offset) {
|
||||
|
|
|
@ -75,7 +75,7 @@ static NS_DEFINE_IID(kXULDocumentCID, NS_XULDOCUMENT_CID);
|
|||
|
||||
extern nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult);
|
||||
|
||||
static char* gHTMLTypes[] = {
|
||||
static const char* const gHTMLTypes[] = {
|
||||
"text/html",
|
||||
"text/plain",
|
||||
"text/css",
|
||||
|
@ -89,7 +89,7 @@ static char* gHTMLTypes[] = {
|
|||
0
|
||||
};
|
||||
|
||||
static char* gXMLTypes[] = {
|
||||
static const char* const gXMLTypes[] = {
|
||||
"text/xml",
|
||||
"application/xml",
|
||||
"application/xhtml+xml",
|
||||
|
@ -100,7 +100,7 @@ static char* gXMLTypes[] = {
|
|||
};
|
||||
|
||||
|
||||
static char* gRDFTypes[] = {
|
||||
static const char* const gRDFTypes[] = {
|
||||
"text/rdf",
|
||||
"application/vnd.mozilla.xul+xml",
|
||||
"mozilla.application/cached-xul",
|
||||
|
@ -109,7 +109,7 @@ static char* gRDFTypes[] = {
|
|||
0
|
||||
};
|
||||
|
||||
static char* gImageTypes[] = {
|
||||
static const char* const gImageTypes[] = {
|
||||
"image/gif",
|
||||
"image/jpeg",
|
||||
"image/jpg",
|
||||
|
@ -538,12 +538,12 @@ RegisterTypes(nsIComponentManager* aCompMgr,
|
|||
nsIFile* aPath,
|
||||
const char *aLocation,
|
||||
const char *aType,
|
||||
char** aTypes)
|
||||
const char* const* aTypes)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
while (*aTypes) {
|
||||
char contractid[500];
|
||||
char* contentType = *aTypes++;
|
||||
const char* contentType = *aTypes++;
|
||||
PR_snprintf(contractid, sizeof(contractid),
|
||||
NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "%s;1?type=%s",
|
||||
aCommand, contentType);
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
|
||||
static char* mEventNames[] = {
|
||||
static const char* const mEventNames[] = {
|
||||
"mousedown", "mouseup", "click", "dblclick", "mouseover",
|
||||
"mouseout", "mousemove", "contextmenu", "keydown", "keyup", "keypress",
|
||||
"focus", "blur", "load", "unload", "abort", "error",
|
||||
|
|
|
@ -4658,8 +4658,8 @@ HTMLContentSink::ProcessHTTPHeaders(nsIChannel* aChannel) {
|
|||
if(aChannel) {
|
||||
nsCOMPtr<nsIHttpChannel> httpchannel(do_QueryInterface(aChannel));
|
||||
if (httpchannel) {
|
||||
char* headers[]={"link","default-style","content-base",0}; // add more http headers if you need
|
||||
char** name=headers;
|
||||
const char *const headers[]={"link","default-style","content-base",0}; // add more http headers if you need
|
||||
const char *const *name=headers;
|
||||
nsXPIDLCString tmp;
|
||||
|
||||
while(*name) {
|
||||
|
|
|
@ -481,7 +481,7 @@ nsHTMLFragmentContentSink::AddBaseTagInfo(nsIHTMLContent* aContent)
|
|||
}
|
||||
}
|
||||
|
||||
static char* kSentinelStr = "endnote";
|
||||
static const char kSentinelStr[] = "endnote";
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode)
|
||||
|
|
|
@ -78,9 +78,9 @@ public:
|
|||
nsCString mPlatformHTMLBindingStr;
|
||||
nsCString mUserHTMLBindingStr;
|
||||
|
||||
static char* sHTMLBindingStr;
|
||||
static char* sPlatformHTMLBindingStr;
|
||||
static char* sUserHTMLBindingStr;
|
||||
static const char sHTMLBindingStr[];
|
||||
static const char sPlatformHTMLBindingStr[];
|
||||
static const char sUserHTMLBindingStr[];
|
||||
|
||||
PRBool mInitialized;
|
||||
|
||||
|
@ -97,11 +97,11 @@ public:
|
|||
nsXBLSpecialDocInfo() : mInitialized(PR_FALSE) {};
|
||||
};
|
||||
|
||||
char* nsXBLSpecialDocInfo::sHTMLBindingStr = "resource:///res/builtin/htmlBindings.xml";
|
||||
char* nsXBLSpecialDocInfo::sPlatformHTMLBindingStr = "resource:///res/builtin/platformHTMLBindings.xml";
|
||||
const char nsXBLSpecialDocInfo::sHTMLBindingStr[] = "resource:///res/builtin/htmlBindings.xml";
|
||||
const char nsXBLSpecialDocInfo::sPlatformHTMLBindingStr[] = "resource:///res/builtin/platformHTMLBindings.xml";
|
||||
// Allow for a userHTMLBindings.xml.
|
||||
// XXX Should be in the user profile directory, when we have a urlspec for that
|
||||
char* nsXBLSpecialDocInfo::sUserHTMLBindingStr = "resource:///res/builtin/userHTMLBindings.xml";
|
||||
const char nsXBLSpecialDocInfo::sUserHTMLBindingStr[] = "resource:///res/builtin/userHTMLBindings.xml";
|
||||
|
||||
void nsXBLSpecialDocInfo::LoadDocInfo()
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
NS_IMETHOD SetFocusedWindow(nsIDOMWindowInternal* aResult)=0;
|
||||
|
||||
NS_IMETHOD GetSuppressFocus(PRBool* aSuppressFlag)=0;
|
||||
NS_IMETHOD SetSuppressFocus(PRBool aSuppressFlag, char* aReason)=0;
|
||||
NS_IMETHOD SetSuppressFocus(PRBool aSuppressFlag, const char* aReason)=0;
|
||||
|
||||
NS_IMETHOD GetSuppressFocusScroll(PRBool* aSuppressFlag)=0;
|
||||
NS_IMETHOD SetSuppressFocusScroll(PRBool aSuppressFlag)=0;
|
||||
|
|
|
@ -410,7 +410,7 @@ nsFocusController::GetSuppressFocus(PRBool* aSuppressFocus)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFocusController::SetSuppressFocus(PRBool aSuppressFocus, char* aReason)
|
||||
nsFocusController::SetSuppressFocus(PRBool aSuppressFocus, const char* aReason)
|
||||
{
|
||||
if(aSuppressFocus) {
|
||||
++mSuppressFocus;
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
NS_IMETHOD SetFocusedWindow(nsIDOMWindowInternal* aResult);
|
||||
|
||||
NS_IMETHOD GetSuppressFocus(PRBool* aSuppressFlag);
|
||||
NS_IMETHOD SetSuppressFocus(PRBool aSuppressFlag, char* aReason);
|
||||
NS_IMETHOD SetSuppressFocus(PRBool aSuppressFlag, const char* aReason);
|
||||
|
||||
NS_IMETHOD GetSuppressFocusScroll(PRBool* aSuppressFlag);
|
||||
NS_IMETHOD SetSuppressFocusScroll(PRBool aSuppressFlag);
|
||||
|
|
|
@ -1303,8 +1303,8 @@ NS_IMETHODIMP nsHTMLEditor::CanPaste(PRInt32 aSelectionType, PRBool *aCanPaste)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// the flavors that we can deal with
|
||||
char* textEditorFlavors[] = { kUnicodeMime, nsnull };
|
||||
char* htmlEditorFlavors[] = { kJPEGImageMime, kHTMLMime, nsnull };
|
||||
const char* const textEditorFlavors[] = { kUnicodeMime, nsnull };
|
||||
const char* const htmlEditorFlavors[] = { kJPEGImageMime, kHTMLMime, nsnull };
|
||||
|
||||
nsCOMPtr<nsISupportsArray> flavorsList;
|
||||
rv = nsComponentManager::CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, nsnull,
|
||||
|
@ -1315,7 +1315,7 @@ NS_IMETHODIMP nsHTMLEditor::CanPaste(PRInt32 aSelectionType, PRBool *aCanPaste)
|
|||
GetFlags(&editorFlags);
|
||||
|
||||
// add the flavors for all editors
|
||||
for (char** flavor = textEditorFlavors; *flavor; flavor++)
|
||||
for (const char* const* flavor = textEditorFlavors; *flavor; flavor++)
|
||||
{
|
||||
nsCOMPtr<nsISupportsString> flavorString;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, nsnull,
|
||||
|
@ -1330,7 +1330,9 @@ NS_IMETHODIMP nsHTMLEditor::CanPaste(PRInt32 aSelectionType, PRBool *aCanPaste)
|
|||
// add the HTML-editor only flavors
|
||||
if ((editorFlags & eEditorPlaintextMask) == 0)
|
||||
{
|
||||
for (char** htmlFlavor = htmlEditorFlavors; *htmlFlavor; htmlFlavor++)
|
||||
for (const char* const* htmlFlavor = htmlEditorFlavors;
|
||||
*htmlFlavor;
|
||||
htmlFlavor++)
|
||||
{
|
||||
nsCOMPtr<nsISupportsString> flavorString;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, nsnull,
|
||||
|
|
|
@ -584,7 +584,7 @@ NS_IMETHODIMP nsPlaintextEditor::CanPaste(PRInt32 aSelectionType, PRBool *aCanPa
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// the flavors that we can deal with
|
||||
char* textEditorFlavors[] = { kUnicodeMime, nsnull };
|
||||
const char* const textEditorFlavors[] = { kUnicodeMime, nsnull };
|
||||
|
||||
nsCOMPtr<nsISupportsArray> flavorsList;
|
||||
rv = nsComponentManager::CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, nsnull,
|
||||
|
@ -595,7 +595,7 @@ NS_IMETHODIMP nsPlaintextEditor::CanPaste(PRInt32 aSelectionType, PRBool *aCanPa
|
|||
GetFlags(&editorFlags);
|
||||
|
||||
// add the flavors for text editors
|
||||
for (char** flavor = textEditorFlavors; *flavor; flavor++)
|
||||
for (const char* const* flavor = textEditorFlavors; *flavor; flavor++)
|
||||
{
|
||||
nsCOMPtr<nsISupportsString> flavorString;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, nsnull,
|
||||
|
|
|
@ -134,7 +134,7 @@ nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
||||
char* propertyURL = "chrome://necko/locale/necko.properties";
|
||||
const char propertyURL[] = "chrome://necko/locale/necko.properties";
|
||||
rv = sBundleService->CreateBundle(propertyURL,
|
||||
getter_AddRefs(stringBundle));
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
static char *sWatcherContractID = "@mozilla.org/embedcomp/window-watcher;1";
|
||||
static const char sWatcherContractID[] = "@mozilla.org/embedcomp/window-watcher;1";
|
||||
|
||||
PRUint32 EmbedPrivate::sWidgetCount = 0;
|
||||
char *EmbedPrivate::sCompPath = nsnull;
|
||||
|
|
|
@ -550,8 +550,8 @@ reload_clicked_cb (GtkButton *button, TestGtkBrowser *browser)
|
|||
void
|
||||
stream_clicked_cb (GtkButton *button, TestGtkBrowser *browser)
|
||||
{
|
||||
char *data;
|
||||
char *data2;
|
||||
const char *data;
|
||||
const char *data2;
|
||||
data = "<html>Hi";
|
||||
data2 = " there</html>\n";
|
||||
g_print("stream_clicked_cb\n");
|
||||
|
@ -587,8 +587,8 @@ void
|
|||
menu_stream_cb (GtkMenuItem *menuitem, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("menu_stream_cb\n");
|
||||
char *data;
|
||||
char *data2;
|
||||
const char *data;
|
||||
const char *data2;
|
||||
data = "<html>Hi";
|
||||
data2 = " there</html>\n";
|
||||
g_print("stream_clicked_cb\n");
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
#include "nsRect.h"
|
||||
#include "nsIWebBrowserChromeFocus.h"
|
||||
|
||||
static char *sWindowWatcherContractID = "@mozilla.org/embedcomp/window-watcher;1";
|
||||
static const char sWindowWatcherContractID[] = "@mozilla.org/embedcomp/window-watcher;1";
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1200,7 +1200,7 @@ nsWebBrowserPersist::CloneNodeWithFixedUpURIAttributes(
|
|||
|
||||
nsresult
|
||||
nsWebBrowserPersist::StoreURIAttribute(
|
||||
nsIDOMNode *aNode, char *aAttribute, PRBool aNeedsPersisting,
|
||||
nsIDOMNode *aNode, const char *aAttribute, PRBool aNeedsPersisting,
|
||||
URIData **aData)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNode);
|
||||
|
@ -1235,7 +1235,8 @@ nsWebBrowserPersist::StoreURIAttribute(
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsWebBrowserPersist::FixupNodeAttribute(nsIDOMNode *aNode, char *aAttribute)
|
||||
nsWebBrowserPersist::FixupNodeAttribute(nsIDOMNode *aNode,
|
||||
const char *aAttribute)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNode);
|
||||
NS_ENSURE_ARG_POINTER(aAttribute);
|
||||
|
|
|
@ -91,9 +91,10 @@ private:
|
|||
nsresult MakeFilenameFromURI(
|
||||
nsIURI *aURI, nsString &aFilename);
|
||||
nsresult StoreURIAttribute(
|
||||
nsIDOMNode *aNode, char *aAttribute, PRBool aNeedsPersisting = PR_TRUE,
|
||||
nsIDOMNode *aNode, const char *aAttribute,
|
||||
PRBool aNeedsPersisting = PR_TRUE,
|
||||
URIData **aData = nsnull);
|
||||
nsresult FixupNodeAttribute(nsIDOMNode *aNode, char *aAttribute);
|
||||
nsresult FixupNodeAttribute(nsIDOMNode *aNode, const char *aAttribute);
|
||||
nsresult FixupAnchor(nsIDOMNode *aNode);
|
||||
nsresult StoreAndFixupStyleSheet(nsIStyleSheet *aStyleSheet);
|
||||
nsresult SaveDocumentToFileWithFixup(
|
||||
|
|
|
@ -107,7 +107,7 @@ int main(PRInt32 argc, char *argv[])
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
||||
char* propertyURL = "chrome://necko/locale/necko.properties";
|
||||
const char propertyURL[] = "chrome://necko/locale/necko.properties";
|
||||
rv = bundleService->CreateBundle(propertyURL, getter_AddRefs(stringBundle));
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@
|
|||
*/
|
||||
|
||||
#ifndef HAVE_64BIT_OS
|
||||
char* GenerateIdFunctionCall::printfFmt = "id0x%08p";
|
||||
const char GenerateIdFunctionCall::printfFmt[] = "id0x%08p";
|
||||
#else
|
||||
char* GenerateIdFunctionCall::printfFmt = "id0x%016p";
|
||||
const char GenerateIdFunctionCall::printfFmt[] = "id0x%016p";
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -316,7 +316,7 @@ public:
|
|||
virtual ExprResult* evaluate(Node* context, ContextState* cs);
|
||||
|
||||
private:
|
||||
static char* printfFmt;
|
||||
static const char printfFmt[];
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -463,7 +463,7 @@ wallet_DumpStopwatch() {
|
|||
#define PROPERTIES_URL "chrome://communicator/locale/wallet/wallet.properties"
|
||||
|
||||
PUBLIC PRUnichar *
|
||||
Wallet_Localize(char* genericString) {
|
||||
Wallet_Localize(const char* genericString) {
|
||||
nsresult ret;
|
||||
nsAutoString v;
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ Wallet_Decrypt(const nsString& crypt, nsString& text);
|
|||
|
||||
extern nsresult Wallet_ProfileDirectory(nsFileSpec& dirSpec);
|
||||
|
||||
extern PRUnichar * Wallet_Localize(char * genericString);
|
||||
extern PRUnichar * Wallet_Localize(const char * genericString);
|
||||
|
||||
extern char* Wallet_RandomName(char* suffix);
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ struct nsFontCharSetInfo
|
|||
|
||||
struct nsFontCharSetMap
|
||||
{
|
||||
char* mName;
|
||||
const char* mName;
|
||||
nsFontLangGroup* mFontLangGroup;
|
||||
nsFontCharSetInfo* mInfo;
|
||||
};
|
||||
|
@ -173,8 +173,8 @@ struct nsFontNode
|
|||
|
||||
struct nsFontPropertyName
|
||||
{
|
||||
char* mName;
|
||||
int mValue;
|
||||
const char* mName;
|
||||
int mValue;
|
||||
};
|
||||
|
||||
struct nsFontStretch
|
||||
|
@ -3396,7 +3396,8 @@ FFREToXLFDPattern(nsAWritableCString &aFFREName, nsAWritableCString &oPattern)
|
|||
// substitute the charset in a FFRE (Foundry-Family-Registry-Encoding)
|
||||
//
|
||||
static void
|
||||
FFRESubstituteCharset(nsAWritableCString &aFFREName, char *aReplacementCharset)
|
||||
FFRESubstituteCharset(nsAWritableCString &aFFREName,
|
||||
const char *aReplacementCharset)
|
||||
{
|
||||
PRInt32 charsetHyphen = aFFREName.FindChar('-');
|
||||
charsetHyphen = aFFREName.FindChar('-', charsetHyphen + 1);
|
||||
|
@ -3408,7 +3409,8 @@ FFRESubstituteCharset(nsAWritableCString &aFFREName, char *aReplacementCharset)
|
|||
// substitute the encoding in a FFRE (Foundry-Family-Registry-Encoding)
|
||||
//
|
||||
static void
|
||||
FFRESubstituteEncoding(nsAWritableCString &aFFREName, char *aReplacementEncoding)
|
||||
FFRESubstituteEncoding(nsAWritableCString &aFFREName,
|
||||
const char *aReplacementEncoding)
|
||||
{
|
||||
PRInt32 encodingHyphen = aFFREName.FindChar('-');
|
||||
encodingHyphen = aFFREName.FindChar('-', encodingHyphen + 1);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
** The names of the characters in the ISO Latin1 set.
|
||||
** Index into this array is the encoding for that character
|
||||
*/
|
||||
char *isotab[256] = {
|
||||
const char *const isotab[256] = {
|
||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "space",
|
||||
"exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand",
|
||||
|
|
|
@ -192,20 +192,20 @@ typedef struct AFM_Single_Char_Metrics AFMscm;
|
|||
struct fontInformation
|
||||
{
|
||||
double mFontVersion;
|
||||
char *mFontName;
|
||||
char *mFullName;
|
||||
char *mFamilyName;
|
||||
char *mWeight;
|
||||
const char *mFontName;
|
||||
const char *mFullName;
|
||||
const char *mFamilyName;
|
||||
const char *mWeight;
|
||||
double mFontBBox_llx;
|
||||
double mFontBBox_lly;
|
||||
double mFontBBox_urx;
|
||||
double mFontBBox_ury;
|
||||
char *mVersion;
|
||||
char *mNotice;
|
||||
char *mEncodingScheme;
|
||||
const char *mVersion;
|
||||
const char *mNotice;
|
||||
const char *mEncodingScheme;
|
||||
PRInt32 mMappingScheme;
|
||||
PRInt32 mEscChar;
|
||||
char *mCharacterSet;
|
||||
const char *mCharacterSet;
|
||||
PRInt32 mCharacters;
|
||||
PRBool mIsBaseFont;
|
||||
double mVVector_0;
|
||||
|
@ -422,8 +422,8 @@ protected:
|
|||
*/
|
||||
struct AFM_SubstituteFonts
|
||||
{
|
||||
char* mPSName;
|
||||
char* mFamily;
|
||||
const char* mPSName;
|
||||
const char* mFamily;
|
||||
PRUint16 mWeight;
|
||||
PRUint8 mStyle;
|
||||
AFMFontInformation* mFontInfo;
|
||||
|
|
|
@ -73,7 +73,7 @@ static NS_DEFINE_IID(kICharsetConverterManagerIID, NS_ICHARSETCONVERTERMANAGER_I
|
|||
/*
|
||||
* Paper Names
|
||||
*/
|
||||
char* paper_string[]={ "Letter", "Legal", "Executive", "A4", "A3" };
|
||||
const char*const paper_string[]={ "Letter", "Legal", "Executive", "A4", "A3" };
|
||||
|
||||
/*
|
||||
* global
|
||||
|
@ -886,7 +886,8 @@ nsPostScriptObj::end_document()
|
|||
* @update 2/1/99 dwc
|
||||
*/
|
||||
void
|
||||
nsPostScriptObj::annotate_page(char *aTemplate, int y, int delta_dir, int pn)
|
||||
nsPostScriptObj::annotate_page(const char *aTemplate,
|
||||
int y, int delta_dir, int pn)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -896,7 +897,7 @@ nsPostScriptObj::annotate_page(char *aTemplate, int y, int delta_dir, int pn)
|
|||
* @update 2/1/99 dwc. Updated 3/22/2000 to deal with only non-Unicode chars. yueheng.xu@intel.com
|
||||
*/
|
||||
void
|
||||
nsPostScriptObj::show(const char* txt, int len, char *align)
|
||||
nsPostScriptObj::show(const char* txt, int len, const char *align)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
|
@ -979,7 +980,7 @@ nsPostScriptObj::preshow(const PRUnichar* txt, int len)
|
|||
* @update 3/22/2000 to deal with only unicode chars. yueheng.xu@intel.com
|
||||
*/
|
||||
void
|
||||
nsPostScriptObj::show(const PRUnichar* txt, int len, char *align)
|
||||
nsPostScriptObj::show(const PRUnichar* txt, int len, const char *align)
|
||||
{
|
||||
FILE *f = mPrintContext->prSetup->out;
|
||||
unsigned char highbyte, lowbyte;
|
||||
|
@ -1554,7 +1555,7 @@ int postscriptFont = 0;
|
|||
* @update 2/1/98 dwc
|
||||
*/
|
||||
void
|
||||
nsPostScriptObj::comment(char *aTheComment)
|
||||
nsPostScriptObj::comment(const char *aTheComment)
|
||||
{
|
||||
|
||||
fprintf(mPrintContext->prSetup->out,"%%%s\n", aTheComment);
|
||||
|
@ -1635,11 +1636,11 @@ nsPostScriptObj::GetUnixPrinterSetting(const nsCAutoString& aKey, char** aVal)
|
|||
|
||||
|
||||
typedef struct _unixPrinterFallbacks_t {
|
||||
char *key;
|
||||
char *val;
|
||||
const char *key;
|
||||
const char *val;
|
||||
} unixPrinterFallbacks_t;
|
||||
|
||||
static unixPrinterFallbacks_t unixPrinterFallbacks[] = {
|
||||
static const unixPrinterFallbacks_t unixPrinterFallbacks[] = {
|
||||
{"print.psnativefont.ja", "Ryumin-Light-EUC-H"},
|
||||
{"print.psnativecode.ja", "euc-jp"},
|
||||
{nsnull, nsnull}
|
||||
|
@ -1648,7 +1649,7 @@ static unixPrinterFallbacks_t unixPrinterFallbacks[] = {
|
|||
PRBool
|
||||
GetUnixPrinterFallbackSetting(const nsCAutoString& aKey, char** aVal)
|
||||
{
|
||||
unixPrinterFallbacks_t *p;
|
||||
const unixPrinterFallbacks_t *p;
|
||||
const char* key = aKey.get();
|
||||
for (p=unixPrinterFallbacks; p->key; p++) {
|
||||
if (strcmp(key, p->key) == 0) {
|
||||
|
|
|
@ -159,8 +159,8 @@ struct PrintSetup_ {
|
|||
int width; /* Paper size, # of cols for text xlate */
|
||||
int height;
|
||||
|
||||
char* header;
|
||||
char* footer;
|
||||
const char* header;
|
||||
const char* footer;
|
||||
|
||||
int *sizes;
|
||||
XP_Bool reverse; /* Output order */
|
||||
|
@ -176,9 +176,9 @@ struct PrintSetup_ {
|
|||
int bigger; /* Used to init sizes if sizesin NULL */
|
||||
int paper_size; /* Paper Size(letter,legal,exec,a4,a3) */
|
||||
|
||||
char* prefix; /* For text xlate, prepended to each line */
|
||||
char* eol; /* For text translation, line terminator */
|
||||
char* bullet; /* What char to use for bullets */
|
||||
const char* prefix; /* For text xlate, prepended to each line */
|
||||
const char* eol; /* For text translation, line terminator */
|
||||
const char* bullet; /* What char to use for bullets */
|
||||
|
||||
struct URL_Struct_ *url; /* url of doc being translated */
|
||||
FILE *out; /* Where to send the output */
|
||||
|
@ -347,7 +347,7 @@ public:
|
|||
* ???
|
||||
* @update 2/1/99 dwc
|
||||
*/
|
||||
void annotate_page( char*, int, int, int);
|
||||
void annotate_page( const char*, int, int, int);
|
||||
/** ---------------------------------------------------
|
||||
* translate the current coordinate system
|
||||
* @update 2/1/99 dwc
|
||||
|
@ -357,12 +357,12 @@ public:
|
|||
* Issue a PS show command, which causes image to be rastered
|
||||
* @update 2/1/99 dwc
|
||||
*/
|
||||
void show(const char* aText, int aLen, char *aAlign);
|
||||
void show(const char* aText, int aLen, const char *aAlign);
|
||||
/** ---------------------------------------------------
|
||||
* This version takes an Unicode string.
|
||||
* @update 3/22/2000 yueheng.xu@intel.com
|
||||
*/
|
||||
void show(const PRUnichar* aText, int aLen, char *aAlign);
|
||||
void show(const PRUnichar* aText, int aLen, const char *aAlign);
|
||||
/** ---------------------------------------------------
|
||||
* set the clipping path to the current path using the winding rule
|
||||
* @update 2/1/99 dwc
|
||||
|
@ -402,7 +402,7 @@ public:
|
|||
* output a postscript comment
|
||||
* @update 2/1/99 dwc
|
||||
*/
|
||||
void comment(char *aTheComment);
|
||||
void comment(const char *aTheComment);
|
||||
/** ---------------------------------------------------
|
||||
* setup language group
|
||||
* @update 5/30/00 katakai
|
||||
|
|
|
@ -70,7 +70,7 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
|||
static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
|
||||
static NS_DEFINE_IID(kClassIID, NS_IOTHERHTML_DTD_IID);
|
||||
static NS_DEFINE_IID(kParserServiceCID, NS_PARSERSERVICE_CID);
|
||||
static char* kVerificationDir = "c:/temp";
|
||||
static const char kVerificationDir[] = "c:/temp";
|
||||
|
||||
|
||||
#ifdef ENABLE_CRC
|
||||
|
|
|
@ -232,7 +232,7 @@ enum {
|
|||
VIEW_SOURCE_MARKUPDECLARATION = 12
|
||||
};
|
||||
|
||||
static char* kElementClasses[] = {
|
||||
static const char* const kElementClasses[] = {
|
||||
"start-tag",
|
||||
"end-tag",
|
||||
"comment",
|
||||
|
@ -248,7 +248,7 @@ static char* kElementClasses[] = {
|
|||
"markupdeclaration"
|
||||
};
|
||||
|
||||
static char* kBeforeText[] = {
|
||||
static const char* const kBeforeText[] = {
|
||||
"<",
|
||||
"</",
|
||||
"",
|
||||
|
@ -264,7 +264,7 @@ static char* kBeforeText[] = {
|
|||
""
|
||||
};
|
||||
|
||||
static char* kAfterText[] = {
|
||||
static const char* const kAfterText[] = {
|
||||
">",
|
||||
">",
|
||||
"",
|
||||
|
@ -281,7 +281,7 @@ static char* kAfterText[] = {
|
|||
};
|
||||
|
||||
#ifdef DUMP_TO_FILE
|
||||
static char* kDumpFileBeforeText[] = {
|
||||
static const char* const kDumpFileBeforeText[] = {
|
||||
"<",
|
||||
"</",
|
||||
"",
|
||||
|
@ -297,7 +297,7 @@ static char* kDumpFileBeforeText[] = {
|
|||
""
|
||||
};
|
||||
|
||||
static char* kDumpFileAfterText[] = {
|
||||
static const char* const kDumpFileAfterText[] = {
|
||||
">",
|
||||
">",
|
||||
"",
|
||||
|
|
|
@ -93,10 +93,10 @@ private:
|
|||
nsIStringBundle ** aResult);
|
||||
|
||||
static nsresult RegisterConverterTitles(nsIRegistry * aRegistry,
|
||||
char * aRegistryPath);
|
||||
const char * aRegistryPath);
|
||||
|
||||
static nsresult RegisterConverterData(nsIRegistry * aRegistry,
|
||||
char * aRegistryPath);
|
||||
const char * aRegistryPath);
|
||||
|
||||
nsresult GetBundleValue(nsIStringBundle * aBundle, const nsIAtom * aName,
|
||||
nsString * aProp, PRUnichar ** aResult);
|
||||
|
@ -104,10 +104,10 @@ private:
|
|||
nsresult GetBundleValue(nsIStringBundle * aBundle, const nsIAtom * aName,
|
||||
nsString * aProp, nsIAtom ** aResult);
|
||||
|
||||
nsresult GetRegistryEnumeration(char * aRegistryKey, char * aAddPrefix,
|
||||
nsISupportsArray ** aArray);
|
||||
nsresult GetRegistryEnumeration(const char * aRegistryKey,
|
||||
const char * aAddPrefix, nsISupportsArray ** aArray);
|
||||
|
||||
nsresult GetRegistryEnumeration2(char * aRegistryKey, PRBool aDecoder,
|
||||
nsresult GetRegistryEnumeration2(const char * aRegistryKey, PRBool aDecoder,
|
||||
nsISupportsArray ** aArray);
|
||||
|
||||
public:
|
||||
|
@ -239,7 +239,7 @@ nsresult nsCharsetConverterManager::RegisterConverterManagerData()
|
|||
|
||||
nsresult nsCharsetConverterManager::RegisterConverterTitles(
|
||||
nsIRegistry * aRegistry,
|
||||
char * aRegistryPath)
|
||||
const char * aRegistryPath)
|
||||
{
|
||||
nsresult res;
|
||||
nsRegistryKey key;
|
||||
|
@ -259,7 +259,7 @@ nsresult nsCharsetConverterManager::RegisterConverterTitles(
|
|||
|
||||
nsresult nsCharsetConverterManager::RegisterConverterData(
|
||||
nsIRegistry * aRegistry,
|
||||
char * aRegistryPath)
|
||||
const char * aRegistryPath)
|
||||
{
|
||||
nsresult res;
|
||||
nsRegistryKey key;
|
||||
|
@ -329,8 +329,8 @@ nsresult nsCharsetConverterManager::GetBundleValue(nsIStringBundle * aBundle,
|
|||
}
|
||||
|
||||
nsresult nsCharsetConverterManager::GetRegistryEnumeration(
|
||||
char * aRegistryKey,
|
||||
char * aAddPrefix,
|
||||
const char * aRegistryKey,
|
||||
const char * aAddPrefix,
|
||||
nsISupportsArray ** aArray)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
@ -401,7 +401,7 @@ next:
|
|||
// .../uconv/decoder/name
|
||||
// .../uconv/encoder/name
|
||||
nsresult nsCharsetConverterManager::GetRegistryEnumeration2(
|
||||
char * aRegistryKey,
|
||||
const char * aRegistryKey,
|
||||
PRBool aDecoder,
|
||||
nsISupportsArray ** aArray)
|
||||
{
|
||||
|
|
|
@ -306,7 +306,7 @@ MySecMan::CanAccess(PRUint32 aAction, nsIXPCNativeCallContext *aCallContext, JSC
|
|||
static void
|
||||
TestSecurityManager(JSContext* jscontext, JSObject* glob, nsIXPConnect* xpc)
|
||||
{
|
||||
char* t;
|
||||
const char* t;
|
||||
jsval rval;
|
||||
JSBool success = JS_TRUE;
|
||||
MySecMan* sm = new MySecMan();
|
||||
|
|
|
@ -75,7 +75,7 @@ static NS_DEFINE_IID(kXULDocumentCID, NS_XULDOCUMENT_CID);
|
|||
|
||||
extern nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult);
|
||||
|
||||
static char* gHTMLTypes[] = {
|
||||
static const char* const gHTMLTypes[] = {
|
||||
"text/html",
|
||||
"text/plain",
|
||||
"text/css",
|
||||
|
@ -89,7 +89,7 @@ static char* gHTMLTypes[] = {
|
|||
0
|
||||
};
|
||||
|
||||
static char* gXMLTypes[] = {
|
||||
static const char* const gXMLTypes[] = {
|
||||
"text/xml",
|
||||
"application/xml",
|
||||
"application/xhtml+xml",
|
||||
|
@ -100,7 +100,7 @@ static char* gXMLTypes[] = {
|
|||
};
|
||||
|
||||
|
||||
static char* gRDFTypes[] = {
|
||||
static const char* const gRDFTypes[] = {
|
||||
"text/rdf",
|
||||
"application/vnd.mozilla.xul+xml",
|
||||
"mozilla.application/cached-xul",
|
||||
|
@ -109,7 +109,7 @@ static char* gRDFTypes[] = {
|
|||
0
|
||||
};
|
||||
|
||||
static char* gImageTypes[] = {
|
||||
static const char* const gImageTypes[] = {
|
||||
"image/gif",
|
||||
"image/jpeg",
|
||||
"image/jpg",
|
||||
|
@ -538,12 +538,12 @@ RegisterTypes(nsIComponentManager* aCompMgr,
|
|||
nsIFile* aPath,
|
||||
const char *aLocation,
|
||||
const char *aType,
|
||||
char** aTypes)
|
||||
const char* const* aTypes)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
while (*aTypes) {
|
||||
char contractid[500];
|
||||
char* contentType = *aTypes++;
|
||||
const char* contentType = *aTypes++;
|
||||
PR_snprintf(contractid, sizeof(contractid),
|
||||
NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "%s;1?type=%s",
|
||||
aCommand, contentType);
|
||||
|
|
|
@ -468,7 +468,7 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
// XXX a hack until the reflow state does this correctly
|
||||
// XXX when it gets fixed, leave in the printf statements or add an assertion
|
||||
static
|
||||
void ButtonHack(nsHTMLReflowState& aReflowState, char* aMessage)
|
||||
void ButtonHack(nsHTMLReflowState& aReflowState, const char* aMessage)
|
||||
{
|
||||
if (aReflowState.mComputedWidth == 0) {
|
||||
aReflowState.mComputedWidth = aReflowState.availableWidth;
|
||||
|
|
|
@ -468,7 +468,7 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
// XXX a hack until the reflow state does this correctly
|
||||
// XXX when it gets fixed, leave in the printf statements or add an assertion
|
||||
static
|
||||
void ButtonHack(nsHTMLReflowState& aReflowState, char* aMessage)
|
||||
void ButtonHack(nsHTMLReflowState& aReflowState, const char* aMessage)
|
||||
{
|
||||
if (aReflowState.mComputedWidth == 0) {
|
||||
aReflowState.mComputedWidth = aReflowState.availableWidth;
|
||||
|
|
|
@ -243,7 +243,7 @@ nsAbSyncDriver::GetString(const PRUnichar *aStringName)
|
|||
|
||||
if (!mStringBundle)
|
||||
{
|
||||
char *propertyURL = AB_STRING_URL;
|
||||
static const char propertyURL[] = AB_STRING_URL;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService =
|
||||
do_GetService(kStringBundleServiceCID, &res);
|
||||
|
|
|
@ -763,7 +763,7 @@ nsAbSync::GenerateProtocolForCard(nsIAbCard *aCard, PRBool aAddId, nsString &pro
|
|||
nsString tProtLine;
|
||||
PRInt32 phoneCount = 1;
|
||||
PRBool foundPhone = PR_FALSE;
|
||||
char *phoneType;
|
||||
const char *phoneType;
|
||||
|
||||
protLine = NS_ConvertASCIItoUCS2("");
|
||||
|
||||
|
@ -2128,7 +2128,7 @@ nsAbSync::AdvanceToNextSection()
|
|||
|
||||
// See if we are sitting on a particular tag...and eat if if we are
|
||||
PRBool
|
||||
nsAbSync::TagHit(char *aTag, PRBool advanceToNextLine)
|
||||
nsAbSync::TagHit(const char *aTag, PRBool advanceToNextLine)
|
||||
{
|
||||
if ((!aTag) || (!*aTag))
|
||||
return PR_FALSE;
|
||||
|
@ -3013,7 +3013,7 @@ nsAbSync::GetString(const PRUnichar *aStringName)
|
|||
|
||||
if (!mStringBundle)
|
||||
{
|
||||
char *propertyURL = AB_STRING_URL;
|
||||
static const char propertyURL[] = AB_STRING_URL;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService =
|
||||
do_GetService(kStringBundleServiceCID, &res);
|
||||
|
|
|
@ -241,7 +241,7 @@ private:
|
|||
nsresult AddNewUsers();
|
||||
nsresult AddValueToNewCard(nsIAbCard *aCard, nsString *aTagName, nsString *aTagValue);
|
||||
|
||||
PRBool TagHit(char *aTag, PRBool advanceToNextLine); // See if we are sitting on a particular tag...and advance if asked
|
||||
PRBool TagHit(const char *aTag, PRBool advanceToNextLine); // See if we are sitting on a particular tag...and advance if asked
|
||||
PRBool ErrorFromServer(char **errString); // Return true if the server returned an error...
|
||||
nsresult ProcessOpReturn();
|
||||
nsresult ProcessNewRecords();
|
||||
|
|
|
@ -798,7 +798,7 @@ nsAbSyncPostEngine::KickTheSyncOperation(void)
|
|||
mProtocolResponse = NS_ConvertASCIItoUCS2("");
|
||||
mPostEngineState = nsIAbSyncPostEngineState::nsIAbSyncPostRunning;
|
||||
|
||||
char *postHeader = "Content-Type: application/x-www-form-urlencoded\r\nContent-Length: %d\r\nCookie: %s\r\n\r\n%s";
|
||||
const char postHeader[] = "Content-Type: application/x-www-form-urlencoded\r\nContent-Length: %d\r\nCookie: %s\r\n\r\n%s";
|
||||
protString = PR_smprintf("%s%s", mSyncProtocolRequestPrefix, mSyncProtocolRequest);
|
||||
if (protString)
|
||||
mMessageSize = nsCRT::strlen(protString);
|
||||
|
|
|
@ -43,44 +43,44 @@
|
|||
#include "nsSyncDecoderRing.h"
|
||||
|
||||
// Server record fields!
|
||||
char *kServerFirstNameColumn = "fname";
|
||||
char *kServerLastNameColumn = "lname";
|
||||
char *kServerDisplayNameColumn = "Display_name";
|
||||
char *kServerNicknameColumn = "nick_name";
|
||||
char *kServerPriEmailColumn = "email1";
|
||||
char *kServer2ndEmailColumn = "email2";
|
||||
char *kServerPlainTextColumn = "Pref_rich_email";
|
||||
char *kServerWorkPhoneColumn = "work_phone";
|
||||
char *kServerHomePhoneColumn = "home_phone";
|
||||
char *kServerFaxColumn = "fax";
|
||||
char *kServerPagerColumn = "pager";
|
||||
char *kServerCellularColumn = "cell_phone";
|
||||
char *kServerHomeAddressColumn = "home_add1";
|
||||
char *kServerHomeAddress2Column = "home_add2";
|
||||
char *kServerHomeCityColumn = "home_city";
|
||||
char *kServerHomeStateColumn = "home_state";
|
||||
char *kServerHomeZipCodeColumn = "home_zip";
|
||||
char *kServerHomeCountryColumn = "home_country";
|
||||
char *kServerWorkAddressColumn = "work_add1";
|
||||
char *kServerWorkAddress2Column = "work_add2";
|
||||
char *kServerWorkCityColumn = "work_city";
|
||||
char *kServerWorkStateColumn = "work_state";
|
||||
char *kServerWorkZipCodeColumn = "work_zip";
|
||||
char *kServerWorkCountryColumn = "work_country";
|
||||
char *kServerJobTitleColumn = "job_title";
|
||||
char *kServerDepartmentColumn = "department";
|
||||
char *kServerCompanyColumn = "company";
|
||||
char *kServerWebPage1Column = "Work_web_page";
|
||||
char *kServerWebPage2Column = "web_page";
|
||||
char *kServerBirthYearColumn = "OMIT:BirthYear";
|
||||
char *kServerBirthMonthColumn = "OMIT:BirthMonth";
|
||||
char *kServerBirthDayColumn = "OMIT:BirthDay";
|
||||
char *kServerCustom1Column = "Custom_1";
|
||||
char *kServerCustom2Column = "Custom_2";
|
||||
char *kServerCustom3Column = "Custom_3";
|
||||
char *kServerCustom4Column = "Custom_4";
|
||||
char *kServerNotesColumn = "addl_info";
|
||||
char *kServerLastModifiedDateColumn = "OMIT:LastModifiedDate";
|
||||
const char kServerFirstNameColumn[] = "fname";
|
||||
const char kServerLastNameColumn[] = "lname";
|
||||
const char kServerDisplayNameColumn[] = "Display_name";
|
||||
const char kServerNicknameColumn[] = "nick_name";
|
||||
const char kServerPriEmailColumn[] = "email1";
|
||||
const char kServer2ndEmailColumn[] = "email2";
|
||||
const char kServerPlainTextColumn[] = "Pref_rich_email";
|
||||
const char kServerWorkPhoneColumn[] = "work_phone";
|
||||
const char kServerHomePhoneColumn[] = "home_phone";
|
||||
const char kServerFaxColumn[] = "fax";
|
||||
const char kServerPagerColumn[] = "pager";
|
||||
const char kServerCellularColumn[] = "cell_phone";
|
||||
const char kServerHomeAddressColumn[] = "home_add1";
|
||||
const char kServerHomeAddress2Column[] = "home_add2";
|
||||
const char kServerHomeCityColumn[] = "home_city";
|
||||
const char kServerHomeStateColumn[] = "home_state";
|
||||
const char kServerHomeZipCodeColumn[] = "home_zip";
|
||||
const char kServerHomeCountryColumn[] = "home_country";
|
||||
const char kServerWorkAddressColumn[] = "work_add1";
|
||||
const char kServerWorkAddress2Column[] = "work_add2";
|
||||
const char kServerWorkCityColumn[] = "work_city";
|
||||
const char kServerWorkStateColumn[] = "work_state";
|
||||
const char kServerWorkZipCodeColumn[] = "work_zip";
|
||||
const char kServerWorkCountryColumn[] = "work_country";
|
||||
const char kServerJobTitleColumn[] = "job_title";
|
||||
const char kServerDepartmentColumn[] = "department";
|
||||
const char kServerCompanyColumn[] = "company";
|
||||
const char kServerWebPage1Column[] = "Work_web_page";
|
||||
const char kServerWebPage2Column[] = "web_page";
|
||||
const char kServerBirthYearColumn[] = "OMIT:BirthYear";
|
||||
const char kServerBirthMonthColumn[] = "OMIT:BirthMonth";
|
||||
const char kServerBirthDayColumn[] = "OMIT:BirthDay";
|
||||
const char kServerCustom1Column[] = "Custom_1";
|
||||
const char kServerCustom2Column[] = "Custom_2";
|
||||
const char kServerCustom3Column[] = "Custom_3";
|
||||
const char kServerCustom4Column[] = "Custom_4";
|
||||
const char kServerNotesColumn[] = "addl_info";
|
||||
const char kServerLastModifiedDateColumn[] = "OMIT:LastModifiedDate";
|
||||
|
||||
nsSyncDecoderRing::nsSyncDecoderRing()
|
||||
{
|
||||
|
|
|
@ -48,44 +48,44 @@
|
|||
|
||||
|
||||
// Server record fields!
|
||||
extern char *kServerFirstNameColumn;
|
||||
extern char *kServerLastNameColumn;
|
||||
extern char *kServerDisplayNameColumn;
|
||||
extern char *kServerNicknameColumn;
|
||||
extern char *kServerPriEmailColumn;
|
||||
extern char *kServer2ndEmailColumn;
|
||||
extern char *kServerPlainTextColumn;
|
||||
extern char *kServerWorkPhoneColumn;
|
||||
extern char *kServerHomePhoneColumn;
|
||||
extern char *kServerFaxColumn;
|
||||
extern char *kServerPagerColumn;
|
||||
extern char *kServerCellularColumn;
|
||||
extern char *kServerHomeAddressColumn;
|
||||
extern char *kServerHomeAddress2Column;
|
||||
extern char *kServerHomeCityColumn;
|
||||
extern char *kServerHomeStateColumn;
|
||||
extern char *kServerHomeZipCodeColumn;
|
||||
extern char *kServerHomeCountryColumn;
|
||||
extern char *kServerWorkAddressColumn;
|
||||
extern char *kServerWorkAddress2Column;
|
||||
extern char *kServerWorkCityColumn;
|
||||
extern char *kServerWorkStateColumn;
|
||||
extern char *kServerWorkZipCodeColumn;
|
||||
extern char *kServerWorkCountryColumn;
|
||||
extern char *kServerJobTitleColumn;
|
||||
extern char *kServerDepartmentColumn;
|
||||
extern char *kServerCompanyColumn;
|
||||
extern char *kServerWebPage1Column;
|
||||
extern char *kServerWebPage2Column;
|
||||
extern char *kServerBirthYearColumn;
|
||||
extern char *kServerBirthMonthColumn;
|
||||
extern char *kServerBirthDayColumn;
|
||||
extern char *kServerCustom1Column;
|
||||
extern char *kServerCustom2Column;
|
||||
extern char *kServerCustom3Column;
|
||||
extern char *kServerCustom4Column;
|
||||
extern char *kServerNotesColumn;
|
||||
extern char *kServerLastModifiedDateColumn;
|
||||
extern const char kServerFirstNameColumn[];
|
||||
extern const char kServerLastNameColumn[];
|
||||
extern const char kServerDisplayNameColumn[];
|
||||
extern const char kServerNicknameColumn[];
|
||||
extern const char kServerPriEmailColumn[];
|
||||
extern const char kServer2ndEmailColumn[];
|
||||
extern const char kServerPlainTextColumn[];
|
||||
extern const char kServerWorkPhoneColumn[];
|
||||
extern const char kServerHomePhoneColumn[];
|
||||
extern const char kServerFaxColumn[];
|
||||
extern const char kServerPagerColumn[];
|
||||
extern const char kServerCellularColumn[];
|
||||
extern const char kServerHomeAddressColumn[];
|
||||
extern const char kServerHomeAddress2Column[];
|
||||
extern const char kServerHomeCityColumn[];
|
||||
extern const char kServerHomeStateColumn[];
|
||||
extern const char kServerHomeZipCodeColumn[];
|
||||
extern const char kServerHomeCountryColumn[];
|
||||
extern const char kServerWorkAddressColumn[];
|
||||
extern const char kServerWorkAddress2Column[];
|
||||
extern const char kServerWorkCityColumn[];
|
||||
extern const char kServerWorkStateColumn[];
|
||||
extern const char kServerWorkZipCodeColumn[];
|
||||
extern const char kServerWorkCountryColumn[];
|
||||
extern const char kServerJobTitleColumn[];
|
||||
extern const char kServerDepartmentColumn[];
|
||||
extern const char kServerCompanyColumn[];
|
||||
extern const char kServerWebPage1Column[];
|
||||
extern const char kServerWebPage2Column[];
|
||||
extern const char kServerBirthYearColumn[];
|
||||
extern const char kServerBirthMonthColumn[];
|
||||
extern const char kServerBirthDayColumn[];
|
||||
extern const char kServerCustom1Column[];
|
||||
extern const char kServerCustom2Column[];
|
||||
extern const char kServerCustom3Column[];
|
||||
extern const char kServerCustom4Column[];
|
||||
extern const char kServerNotesColumn[];
|
||||
extern const char kServerLastModifiedDateColumn[];
|
||||
|
||||
class nsSyncDecoderRing
|
||||
{
|
||||
|
|
|
@ -194,7 +194,7 @@ NS_IMETHODIMP nsAbMDBCard::OnCardEntryChange
|
|||
|
||||
// protected class methods
|
||||
|
||||
nsresult nsAbMDBCard::NotifyPropertyChanged(char *property, PRUnichar* oldValue, PRUnichar* newValue)
|
||||
nsresult nsAbMDBCard::NotifyPropertyChanged(const char *property, PRUnichar* oldValue, PRUnichar* newValue)
|
||||
{
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
if(NS_SUCCEEDED(QueryInterface(NS_GET_IID(nsISupports), getter_AddRefs(supports))))
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
nsresult NotifyPropertyChanged(char *property, PRUnichar* oldValue, PRUnichar* newValue);
|
||||
nsresult NotifyPropertyChanged(const char *property, PRUnichar* oldValue, PRUnichar* newValue);
|
||||
nsresult AddSubNode(nsAutoString name, nsIAbCard **childDir);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -202,7 +202,7 @@ NS_IMETHODIMP nsAbMDBDirectory::DeleteDirectory(nsIAbDirectory *directory)
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsAbMDBDirectory::NotifyPropertyChanged(char *property, PRUnichar* oldValue, PRUnichar* newValue)
|
||||
nsresult nsAbMDBDirectory::NotifyPropertyChanged(const char *property, PRUnichar* oldValue, PRUnichar* newValue)
|
||||
{
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
if(NS_SUCCEEDED(QueryInterface(NS_GET_IID(nsISupports), getter_AddRefs(supports))))
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
PRBool IsMailingList(){ return (mIsMailingList == 1); }
|
||||
|
||||
protected:
|
||||
nsresult NotifyPropertyChanged(char *property, PRUnichar* oldValue, PRUnichar* newValue);
|
||||
nsresult NotifyPropertyChanged(const char *property, PRUnichar* oldValue, PRUnichar* newValue);
|
||||
nsresult NotifyItemAdded(nsISupports *item);
|
||||
nsresult NotifyItemDeleted(nsISupports *item);
|
||||
nsresult AddChildCards(nsAutoString name, nsIAbCard **childDir);
|
||||
|
|
|
@ -145,7 +145,7 @@ nsAddbookProtocolHandler::AllowPort(PRInt32 port, const char *scheme, PRBool *_r
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAddbookProtocolHandler::GenerateHTMLOutputChannel( char *aHtmlOutput,
|
||||
nsAddbookProtocolHandler::GenerateHTMLOutputChannel( const char *aHtmlOutput,
|
||||
PRInt32 aHtmlOutputSize,
|
||||
nsIAddbookUrl *addbookUrl,
|
||||
nsIURI *aURI,
|
||||
|
@ -199,7 +199,7 @@ nsAddbookProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval)
|
|||
rv = GeneratePrintOutput(addbookUrl, &outBuf);
|
||||
if ((NS_FAILED(rv) || (!outBuf)))
|
||||
{
|
||||
char *eMsg = "Unsupported format/operation requested for \"addbook:\" URL.";
|
||||
const char *eMsg = "Unsupported format/operation requested for \"addbook:\" URL.";
|
||||
PRInt32 eSize = nsCRT::strlen(eMsg);
|
||||
rv = GenerateHTMLOutputChannel(eMsg, eSize, addbookUrl, aURI, _retval);
|
||||
break;
|
||||
|
@ -219,7 +219,7 @@ nsAddbookProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval)
|
|||
case nsIAddbookUrlOperation::ImportTitle:
|
||||
case nsIAddbookUrlOperation::InvalidUrl:
|
||||
default:
|
||||
char *eMsg = "Unsupported format/operation requested for \"addbook:\" URL.";
|
||||
const char *eMsg = "Unsupported format/operation requested for \"addbook:\" URL.";
|
||||
PRInt32 eSize = nsCRT::strlen(eMsg);
|
||||
|
||||
rv = GenerateHTMLOutputChannel(eMsg, eSize, addbookUrl, aURI, _retval);
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
private:
|
||||
// Output Generation calls to create the HTML output
|
||||
NS_METHOD GenerateHTMLOutputChannel(char *aHtmlOutput,
|
||||
NS_METHOD GenerateHTMLOutputChannel(const char *aHtmlOutput,
|
||||
PRInt32 aHtmlOutputSize,
|
||||
nsIAddbookUrl *addbookUrl,
|
||||
nsIURI *aURI,
|
||||
|
|
|
@ -217,8 +217,10 @@ NS_IMETHODIMP nsAddressBook::DeleteAddressBooks
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsAddressBook::DoCommand(nsIRDFCompositeDataSource* db, char *command,
|
||||
nsISupportsArray *srcArray, nsISupportsArray *argumentArray)
|
||||
nsresult nsAddressBook::DoCommand(nsIRDFCompositeDataSource* db,
|
||||
const char *command,
|
||||
nsISupportsArray *srcArray,
|
||||
nsISupportsArray *argumentArray)
|
||||
{
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
|
|
@ -67,7 +67,8 @@ public:
|
|||
CMDLINEHANDLER_REGISTERPROC_DECLS
|
||||
|
||||
protected:
|
||||
nsresult DoCommand(nsIRDFCompositeDataSource *db, char * command, nsISupportsArray *srcArray,
|
||||
nsresult DoCommand(nsIRDFCompositeDataSource *db, const char * command,
|
||||
nsISupportsArray *srcArray,
|
||||
nsISupportsArray *arguments);
|
||||
nsresult GetAbDatabaseFromFile(char* pDbFile, nsIAddrDatabase **db);
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ typedef struct DIR_DefaultAttribute
|
|||
{
|
||||
DIR_AttributeId id;
|
||||
PRInt32 resourceId;
|
||||
char *name;
|
||||
const char *name;
|
||||
} DIR_DefaultAttribute;
|
||||
|
||||
/* DIR_Filter.flags */
|
||||
|
|
|
@ -237,8 +237,8 @@ char *nsMsgSearchNews::EncodeTerm (nsIMsgSearchTerm *term)
|
|||
|
||||
// Combine the XPAT command syntax with the attribute and the pattern to
|
||||
// form the term encoding
|
||||
char *xpatTemplate = "XPAT %s 1- %s";
|
||||
int termLength = nsCRT::strlen(xpatTemplate) + nsCRT::strlen(attribEncoding) + pattern.Length() + 1;
|
||||
const char xpatTemplate[] = "XPAT %s 1- %s";
|
||||
int termLength = (sizeof(xpatTemplate) - 1) + nsCRT::strlen(attribEncoding) + pattern.Length() + 1;
|
||||
char *termEncoding = new char [termLength];
|
||||
if (termEncoding)
|
||||
PR_snprintf (termEncoding, termLength, xpatTemplate, attribEncoding, pattern.get());
|
||||
|
|
|
@ -221,7 +221,7 @@ nsresult NS_MsgGetStringForOperator(PRInt16 op, const char **string)
|
|||
|
||||
void NS_MsgGetUntranslatedStatusName (uint32 s, nsCString *outName)
|
||||
{
|
||||
char *tmpOutName = NULL;
|
||||
const char *tmpOutName = NULL;
|
||||
#define MSG_STATUS_MASK (MSG_FLAG_READ | MSG_FLAG_REPLIED | MSG_FLAG_FORWARDED | MSG_FLAG_NEW)
|
||||
PRUint32 maskOut = (s & MSG_STATUS_MASK);
|
||||
|
||||
|
|
|
@ -996,7 +996,7 @@ nsMessenger::Alert(const char *stringName)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMessenger::DoCommand(nsIRDFCompositeDataSource* db, char *command,
|
||||
nsMessenger::DoCommand(nsIRDFCompositeDataSource* db, const char *command,
|
||||
nsISupportsArray *srcArray,
|
||||
nsISupportsArray *argumentArray)
|
||||
{
|
||||
|
@ -1128,7 +1128,7 @@ nsMessenger::CopyFolders(nsIRDFCompositeDataSource *database,
|
|||
|
||||
folderArray->AppendElement(dstResource);
|
||||
|
||||
return DoCommand(database, isMoveFolder ? (char *)NC_RDF_MOVEFOLDER : (char *)NC_RDF_COPYFOLDER, folderArray, argumentArray);
|
||||
return DoCommand(database, isMoveFolder ? NC_RDF_MOVEFOLDER : NC_RDF_COPYFOLDER, folderArray, argumentArray);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1773,7 +1773,7 @@ nsMessenger::InitStringBundle()
|
|||
nsresult res = NS_OK;
|
||||
if (!mStringBundle)
|
||||
{
|
||||
char *propertyURL = MESSENGER_STRING_URL;
|
||||
const char propertyURL[] = MESSENGER_STRING_URL;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService =
|
||||
do_GetService(kStringBundleServiceCID, &res);
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
protected:
|
||||
nsresult DoDelete(nsIRDFCompositeDataSource* db, nsISupportsArray *srcArray, nsISupportsArray *deletedArray);
|
||||
nsresult DoCommand(nsIRDFCompositeDataSource *db, char * command, nsISupportsArray *srcArray,
|
||||
nsresult DoCommand(nsIRDFCompositeDataSource *db, const char * command, nsISupportsArray *srcArray,
|
||||
nsISupportsArray *arguments);
|
||||
PRUnichar *GetString(const PRUnichar *aStringName);
|
||||
nsresult InitStringBundle();
|
||||
|
|
|
@ -202,7 +202,7 @@ PRUnichar * nsMsgDBView::GetString(const PRUnichar *aStringName)
|
|||
|
||||
if (!mMessengerStringBundle)
|
||||
{
|
||||
char *propertyURL = MESSENGER_STRING_URL;
|
||||
static const char propertyURL[] = MESSENGER_STRING_URL;
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService = do_GetService(kStringBundleServiceCID, &res);
|
||||
if (NS_SUCCEEDED(res) && sBundleService)
|
||||
res = sBundleService->CreateBundle(propertyURL, getter_AddRefs(mMessengerStringBundle));
|
||||
|
|
|
@ -275,7 +275,7 @@ nsresult nsMsgOfflineManager::ShowStatus(const char *statusMsgName)
|
|||
nsresult res = NS_OK;
|
||||
if (!mStringBundle)
|
||||
{
|
||||
char *propertyURL = MESSENGER_STRING_URL;
|
||||
static const char propertyURL[] = MESSENGER_STRING_URL;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService =
|
||||
do_GetService(kStringBundleServiceCID, &res);
|
||||
|
|
|
@ -399,7 +399,7 @@ nsMsgPrintEngine::GetString(const PRUnichar *aStringName)
|
|||
|
||||
if (!mStringBundle)
|
||||
{
|
||||
char *propertyURL = MESSENGER_STRING_URL;
|
||||
static const char propertyURL[] = MESSENGER_STRING_URL;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService =
|
||||
do_GetService(kStringBundleServiceCID, &res);
|
||||
|
|
|
@ -75,7 +75,7 @@ static NS_DEFINE_CID(kHTTPHandlerCID, NS_HTTPPROTOCOLHANDLER_CID);
|
|||
// on the local machine. Caller must free memory
|
||||
//
|
||||
nsFileSpec *
|
||||
nsMsgCreateTempFileSpec(char *tFileName)
|
||||
nsMsgCreateTempFileSpec(const char *tFileName)
|
||||
{
|
||||
if ((!tFileName) || (!*tFileName))
|
||||
tFileName = "nsmail.tmp";
|
||||
|
@ -97,7 +97,7 @@ nsMsgCreateTempFileSpec(char *tFileName)
|
|||
// returned
|
||||
//
|
||||
char *
|
||||
nsMsgCreateTempFileName(char *tFileName)
|
||||
nsMsgCreateTempFileName(const char *tFileName)
|
||||
{
|
||||
if ((!tFileName) || (!*tFileName))
|
||||
tFileName = "nsmail.tmp";
|
||||
|
@ -1879,8 +1879,8 @@ mime_gen_content_id(PRUint32 aPartNum, const char *aEmailAddress)
|
|||
PRInt32 randLen = 5;
|
||||
unsigned char rand_buf1[5];
|
||||
unsigned char rand_buf2[5];
|
||||
char *domain = nsnull;
|
||||
char *defaultDomain = "@netscape.com";
|
||||
const char *domain = nsnull;
|
||||
const char *defaultDomain = "@netscape.com";
|
||||
|
||||
nsCRT::memset(rand_buf1, 0, randLen-1);
|
||||
nsCRT::memset(rand_buf2, 0, randLen-1);
|
||||
|
@ -1890,7 +1890,7 @@ mime_gen_content_id(PRUint32 aPartNum, const char *aEmailAddress)
|
|||
|
||||
// Find the @domain.com string...
|
||||
if (aEmailAddress && *aEmailAddress)
|
||||
domain = PL_strchr(aEmailAddress, '@');
|
||||
domain = NS_CONST_CAST(const char*, PL_strchr(aEmailAddress, '@'));
|
||||
|
||||
if (!domain)
|
||||
domain = defaultDomain;
|
||||
|
|
|
@ -54,8 +54,8 @@ NS_BEGIN_EXTERN_C
|
|||
// Create a file spec or file name using the name passed
|
||||
// in as a template
|
||||
//
|
||||
nsFileSpec *nsMsgCreateTempFileSpec(char *tFileName);
|
||||
char *nsMsgCreateTempFileName(char *tFileName);
|
||||
nsFileSpec *nsMsgCreateTempFileSpec(const char *tFileName);
|
||||
char *nsMsgCreateTempFileName(const char *tFileName);
|
||||
|
||||
|
||||
//
|
||||
|
|
|
@ -813,7 +813,7 @@ nsresult nsMsgCompose::_SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *ide
|
|||
PRBool newBody = PR_FALSE;
|
||||
char *bodyString = (char *)m_compFields->GetBody();
|
||||
PRInt32 bodyLength;
|
||||
char *attachment1_type = TEXT_HTML; // we better be "text/html" at this point
|
||||
const char attachment1_type[] = TEXT_HTML; // we better be "text/html" at this point
|
||||
|
||||
if (!entityConversionDone)
|
||||
{
|
||||
|
|
|
@ -645,7 +645,7 @@ PRInt32 nsIMAPBodypart::GenerateEmptyFilling(PRBool stream, PRBool prefetch)
|
|||
if (prefetch)
|
||||
return 0; // don't need to prefetch anything
|
||||
|
||||
char *emptyString = "This body part will be downloaded on demand.";
|
||||
const char emptyString[] = "This body part will be downloaded on demand.";
|
||||
// XP_GetString(MK_IMAP_EMPTY_MIME_PART); ### need to be able to localize
|
||||
if (emptyString)
|
||||
{
|
||||
|
|
|
@ -2041,9 +2041,7 @@ nsresult nsImapIncomingServer::GetStringBundle()
|
|||
nsresult res;
|
||||
if (!m_stringBundle)
|
||||
{
|
||||
char* propertyURL = NULL;
|
||||
|
||||
propertyURL = IMAP_MSGS_URL;
|
||||
static const char propertyURL[] = IMAP_MSGS_URL;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &res);
|
||||
if (NS_SUCCEEDED(res) && (nsnull != sBundleService))
|
||||
|
|
|
@ -626,7 +626,7 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer)
|
|||
|
||||
ClearFlag(IMAP_CONNECTION_IS_OPEN);
|
||||
PRBool isSecure = PR_FALSE;
|
||||
char *connectionType = nsnull;
|
||||
const char *connectionType = nsnull;
|
||||
|
||||
if (NS_SUCCEEDED(server->GetIsSecure(&isSecure)) && isSecure)
|
||||
connectionType = "ssl-forcehandshake";
|
||||
|
@ -2508,7 +2508,7 @@ nsImapProtocol::FetchMessage(const char * messageIds,
|
|||
|
||||
case kEveryThingRFC822Peek:
|
||||
{
|
||||
char *formatString = "";
|
||||
const char *formatString = "";
|
||||
PRUint32 server_capabilityFlags = GetServerStateParser().GetCapabilityFlag();
|
||||
|
||||
GetServerStateParser().SetFetchingEverythingRFC822(PR_TRUE);
|
||||
|
@ -3387,11 +3387,11 @@ void nsImapProtocol::Log(const char *logSubName, const char *extraInfo, const ch
|
|||
{
|
||||
if (PR_LOG_TEST(IMAP, PR_LOG_ALWAYS))
|
||||
{
|
||||
static char *nonAuthStateName = "NA";
|
||||
static char *authStateName = "A";
|
||||
static char *selectedStateName = "S";
|
||||
// static char *waitingStateName = "W";
|
||||
char *stateName = NULL;
|
||||
static const char nonAuthStateName[] = "NA";
|
||||
static const char authStateName[] = "A";
|
||||
static const char selectedStateName[] = "S";
|
||||
// static const char waitingStateName[] = "W";
|
||||
const char *stateName = NULL;
|
||||
const char *hostName = GetImapHostName(); // initilize to empty string
|
||||
switch (GetServerStateParser().GetIMAPstate())
|
||||
{
|
||||
|
@ -4239,7 +4239,7 @@ nsImapProtocol::Store(const char * messageList, const char * messageData,
|
|||
{
|
||||
IncrementCommandTagNumber();
|
||||
|
||||
char *formatString;
|
||||
const char *formatString;
|
||||
if (idsAreUid)
|
||||
formatString = "%s uid store %s %s\015\012";
|
||||
else
|
||||
|
|
|
@ -58,7 +58,7 @@ nsIStringBundle *nsImportStringBundle::GetStringBundle( void)
|
|||
return( m_pBundle);
|
||||
|
||||
nsresult rv;
|
||||
char* propertyURL = IMPORT_MSGS_URL;
|
||||
const char propertyURL[] = IMPORT_MSGS_URL;
|
||||
nsIStringBundle* sBundle = nsnull;
|
||||
|
||||
|
||||
|
|
|
@ -536,7 +536,7 @@ nsresult nsTextAddress::ProcessLine( const char *pLine, PRInt32 len, nsString& e
|
|||
|
||||
// Some common ldif fields, it an ldif file has NONE of these entries
|
||||
// then it is most likely NOT an ldif file!
|
||||
static char *sLDIFFields[] = {
|
||||
static const char *const sLDIFFields[] = {
|
||||
"objectclass",
|
||||
"sn",
|
||||
"dn",
|
||||
|
|
|
@ -40,7 +40,7 @@ nsIStringBundle *nsTextStringBundle::GetStringBundle( void)
|
|||
return( m_pBundle);
|
||||
|
||||
nsresult rv;
|
||||
char* propertyURL = TEXT_MSGS_URL;
|
||||
static const char propertyURL[] = TEXT_MSGS_URL;
|
||||
nsIStringBundle* sBundle = nsnull;
|
||||
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ net_pop3_write_state(Pop3UidlHost* host, nsIFileSpec *mailDirectory)
|
|||
|
||||
nsOutputFileStream outFileStream(fileSpec, PR_WRONLY | PR_CREATE_FILE |
|
||||
PR_TRUNCATE);
|
||||
char* tmpBuffer =
|
||||
const char tmpBuffer[] =
|
||||
"# POP3 State File" MSG_LINEBREAK
|
||||
"# This is a generated file! Do not edit." MSG_LINEBREAK
|
||||
MSG_LINEBREAK;
|
||||
|
|
|
@ -70,9 +70,7 @@ nsCOMPtr<nsIStringBundle> stringBundle = nsnull;
|
|||
|
||||
if (!stringBundle)
|
||||
{
|
||||
char* propertyURL = NULL;
|
||||
|
||||
propertyURL = SMIME_PROPERTIES_URL;
|
||||
static const char propertyURL[] = SMIME_PROPERTIES_URL;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService =
|
||||
do_GetService(kStringBundleServiceCID, &res);
|
||||
|
|
|
@ -209,9 +209,7 @@ nsMimeBaseEmitter::MimeGetStringByName(const char *aHeaderName)
|
|||
|
||||
if (!m_stringBundle)
|
||||
{
|
||||
char* propertyURL = NULL;
|
||||
|
||||
propertyURL = MIME_URL;
|
||||
static const char propertyURL[] = MIME_URL;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService =
|
||||
do_GetService(kStringBundleServiceCID, &res);
|
||||
|
|
|
@ -625,8 +625,8 @@ nsMimeXULEmitter::DumpRestOfHeaders()
|
|||
|
||||
if (userAgent)
|
||||
{
|
||||
char *compVal = "Mozilla 5.0";
|
||||
if (!nsCRT::strncasecmp(userAgent, compVal, nsCRT::strlen(compVal)))
|
||||
const char compVal[] = "Mozilla 5.0";
|
||||
if (!nsCRT::strncasecmp(userAgent, compVal, sizeof(compVal) - 1))
|
||||
{
|
||||
UtilityWriteCRLF("<toolbar>");
|
||||
UtilityWriteCRLF("<box name=\"header-seamonkey\" align=\"vertical\" flex=\"1\">");
|
||||
|
|
|
@ -1126,7 +1126,7 @@ static void intl_copy_uncoded_header(char **output, const char *input,
|
|||
}
|
||||
}
|
||||
|
||||
static char *especials = "()<>@,;:\\\"/[]?.=";
|
||||
static const char especials[] = "()<>@,;:\\\"/[]?.=";
|
||||
|
||||
static
|
||||
char *intl_decode_mime_part2_str(const char *header,
|
||||
|
|
|
@ -101,7 +101,7 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
|||
// on the local machine. Caller must free memory
|
||||
//
|
||||
nsFileSpec *
|
||||
nsMsgCreateTempFileSpec(char *tFileName)
|
||||
nsMsgCreateTempFileSpec(const char *tFileName)
|
||||
{
|
||||
//Calling NS_MsgHashIfNecessary so that when Replies are forwarded - the ':' in the subject line doesn't cause problems
|
||||
nsFileSpec *tmpSpec = new nsFileSpec(nsSpecialSystemDirectory(nsSpecialSystemDirectory::OS_TemporaryDirectory));
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
//
|
||||
// External Defines...
|
||||
//
|
||||
extern nsFileSpec *nsMsgCreateTempFileSpec(char *tFileName);
|
||||
extern nsFileSpec *nsMsgCreateTempFileSpec(const char *tFileName);
|
||||
|
||||
#define MIME_SUPERCLASS mimeMultipartClass
|
||||
MimeDefClass(MimeMultipartRelated, MimeMultipartRelatedClass,
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
//
|
||||
// External Defines...
|
||||
//
|
||||
extern nsFileSpec *nsMsgCreateTempFileSpec(char *tFileName);
|
||||
extern nsFileSpec *nsMsgCreateTempFileSpec(const char *tFileName);
|
||||
|
||||
/* See mimepbuf.h for a description of the mission of this file.
|
||||
|
||||
|
|
|
@ -876,7 +876,7 @@ nsStreamConverter::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
|
|||
if (mWrapperOutput)
|
||||
{
|
||||
char outBuf[1024];
|
||||
char *output = "\
|
||||
const char output[] = "\
|
||||
<HTML>\
|
||||
<FRAMESET ROWS=\"30%%,70%%\">\
|
||||
<FRAME NAME=messageHeader SRC=\"%s?header=only\">\
|
||||
|
|
|
@ -208,7 +208,7 @@ if (NNTP==NULL) \
|
|||
NNTP = PR_NewLogModule("NNTP"); \
|
||||
PR_LOG(NNTP, out, ("(%p) %s",this, buf)) ;
|
||||
|
||||
char *stateLabels[] = {
|
||||
const char *const stateLabels[] = {
|
||||
"NNTP_RESPONSE",
|
||||
#ifdef BLOCK_UNTIL_AVAILABLE_CONNECTION
|
||||
"NNTP_BLOCK_UNTIL_CONNECTIONS_ARE_AVAILABLE",
|
||||
|
|
|
@ -49,10 +49,9 @@ NS_IMETHODIMP nsCNullSecurityContext::GetOrigin(char* buf, int len)
|
|||
if (buf == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
char* origin = "file:///";
|
||||
PRInt32 originLen = (PRInt32) nsCRT::strlen(origin);
|
||||
const char origin[] = "file:///";
|
||||
PRInt32 originLen = (PRInt32) (sizeof(origin) - 1);
|
||||
if (len <= originLen) {
|
||||
nsCRT::free(origin);
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
// Copy origin
|
||||
|
|
|
@ -221,8 +221,7 @@ static void LoadExtraSharedLibs()
|
|||
if (!sonameList) {
|
||||
// pref is not set, lets use hardcoded list
|
||||
prefSonameListIsSet = PR_FALSE;
|
||||
sonameList = DEFAULT_EXTRA_LIBS_LIST;
|
||||
sonameList = PL_strdup(sonameList);
|
||||
sonameList = PL_strdup(DEFAULT_EXTRA_LIBS_LIST);
|
||||
}
|
||||
if (sonameList) {
|
||||
char *arrayOfLibs[PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS] = {0};
|
||||
|
|
|
@ -781,7 +781,7 @@ nsSocketTransportService::GetNeckoStringByName (const char *aName, PRUnichar **a
|
|||
nsAutoString resultString; resultString.AssignWithConversion(aName);
|
||||
|
||||
if (!m_stringBundle) {
|
||||
char* propertyURL = NECKO_MSGS_URL;
|
||||
const char propertyURL[] = NECKO_MSGS_URL;
|
||||
// make sure that we get this service on the UI thread.
|
||||
NS_WITH_PROXIED_SERVICE(nsIStringBundleService, sBundleService, kStringBundleServiceCID,
|
||||
NS_UI_THREAD_EVENTQ, &res);
|
||||
|
|
|
@ -255,7 +255,7 @@ static PRUint32 g_StreamConverterCount = 16;
|
|||
static PRUint32 g_StreamConverterCount = 15;
|
||||
#endif
|
||||
|
||||
static char *g_StreamConverterArray[] = {
|
||||
static const char *const g_StreamConverterArray[] = {
|
||||
FTP_UNIX_TO_INDEX,
|
||||
FTP_NT_TO_INDEX,
|
||||
FTP_OS2_TO_INDEX,
|
||||
|
|
|
@ -1475,7 +1475,7 @@ nsFtpState::S_pasv() {
|
|||
}
|
||||
|
||||
|
||||
char * string;
|
||||
const char * string;
|
||||
if (mIPv6ServerAddress)
|
||||
string = "EPSV" CRLF;
|
||||
else
|
||||
|
|
|
@ -1996,7 +1996,7 @@ nsHttpChannel::GetReferrer(nsIURI **referrer)
|
|||
|
||||
#define numInvalidReferrerSchemes 8
|
||||
|
||||
static char * invalidReferrerSchemes [numInvalidReferrerSchemes] =
|
||||
static const char *const invalidReferrerSchemes [numInvalidReferrerSchemes] =
|
||||
{
|
||||
"chrome",
|
||||
"resource",
|
||||
|
|
|
@ -169,7 +169,7 @@ main(int argc, char* argv[])
|
|||
// in other modules (necko converters for example).
|
||||
|
||||
PRUint32 converterListSize = 7;
|
||||
char *converterList[] = {
|
||||
const char *const converterList[] = {
|
||||
"?from=a/foo&to=b/foo",
|
||||
"?from=b/foo&to=c/foo",
|
||||
"?from=b/foo&to=d/foo",
|
||||
|
|
|
@ -238,7 +238,7 @@ Consumer::Validate(nsIRequest* request, nsISupports *aContext) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult StartLoad(char *);
|
||||
nsresult StartLoad(const char *);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -299,7 +299,7 @@ int main(int argc, char *argv[]) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult StartLoad(char *aURISpec) {
|
||||
nsresult StartLoad(const char *aURISpec) {
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// create a context
|
||||
|
|
|
@ -602,7 +602,7 @@ main(int argc, char* argv[])
|
|||
/// }
|
||||
|
||||
PRBool bIsAsync = PR_TRUE;
|
||||
char* hostName = nsnull;
|
||||
const char* hostName = nsnull;
|
||||
int i;
|
||||
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
|||
static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
|
||||
static NS_DEFINE_IID(kClassIID, NS_IOTHERHTML_DTD_IID);
|
||||
static NS_DEFINE_IID(kParserServiceCID, NS_PARSERSERVICE_CID);
|
||||
static char* kVerificationDir = "c:/temp";
|
||||
static const char kVerificationDir[] = "c:/temp";
|
||||
|
||||
|
||||
#ifdef ENABLE_CRC
|
||||
|
|
|
@ -232,7 +232,7 @@ enum {
|
|||
VIEW_SOURCE_MARKUPDECLARATION = 12
|
||||
};
|
||||
|
||||
static char* kElementClasses[] = {
|
||||
static const char* const kElementClasses[] = {
|
||||
"start-tag",
|
||||
"end-tag",
|
||||
"comment",
|
||||
|
@ -248,7 +248,7 @@ static char* kElementClasses[] = {
|
|||
"markupdeclaration"
|
||||
};
|
||||
|
||||
static char* kBeforeText[] = {
|
||||
static const char* const kBeforeText[] = {
|
||||
"<",
|
||||
"</",
|
||||
"",
|
||||
|
@ -264,7 +264,7 @@ static char* kBeforeText[] = {
|
|||
""
|
||||
};
|
||||
|
||||
static char* kAfterText[] = {
|
||||
static const char* const kAfterText[] = {
|
||||
">",
|
||||
">",
|
||||
"",
|
||||
|
@ -281,7 +281,7 @@ static char* kAfterText[] = {
|
|||
};
|
||||
|
||||
#ifdef DUMP_TO_FILE
|
||||
static char* kDumpFileBeforeText[] = {
|
||||
static const char* const kDumpFileBeforeText[] = {
|
||||
"<",
|
||||
"</",
|
||||
"",
|
||||
|
@ -297,7 +297,7 @@ static char* kDumpFileBeforeText[] = {
|
|||
""
|
||||
};
|
||||
|
||||
static char* kDumpFileAfterText[] = {
|
||||
static const char* const kDumpFileAfterText[] = {
|
||||
">",
|
||||
">",
|
||||
"",
|
||||
|
|
|
@ -1237,7 +1237,7 @@ nsPrefMigration::CreateNewUser5Tree(nsIFileSpec * oldProfilePath, nsIFileSpec *
|
|||
*
|
||||
*--------------------------------------------------------------------------------*/
|
||||
nsresult
|
||||
nsPrefMigration::GetDirFromPref(nsIFileSpec * oldProfilePath, nsIFileSpec * newProfilePath, const char *newDirName, char* pref, nsIFileSpec* newPath, nsIFileSpec* oldPath)
|
||||
nsPrefMigration::GetDirFromPref(nsIFileSpec * oldProfilePath, nsIFileSpec * newProfilePath, const char *newDirName, const char* pref, nsIFileSpec* newPath, nsIFileSpec* oldPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class nsPrefMigration: public nsIPrefMigration
|
|||
nsresult GetDirFromPref(nsIFileSpec* oldProfilePath,
|
||||
nsIFileSpec* newProfilePath,
|
||||
const char* newDirName,
|
||||
char* pref,
|
||||
const char* pref,
|
||||
nsIFileSpec* newPath,
|
||||
nsIFileSpec* oldPath);
|
||||
|
||||
|
|
|
@ -446,7 +446,7 @@ nsNSSComponent::RegisterPSMContentListener()
|
|||
|
||||
/* Table of pref names and SSL cipher ID */
|
||||
typedef struct {
|
||||
char* pref;
|
||||
const char* pref;
|
||||
long id;
|
||||
} CipherPref;
|
||||
|
||||
|
|
|
@ -1156,7 +1156,7 @@ nsViewerApp::CreateRobot(nsBrowserWindow* aWindow)
|
|||
static nsBrowserWindow* gWinData;
|
||||
static int gTop100Pointer = 0;
|
||||
static int gTop100LastPointer = 0;
|
||||
static char * gTop100List[] = {
|
||||
static const char *const gTop100List[] = {
|
||||
"http://www.yahoo.com",
|
||||
"http://www.netscape.com",
|
||||
"http://www.mozilla.org",
|
||||
|
@ -1386,7 +1386,7 @@ PRBool CreateSiteDialog(nsIWidget * aParent)
|
|||
{
|
||||
// Dynamically find the index of the last pointer
|
||||
gTop100LastPointer = 0;
|
||||
char * p;
|
||||
const char * p;
|
||||
do {
|
||||
p = gTop100List[gTop100LastPointer++];
|
||||
} while (p);
|
||||
|
|
|
@ -36,9 +36,9 @@ static NS_DEFINE_IID(kCDragServiceCID, NS_DRAGSERVICE_CID);
|
|||
|
||||
static PRLogModuleInfo *sDragLm = NULL;
|
||||
|
||||
static char *gMimeListType = "application/x-moz-internal-item-list";
|
||||
static char *gMozUrlType = "_NETSCAPE_URL";
|
||||
static char *gTextUriListType = "text/uri-list";
|
||||
static const char gMimeListType[] = "application/x-moz-internal-item-list";
|
||||
static const char gMozUrlType[] = "_NETSCAPE_URL";
|
||||
static const char gTextUriListType[] = "text/uri-list";
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
|
||||
|
@ -776,7 +776,7 @@ nsDragService::GetSourceList(void)
|
|||
GtkTargetList *multiTargetList = 0;
|
||||
GdkAtom listAtom = gdk_atom_intern(gMimeListType, FALSE);
|
||||
GtkTargetEntry target;
|
||||
target.target = gMimeListType;
|
||||
target.target = (gchar*)gMimeListType;
|
||||
target.flags = 0;
|
||||
target.info = listAtom;
|
||||
multiTargetList = gtk_target_list_new(&target, 1);
|
||||
|
|
|
@ -1362,7 +1362,7 @@ nsIMEGtkIC::SetPreeditFont(GdkFont *aFontset) {
|
|||
}
|
||||
|
||||
void
|
||||
nsIMEGtkIC::SetStatusText(char *aText) {
|
||||
nsIMEGtkIC::SetStatusText(const char *aText) {
|
||||
if (!aText) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ class nsIMEGtkIC {
|
|||
GdkIMStyle mInputStyle;
|
||||
GdkFont *GetPreeditFont();
|
||||
char *mStatusText;
|
||||
void SetStatusText(char*);
|
||||
void SetStatusText(const char*);
|
||||
void SetPreeditFont(GdkFont*);
|
||||
void SetStatusFont(GdkFont*);
|
||||
void SetPreeditSpotLocation(unsigned long, unsigned long);
|
||||
|
|
|
@ -42,7 +42,7 @@ Atom nsGtkMozRemoteHelper::sMozResponseAtom = 0;
|
|||
Atom nsGtkMozRemoteHelper::sMozUserAtom = 0;
|
||||
|
||||
// XXX get this dynamically
|
||||
static char *sRemoteVersion = "5.0";
|
||||
static const char sRemoteVersion[] = "5.0";
|
||||
|
||||
void
|
||||
nsGtkMozRemoteHelper::SetupVersion(GdkWindow *aWindow)
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef enum {
|
|||
|
||||
struct nsLookAndFeelIntPref
|
||||
{
|
||||
char* name;
|
||||
const char* name;
|
||||
nsILookAndFeel::nsMetricID id;
|
||||
PRPackedBool isSet;
|
||||
nsLookAndFeelType type;
|
||||
|
@ -64,7 +64,7 @@ struct nsLookAndFeelIntPref
|
|||
|
||||
struct nsLookAndFeelFloatPref
|
||||
{
|
||||
char* name;
|
||||
const char* name;
|
||||
nsILookAndFeel::nsMetricFloatID id;
|
||||
PRPackedBool isSet;
|
||||
nsLookAndFeelType type;
|
||||
|
|
|
@ -144,7 +144,7 @@ nsPersistentProperties::Load(nsIInputStream *aIn)
|
|||
if (c < 0) {
|
||||
break;
|
||||
}
|
||||
char *trimThese = " \t";
|
||||
static const char trimThese[] = " \t";
|
||||
key.Trim(trimThese, PR_FALSE, PR_TRUE);
|
||||
c = Read();
|
||||
nsAutoString value;
|
||||
|
|
|
@ -92,7 +92,7 @@ NS_COM char* nsEscapeCount(
|
|||
return 0;
|
||||
|
||||
int i, extra = 0;
|
||||
char* hexChars = "0123456789ABCDEF";
|
||||
static const char hexChars[] = "0123456789ABCDEF";
|
||||
|
||||
register const unsigned char* src = (const unsigned char *) str;
|
||||
for (i = 0; i < len; i++)
|
||||
|
@ -339,7 +339,7 @@ NS_COM nsresult nsStdEscape(const char* str, PRInt16 mask, nsCString &result)
|
|||
return NS_OK;
|
||||
|
||||
int i = 0;
|
||||
char* hexChars = "0123456789ABCDEF";
|
||||
static const char hexChars[] = "0123456789ABCDEF";
|
||||
int len = PL_strlen(str);
|
||||
PRBool forced = PR_FALSE;
|
||||
|
||||
|
|
|
@ -1,624 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// This file is included by nsFileSpec.cpp, and includes the Unix-specific
|
||||
// implementations.
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include "nsError.h"
|
||||
#include "prio.h" /* for PR_Rename */
|
||||
|
||||
#if defined(_SCO_DS)
|
||||
#define _SVID3 /* for statvfs.h */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STATVFS_H
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_VFS_H
|
||||
#include <sys/vfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
#include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
#include <sys/mount.h>
|
||||
#undef Free
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STATVFS
|
||||
#define STATFS statvfs
|
||||
#else
|
||||
#define STATFS statfs
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 1024 /* Guessing this is okay. Works for SCO. */
|
||||
#endif
|
||||
|
||||
#if defined(__QNX__)
|
||||
#include <unix.h> /* for realpath */
|
||||
#define f_bavail f_bfree
|
||||
extern "C" int truncate(const char *, off_t);
|
||||
#endif
|
||||
|
||||
#if defined(SUNOS4)
|
||||
extern "C" int statfs(char *, struct statfs *);
|
||||
#endif
|
||||
|
||||
#if defined(OSF1)
|
||||
extern "C" int statvfs(const char *, struct statvfs *);
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpecHelpers::Canonify(nsSimpleCharString& ioPath, PRBool inMakeDirs)
|
||||
// Canonify, make absolute, and check whether directories exist
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (ioPath.IsEmpty())
|
||||
return;
|
||||
if (inMakeDirs)
|
||||
{
|
||||
const mode_t mode = 0755;
|
||||
nsFileSpecHelpers::MakeAllDirectories((const char*)ioPath, mode);
|
||||
}
|
||||
|
||||
errno = 0; // needed?
|
||||
|
||||
if (ioPath[0] != '/')
|
||||
{
|
||||
// the ioPath that was passed in is relative. We must cat it to the cwd.
|
||||
char buffer[MAXPATHLEN];
|
||||
|
||||
(void) getcwd(buffer, MAXPATHLEN);
|
||||
|
||||
strcat(buffer, "/");
|
||||
strcat(buffer, ioPath);
|
||||
|
||||
ioPath = buffer;
|
||||
}
|
||||
} // nsFileSpecHelpers::Canonify
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::SetLeafName(const char* inLeafName)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mPath.LeafReplace('/', inLeafName);
|
||||
} // nsFileSpec::SetLeafName
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
char* nsFileSpec::GetLeafName() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return mPath.GetLeaf('/');
|
||||
} // nsFileSpec::GetLeafName
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::Exists() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
return !mPath.IsEmpty() && 0 == stat(mPath, &st);
|
||||
} // nsFileSpec::Exists
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::GetModDate(TimeStamp& outStamp) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
if (!mPath.IsEmpty() && stat(mPath, &st) == 0)
|
||||
outStamp = st.st_mtime;
|
||||
else
|
||||
outStamp = 0;
|
||||
} // nsFileSpec::GetModDate
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRUint32 nsFileSpec::GetFileSize() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
if (!mPath.IsEmpty() && stat(mPath, &st) == 0)
|
||||
return (PRUint32)st.st_size;
|
||||
return 0;
|
||||
} // nsFileSpec::GetFileSize
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsFile() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
return !mPath.IsEmpty() && stat(mPath, &st) == 0 && S_ISREG(st.st_mode);
|
||||
} // nsFileSpec::IsFile
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsDirectory() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
return !mPath.IsEmpty() && 0 == stat(mPath, &st) && S_ISDIR(st.st_mode);
|
||||
} // nsFileSpec::IsDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsHidden() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
PRBool hidden = PR_FALSE;
|
||||
char *leafname = GetLeafName();
|
||||
if (nsnull != leafname)
|
||||
{
|
||||
// rjc: don't return ".", "..", or any file/directory that begins with a "."
|
||||
|
||||
/* if ((!strcmp(leafname, ".")) || (!strcmp(leafname, ".."))) */
|
||||
if (leafname[0] == '.')
|
||||
{
|
||||
hidden = PR_TRUE;
|
||||
}
|
||||
nsCRT::free(leafname);
|
||||
}
|
||||
return hidden;
|
||||
} // nsFileSpec::IsHidden
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsSymlink() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
if (!mPath.IsEmpty() && stat(mPath, &st) == 0 && S_ISLNK(st.st_mode))
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
} // nsFileSpec::IsSymlink
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::ResolveSymlink(PRBool& wasAliased)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
wasAliased = PR_FALSE;
|
||||
|
||||
char resolvedPath[MAXPATHLEN];
|
||||
int charCount = readlink(mPath, (char*)&resolvedPath, MAXPATHLEN);
|
||||
if (0 < charCount)
|
||||
{
|
||||
if (MAXPATHLEN > charCount)
|
||||
resolvedPath[charCount] = '\0';
|
||||
|
||||
wasAliased = PR_TRUE;
|
||||
|
||||
/* if it's not an absolute path,
|
||||
replace the leaf with what got resolved */
|
||||
if (resolvedPath[0] != '/') {
|
||||
SetLeafName(resolvedPath);
|
||||
}
|
||||
else {
|
||||
mPath = (char*)&resolvedPath;
|
||||
}
|
||||
|
||||
char* canonicalPath = realpath((const char *)mPath, resolvedPath);
|
||||
NS_ASSERTION(canonicalPath, "realpath failed");
|
||||
if (canonicalPath) {
|
||||
mPath = (char*)&resolvedPath;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
} // nsFileSpec::ResolveSymlink
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
outSpec.mPath = mPath;
|
||||
char* chars = (char*)outSpec.mPath;
|
||||
chars[outSpec.mPath.Length() - 1] = '\0'; // avoid trailing separator, if any
|
||||
char* cp = strrchr(chars, '/');
|
||||
if (cp++)
|
||||
outSpec.mPath.SetLength(cp - chars); // truncate.
|
||||
} // nsFileSpec::GetParent
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator += (const char* inRelativePath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
NS_ASSERTION(inRelativePath, "Attempt to do += with a null string");
|
||||
|
||||
if (!inRelativePath || mPath.IsEmpty())
|
||||
return;
|
||||
|
||||
char endChar = mPath[(int)(strlen(mPath) - 1)];
|
||||
if (endChar == '/')
|
||||
mPath += "x";
|
||||
else
|
||||
mPath += "/x";
|
||||
SetLeafName(inRelativePath);
|
||||
} // nsFileSpec::operator +=
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::CreateDirectory(int mode)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// Note that mPath is canonical!
|
||||
if (mPath.IsEmpty())
|
||||
return;
|
||||
mkdir(mPath, mode);
|
||||
} // nsFileSpec::CreateDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::Delete(PRBool inRecursive) const
|
||||
// To check if this worked, call Exists() afterwards, see?
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (IsDirectory())
|
||||
{
|
||||
if (inRecursive)
|
||||
{
|
||||
for (nsDirectoryIterator i(*this, PR_FALSE); i.Exists(); i++)
|
||||
{
|
||||
nsFileSpec& child = (nsFileSpec&)i;
|
||||
child.Delete(inRecursive);
|
||||
}
|
||||
}
|
||||
rmdir(mPath);
|
||||
}
|
||||
else if (!mPath.IsEmpty())
|
||||
remove(mPath);
|
||||
} // nsFileSpec::Delete
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::RecursiveCopy(nsFileSpec newDir) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (IsDirectory())
|
||||
{
|
||||
if (!(newDir.Exists()))
|
||||
{
|
||||
newDir.CreateDirectory();
|
||||
}
|
||||
|
||||
for (nsDirectoryIterator i(*this, PR_FALSE); i.Exists(); i++)
|
||||
{
|
||||
nsFileSpec& child = (nsFileSpec&)i;
|
||||
|
||||
if (child.IsDirectory())
|
||||
{
|
||||
nsFileSpec tmpDirSpec(newDir);
|
||||
|
||||
char *leafname = child.GetLeafName();
|
||||
tmpDirSpec += leafname;
|
||||
nsCRT::free(leafname);
|
||||
|
||||
child.RecursiveCopy(tmpDirSpec);
|
||||
}
|
||||
else
|
||||
{
|
||||
child.RecursiveCopy(newDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!mPath.IsEmpty())
|
||||
{
|
||||
nsFileSpec& filePath = (nsFileSpec&) *this;
|
||||
|
||||
if (!(newDir.Exists()))
|
||||
{
|
||||
newDir.CreateDirectory();
|
||||
}
|
||||
|
||||
filePath.CopyToDir(newDir);
|
||||
}
|
||||
} // nsFileSpec::RecursiveCopy
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Truncate(PRInt32 offset) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char* Path = nsCRT::strdup(mPath);
|
||||
|
||||
int rv = truncate(Path, offset) ;
|
||||
|
||||
nsCRT::free(Path) ;
|
||||
|
||||
if(!rv)
|
||||
return NS_OK ;
|
||||
else
|
||||
return NS_ERROR_FAILURE ;
|
||||
} // nsFileSpec::Truncate
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Rename(const char* inNewName)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
NS_ASSERTION(inNewName, "Attempt to Rename with a null string");
|
||||
|
||||
// This function should not be used to move a file on disk.
|
||||
if (mPath.IsEmpty() || strchr(inNewName, '/'))
|
||||
return NS_FILE_FAILURE;
|
||||
|
||||
char* oldPath = nsCRT::strdup(mPath);
|
||||
|
||||
SetLeafName(inNewName);
|
||||
|
||||
if (PR_Rename(oldPath, mPath) != NS_OK)
|
||||
{
|
||||
// Could not rename, set back to the original.
|
||||
mPath = oldPath;
|
||||
return NS_FILE_FAILURE;
|
||||
}
|
||||
|
||||
nsCRT::free(oldPath);
|
||||
|
||||
return NS_OK;
|
||||
} // nsFileSpec::Rename
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
static int CrudeFileCopy(const char* in, const char* out)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat in_stat;
|
||||
int stat_result = -1;
|
||||
|
||||
char buf [1024];
|
||||
FILE *ifp, *ofp;
|
||||
int rbytes, wbytes;
|
||||
|
||||
if (!in || !out)
|
||||
return -1;
|
||||
|
||||
stat_result = stat (in, &in_stat);
|
||||
|
||||
ifp = fopen (in, "r");
|
||||
if (!ifp)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
ofp = fopen (out, "w");
|
||||
if (!ofp)
|
||||
{
|
||||
fclose (ifp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((rbytes = fread (buf, 1, sizeof(buf), ifp)) > 0)
|
||||
{
|
||||
while (rbytes > 0)
|
||||
{
|
||||
if ( (wbytes = fwrite (buf, 1, rbytes, ofp)) < 0 )
|
||||
{
|
||||
fclose (ofp);
|
||||
fclose (ifp);
|
||||
unlink(out);
|
||||
return -1;
|
||||
}
|
||||
rbytes -= wbytes;
|
||||
}
|
||||
}
|
||||
fclose (ofp);
|
||||
fclose (ifp);
|
||||
|
||||
if (stat_result == 0)
|
||||
chmod (out, in_stat.st_mode & 0777);
|
||||
|
||||
return 0;
|
||||
} // nsFileSpec::Rename
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::CopyToDir(const nsFileSpec& inParentDirectory) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// We can only copy into a directory, and (for now) can not copy entire directories
|
||||
nsresult result = NS_FILE_FAILURE;
|
||||
|
||||
if (inParentDirectory.IsDirectory() && (! IsDirectory() ) )
|
||||
{
|
||||
char *leafname = GetLeafName();
|
||||
nsSimpleCharString destPath(inParentDirectory.GetCString());
|
||||
destPath += "/";
|
||||
destPath += leafname;
|
||||
nsCRT::free(leafname);
|
||||
result = NS_FILE_RESULT(CrudeFileCopy(GetCString(), destPath));
|
||||
}
|
||||
return result;
|
||||
} // nsFileSpec::CopyToDir
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::MoveToDir(const nsFileSpec& inNewParentDirectory)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// We can only copy into a directory, and (for now) can not copy entire directories
|
||||
nsresult result = NS_FILE_FAILURE;
|
||||
|
||||
if (inNewParentDirectory.IsDirectory() && !IsDirectory())
|
||||
{
|
||||
char *leafname = GetLeafName();
|
||||
nsSimpleCharString destPath(inNewParentDirectory.GetCString());
|
||||
destPath += "/";
|
||||
destPath += leafname;
|
||||
nsCRT::free(leafname);
|
||||
|
||||
result = NS_FILE_RESULT(CrudeFileCopy(GetCString(), (const char*)destPath));
|
||||
if (result == NS_OK)
|
||||
{
|
||||
// cast to fix const-ness
|
||||
((nsFileSpec*)this)->Delete(PR_FALSE);
|
||||
|
||||
*this = inNewParentDirectory + GetLeafName();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Execute(const char* inArgs ) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsresult result = NS_FILE_FAILURE;
|
||||
|
||||
if (!mPath.IsEmpty() && !IsDirectory())
|
||||
{
|
||||
nsSimpleCharString fileNameWithArgs = mPath + " " + inArgs;
|
||||
result = NS_FILE_RESULT(system(fileNameWithArgs));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
} // nsFileSpec::Execute
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRInt64 nsFileSpec::GetDiskSpaceAvailable() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
PRInt64 bytes; /* XXX dougt needs to fix this */
|
||||
LL_I2L(bytes , LONG_MAX); // initialize to all the space in the world?
|
||||
|
||||
|
||||
#if defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_STATVFS_H)
|
||||
|
||||
char curdir [MAXPATHLEN];
|
||||
if (mPath.IsEmpty())
|
||||
{
|
||||
(void) getcwd(curdir, MAXPATHLEN);
|
||||
if (!curdir)
|
||||
return bytes; /* hope for the best as we did in cheddar */
|
||||
}
|
||||
else
|
||||
sprintf(curdir, "%.200s", (const char*)mPath);
|
||||
|
||||
struct STATFS fs_buf;
|
||||
#if defined(__QNX__) && !defined(HAVE_STATVFS) /* Maybe this should be handled differently? */
|
||||
if (STATFS(curdir, &fs_buf, 0, 0) < 0)
|
||||
#else
|
||||
if (STATFS(curdir, &fs_buf) < 0)
|
||||
#endif
|
||||
return bytes; /* hope for the best as we did in cheddar */
|
||||
|
||||
#ifdef DEBUG_DISK_SPACE
|
||||
printf("DiskSpaceAvailable: %d bytes\n",
|
||||
fs_buf.f_bsize * (fs_buf.f_bavail - 1));
|
||||
#endif
|
||||
|
||||
PRInt64 bsize,bavail;
|
||||
LL_I2L( bsize, fs_buf.f_bsize );
|
||||
LL_I2L( bavail, fs_buf.f_bavail - 1 );
|
||||
LL_MUL( bytes, bsize, bavail );
|
||||
return bytes;
|
||||
|
||||
#else
|
||||
/*
|
||||
** This platform doesn't have statfs or statvfs, so we don't have much
|
||||
** choice but to "hope for the best as we did in cheddar".
|
||||
*/
|
||||
return bytes;
|
||||
#endif /* HAVE_SYS_STATFS_H or HAVE_SYS_STATVFS_H */
|
||||
|
||||
} // nsFileSpec::GetDiskSpace()
|
||||
|
||||
//========================================================================================
|
||||
// nsDirectoryIterator
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsDirectoryIterator::nsDirectoryIterator(const nsFileSpec& inDirectory, PRBool resolveSymLinks)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mCurrent(inDirectory)
|
||||
, mExists(PR_FALSE)
|
||||
, mResoveSymLinks(resolveSymLinks)
|
||||
, mStarting(inDirectory)
|
||||
, mDir(nsnull)
|
||||
|
||||
{
|
||||
mStarting += "sysygy"; // save off the starting directory
|
||||
mCurrent += "sysygy"; // prepare the path for SetLeafName
|
||||
mDir = opendir((const char*)nsFilePath(inDirectory));
|
||||
++(*this);
|
||||
} // nsDirectoryIterator::nsDirectoryIterator
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsDirectoryIterator::~nsDirectoryIterator()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (mDir)
|
||||
closedir(mDir);
|
||||
} // nsDirectoryIterator::nsDirectoryIterator
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsDirectoryIterator& nsDirectoryIterator::operator ++ ()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mExists = PR_FALSE;
|
||||
if (!mDir)
|
||||
return *this;
|
||||
char* dot = ".";
|
||||
char* dotdot = "..";
|
||||
struct dirent* entry = readdir(mDir);
|
||||
if (entry && strcmp(entry->d_name, dot) == 0)
|
||||
entry = readdir(mDir);
|
||||
if (entry && strcmp(entry->d_name, dotdot) == 0)
|
||||
entry = readdir(mDir);
|
||||
if (entry)
|
||||
{
|
||||
mExists = PR_TRUE;
|
||||
mCurrent = mStarting; // restore mCurrent to be the starting directory. ResolveSymlink() may have taken us to another directory
|
||||
mCurrent.SetLeafName(entry->d_name);
|
||||
if (mResoveSymLinks)
|
||||
{
|
||||
PRBool ignore;
|
||||
mCurrent.ResolveSymlink(ignore);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
} // nsDirectoryIterator::operator ++
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsDirectoryIterator& nsDirectoryIterator::operator -- ()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return ++(*this); // can't do it backwards.
|
||||
} // nsDirectoryIterator::operator --
|
|
@ -56,7 +56,7 @@
|
|||
----------------------------------------------------------------------------*/
|
||||
static const char* GetLinebreakString(nsLinebreakConverter::ELinebreakType aBreakType)
|
||||
{
|
||||
static char* sLinebreaks[] = {
|
||||
static const char* const sLinebreaks[] = {
|
||||
"", // any
|
||||
NS_LINEBREAK, // platform
|
||||
LFSTR, // content
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче