aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/llsys.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llcommon/llsys.cpp56
1 files changed, 24 insertions, 32 deletions
diff --git a/linden/indra/llcommon/llsys.cpp b/linden/indra/llcommon/llsys.cpp
index 1285851..cb2e34a 100644
--- a/linden/indra/llcommon/llsys.cpp
+++ b/linden/indra/llcommon/llsys.cpp
@@ -143,28 +143,22 @@ LLOSInfo::LLOSInfo() :
143 143
144 std::string csdversion = utf16str_to_utf8str(osvi.szCSDVersion); 144 std::string csdversion = utf16str_to_utf8str(osvi.szCSDVersion);
145 // Display version, service pack (if any), and build number. 145 // Display version, service pack (if any), and build number.
146 char tmp[MAX_STRING]; /* Flawfinder: ignore */ 146 std::string tmpstr;
147 if(osvi.dwMajorVersion <= 4) 147 if(osvi.dwMajorVersion <= 4)
148 { 148 {
149 snprintf( /* Flawfinder: ignore */ 149 tmpstr = llformat("version %d.%d %s (Build %d)",
150 tmp, 150 osvi.dwMajorVersion,
151 sizeof(tmp), 151 osvi.dwMinorVersion,
152 "version %d.%d %s (Build %d)", 152 csdversion.c_str(),
153 osvi.dwMajorVersion, 153 (osvi.dwBuildNumber & 0xffff));
154 osvi.dwMinorVersion,
155 csdversion.c_str(),
156 (osvi.dwBuildNumber & 0xffff));
157 } 154 }
158 else 155 else
159 { 156 {
160 snprintf( /* Flawfinder: ignore */ 157 tmpstr = llformat("%s (Build %d)",
161 tmp, 158 csdversion.c_str(),
162 sizeof(tmp), 159 (osvi.dwBuildNumber & 0xffff));
163 "%s (Build %d)",
164 csdversion.c_str(),
165 (osvi.dwBuildNumber & 0xffff));
166 } 160 }
167 mOSString = mOSStringSimple + tmp; 161 mOSString = mOSStringSimple + tmpstr;
168 } 162 }
169 break; 163 break;
170 164
@@ -397,7 +391,7 @@ LLCPUInfo::LLCPUInfo()
397 mCPUString = out.str(); 391 mCPUString = out.str();
398 392
399#elif LL_LINUX 393#elif LL_LINUX
400 std::map< LLString, LLString > cpuinfo; 394 std::map< std::string, std::string > cpuinfo;
401 LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb"); 395 LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb");
402 if(cpuinfo_fp) 396 if(cpuinfo_fp)
403 { 397 {
@@ -420,21 +414,21 @@ LLCPUInfo::LLCPUInfo()
420 if (nlspot == NULL) 414 if (nlspot == NULL)
421 nlspot = line + strlen( line ); // Fallback to terminating NUL 415 nlspot = line + strlen( line ); // Fallback to terminating NUL
422 std::string linename( line, tabspot ); 416 std::string linename( line, tabspot );
423 LLString llinename(linename); 417 std::string llinename(linename);
424 LLString::toLower(llinename); 418 LLStringUtil::toLower(llinename);
425 std::string lineval( spacespot + 1, nlspot ); 419 std::string lineval( spacespot + 1, nlspot );
426 cpuinfo[ llinename ] = lineval; 420 cpuinfo[ llinename ] = lineval;
427 } 421 }
428 fclose(cpuinfo_fp); 422 fclose(cpuinfo_fp);
429 } 423 }
430# if LL_X86 424# if LL_X86
431 LLString flags = " " + cpuinfo["flags"] + " "; 425 std::string flags = " " + cpuinfo["flags"] + " ";
432 LLString::toLower(flags); 426 LLStringUtil::toLower(flags);
433 mHasSSE = ( flags.find( " sse " ) != std::string::npos ); 427 mHasSSE = ( flags.find( " sse " ) != std::string::npos );
434 mHasSSE2 = ( flags.find( " sse2 " ) != std::string::npos ); 428 mHasSSE2 = ( flags.find( " sse2 " ) != std::string::npos );
435 429
436 F64 mhz; 430 F64 mhz;
437 if (LLString::convertToF64(cpuinfo["cpu mhz"], mhz) 431 if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz)
438 && 200.0 < mhz && mhz < 10000.0) 432 && 200.0 < mhz && mhz < 10000.0)
439 { 433 {
440 mCPUMhz = (S32)llrint(mhz); 434 mCPUMhz = (S32)llrint(mhz);
@@ -658,18 +652,17 @@ std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info)
658 return s; 652 return s;
659} 653}
660 654
661BOOL gunzip_file(const char *srcfile, const char *dstfile) 655BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile)
662{ 656{
663 char tmpfile[LL_MAX_PATH]; /* Flawfinder: ignore */ 657 std::string tmpfile;
664 const S32 UNCOMPRESS_BUFFER_SIZE = 32768; 658 const S32 UNCOMPRESS_BUFFER_SIZE = 32768;
665 BOOL retval = FALSE; 659 BOOL retval = FALSE;
666 gzFile src = NULL; 660 gzFile src = NULL;
667 U8 buffer[UNCOMPRESS_BUFFER_SIZE]; 661 U8 buffer[UNCOMPRESS_BUFFER_SIZE];
668 LLFILE *dst = NULL; 662 LLFILE *dst = NULL;
669 S32 bytes = 0; 663 S32 bytes = 0;
670 (void *) strcpy(tmpfile, dstfile); /* Flawfinder: ignore */ 664 tmpfile = dstfile + ".t";
671 (void *) strncat(tmpfile, ".t", sizeof(tmpfile) - strlen(tmpfile) -1); /* Flawfinder: ignore */ 665 src = gzopen(srcfile.c_str(), "rb");
672 src = gzopen(srcfile, "rb");
673 if (! src) goto err; 666 if (! src) goto err;
674 dst = LLFile::fopen(tmpfile, "wb"); /* Flawfinder: ignore */ 667 dst = LLFile::fopen(tmpfile, "wb"); /* Flawfinder: ignore */
675 if (! dst) goto err; 668 if (! dst) goto err;
@@ -693,18 +686,17 @@ err:
693 return retval; 686 return retval;
694} 687}
695 688
696BOOL gzip_file(const char *srcfile, const char *dstfile) 689BOOL gzip_file(const std::string& srcfile, const std::string& dstfile)
697{ 690{
698 const S32 COMPRESS_BUFFER_SIZE = 32768; 691 const S32 COMPRESS_BUFFER_SIZE = 32768;
699 char tmpfile[LL_MAX_PATH]; /* Flawfinder: ignore */ 692 std::string tmpfile;
700 BOOL retval = FALSE; 693 BOOL retval = FALSE;
701 U8 buffer[COMPRESS_BUFFER_SIZE]; 694 U8 buffer[COMPRESS_BUFFER_SIZE];
702 gzFile dst = NULL; 695 gzFile dst = NULL;
703 LLFILE *src = NULL; 696 LLFILE *src = NULL;
704 S32 bytes = 0; 697 S32 bytes = 0;
705 (void *) strcpy(tmpfile, dstfile); /* Flawfinder: ignore */ 698 tmpfile = dstfile + ".t";
706 (void *) strncat(tmpfile, ".t", sizeof(tmpfile) - strlen(tmpfile) -1); /* Flawfinder: ignore */ 699 dst = gzopen(tmpfile.c_str(), "wb"); /* Flawfinder: ignore */
707 dst = gzopen(tmpfile, "wb"); /* Flawfinder: ignore */
708 if (! dst) goto err; 700 if (! dst) goto err;
709 src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */ 701 src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */
710 if (! src) goto err; 702 if (! src) goto err;