mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-08 14:03:49 +00:00
Bug #6722 -- part of PR_Open removal.
This commit is contained in:
parent
5c158bd9ea
commit
9fdb96a266
@ -2209,11 +2209,13 @@ nsMsgComposeAndSend::ImapAppendAddBccHeadersIfNeeded(URL_Struct *url)
|
||||
post_data = nsMsgCreateTempFileName("nsmail.tmp");
|
||||
if (post_data)
|
||||
{
|
||||
PRFileDesc *dstFile = PR_Open(post_data, PR_WRONLY | PR_CREATE_FILE, 0);
|
||||
if (dstFile)
|
||||
nsFileSpec dstSpec(post_data);
|
||||
nsOutputFileStream dstFile(dstSpec, PR_WRONLY | PR_CREATE_FILE);
|
||||
if (dstFile.is_open())
|
||||
{
|
||||
PRFileDesc *srcFile = PR_Open(m_msg_file_name, PR_RDONLY, 0);
|
||||
if (srcFile)
|
||||
nsFileSpec srcSpec(m_msg_file_name); // mscott - shouldn't we be storing m_msg_file_name as a file spec?
|
||||
nsInputFileStream srcFile(srcSpec);
|
||||
if (srcFile.is_open())
|
||||
{
|
||||
char *tmpBuffer = NULL;
|
||||
int bSize = TEN_K;
|
||||
@ -2227,20 +2229,18 @@ nsMsgComposeAndSend::ImapAppendAddBccHeadersIfNeeded(URL_Struct *url)
|
||||
int bytesRead = 0;
|
||||
if (tmpBuffer)
|
||||
{
|
||||
PR_Write(dstFile, "Bcc: ", 5);
|
||||
PR_Write(dstFile, bcc_headers, PL_strlen(bcc_headers));
|
||||
PR_Write(dstFile, CRLF, PL_strlen(CRLF));
|
||||
bytesRead = PR_Read(srcFile, tmpBuffer, bSize);
|
||||
dstFile << "Bcc: " << bcc_headers << CRLF;
|
||||
bytesRead = srcFile.read(tmpBuffer, bSize);
|
||||
while (bytesRead > 0)
|
||||
{
|
||||
PR_Write(dstFile, tmpBuffer, bytesRead);
|
||||
bytesRead = PR_Read(srcFile, tmpBuffer, bSize);
|
||||
dstFile.write(tmpBuffer, bytesRead);
|
||||
bytesRead = srcFile.read(tmpBuffer, bSize);
|
||||
}
|
||||
PR_Free(tmpBuffer);
|
||||
}
|
||||
PR_Close(srcFile);
|
||||
srcFile.close();
|
||||
}
|
||||
PR_Close(dstFile);
|
||||
dstFile.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "nsMsgEncoders.h"
|
||||
#include "nsMsgI18N.h"
|
||||
#include "nsMsgCompUtils.h"
|
||||
#include "nsFileStream.h"
|
||||
|
||||
#include "MsgCompGlue.h"
|
||||
|
||||
@ -503,7 +504,6 @@ int nsMsgSendPart::Write()
|
||||
{
|
||||
int status = 0;
|
||||
char *separator = 0;
|
||||
PRFileDesc *file = NULL;
|
||||
|
||||
#define PUSHLEN(str, length) \
|
||||
do { \
|
||||
@ -527,21 +527,16 @@ int nsMsgSendPart::Write()
|
||||
m_buffer = (char *) PR_Malloc(sizeof(char) * (length + 1));
|
||||
if (m_buffer)
|
||||
{
|
||||
file = PR_Open(m_filename, PR_RDONLY, 0);
|
||||
if (file)
|
||||
nsInputFileStream file(mySpec);
|
||||
if (file.is_open())
|
||||
{
|
||||
PR_Read(file, m_buffer, length);
|
||||
PR_Close(file);
|
||||
m_buffer[length] = '\0';
|
||||
file = NULL;
|
||||
PR_FREEIF(m_filename);
|
||||
m_filename = NULL;
|
||||
length = file.read(m_buffer, length);
|
||||
file.close();
|
||||
m_buffer[length] = '\0';
|
||||
PR_FREEIF(m_filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
PR_Free(m_buffer);
|
||||
m_buffer = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_buffer)
|
||||
@ -815,8 +810,6 @@ int nsMsgSendPart::Write()
|
||||
|
||||
FAIL:
|
||||
PR_FREEIF(separator);
|
||||
if (file)
|
||||
PR_Close(file);
|
||||
if (m_intlDocToMailConverter) {
|
||||
nsMsgI18NDestroyCharCodeConverter(m_intlDocToMailConverter);
|
||||
m_intlDocToMailConverter = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user