зеркало из https://github.com/mozilla/pjs.git
More work on AppleDouble - NOT PART OF THE BUILD!!!
This commit is contained in:
Родитель
60e8771870
Коммит
650269aa67
|
@ -171,10 +171,10 @@ int ap_seek_part_start(
|
|||
if (newline[0] == '\0' && p_ap_decode_obj->boundary0 != NULL)
|
||||
return errDone;
|
||||
|
||||
if (!XP_STRNCASECMP(newline, "--", 2))
|
||||
if (!PL_strncasecmp(newline, "--", 2))
|
||||
{
|
||||
/* we meet the start seperator, copy it and it will be our boundary */
|
||||
p_ap_decode_obj->boundary0 = XP_STRDUP(newline+2);
|
||||
p_ap_decode_obj->boundary0 = nsCRT::strdup(newline+2);
|
||||
return errDone;
|
||||
}
|
||||
}
|
||||
|
@ -202,31 +202,31 @@ int ParseFileHeader(
|
|||
/*
|
||||
** we only care about these params.
|
||||
*/
|
||||
if (!XP_STRNCASECMP(param, "Content-Type:", 13))
|
||||
if (!PL_strncasecmp(param, "Content-Type:", 13))
|
||||
{
|
||||
if (!XP_STRNCASECMP(define, MULTIPART_APPLEDOUBLE,
|
||||
if (!PL_strncasecmp(define, MULTIPART_APPLEDOUBLE,
|
||||
nsCRT::strlen(MULTIPART_APPLEDOUBLE)) ||
|
||||
!XP_STRNCASECMP(define, MULTIPART_HEADER_SET,
|
||||
!PL_strncasecmp(define, MULTIPART_HEADER_SET,
|
||||
nsCRT::strlen(MULTIPART_HEADER_SET)))
|
||||
p_ap_decode_obj->messagetype = kAppleDouble;
|
||||
else
|
||||
p_ap_decode_obj->messagetype = kGeneralMine;
|
||||
}
|
||||
else if (!XP_STRNCASECMP(param, "boundary=", 9))
|
||||
else if (!PL_strncasecmp(param, "boundary=", 9))
|
||||
{
|
||||
for (i = 0; *define && *define != '\"'; )
|
||||
p_ap_decode_obj->boundary0[i++] = *define++;
|
||||
|
||||
p_ap_decode_obj->boundary0[i] = '\0';
|
||||
}
|
||||
else if (!XP_STRNCASECMP(param, "Content-Disposition:", 20))
|
||||
else if (!PL_strncasecmp(param, "Content-Disposition:", 20))
|
||||
{
|
||||
if (!XP_STRNCASECMP(define, "inline", 5))
|
||||
if (!PL_strncasecmp(define, "inline", 5))
|
||||
p_ap_decode_obj->deposition = kInline;
|
||||
else
|
||||
p_ap_decode_obj->deposition = kDontCare;
|
||||
}
|
||||
else if (!XP_STRNCASECMP(param, "filename=", 9))
|
||||
else if (!PL_strncasecmp(param, "filename=", 9))
|
||||
{
|
||||
for (i = 0, p=define; *p && *p != '\"'; )
|
||||
p_ap_decode_obj->fname[i++] = *p++;
|
||||
|
@ -255,11 +255,11 @@ int ap_seek_to_boundary(
|
|||
if (status != NOERR)
|
||||
break;
|
||||
|
||||
if ((!XP_STRNCASECMP(buff, "--", 2) &&
|
||||
!XP_STRNCASECMP( buff+2,
|
||||
if ((!PL_strncasecmp(buff, "--", 2) &&
|
||||
!PL_strncasecmp( buff+2,
|
||||
p_ap_decode_obj->boundary0,
|
||||
nsCRT::strlen(p_ap_decode_obj->boundary0)))
|
||||
||!XP_STRNCASECMP( buff,
|
||||
||!PL_strncasecmp( buff,
|
||||
p_ap_decode_obj->boundary0,
|
||||
nsCRT::strlen(p_ap_decode_obj->boundary0)))
|
||||
{
|
||||
|
@ -306,40 +306,40 @@ int ap_parse_header(
|
|||
/*
|
||||
** we only care about these params.
|
||||
*/
|
||||
if (!XP_STRNCASECMP(param, "Content-Type:", 13))
|
||||
if (!PL_strncasecmp(param, "Content-Type:", 13))
|
||||
{
|
||||
if (!XP_STRNCASECMP(define, "application/applefile", 21))
|
||||
if (!PL_strncasecmp(define, "application/applefile", 21))
|
||||
p_ap_decode_obj->which_part = kHeaderPortion;
|
||||
else
|
||||
{
|
||||
p_ap_decode_obj->which_part = kDataPortion;
|
||||
if (!XP_STRNCASECMP(define, "text/plain", 10))
|
||||
if (!PL_strncasecmp(define, "text/plain", 10))
|
||||
p_ap_decode_obj->is_binary = FALSE;
|
||||
else
|
||||
p_ap_decode_obj->is_binary = TRUE;
|
||||
}
|
||||
|
||||
/* Broken QuickMail messages */
|
||||
if (!XP_STRNCASECMP(define, "x-uuencode-apple-single", 23))
|
||||
if (!PL_strncasecmp(define, "x-uuencode-apple-single", 23))
|
||||
p_ap_decode_obj->encoding = kEncodeUU;
|
||||
}
|
||||
else if (!XP_STRNCASECMP(param, "Content-Transfer-Encoding:",26))
|
||||
else if (!PL_strncasecmp(param, "Content-Transfer-Encoding:",26))
|
||||
{
|
||||
if (!XP_STRNCASECMP(define, "base64", 6))
|
||||
if (!PL_strncasecmp(define, "base64", 6))
|
||||
p_ap_decode_obj->encoding = kEncodeBase64;
|
||||
else if (!XP_STRNCASECMP(define, "quoted-printable", 16))
|
||||
else if (!PL_strncasecmp(define, "quoted-printable", 16))
|
||||
p_ap_decode_obj->encoding = kEncodeQP;
|
||||
else
|
||||
p_ap_decode_obj->encoding = kEncodeNone;
|
||||
}
|
||||
else if (!XP_STRNCASECMP(param, "Content-Disposition:", 20))
|
||||
else if (!PL_strncasecmp(param, "Content-Disposition:", 20))
|
||||
{
|
||||
if (!XP_STRNCASECMP(define, "inline", 5))
|
||||
if (!PL_strncasecmp(define, "inline", 5))
|
||||
p_ap_decode_obj->deposition = kInline;
|
||||
else
|
||||
p_ap_decode_obj->deposition = kDontCare;
|
||||
}
|
||||
else if (!XP_STRNCASECMP(param, "filename=", 9))
|
||||
else if (!PL_strncasecmp(param, "filename=", 9))
|
||||
{
|
||||
if (p_ap_decode_obj->fname[0] == '\0')
|
||||
{
|
||||
|
@ -474,7 +474,7 @@ int ap_decode_file_infor(appledouble_decode_object *p_ap_decode_obj)
|
|||
}
|
||||
|
||||
/* P_String version of the file name. */
|
||||
XP_STRCPY((char *)name+1, p_ap_decode_obj->fname);
|
||||
nsCRT::strcpy((char *)name+1, p_ap_decode_obj->fname);
|
||||
name[0] = (char) in_count;
|
||||
|
||||
if (p_ap_decode_obj->write_as_binhex)
|
||||
|
@ -577,7 +577,7 @@ int ap_decode_file_infor(appledouble_decode_object *p_ap_decode_obj)
|
|||
StandardFileReply reply;
|
||||
|
||||
/* convert char* p_ap_decode_obj->fname to a pascal string */
|
||||
XP_STRCPY((char*)filename + 1, p_ap_decode_obj->fname);
|
||||
nsCRT::strcpy((char*)filename + 1, p_ap_decode_obj->fname);
|
||||
filename[0] = nsCRT::strlen(p_ap_decode_obj->fname);
|
||||
|
||||
if( !p_ap_decode_obj->mSpec )
|
||||
|
@ -595,10 +595,10 @@ int ap_decode_file_infor(appledouble_decode_object *p_ap_decode_obj)
|
|||
{
|
||||
reply.sfFile.vRefNum = p_ap_decode_obj->mSpec->vRefNum;
|
||||
reply.sfFile.parID = p_ap_decode_obj->mSpec->parID;
|
||||
XP_MEMCPY(&reply.sfFile.name, p_ap_decode_obj->mSpec->name , 63 );
|
||||
nsCRT::memcpy(&reply.sfFile.name, p_ap_decode_obj->mSpec->name , 63 );
|
||||
}
|
||||
|
||||
XP_MEMCPY(p_ap_decode_obj->fname,
|
||||
nsCRT::memcpy(p_ap_decode_obj->fname,
|
||||
reply.sfFile.name+1,
|
||||
*(reply.sfFile.name)+1);
|
||||
p_ap_decode_obj->fname[*(reply.sfFile.name)] = '\0';
|
||||
|
@ -829,7 +829,7 @@ int ap_decode_process_header(
|
|||
short refNum;
|
||||
|
||||
fname[0] = nsCRT::strlen(p_ap_decode_obj->fname);
|
||||
XP_STRCPY((char*)fname+1, p_ap_decode_obj->fname);
|
||||
nsCRT::strcpy((char*)fname+1, p_ap_decode_obj->fname);
|
||||
|
||||
if (HOpenRF(p_ap_decode_obj->vRefNum,
|
||||
p_ap_decode_obj->dirId,
|
||||
|
@ -946,7 +946,7 @@ int ap_decode_process_data(
|
|||
fspec.vRefNum = p_ap_decode_obj->vRefNum;
|
||||
fspec.parID = p_ap_decode_obj->dirId;
|
||||
fspec.name[0] = nsCRT::strlen(p_ap_decode_obj->fname);
|
||||
XP_STRCPY((char*)fspec.name+1, p_ap_decode_obj->fname);
|
||||
nsCRT::strcpy((char*)fspec.name+1, p_ap_decode_obj->fname);
|
||||
|
||||
filename = my_PathnameFromFSSpec(&fspec);
|
||||
if (p_ap_decode_obj->is_binary)
|
||||
|
@ -1425,11 +1425,11 @@ PRIVATE int from_qp(
|
|||
if (p_ap_decode_obj->pos_inbuff < p_ap_decode_obj->s_inbuff)
|
||||
{
|
||||
if (p_ap_decode_obj->boundary0 &&
|
||||
(!XP_STRNCASECMP(p_ap_decode_obj->pos_inbuff+p_ap_decode_obj->inbuff,
|
||||
(!PL_strncasecmp(p_ap_decode_obj->pos_inbuff+p_ap_decode_obj->inbuff,
|
||||
"--",
|
||||
2)
|
||||
&&
|
||||
!XP_STRNCASECMP(p_ap_decode_obj->pos_inbuff+p_ap_decode_obj->inbuff+2,
|
||||
!PL_strncasecmp(p_ap_decode_obj->pos_inbuff+p_ap_decode_obj->inbuff+2,
|
||||
p_ap_decode_obj->boundary0,
|
||||
nsCRT::strlen(p_ap_decode_obj->boundary0))))
|
||||
{
|
||||
|
@ -1460,7 +1460,7 @@ PRIVATE void ensure_uu_body_state(appledouble_decode_object* p)
|
|||
char *current = &(p->inbuff[p->pos_inbuff]);
|
||||
|
||||
if (p->uu_state == kMainBody && p->uu_starts_line
|
||||
&& !XP_STRNCASECMP(current, "end", PR_MIN(3, end - current)))
|
||||
&& !PL_strncasecmp(current, "end", PR_MIN(3, end - current)))
|
||||
p->uu_state = kEnd;
|
||||
|
||||
while (p->uu_state != kMainBody && (current < end))
|
||||
|
@ -1506,7 +1506,7 @@ PRIVATE void ensure_uu_body_state(appledouble_decode_object* p)
|
|||
*/
|
||||
|
||||
if ((p->uu_state == kWaitingForBegin)
|
||||
&& !XP_STRNCASECMP(current, "begin", PR_MIN(5, end - current)))
|
||||
&& !PL_strncasecmp(current, "begin", PR_MIN(5, end - current)))
|
||||
p->uu_state = kBegin;
|
||||
p->uu_starts_line = FALSE; /* make us advance to next line */
|
||||
}
|
||||
|
@ -1544,7 +1544,7 @@ PRIVATE int fetch_next_char_uu(appledouble_decode_object* p, PRBool newBunch)
|
|||
char *current = &(p->inbuff[p->pos_inbuff]);
|
||||
|
||||
/* Look here for 'end' line signifying end of uuencode body. */
|
||||
if (!XP_STRNCASECMP(current, "end", PR_MIN(3, end - current)))
|
||||
if (!PL_strncasecmp(current, "end", PR_MIN(3, end - current)))
|
||||
{
|
||||
p->uu_state = kEnd; /* set the uuencode state to end */
|
||||
p->pos_inbuff = p->s_inbuff; /* run out the current buffer */
|
||||
|
@ -1755,11 +1755,11 @@ PRIVATE int from_none(
|
|||
if (p_ap_decode_obj->pos_inbuff < p_ap_decode_obj->s_inbuff)
|
||||
{
|
||||
if (p_ap_decode_obj->boundary0 &&
|
||||
(!XP_STRNCASECMP(p_ap_decode_obj->pos_inbuff+p_ap_decode_obj->inbuff,
|
||||
(!PL_strncasecmp(p_ap_decode_obj->pos_inbuff+p_ap_decode_obj->inbuff,
|
||||
"--",
|
||||
2)
|
||||
&&
|
||||
!XP_STRNCASECMP(p_ap_decode_obj->pos_inbuff+p_ap_decode_obj->inbuff+2,
|
||||
!PL_strncasecmp(p_ap_decode_obj->pos_inbuff+p_ap_decode_obj->inbuff+2,
|
||||
p_ap_decode_obj->boundary0,
|
||||
nsCRT::strlen(p_ap_decode_obj->boundary0))))
|
||||
{
|
||||
|
|
|
@ -170,11 +170,11 @@ fe_MakeAppleDoubleEncodeStream (int format_out,
|
|||
|
||||
TRACEMSG(("Setting up apple encode stream. Have URL: %s\n", URL_s->address));
|
||||
|
||||
stream = XP_NEW(NET_StreamClass);
|
||||
stream = new (NET_StreamClass);
|
||||
if(stream == NULL)
|
||||
return(NULL);
|
||||
|
||||
obj = XP_NEW(AppleDoubleEncodeObject);
|
||||
obj = new (AppleDoubleEncodeObject);
|
||||
if (obj == NULL)
|
||||
{
|
||||
PR_FREEIF (stream);
|
||||
|
@ -211,7 +211,7 @@ fe_MakeAppleDoubleEncodeStream (int format_out,
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
obj->fname = XP_STRDUP(dst_filename);
|
||||
obj->fname = nsCRT::strdup(dst_filename);
|
||||
|
||||
obj->buff = working_buff;
|
||||
obj->s_buff = bSize;
|
||||
|
@ -265,7 +265,7 @@ net_AppleDouble_Decode_Write (
|
|||
if (obj->bytes_in_buff + l > 1024)
|
||||
{
|
||||
size = 1024 - obj->bytes_in_buff;
|
||||
XP_MEMCPY(obj->in_buff+obj->bytes_in_buff,
|
||||
nsCRT::memcpy(obj->in_buff+obj->bytes_in_buff,
|
||||
s,
|
||||
size);
|
||||
s += size;
|
||||
|
@ -287,7 +287,7 @@ net_AppleDouble_Decode_Write (
|
|||
else
|
||||
{
|
||||
/* and we are sure we will not get overflow with the buff. */
|
||||
XP_MEMCPY(obj->in_buff+obj->bytes_in_buff,
|
||||
nsCRT::memcpy(obj->in_buff+obj->bytes_in_buff,
|
||||
s,
|
||||
l);
|
||||
obj->bytes_in_buff += l;
|
||||
|
@ -361,7 +361,7 @@ static void
|
|||
simple_copy(MWContext* context, char* saveName, void* closure)
|
||||
{
|
||||
/* just copy the filename to the closure, so the caller can get it. */
|
||||
XP_STRCPY(closure, saveName);
|
||||
nsCRT::strcpy(closure, saveName);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -451,11 +451,11 @@ fe_MakeAppleDoubleDecodeStream (int format_out,
|
|||
|
||||
TRACEMSG(("Setting up apple double decode stream. Have URL: %s\n", URL_s->address));
|
||||
|
||||
stream = XP_NEW(NET_StreamClass);
|
||||
stream = new (NET_StreamClass);
|
||||
if(stream == NULL)
|
||||
return(NULL);
|
||||
|
||||
obj = XP_NEW(AppleDoubleDecodeObject);
|
||||
obj = new (AppleDoubleDecodeObject);
|
||||
if (obj == NULL)
|
||||
{
|
||||
PR_FREEIF(stream);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
*
|
||||
*/
|
||||
#include "nsID.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nscore.h"
|
||||
#include "msgCore.h"
|
||||
#include "nsMsgAppleDouble.h"
|
||||
|
@ -40,12 +41,12 @@
|
|||
#include "m_cvstrm.h"
|
||||
|
||||
#pragma cplusplus on
|
||||
#include "InternetConfig.h"
|
||||
#include "ufilemgr.h"
|
||||
#include "BufferStream.h"
|
||||
#include "Umimemap.h"
|
||||
#include "uprefd.h"
|
||||
#include "ulaunch.h"
|
||||
//RICHIERM #include "InternetConfig.h"
|
||||
//RICHIERM #include "ufilemgr.h"
|
||||
//RICHIERM #include "BufferStream.h"
|
||||
//RICHIERM #include "Umimemap.h"
|
||||
//RICHIERM #include "uprefd.h"
|
||||
//RICHIERM #include "ulaunch.h"
|
||||
void DecodingDone( appledouble_decode_object* p_ap_decode_obj );
|
||||
|
||||
OSErr my_FSSpecFromPathname(char* src_filename, FSSpec* fspec)
|
||||
|
@ -61,12 +62,11 @@ char* my_PathnameFromFSSpec(FSSpec* fspec)
|
|||
|
||||
/* returns true if the resource fork should be sent */
|
||||
PRBool
|
||||
nsMsgIsMacFile(char* filename)
|
||||
nsMsgIsMacFile(nsFileSpec *fs)
|
||||
{
|
||||
Boolean returnValue = FALSE;
|
||||
|
||||
FSSpec fspec;
|
||||
my_FSSpecFromPathname(filename, &fspec);
|
||||
FSSpec fspec = fs->GetFSSpec();
|
||||
|
||||
returnValue = CFileMgr::FileHasResourceFork(fspec);
|
||||
/* always use IC even if the pref isn't checked since we have no
|
||||
|
@ -131,14 +131,14 @@ void MacGetFileType(nsFileSpec *path,
|
|||
if (mapper != NULL)
|
||||
{
|
||||
*useDefault = FALSE;
|
||||
*fileType = XP_STRDUP(mapper->GetMimeName());
|
||||
*fileType = nsCRT::strdup(mapper->GetMimeName());
|
||||
}
|
||||
else
|
||||
{
|
||||
FInfo fndrInfo;
|
||||
OSErr err = FSpGetFInfo( &spec, &fndrInfo );
|
||||
if ( (err != noErr) || (fndrInfo.fdType == 'TEXT') )
|
||||
*fileType = XP_STRDUP(APPLICATION_OCTET_STREAM);
|
||||
*fileType = nsCRT::strdup(APPLICATION_OCTET_STREAM);
|
||||
else
|
||||
{
|
||||
// Time to call IC to see if it knows anything
|
||||
|
@ -152,7 +152,7 @@ void MacGetFileType(nsFileSpec *path,
|
|||
{
|
||||
*useDefault = FALSE;
|
||||
CStr255 mimeName( ICMapper.MIME_type );
|
||||
*fileType = XP_STRDUP( mimeName );
|
||||
*fileType = nsCRT::strdup( mimeName );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -161,12 +161,12 @@ void MacGetFileType(nsFileSpec *path,
|
|||
if( mapper)
|
||||
{
|
||||
*useDefault = FALSE;
|
||||
*fileType = XP_STRDUP(mapper->GetMimeName());
|
||||
*fileType = nsCRT::strdup(mapper->GetMimeName());
|
||||
}
|
||||
else
|
||||
{
|
||||
// don't have a mime mapper
|
||||
*fileType = XP_STRDUP(APPLICATION_OCTET_STREAM);
|
||||
*fileType = nsCRT::strdup(APPLICATION_OCTET_STREAM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -199,27 +199,26 @@ void DecodingDone( appledouble_decode_object* p_ap_decode_obj )
|
|||
* Setup the encode envirment
|
||||
*/
|
||||
|
||||
int ap_encode_init(
|
||||
appledouble_encode_object *p_ap_encode_obj,
|
||||
char* fname,
|
||||
char* separator)
|
||||
int ap_encode_init( appledouble_encode_object *p_ap_encode_obj,
|
||||
char *fname,
|
||||
char *separator)
|
||||
{
|
||||
FSSpec fspec;
|
||||
|
||||
if (my_FSSpecFromPathname(fname, &fspec) != noErr )
|
||||
return -1;
|
||||
|
||||
XP_MEMSET(p_ap_encode_obj, 0, sizeof(appledouble_encode_object));
|
||||
nsCRT::memset(p_ap_encode_obj, 0, sizeof(appledouble_encode_object));
|
||||
|
||||
/*
|
||||
** Fill out the source file inforamtion.
|
||||
*/
|
||||
XP_MEMCPY(p_ap_encode_obj->fname, fspec.name+1, *fspec.name);
|
||||
nsCRT::memcpy(p_ap_encode_obj->fname, fspec.name+1, *fspec.name);
|
||||
p_ap_encode_obj->fname[*fspec.name] = '\0';
|
||||
p_ap_encode_obj->vRefNum = fspec.vRefNum;
|
||||
p_ap_encode_obj->dirId = fspec.parID;
|
||||
|
||||
p_ap_encode_obj->boundary = XP_STRDUP(separator);
|
||||
p_ap_encode_obj->boundary = nsCRT::strdup(separator);
|
||||
return noErr;
|
||||
}
|
||||
/*
|
||||
|
@ -392,7 +391,7 @@ int ap_decode_init(
|
|||
PRBool write_as_binhex,
|
||||
void *closure)
|
||||
{
|
||||
XP_MEMSET(p_ap_decode_obj, 0, sizeof(appledouble_decode_object));
|
||||
nsCRT::memset(p_ap_decode_obj, 0, sizeof(appledouble_decode_object));
|
||||
|
||||
/* presume first buff starts a line */
|
||||
p_ap_decode_obj->uu_starts_line = TRUE;
|
||||
|
|
|
@ -65,7 +65,7 @@ int write_stream(
|
|||
{
|
||||
if (p_ap_encode_obj->pos_outbuff + len < p_ap_encode_obj->s_outbuff)
|
||||
{
|
||||
XP_MEMCPY(p_ap_encode_obj->outbuff + p_ap_encode_obj->pos_outbuff,
|
||||
nsCRT::memcpy(p_ap_encode_obj->outbuff + p_ap_encode_obj->pos_outbuff,
|
||||
out_string,
|
||||
len);
|
||||
p_ap_encode_obj->pos_outbuff += len;
|
||||
|
@ -78,10 +78,10 @@ int write_stream(
|
|||
*/
|
||||
int s_len = p_ap_encode_obj->s_outbuff - p_ap_encode_obj->pos_outbuff;
|
||||
|
||||
XP_MEMCPY(p_ap_encode_obj->outbuff + p_ap_encode_obj->pos_outbuff,
|
||||
nsCRT::memcpy(p_ap_encode_obj->outbuff + p_ap_encode_obj->pos_outbuff,
|
||||
out_string,
|
||||
s_len);
|
||||
XP_MEMCPY(p_ap_encode_obj->b_overflow + p_ap_encode_obj->s_overflow,
|
||||
nsCRT::memcpy(p_ap_encode_obj->b_overflow + p_ap_encode_obj->s_overflow,
|
||||
out_string + s_len,
|
||||
p_ap_encode_obj->s_overflow += (len - s_len));
|
||||
p_ap_encode_obj->pos_outbuff += s_len;
|
||||
|
@ -104,7 +104,7 @@ int fill_apple_mime_header(
|
|||
// if (status != noErr)
|
||||
// return status;
|
||||
|
||||
sprintf(tmpstr,
|
||||
PR_snprintf(tmpstr, sizeof(tmpstr),
|
||||
"Content-Type: multipart/appledouble; boundary=\"=\"; name=\"");
|
||||
status = write_stream(p_ap_encode_obj,
|
||||
tmpstr,
|
||||
|
@ -118,11 +118,11 @@ int fill_apple_mime_header(
|
|||
if (status != noErr)
|
||||
return status;
|
||||
|
||||
XP_SPRINTF(tmpstr,
|
||||
PR_snprintf(tmpstr, sizeof(tmpstr),
|
||||
"\"\nContent-Disposition: inline; filename=\"%s\"\n\n\n--=\n",
|
||||
p_ap_encode_obj->fname);
|
||||
#endif
|
||||
XP_SPRINTF(tmpstr, "--%s"CRLF, p_ap_encode_obj->boundary);
|
||||
PR_snprintf(tmpstr, sizeof(tmpstr), "--%s"CRLF, p_ap_encode_obj->boundary);
|
||||
status = write_stream(p_ap_encode_obj,
|
||||
tmpstr,
|
||||
nsCRT::strlen(tmpstr));
|
||||
|
@ -292,7 +292,7 @@ int ap_encode_header(
|
|||
|
||||
if (firstime)
|
||||
{
|
||||
XP_STRCPY(rd_buff,
|
||||
nsCRT::strcpy(rd_buff,
|
||||
"Content-Type: application/applefile\nContent-Transfer-Encoding: base64\n\n");
|
||||
status = write_stream(p_ap_encode_obj,
|
||||
rd_buff,
|
||||
|
@ -346,7 +346,7 @@ int ap_encode_header(
|
|||
/*
|
||||
** write out the boundary
|
||||
*/
|
||||
XP_SPRINTF(rd_buff,
|
||||
PR_snprintf(rd_buff, sizeof(rd_buff),
|
||||
CRLF"--%s"CRLF,
|
||||
p_ap_encode_obj->boundary);
|
||||
|
||||
|
@ -444,7 +444,7 @@ int ap_encode_data(
|
|||
** preparing to encode the data fork.
|
||||
*/
|
||||
name[0] = nsCRT::strlen(p_ap_encode_obj->fname);
|
||||
XP_STRCPY((char*)name+1, p_ap_encode_obj->fname);
|
||||
nsCRT::strcpy((char*)name+1, p_ap_encode_obj->fname);
|
||||
if (HOpen( p_ap_encode_obj->vRefNum,
|
||||
p_ap_encode_obj->dirId,
|
||||
name,
|
||||
|
@ -507,7 +507,7 @@ int ap_encode_data(
|
|||
/*
|
||||
** the data portion header information.
|
||||
*/
|
||||
XP_SPRINTF(rd_buff,
|
||||
PR_snprintf(rd_buff, sizeof(rd_buff),
|
||||
"Content-Type: %s; name=\"%s\"" CRLF "Content-Transfer-Encoding: base64" CRLF "Content-Disposition: inline; filename=\"%s\""CRLF CRLF,
|
||||
magic_type,
|
||||
p_ap_encode_obj->fname,
|
||||
|
@ -551,7 +551,7 @@ int ap_encode_data(
|
|||
|
||||
/* write out the boundary */
|
||||
|
||||
XP_SPRINTF(rd_buff,
|
||||
PR_snprintf(rd_buff, sizeof(rd_buff),
|
||||
CRLF"--%s--"CRLF CRLF,
|
||||
p_ap_encode_obj->boundary);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "nscore.h"
|
||||
#include "msgCore.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsMsgAppleDouble.h"
|
||||
#include "nsMsgAppleCodes.h"
|
||||
|
@ -228,7 +229,7 @@ int binhex_encode_init(binhex_encode_object *p_bh_encode_obj)
|
|||
/*
|
||||
** init all the status.
|
||||
*/
|
||||
XP_MEMSET(p_bh_encode_obj, 0, sizeof(binhex_encode_object));
|
||||
nsCRT::memset(p_bh_encode_obj, 0, sizeof(binhex_encode_object));
|
||||
|
||||
p_bh_encode_obj->line_length = 1;
|
||||
|
||||
|
@ -260,7 +261,7 @@ int binhex_encode_next(
|
|||
*/
|
||||
if (p_bh_encode_obj->s_overflow)
|
||||
{
|
||||
XP_MEMCPY(p_bh_encode_obj->overflow,
|
||||
nsCRT::memcpy(p_bh_encode_obj->overflow,
|
||||
p_bh_encode_obj->outbuff,
|
||||
p_bh_encode_obj->s_overflow);
|
||||
|
||||
|
@ -287,19 +288,19 @@ int binhex_encode_next(
|
|||
{
|
||||
if (p_bh_encode_obj->state == BINHEX_STATE_START)
|
||||
{
|
||||
XP_STRCPY(p_bh_encode_obj->outbuff + p_bh_encode_obj->pos_outbuff,
|
||||
nsCRT::strcpy(p_bh_encode_obj->outbuff + p_bh_encode_obj->pos_outbuff,
|
||||
"\r\n(This file must be converted with BinHex 4.0)\r\n\r\n:");
|
||||
p_bh_encode_obj->pos_outbuff += 52;
|
||||
|
||||
p_bh_encode_obj->state = BINHEX_STATE_HEADER;
|
||||
|
||||
XP_MEMCPY(p_bh_encode_obj->name,
|
||||
nsCRT::memcpy(p_bh_encode_obj->name,
|
||||
in_buff,
|
||||
in_size);
|
||||
}
|
||||
else if (p_bh_encode_obj->state == BINHEX_STATE_HEADER)
|
||||
{
|
||||
XP_MEMCPY(&(p_bh_encode_obj->head),
|
||||
nsCRT::memcpy(&(p_bh_encode_obj->head),
|
||||
in_buff,
|
||||
sizeof(binhex_header));
|
||||
|
||||
|
@ -370,12 +371,12 @@ int binhex_reencode_head(
|
|||
p_bh_encode_obj->head.dlen = htonl(dlen = p_bh_encode_obj->head.dlen);
|
||||
|
||||
/* make a copy before do the encoding, -- it may modify the head!!!. */
|
||||
XP_MEMCPY(buff, (char*)&p_bh_encode_obj->head,
|
||||
nsCRT::memcpy(buff, (char*)&p_bh_encode_obj->head,
|
||||
sizeof(binhex_header));
|
||||
if (18 < sizeof(binhex_header))
|
||||
{
|
||||
/* we get an alignment problem here. */
|
||||
XP_MEMCPY(buff + 10, buff + 12, 8);
|
||||
nsCRT::memcpy(buff + 10, buff + 12, 8);
|
||||
}
|
||||
|
||||
status = binhex_encode_next(
|
||||
|
@ -506,7 +507,7 @@ int binhex_decode_init (
|
|||
binhex_decode_object *p_bh_decode_obj,
|
||||
MWContext *context)
|
||||
{
|
||||
XP_MEMSET(p_bh_decode_obj, 0, sizeof(binhex_decode_object));
|
||||
nsCRT::memset(p_bh_decode_obj, 0, sizeof(binhex_decode_object));
|
||||
|
||||
p_bh_decode_obj->octetin = 26;
|
||||
p_bh_decode_obj->donepos = 3;
|
||||
|
@ -518,7 +519,7 @@ int binhex_decode_init (
|
|||
static void
|
||||
simple_copy(MWContext* context, char* newFile, void* closure)
|
||||
{
|
||||
XP_STRCPY((char *)closure, newFile);
|
||||
nsCRT::strcpy((char *)closure, newFile);
|
||||
}
|
||||
|
||||
PRIVATE void binhex_process(
|
||||
|
@ -731,10 +732,10 @@ PRIVATE void binhex_process(
|
|||
{
|
||||
reply.sfFile.vRefNum = p_bh_decode_obj->mSpec->vRefNum;
|
||||
reply.sfFile.parID = p_bh_decode_obj->mSpec->parID;
|
||||
XP_MEMCPY(&reply.sfFile.name, p_bh_decode_obj->mSpec->name , 63 );
|
||||
nsCRT::memcpy(&reply.sfFile.name, p_bh_decode_obj->mSpec->name , 63 );
|
||||
}
|
||||
|
||||
XP_MEMCPY(p_bh_decode_obj->name,
|
||||
nsCRT::memcpy(p_bh_decode_obj->name,
|
||||
reply.sfFile.name,
|
||||
*(reply.sfFile.name)+1); /* save the new file name. */
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче