From 149ec99a10f821f5fa24b65e743701c671f323cd Mon Sep 17 00:00:00 2001 From: "ducarroz%netscape.com" Date: Tue, 27 Apr 1999 21:31:20 +0000 Subject: [PATCH] Implemented XP_StripLine to avoid crash when send a message with a newsgroup address set --- mailnews/compose/src/msgCompGlue.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/mailnews/compose/src/msgCompGlue.cpp b/mailnews/compose/src/msgCompGlue.cpp index 4094eb6eadc5..bae9473add03 100644 --- a/mailnews/compose/src/msgCompGlue.cpp +++ b/mailnews/compose/src/msgCompGlue.cpp @@ -44,7 +44,31 @@ char* NET_ScanHTMLForURLs(const char* input) {return NULL;} int XP_FileRemove(const char *, XP_FileType) {return 0;} XP_FILE_URL_PATH XP_PlatformFileToURL (const XP_FILE_NATIVE_PATH ) {return NULL;} MWContext * XP_FindContextOfType(MWContext *, MWContextType) {return NULL;} -char * XP_StripLine (char *) {return NULL;} +char * XP_StripLine (char * string) +{ + //ducarroz: we should use nsString::Trim + // + char * ptr; + + /* remove leading blanks */ + while(*string=='\t' || *string==' ' || *string=='\r' || *string=='\n') + string++; + + for(ptr=string; *ptr; ptr++) + ; /* NULL BODY; Find end of string */ + + /* remove trailing blanks */ + for(ptr--; ptr >= string; ptr--) + { + if(*ptr=='\t' || *ptr==' ' || *ptr=='\r' || *ptr=='\n') + *ptr = '\0'; + else + break; + } + + return string; + +} XP_File XP_FileOpen (const char* name, XP_FileType type, const XP_FilePerm permissions) {return NULL;} int XP_Stat(const char * name, XP_StatStruct * outStat, XP_FileType type) {return 0;} int XP_FileTruncate(const char* name, XP_FileType type, int32 length) {return 0;}