mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
fix uninitialized variable warning, bug 204503, patch by alfredkayser@nl.ibm.com, r+sr=darin
This commit is contained in:
parent
dc195dfd03
commit
e4ebafaa4b
@ -470,44 +470,35 @@ nsJARChannel::GetSecurityInfo(nsISupports **aSecurityInfo)
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentType(nsACString &result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (!mContentType.IsEmpty()) {
|
||||
result = mContentType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// generate content type and set it
|
||||
//
|
||||
if (mJarEntry.IsEmpty()) {
|
||||
LOG(("mJarEntry is empty!\n"));
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
const char *ext = nsnull, *fileName = mJarEntry.get();
|
||||
PRInt32 len = mJarEntry.Length();
|
||||
for (PRInt32 i = len-1; i >= 0; i--) {
|
||||
if (fileName[i] == '.') {
|
||||
ext = &fileName[i + 1];
|
||||
break;
|
||||
if (mContentType.IsEmpty()) {
|
||||
//
|
||||
// generate content type and set it
|
||||
//
|
||||
if (mJarEntry.IsEmpty()) {
|
||||
LOG(("mJarEntry is empty!\n"));
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
if (ext) {
|
||||
nsIMIMEService *mimeServ = gJarHandler->MimeService();
|
||||
if (mimeServ) {
|
||||
nsXPIDLCString mimeType;
|
||||
rv = mimeServ->GetTypeFromExtension(ext, getter_Copies(mimeType));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mContentType = mimeType;
|
||||
|
||||
const char *ext = nsnull, *fileName = mJarEntry.get();
|
||||
PRInt32 len = mJarEntry.Length();
|
||||
for (PRInt32 i = len-1; i >= 0; i--) {
|
||||
if (fileName[i] == '.') {
|
||||
ext = &fileName[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ext) {
|
||||
nsIMIMEService *mimeServ = gJarHandler->MimeService();
|
||||
if (mimeServ) {
|
||||
nsXPIDLCString mimeType;
|
||||
nsresult rv = mimeServ->GetTypeFromExtension(ext, getter_Copies(mimeType));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mContentType = mimeType;
|
||||
}
|
||||
}
|
||||
if (mContentType.IsEmpty())
|
||||
mContentType = NS_LITERAL_CSTRING(UNKNOWN_CONTENT_TYPE);
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
if (NS_FAILED(rv) || mContentType.IsEmpty())
|
||||
mContentType = NS_LITERAL_CSTRING(UNKNOWN_CONTENT_TYPE);
|
||||
|
||||
result = mContentType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -470,44 +470,35 @@ nsJARChannel::GetSecurityInfo(nsISupports **aSecurityInfo)
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentType(nsACString &result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (!mContentType.IsEmpty()) {
|
||||
result = mContentType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// generate content type and set it
|
||||
//
|
||||
if (mJarEntry.IsEmpty()) {
|
||||
LOG(("mJarEntry is empty!\n"));
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
const char *ext = nsnull, *fileName = mJarEntry.get();
|
||||
PRInt32 len = mJarEntry.Length();
|
||||
for (PRInt32 i = len-1; i >= 0; i--) {
|
||||
if (fileName[i] == '.') {
|
||||
ext = &fileName[i + 1];
|
||||
break;
|
||||
if (mContentType.IsEmpty()) {
|
||||
//
|
||||
// generate content type and set it
|
||||
//
|
||||
if (mJarEntry.IsEmpty()) {
|
||||
LOG(("mJarEntry is empty!\n"));
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
if (ext) {
|
||||
nsIMIMEService *mimeServ = gJarHandler->MimeService();
|
||||
if (mimeServ) {
|
||||
nsXPIDLCString mimeType;
|
||||
rv = mimeServ->GetTypeFromExtension(ext, getter_Copies(mimeType));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mContentType = mimeType;
|
||||
|
||||
const char *ext = nsnull, *fileName = mJarEntry.get();
|
||||
PRInt32 len = mJarEntry.Length();
|
||||
for (PRInt32 i = len-1; i >= 0; i--) {
|
||||
if (fileName[i] == '.') {
|
||||
ext = &fileName[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ext) {
|
||||
nsIMIMEService *mimeServ = gJarHandler->MimeService();
|
||||
if (mimeServ) {
|
||||
nsXPIDLCString mimeType;
|
||||
nsresult rv = mimeServ->GetTypeFromExtension(ext, getter_Copies(mimeType));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mContentType = mimeType;
|
||||
}
|
||||
}
|
||||
if (mContentType.IsEmpty())
|
||||
mContentType = NS_LITERAL_CSTRING(UNKNOWN_CONTENT_TYPE);
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
if (NS_FAILED(rv) || mContentType.IsEmpty())
|
||||
mContentType = NS_LITERAL_CSTRING(UNKNOWN_CONTENT_TYPE);
|
||||
|
||||
result = mContentType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user