aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lllogchat.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/lllogchat.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/newview/lllogchat.cpp')
-rw-r--r--linden/indra/newview/lllogchat.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/linden/indra/newview/lllogchat.cpp b/linden/indra/newview/lllogchat.cpp
index f8b100e..6be5ee1 100644
--- a/linden/indra/newview/lllogchat.cpp
+++ b/linden/indra/newview/lllogchat.cpp
@@ -43,7 +43,13 @@ LLString LLLogChat::makeLogFileName(LLString filename)
43//static 43//static
44void LLLogChat::saveHistory(LLString filename, LLString line) 44void LLLogChat::saveHistory(LLString filename, LLString line)
45{ 45{
46 FILE *fp = LLFile::fopen(LLLogChat::makeLogFileName(filename).c_str(), "a"); 46 if(!filename.size())
47 {
48 llinfos << "Filename is Empty!" << llendl;
49 return;
50 }
51
52 FILE* fp = LLFile::fopen(LLLogChat::makeLogFileName(filename).c_str(), "a"); /*Flawfinder: ignore*/
47 if (!fp) 53 if (!fp)
48 { 54 {
49 llinfos << "Couldn't open chat history log!" << llendl; 55 llinfos << "Couldn't open chat history log!" << llendl;
@@ -58,14 +64,19 @@ void LLLogChat::saveHistory(LLString filename, LLString line)
58 64
59void LLLogChat::loadHistory(LLString filename , void (*callback)(LLString,void*), void* userdata) 65void LLLogChat::loadHistory(LLString filename , void (*callback)(LLString,void*), void* userdata)
60{ 66{
61 FILE *fptr = LLFile::fopen(makeLogFileName(filename).c_str(), "r"); 67 if(!filename.size())
68 {
69 llerrs << "Filename is Empty!" << llendl;
70 }
71
72 FILE* fptr = LLFile::fopen(makeLogFileName(filename).c_str(), "r"); /*Flawfinder: ignore*/
62 if (!fptr) 73 if (!fptr)
63 { 74 {
64 return; //No previous conversation with this name. 75 return; //No previous conversation with this name.
65 } 76 }
66 else 77 else
67 { 78 {
68 char buffer[LOG_RECALL_SIZE]; 79 char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/
69 char *bptr; 80 char *bptr;
70 S32 len; 81 S32 len;
71 bool firstline=TRUE; 82 bool firstline=TRUE;
@@ -82,7 +93,7 @@ void LLLogChat::loadHistory(LLString filename , void (*callback)(LLString,void*)
82 93
83 while ( fgets(buffer, LOG_RECALL_SIZE, fptr) && !feof(fptr) ) 94 while ( fgets(buffer, LOG_RECALL_SIZE, fptr) && !feof(fptr) )
84 { 95 {
85 len = strlen(buffer) - 1; 96 len = strlen(buffer) - 1; /*Flawfinder: ignore*/
86 for ( bptr = (buffer + len); (*bptr == '\n' || *bptr == '\r') && bptr>buffer; bptr--) *bptr='\0'; 97 for ( bptr = (buffer + len); (*bptr == '\n' || *bptr == '\r') && bptr>buffer; bptr--) *bptr='\0';
87 98
88 if (!firstline) 99 if (!firstline)