зеркало из https://github.com/mozilla/gecko-dev.git
Fixes bug 71397. s/r=waterson@netscape.com
This commit is contained in:
Родитель
61b5f3beff
Коммит
f667808665
|
@ -104,6 +104,10 @@ nsFileIO::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsFileIO::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm)
|
nsFileIO::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm)
|
||||||
{
|
{
|
||||||
|
NS_ASSERTION(file, "File must not be null");
|
||||||
|
if (file == nsnull)
|
||||||
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
|
||||||
mFile = file;
|
mFile = file;
|
||||||
mIOFlags = ioFlags;
|
mIOFlags = ioFlags;
|
||||||
mPerm = perm;
|
mPerm = perm;
|
||||||
|
@ -125,6 +129,10 @@ nsFileIO::GetFile(nsIFile* *aFile)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsFileIO::Open(char **contentType, PRInt32 *contentLength)
|
nsFileIO::Open(char **contentType, PRInt32 *contentLength)
|
||||||
{
|
{
|
||||||
|
NS_ASSERTION(mFile, "File must not be null");
|
||||||
|
if (mFile == nsnull)
|
||||||
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
|
||||||
// don't actually open the file here -- we'll do it on demand in the
|
// don't actually open the file here -- we'll do it on demand in the
|
||||||
// GetInputStream/GetOutputStream methods
|
// GetInputStream/GetOutputStream methods
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
@ -188,6 +196,10 @@ nsFileIO::Close(nsresult status)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsFileIO::GetInputStream(nsIInputStream * *aInputStream)
|
nsFileIO::GetInputStream(nsIInputStream * *aInputStream)
|
||||||
{
|
{
|
||||||
|
NS_ASSERTION(mFile, "File must not be null");
|
||||||
|
if (mFile == nsnull)
|
||||||
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
PRBool isDir;
|
PRBool isDir;
|
||||||
rv = mFile->IsDirectory(&isDir);
|
rv = mFile->IsDirectory(&isDir);
|
||||||
|
@ -224,6 +236,10 @@ nsFileIO::GetInputStream(nsIInputStream * *aInputStream)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsFileIO::GetOutputStream(nsIOutputStream * *aOutputStream)
|
nsFileIO::GetOutputStream(nsIOutputStream * *aOutputStream)
|
||||||
{
|
{
|
||||||
|
NS_ASSERTION(mFile, "File must not be null");
|
||||||
|
if (mFile == nsnull)
|
||||||
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
PRBool isDir;
|
PRBool isDir;
|
||||||
rv = mFile->IsDirectory(&isDir);
|
rv = mFile->IsDirectory(&isDir);
|
||||||
|
@ -257,6 +273,10 @@ nsFileIO::GetOutputStream(nsIOutputStream * *aOutputStream)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsFileIO::GetName(char* *aName)
|
nsFileIO::GetName(char* *aName)
|
||||||
{
|
{
|
||||||
|
NS_ASSERTION(mFile, "File must not be null");
|
||||||
|
if (mFile == nsnull)
|
||||||
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
|
||||||
return mFile->GetPath(aName);
|
return mFile->GetPath(aName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1920,6 +1920,8 @@ nsSocketBOS::Write(const char *aBuf, PRUint32 aCount, PRUint32 *aBytesWritten)
|
||||||
|
|
||||||
tryWrite:
|
tryWrite:
|
||||||
total = PR_Write(mSock, aBuf, aCount);
|
total = PR_Write(mSock, aBuf, aCount);
|
||||||
|
LOG(("nsSocketBOS PR_Write [this=%x] wrote %d\n", this, total));
|
||||||
|
|
||||||
if (total < 0) {
|
if (total < 0) {
|
||||||
if (PR_GetError() == PR_WOULD_BLOCK_ERROR) {
|
if (PR_GetError() == PR_WOULD_BLOCK_ERROR) {
|
||||||
//
|
//
|
||||||
|
@ -1933,6 +1935,7 @@ tryWrite:
|
||||||
LOG(("nsSocketBOS::Write [this=%x] Poll succeeded; looping back to PR_Write\n", this));
|
LOG(("nsSocketBOS::Write [this=%x] Poll succeeded; looping back to PR_Write\n", this));
|
||||||
goto tryWrite;
|
goto tryWrite;
|
||||||
}
|
}
|
||||||
|
LOG(("nsSocketBOS::Write [this=%x] Write Failed [rv=%x]\n", this, PR_GetError()));
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче