diff options
70 files changed, 2171 insertions, 439 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt index 2a7e106df7..f7c2970253 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -17,10 +17,11 @@ Drewan Keats - VWR-28, VWR-248, VWR-412 Duckless Vandyke - VWR-383 Dylan Haskell - VWR-72 Dzonatas Sol - VWR-198, VWR-878, VWR-1704, VWR-1705 -Eddy Stryker - VWR-15, VWR-23 +Eddy Stryker - VWR-15, VWR-23, VWR-1468 +EponymousDylan Ra - VWR-1465 Fee Larsson - VWR-1314 Fremont Cunningham - VWR-1147 -Gigs Taggart - VWR-71, VWR-326, VWR-1217 +Gigs Taggart - VWR-71, VWR-326, VWR-1217, VWR-1434 Ginko Bayliss - VWR-4 Grazer Kline - VWR-1092 Hikkoshi Sakai - VWR-429 @@ -43,8 +44,9 @@ Stevex Janus - VWR-1182 Still Defiant - VWR-207, VWR-446 Strife Onizuka - SVC-9, VWR-74, VWR-85, VWR-148 tenebrous pau - VWR-247 -TBBle Kurosawa - VWR-938, VWR-941, VWR-944 +TBBle Kurosawa - VWR-938, VWR-941, VWR-944, VWR-945 Tharax Ferraris - VWR-605 +Thraxis Epsilon - SVC-371 Zi Ree - VWR-671, VWR-682, VWR-1140 Zipherius Turas - VWR-76, VWR-77 diff --git a/indra/linux_crash_logger/linux_crash_logger.cpp b/indra/linux_crash_logger/linux_crash_logger.cpp index 12a513c136..1b7d2870dc 100644 --- a/indra/linux_crash_logger/linux_crash_logger.cpp +++ b/indra/linux_crash_logger/linux_crash_logger.cpp @@ -454,9 +454,9 @@ LLFileEncoder::LLFileEncoder(const char *form_name, const char *filename, bool i S32 buf_size = stat_data.st_size; FILE *fp = fopen(mFilename.c_str(), "rb"); U8 *buf = new U8[buf_size + 1]; - fread(buf, 1, buf_size, fp); + size_t nread = fread(buf, 1, buf_size, fp); fclose(fp); - buf[buf_size] = 0; + buf[nread] = 0; mBuf = (char *)buf; diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 6e8912c461..1e2d86f814 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -11,7 +11,7 @@ #ifndef LL_LLAPR_H #define LL_LLAPR_H -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS #include <sys/param.h> // Need PATH_MAX in APR headers... #endif diff --git a/indra/llcommon/llfixedbuffer.cpp b/indra/llcommon/llfixedbuffer.cpp index ca7bf1ce48..113c8cecb1 100644 --- a/indra/llcommon/llfixedbuffer.cpp +++ b/indra/llcommon/llfixedbuffer.cpp @@ -62,7 +62,7 @@ void LLFixedBuffer::setMaxLines(S32 max_lines) void LLFixedBuffer::removeExtraLines() { - while ((S32)mLines.size() > llmax(0, (S32)(mMaxLines - 1))) + while ((S32)mLines.size() > llmax((S32)0, (S32)(mMaxLines - 1))) { mLines.pop_front(); mAddTimes.pop_front(); diff --git a/indra/llcommon/llhash.h b/indra/llcommon/llhash.h index fbf059bbcd..d03c70b04b 100644 --- a/indra/llcommon/llhash.h +++ b/indra/llcommon/llhash.h @@ -22,6 +22,8 @@ # else # include <hashtable.h> # endif +#elif LL_SOLARIS +#include <ext/hashtable.h> #else #error Please define your platform. #endif @@ -33,7 +35,7 @@ template<class T> inline size_t llhash(T value) #elif ( (defined _STLPORT_VERSION) || ((LL_LINUX) && (__GNUC__ <= 2)) ) std::hash<T> H; return H(value); -#elif LL_DARWIN || LL_LINUX +#elif LL_DARWIN || LL_LINUX || LL_SOLARIS __gnu_cxx::hash<T> H; return H(value); #else diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 4389fd3e30..6f38058439 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -42,6 +42,11 @@ #ifndef LL_LIBXUL_ENABLED #define LL_LIBXUL_ENABLED 1 #endif // def LL_LIBXUL_ENABLED +#elif LL_SOLARIS + #define LL_QUICKTIME_ENABLED 0 + #ifndef LL_LIBXUL_ENABLED + #define LL_LIBXUL_ENABLED 0 + #endif // def LL_LIBXUL_ENABLED #endif #if LL_LIBXUL_ENABLED && !defined(MOZILLA_INTERNAL_API) diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 3ff41a0104..e7cfe564f8 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -38,7 +38,7 @@ # include <windows.h> #endif -#if !LL_DARWIN +#if !LL_DARWIN && !LL_SOLARIS #ifdef PROCESSOR_FREQUENCY_MEASURE_AVAILABLE // We need the QueryPerformanceCounter and Sleep functions @@ -1632,6 +1632,125 @@ const ProcessorInfo *CProcessor::GetCPUInfo() return (&CPUInfo); } +#elif LL_SOLARIS +#include <kstat.h> + +// ====================== +// Class constructor: +///////////////////////// +CProcessor::CProcessor() +{ + uqwFrequency = 0; + strCPUName[0] = 0; + memset(&CPUInfo, 0, sizeof(CPUInfo)); +} + +// unsigned __int64 CProcessor::GetCPUFrequency(unsigned int uiMeasureMSecs) +// ========================================================================= +// Function to query the current CPU frequency +//////////////////////////////////////////////////////////////////////////// +F64 CProcessor::GetCPUFrequency(unsigned int /*uiMeasureMSecs*/) +{ + if(uqwFrequency == 0){ + GetCPUInfo(); + } + + return uqwFrequency; +} + +// const ProcessorInfo *CProcessor::GetCPUInfo() +// ============================================= +// Calls all the other detection function to create an detailed +// processor information +/////////////////////////////////////////////////////////////// +const ProcessorInfo *CProcessor::GetCPUInfo() +{ + // In Solaris the CPU info is in the kstats + // try "psrinfo" or "kstat cpu_info" to see all + // that's available + int ncpus=0, i; + kstat_ctl_t *kc; + kstat_t *ks; + kstat_named_t *ksinfo, *ksi; + kstat_t *CPU_stats_list; + + kc = kstat_open(); + + if((int)kc == -1){ + llwarns << "kstat_open(0 failed!" << llendl; + return (&CPUInfo); + } + + for (ks = kc->kc_chain; ks != NULL; ks = ks->ks_next) { + if (strncmp(ks->ks_module, "cpu_info", 8) == 0 && + strncmp(ks->ks_name, "cpu_info", 8) == 0) + ncpus++; + } + + if(ncpus < 1){ + llwarns << "No cpus found in kstats!" << llendl; + return (&CPUInfo); + } + + for (ks = kc->kc_chain; ks; ks = ks->ks_next) { + if (strncmp(ks->ks_module, "cpu_info", 8) == 0 + && strncmp(ks->ks_name, "cpu_info", 8) == 0 + && kstat_read(kc, ks, NULL) != -1){ + CPU_stats_list = ks; // only looking at the first CPU + + break; + } + } + + if(ncpus > 1) + snprintf(strCPUName, sizeof(strCPUName), "%d x ", ncpus); + + kstat_read(kc, CPU_stats_list, NULL); + ksinfo = (kstat_named_t *)CPU_stats_list->ks_data; + for(i=0; i < (int)(CPU_stats_list->ks_ndata); ++i){ // Walk the kstats for this cpu gathering what we need + ksi = ksinfo++; + if(!strcmp(ksi->name, "brand")){ + strncat(strCPUName, (char *)KSTAT_NAMED_STR_PTR(ksi), + sizeof(strCPUName)-strlen(strCPUName)-1); + strncat(CPUInfo.strFamily, (char *)KSTAT_NAMED_STR_PTR(ksi), + sizeof(CPUInfo.strFamily)-strlen(CPUInfo.strFamily)-1); + strncpy(CPUInfo.strBrandID, strCPUName,sizeof(CPUInfo.strBrandID)-1); + CPUInfo.strBrandID[sizeof(CPUInfo.strBrandID)-1]='\0'; + // DEBUG llinfos << "CPU brand: " << strCPUName << llendl; + continue; + } + + if(!strcmp(ksi->name, "clock_MHz")){ +#if defined(__sparc) + llinfos << "Raw kstat clock rate is: " << ksi->value.l << llendl; + uqwFrequency = (F64)(ksi->value.l * 1000000); +#else + uqwFrequency = (F64)(ksi->value.i64 * 1000000); +#endif + //DEBUG llinfos << "CPU frequency: " << uqwFrequency << llendl; + continue; + } + +#if defined(__i386) + if(!strcmp(ksi->name, "vendor_id")){ + strncpy(CPUInfo.strVendor, (char *)KSTAT_NAMED_STR_PTR(ksi), sizeof(CPUInfo.strVendor)-1); + // DEBUG llinfos << "CPU vendor: " << CPUInfo.strVendor << llendl; + continue; + } +#endif + } + + kstat_close(kc); + +#if defined(__sparc) // SPARC does not define a vendor string in kstat + strncpy(CPUInfo.strVendor, "Sun Microsystems, Inc.", sizeof(CPUInfo.strVendor)-1); +#endif + + // DEBUG llinfo << "The system has " << ncpus << " CPUs with a clock rate of " << uqwFrequency << "MHz." << llendl; + + return (&CPUInfo); +} + #else // LL_DARWIN @@ -2006,6 +2125,7 @@ bool CProcessor::CPUInfoToText(char *strBuffer, unsigned int uiMaxLen) { COPYADD("Processor Serial: Disabled\n"); } +#if !LL_SOLARIS // NOTE: Why bother printing all this when it's irrelavent COPYADD("\n\n// CPU Configuration\n////////////////////\n"); FORMATADD("L1 instruction cache: %s\n", CPUInfo._L1.Instruction.strCache); @@ -2062,7 +2182,7 @@ bool CProcessor::CPUInfoToText(char *strBuffer, unsigned int uiMaxLen) BOOLADD("VME Virtual 8086 Mode Enhancements: ", CPUInfo._Ext.VME_Virtual8086ModeEnhancements); BOOLADD("3DNow! Instructions: ", CPUInfo._Ext._3DNOW_InstructionExtensions); BOOLADD("Enhanced 3DNow! Instructions: ", CPUInfo._Ext._E3DNOW_InstructionExtensions); - +#endif // Yippie!!! return true; } diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index e6d9396f7d..2b94e19fd4 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -15,7 +15,7 @@ #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN # include <winsock2.h> // for htonl -#elif LL_LINUX +#elif LL_LINUX || LL_SOLARIS # include <netinet/in.h> #elif LL_DARWIN # include <arpa/inet.h> diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index c958e08415..3005155b19 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -20,7 +20,7 @@ #include <errno.h> #include <math.h> #include <stdarg.h> /* for vsnprintf */ -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS #include <wctype.h> #include <wchar.h> #endif @@ -34,7 +34,7 @@ class LLUUID; class LLColor4; class LLColor4U; -#if (LL_DARWIN || (LL_LINUX && __GNUC__ > 2)) +#if (LL_DARWIN || LL_SOLARIS || (LL_LINUX && __GNUC__ > 2)) // Template specialization of char_traits for U16s. Only necessary on Mac for now (exists on Windows, unused/broken on Linux/gcc2.95) namespace std { @@ -185,7 +185,7 @@ public: LLStringBase(const T* s, size_type n); LLStringBase(const T* s, size_type pos, size_type n ); -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS void clear() { assign(null); } LLStringBase<T>& assign(const T* s); @@ -680,7 +680,7 @@ LLStringBase<T>::LLStringBase(const T* s, size_type pos, size_type n ) : std::ba } } -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS template<class T> LLStringBase<T>& LLStringBase<T>::assign(const T* s) { @@ -1075,7 +1075,7 @@ BOOL LLStringBase<T>::read(std::basic_string<T>& string, const char* filename) template<class T> BOOL LLStringBase<T>::write(std::basic_string<T>& string, const char* filename) { -#ifdef LL_LINUX +#if LL_LINUX || LL_SOLARIS printf("STUBBED: LLStringBase<T>::write at %s:%d\n", __FILE__, __LINE__); #else llofstream ofs(filename, llofstream::binary); diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 3398f475aa..87d31987ce 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -166,7 +166,7 @@ LLOSInfo::LLOSInfo() : } #else struct utsname un; - if(0==uname(&un)) + if(uname(&un) != -1) { mOSString.append(un.sysname); mOSString.append(" "); @@ -239,10 +239,9 @@ U32 LLOSInfo::getProcessVirtualSizeKB() FILE* status_filep = LLFile::fopen("/proc/self/status", "r"); /* Flawfinder: ignore */ S32 numRead = 0; char buff[STATUS_SIZE]; /* Flawfinder: ignore */ - bzero(buff, STATUS_SIZE); - rewind(status_filep); - fread(buff, 1, STATUS_SIZE-2, status_filep); + size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep); + buff[nbytes] = '\0'; // All these guys return numbers in KB char *memp = strstr(buff, "VmSize:"); @@ -251,6 +250,24 @@ U32 LLOSInfo::getProcessVirtualSizeKB() numRead += sscanf(memp, "%*s %u", &virtual_size); } fclose(status_filep); +#elif LL_SOLARIS + char proc_ps[LL_MAX_PATH]; + sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); + int proc_fd = -1; + if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ + llwarns << "unable to open " << proc_ps << llendl; + return 0; + } + psinfo_t proc_psinfo; + if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ + llwarns << "Unable to read " << proc_ps << llendl; + close(proc_fd); + return 0; + } + + close(proc_fd); + + virtual_size = proc_psinfo.pr_size; #endif return virtual_size; } @@ -267,10 +284,9 @@ U32 LLOSInfo::getProcessResidentSizeKB() { S32 numRead = 0; char buff[STATUS_SIZE]; /* Flawfinder: ignore */ - bzero(buff, STATUS_SIZE); - rewind(status_filep); - fread(buff, 1, STATUS_SIZE-2, status_filep); + size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep); + buff[nbytes] = '\0'; // All these guys return numbers in KB char *memp = strstr(buff, "VmRSS:"); @@ -280,6 +296,24 @@ U32 LLOSInfo::getProcessResidentSizeKB() } fclose(status_filep); } +#elif LL_SOLARIS + char proc_ps[LL_MAX_PATH]; + sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); + int proc_fd = -1; + if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ + llwarns << "unable to open " << proc_ps << llendl; + return 0; + } + psinfo_t proc_psinfo; + if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ + llwarns << "Unable to read " << proc_ps << llendl; + close(proc_fd); + return 0; + } + + close(proc_fd); + + resident_size = proc_psinfo.pr_rssize; #endif return resident_size; } @@ -318,7 +352,7 @@ S32 LLCPUInfo::getMhz() const std::string LLCPUInfo::getCPUString() const { -#if LL_WINDOWS || LL_DARWIN +#if LL_WINDOWS || LL_DARWIN || LL_SOLARIS std::ostringstream out; CProcessor proc; @@ -341,7 +375,7 @@ std::string LLCPUInfo::getCPUString() const void LLCPUInfo::stream(std::ostream& s) const { -#if LL_WINDOWS || LL_DARWIN +#if LL_WINDOWS || LL_DARWIN || LL_SOLARIS // gather machine information. char proc_buf[CPUINFO_BUFFER_SIZE]; /* Flawfinder: ignore */ CProcessor proc; @@ -404,7 +438,8 @@ U32 LLMemoryInfo::getPhysicalMemory() const #elif LL_LINUX return getpagesize() * get_phys_pages(); - +#elif LL_SOLARIS + return getpagesize() * sysconf(_SC_PHYS_PAGES); #else return 0; @@ -438,7 +473,12 @@ void LLMemoryInfo::stream(std::ostream& s) const { s << "Unable to collect memory information"; } - +#elif LL_SOLARIS + U64 phys = 0; + + phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); + + s << "Total Physical Kb: " << phys << std::endl; #else // *NOTE: This works on linux. What will it do on other systems? FILE* meminfo = LLFile::fopen(MEMINFO_FILE,"r"); /* Flawfinder: ignore */ @@ -496,7 +536,11 @@ BOOL gunzip_file(const char *srcfile, const char *dstfile) do { bytes = gzread(src, buffer, UNCOMPRESS_BUFFER_SIZE); - fwrite(buffer, sizeof(U8), bytes, dst); + size_t nwrit = fwrite(buffer, sizeof(U8), bytes, dst); + if (nwrit < (size_t) bytes) + { + llerrs << "Short write on " << tmpfile << llendl; + } } while(gzeof(src) == 0); fclose(dst); dst = NULL; diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index a92d553148..b7be8d6a3b 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -12,7 +12,7 @@ #include "lltimer.h" -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS #include <sched.h> #endif @@ -206,7 +206,7 @@ void LLThread::setQuitting() // static void LLThread::yield() { -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS sched_yield(); // annoyingly, apr_thread_yield is a noop on linux... #else apr_thread_yield(); diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index a8118258f9..993574b528 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -17,7 +17,7 @@ # include <winsock2.h> # include <windows.h> # include <time.h> -#elif LL_LINUX +#elif LL_LINUX || LL_SOLARIS # include <time.h> # include <sys/time.h> # include <sched.h> @@ -70,7 +70,7 @@ void llyield() { SleepEx(0, TRUE); // Relinquishes time slice to any thread of equal priority, can be woken up by extended IO functions } -#elif LL_LINUX +#elif LL_LINUX || LL_SOLARIS void ms_sleep(long ms) { struct timespec t; @@ -130,7 +130,7 @@ F64 calc_clock_frequency(U32 uiMeasureMSecs) #endif // LL_WINDOWS -#if LL_LINUX || LL_DARWIN +#if LL_LINUX || LL_DARWIN || LL_SOLARIS // Both Linux and Mac use gettimeofday for accurate time F64 calc_clock_frequency(unsigned int uiMeasureMSecs) { @@ -149,7 +149,7 @@ U64 get_clock_count() void update_clock_frequencies() { - gClockFrequency = calc_clock_frequency(50); + gClockFrequency = calc_clock_frequency(50U); gClockFrequencyInv = 1.0/gClockFrequency; gClocksToMicroseconds = gClockFrequencyInv * SEC_TO_MICROSEC; } diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 31f5c1cfcd..5c304077fb 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -84,6 +84,8 @@ S32 LLWorkerThread::update(U32 max_time_ms) } delete *iter; } + // delete and aborted entries mean there's still work to do + res += delete_list.size() + abort_list.size(); return res; } diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index b898475683..ccb843061d 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -11,18 +11,18 @@ #include <limits.h> #include <float.h> -typedef signed char S8; +typedef signed char S8; typedef unsigned char U8; typedef signed short S16; typedef unsigned short U16; -typedef signed int S32; +typedef signed int S32; typedef unsigned int U32; #if LL_WINDOWS // Windows wchar_t is 16-bit -typedef U32 llwchar; +typedef U32 llwchar; #else -typedef wchar_t llwchar; +typedef wchar_t llwchar; #endif #if LL_WINDOWS @@ -33,20 +33,20 @@ typedef unsigned __int64 U64; #define U64L(a) (a) #else typedef long long int S64; -typedef long long unsigned int U64; -#if LL_DARWIN || LL_LINUX -#define S64L(a) (a##LL) -#define U64L(a) (a##ULL) +typedef long long unsigned int U64; +#if LL_DARWIN || LL_LINUX || LL_SOLARIS +#define S64L(a) (a##LL) +#define U64L(a) (a##ULL) #endif #endif -typedef float F32; -typedef double F64; +typedef float F32; +typedef double F64; typedef S32 BOOL; typedef U8 KEY; typedef U32 MASK; -typedef U32 TPACKETID; +typedef U32 TPACKETID; // Use #define instead of consts to avoid conversion headaches #define S8_MAX (SCHAR_MAX) diff --git a/indra/llcommon/timing.h b/indra/llcommon/timing.h index f09fb0f92b..8952bc3b52 100644 --- a/indra/llcommon/timing.h +++ b/indra/llcommon/timing.h @@ -11,7 +11,7 @@ #include <time.h> -#if LL_LINUX || LL_DARWIN +#if LL_LINUX || LL_DARWIN || LL_SOLARIS # include <sys/time.h> #endif diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 36b7ab0680..60c1ade38f 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -515,7 +515,11 @@ BOOL LLInventoryItem::importFile(FILE* fp) mAssetUUID.setNull(); while(success && (!feof(fp))) { - fgets(buffer, MAX_STRING, fp); + if (fgets(buffer, MAX_STRING, fp) == NULL) + { + buffer[0] = '\0'; + } + sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */ if(0 == strcmp("{",keyword)) { @@ -1371,7 +1375,11 @@ BOOL LLInventoryCategory::importFile(FILE* fp) valuestr[0] = '\0'; while(!feof(fp)) { - fgets(buffer, MAX_STRING, fp); + if (fgets(buffer, MAX_STRING, fp) == NULL) + { + buffer[0] = '\0'; + } + sscanf( /* Flawfinder: ignore */ buffer, " %254s %254s", diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index e0e8036d42..18faefe180 100644 --- a/indra/llinventory/llpermissions.cpp +++ b/indra/llinventory/llpermissions.cpp @@ -506,7 +506,11 @@ BOOL LLPermissions::importFile(FILE* fp) while (!feof(fp)) { - fgets(buffer, BUFSIZE, fp); + if (fgets(buffer, BUFSIZE, fp) == NULL) + { + buffer[0] = '\0'; + } + sscanf( /* Flawfinder: ignore */ buffer, " %255s %255s", diff --git a/indra/llinventory/llsaleinfo.cpp b/indra/llinventory/llsaleinfo.cpp index 32ba4aaaec..fa03961e9c 100644 --- a/indra/llinventory/llsaleinfo.cpp +++ b/indra/llinventory/llsaleinfo.cpp @@ -150,7 +150,11 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask) valuestr[0] = '\0'; while(success && (!feof(fp))) { - fgets(buffer, MAX_STRING, fp); + if (fgets(buffer, MAX_STRING, fp) == NULL) + { + buffer[0] = '\0'; + } + sscanf( /* Flawfinder: ignore */ buffer, " %254s %254s", diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 5fd365086f..5fa74f30f2 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -22,6 +22,9 @@ #elif (LL_LINUX && __GNUC__ <= 2) #define llisnan(val) isnan(val) #define llfinite(val) isfinite(val) +#elif LL_SOLARIS +#define llisnan(val) isnan(val) +#define llfinite(val) (val <= std::numeric_limits<double>::max()) #else #define llisnan(val) std::isnan(val) #define llfinite(val) std::isfinite(val) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 67ffb6d628..7345dabf72 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -730,7 +730,11 @@ BOOL LLProfileParams::importFile(FILE *fp) while (!feof(fp)) { - fgets(buffer, BUFSIZE, fp); + if (fgets(buffer, BUFSIZE, fp) == NULL) + { + buffer[0] = '\0'; + } + sscanf( /* Flawfinder: ignore */ buffer, " %255s %255s", @@ -1231,7 +1235,11 @@ BOOL LLPathParams::importFile(FILE *fp) while (!feof(fp)) { - fgets(buffer, BUFSIZE, fp); + if (fgets(buffer, BUFSIZE, fp) == NULL) + { + buffer[0] = '\0'; + } + sscanf( /* Flawfinder: ignore */ buffer, " %255s %255s", @@ -3562,7 +3570,11 @@ BOOL LLVolumeParams::importFile(FILE *fp) while (!feof(fp)) { - fgets(buffer, BUFSIZE, fp); + if (fgets(buffer, BUFSIZE, fp) == NULL) + { + buffer[0] = '\0'; + } + sscanf(buffer, " %255s", keyword); /* Flawfinder: ignore */ if (!strcmp("{", keyword)) { diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index d36e639f45..74a6a871c0 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -1875,7 +1875,10 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v { fpos_t last_pos; fgetpos(mFP, &last_pos); - fgets(buffer, DP_BUFSIZE, mFP); + if (fgets(buffer, DP_BUFSIZE, mFP) == NULL) + { + buffer[0] = '\0'; + } sscanf(buffer, "%511s %511[^\n]", keyword, value); /* Flawfinder: ignore */ diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index 07ca6a42a1..fcf27fac66 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -33,6 +33,7 @@ static const char HTTP_VERSION_STR[] = "HTTP/1.0"; static const std::string CONTEXT_REQUEST("request"); +static const std::string CONTEXT_RESPONSE("response"); static const std::string HTTP_VERB_GET("GET"); static const std::string HTTP_VERB_PUT("PUT"); static const std::string HTTP_VERB_POST("POST"); @@ -136,10 +137,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( LLBufferStream istr(channels, buffer.get()); static LLTimer timer; - if (sTimingCallback) - { - timer.reset(); - } + timer.reset(); std::string verb = context[CONTEXT_REQUEST]["verb"]; if(verb == HTTP_VERB_GET) @@ -169,6 +167,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( mResponse->methodNotAllowed(); } + F32 delta = timer.getElapsedTimeF32(); if (sTimingCallback) { LLHTTPNode::Description desc; @@ -177,16 +176,20 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( std::string timing_name = info["description"]; timing_name += " "; timing_name += verb; - F32 delta = timer.getElapsedTimeF32(); sTimingCallback(timing_name.c_str(), delta, sTimingCallbackData); } + // Log all HTTP transactions. + llinfos << verb << " " << context[CONTEXT_REQUEST]["path"].asString() + << " " << mStatusCode << " " << mStatusMessage << " " << delta + << "s" << llendl; + // Log Internal Server Errors - if(mStatusCode == 500) - { - llwarns << "LLHTTPPipe::process_impl:500:Internal Server Error" - << llendl; - } + //if(mStatusCode == 500) + //{ + // llwarns << "LLHTTPPipe::process_impl:500:Internal Server Error" + // << llendl; + //} } PUMP_DEBUG; @@ -203,7 +206,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( case STATE_GOOD_RESULT: { - context["response"]["contentType"] = "application/xml"; + context[CONTEXT_RESPONSE]["contentType"] = "application/xml"; LLBufferStream ostr(channels, buffer.get()); LLSDSerialize::toXML(mGoodResult, ostr); @@ -212,9 +215,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( case STATE_STATUS_RESULT: { - context["response"]["contentType"] = "text/plain"; - context["response"]["statusCode"] = mStatusCode; - context["response"]["statusMessage"] = mStatusMessage; + context[CONTEXT_RESPONSE]["contentType"] = "text/plain"; + context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode; + context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage; LLBufferStream ostr(channels, buffer.get()); ostr << mStatusMessage << std::ends; @@ -351,9 +354,9 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( PUMP_DEBUG; //mGotEOS = true; std::ostringstream ostr; - std::string message = context["response"]["statusMessage"]; + std::string message = context[CONTEXT_RESPONSE]["statusMessage"]; - int code = context["response"]["statusCode"]; + int code = context[CONTEXT_RESPONSE]["statusCode"]; if (code < 200) { code = 200; @@ -362,7 +365,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; - std::string type = context["response"]["contentType"].asString(); + std::string type = context[CONTEXT_RESPONSE]["contentType"].asString(); if (!type.empty()) { ostr << "Content-Type: " << type << "\r\n"; diff --git a/indra/llmessage/llmessagereader.cpp b/indra/llmessage/llmessagereader.cpp index 5375fab0f8..996258af52 100644 --- a/indra/llmessage/llmessagereader.cpp +++ b/indra/llmessage/llmessagereader.cpp @@ -6,6 +6,7 @@ * $License$ */ +#include "linden_common.h" #include "llmessagereader.h" static BOOL sTimeDecodes = FALSE; diff --git a/indra/llmessage/llnamevalue.h b/indra/llmessage/llnamevalue.h index 27355277ca..f3d0d0d338 100644 --- a/indra/llmessage/llnamevalue.h +++ b/indra/llmessage/llnamevalue.h @@ -174,7 +174,6 @@ public: ENameValueSendto mSendto; UNameValueReference mNameValueReference; - S32 mNumberEntries; LLStringTable *mNVNameTable; TNameValueCallback mNameValueCB; void **mUserData; diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index 9015be7106..3e08b9de26 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -6,6 +6,7 @@ * $License$ */ +#include "linden_common.h" #include "lltemplatemessagereader.h" #include "llfasttimer.h" @@ -331,7 +332,7 @@ void LLTemplateMessageReader::getF64(const char *block, const char *var, void LLTemplateMessageReader::getVector3(const char *block, const char *var, LLVector3 &v, S32 blocknum ) { - getData(block, var, v.mV, sizeof(v.mV), blocknum); + getData(block, var, &v.mV[0], sizeof(v.mV), blocknum); if( !v.isFinite() ) { @@ -344,7 +345,7 @@ void LLTemplateMessageReader::getVector3(const char *block, const char *var, void LLTemplateMessageReader::getVector4(const char *block, const char *var, LLVector4 &v, S32 blocknum) { - getData(block, var, v.mV, sizeof(v.mV), blocknum); + getData(block, var, &v.mV[0], sizeof(v.mV), blocknum); if( !v.isFinite() ) { @@ -357,7 +358,7 @@ void LLTemplateMessageReader::getVector4(const char *block, const char *var, void LLTemplateMessageReader::getVector3d(const char *block, const char *var, LLVector3d &v, S32 blocknum ) { - getData(block, var, v.mdV, sizeof(v.mdV), blocknum); + getData(block, var, &v.mdV[0], sizeof(v.mdV), blocknum); if( !v.isFinite() ) { @@ -372,7 +373,7 @@ void LLTemplateMessageReader::getQuat(const char *block, const char *var, LLQuaternion &q, S32 blocknum) { LLVector3 vec; - getData(block, var, vec.mV, sizeof(vec.mV), blocknum); + getData(block, var, &vec.mV[0], sizeof(vec.mV), blocknum); if( vec.isFinite() ) { q.unpackFromVector3( vec ); @@ -388,7 +389,7 @@ void LLTemplateMessageReader::getQuat(const char *block, const char *var, void LLTemplateMessageReader::getUUID(const char *block, const char *var, LLUUID &u, S32 blocknum) { - getData(block, var, u.mData, sizeof(u.mData), blocknum); + getData(block, var, &u.mData[0], sizeof(u.mData), blocknum); } inline void LLTemplateMessageReader::getIPAddr(const char *block, const char *var, U32 &u, S32 blocknum) diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index 299c043d93..338dbdd215 100644 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -269,7 +269,11 @@ S32 LLXfer_File::flush() if (mFp) { - fwrite(mBuffer,1,mBufferLength,mFp); + if (fwrite(mBuffer,1,mBufferLength,mFp) != mBufferLength) + { + llwarns << "Short write" << llendl; + } + // llinfos << "******* wrote " << mBufferLength << " bytes of file xfer" << llendl; fclose(mFp); mFp = NULL; diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 1a616d9e2b..d0414def6d 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -385,6 +385,7 @@ LLMessageSystem::~LLMessageSystem() { end_net(mSocket); } + mSocket = 0; delete mTemplateMessageReader; mTemplateMessageReader = NULL; diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 9c07227a67..2f875f2b96 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -19,6 +19,10 @@ #include <netinet/in.h> #endif +#if LL_SOLARIS +#include <netinet/in.h> +#endif + #if LL_WINDOWS #include "winsock2.h" // htons etc. #endif @@ -184,14 +188,14 @@ public: class LLMessageSystem { private: - U8 mSendBuffer[MAX_BUFFER_SIZE]; - S32 mSendSize; + U8 mSendBuffer[MAX_BUFFER_SIZE]; + S32 mSendSize; public: - LLPacketRing mPacketRing; - LLReliablePacketParams mReliablePacketParams; + LLPacketRing mPacketRing; + LLReliablePacketParams mReliablePacketParams; - //LLLinkedList<LLPacketAck> mAckList; + //LLLinkedList<LLPacketAck> mAckList; // Set this flag to TRUE when you want *very* verbose logs. BOOL mVerboseLog; @@ -202,36 +206,35 @@ class LLMessageSystem typedef std::map<U32, LLMessageTemplate*> message_template_number_map_t; private: - message_template_name_map_t mMessageTemplates; - message_template_number_map_t mMessageNumbers; + message_template_name_map_t mMessageTemplates; + message_template_number_map_t mMessageNumbers; public: - S32 mSystemVersionMajor; - S32 mSystemVersionMinor; - S32 mSystemVersionPatch; - S32 mSystemVersionServer; - U32 mVersionFlags; + S32 mSystemVersionMajor; + S32 mSystemVersionMinor; + S32 mSystemVersionPatch; + S32 mSystemVersionServer; + U32 mVersionFlags; + BOOL mbProtected; - BOOL mbProtected; + U32 mNumberHighFreqMessages; + U32 mNumberMediumFreqMessages; + U32 mNumberLowFreqMessages; + S32 mPort; + S32 mSocket; - U32 mNumberHighFreqMessages; - U32 mNumberMediumFreqMessages; - U32 mNumberLowFreqMessages; - S32 mPort; - S32 mSocket; + U32 mPacketsIn; // total packets in, including compressed and uncompressed + U32 mPacketsOut; // total packets out, including compressed and uncompressed - U32 mPacketsIn; // total packets in, including compressed and uncompressed - U32 mPacketsOut; // total packets out, including compressed and uncompressed - - U64 mBytesIn; // total bytes in, including compressed and uncompressed - U64 mBytesOut; // total bytes out, including compressed and uncompressed + U64 mBytesIn; // total bytes in, including compressed and uncompressed + U64 mBytesOut; // total bytes out, including compressed and uncompressed - U32 mCompressedPacketsIn; // total compressed packets in - U32 mCompressedPacketsOut; // total compressed packets out + U32 mCompressedPacketsIn; // total compressed packets in + U32 mCompressedPacketsOut; // total compressed packets out - U32 mReliablePacketsIn; // total reliable packets in - U32 mReliablePacketsOut; // total reliable packets out + U32 mReliablePacketsIn; // total reliable packets in + U32 mReliablePacketsOut; // total reliable packets out U32 mDroppedPackets; // total dropped packets in U32 mResentPackets; // total resent packets out @@ -239,26 +242,26 @@ public: U32 mOffCircuitPackets; // total # of off-circuit packets rejected U32 mInvalidOnCircuitPackets; // total # of on-circuit but invalid packets rejected - S64 mUncompressedBytesIn; // total uncompressed size of compressed packets in - S64 mUncompressedBytesOut; // total uncompressed size of compressed packets out - S64 mCompressedBytesIn; // total compressed size of compressed packets in - S64 mCompressedBytesOut; // total compressed size of compressed packets out - S64 mTotalBytesIn; // total size of all uncompressed packets in - S64 mTotalBytesOut; // total size of all uncompressed packets out + S64 mUncompressedBytesIn; // total uncompressed size of compressed packets in + S64 mUncompressedBytesOut; // total uncompressed size of compressed packets out + S64 mCompressedBytesIn; // total compressed size of compressed packets in + S64 mCompressedBytesOut; // total compressed size of compressed packets out + S64 mTotalBytesIn; // total size of all uncompressed packets in + S64 mTotalBytesOut; // total size of all uncompressed packets out BOOL mSendReliable; // does the outgoing message require a pos ack? - LLCircuit mCircuitInfo; - F64 mCircuitPrintTime; // used to print circuit debug info every couple minutes - F32 mCircuitPrintFreq; // seconds + LLCircuit mCircuitInfo; + F64 mCircuitPrintTime; // used to print circuit debug info every couple minutes + F32 mCircuitPrintFreq; // seconds - std::map<U64, U32> mIPPortToCircuitCode; - std::map<U32, U64> mCircuitCodeToIPPort; - U32 mOurCircuitCode; - S32 mSendPacketFailureCount; - S32 mUnackedListDepth; - S32 mUnackedListSize; - S32 mDSMaxListDepth; + std::map<U64, U32> mIPPortToCircuitCode; + std::map<U32, U64> mCircuitCodeToIPPort; + U32 mOurCircuitCode; + S32 mSendPacketFailureCount; + S32 mUnackedListDepth; + S32 mUnackedListSize; + S32 mDSMaxListDepth; public: // Read file and build message templates @@ -673,14 +676,14 @@ private: LLMessagePollInfo *mPollInfop; - U8 mEncodedRecvBuffer[MAX_BUFFER_SIZE]; - U8 mTrueReceiveBuffer[MAX_BUFFER_SIZE]; - S32 mTrueReceiveSize; + U8 mEncodedRecvBuffer[MAX_BUFFER_SIZE]; + U8 mTrueReceiveBuffer[MAX_BUFFER_SIZE]; + S32 mTrueReceiveSize; // Must be valid during decode - BOOL mbError; - S32 mErrorCode; + BOOL mbError; + S32 mErrorCode; F64 mResendDumpTime; // The last time we dumped resends @@ -755,6 +758,10 @@ void null_message_callback(LLMessageSystem *msg, void **data); // Inlines // +#if !defined( LL_BIG_ENDIAN ) && !defined( LL_LITTLE_ENDIAN ) +#error Unknown endianness for htonmemcpy. Did you miss a common include? +#endif + static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, size_t n) { char *s = (char *)vs; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 0ec161b232..541ffd87bc 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -943,7 +943,8 @@ BOOL LLImageGL::setDiscardLevel(S32 discard_level) } else { -#ifndef LL_LINUX // *FIX: This should not be skipped for the linux client. +#if !LL_LINUX && !LL_SOLARIS + // *FIX: This should not be skipped for the linux client. llerrs << "LLImageGL::setDiscardLevel() called on image without mipmaps" << llendl; #endif return FALSE; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 5857f49a3e..d7ccfe1daa 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -2945,6 +2945,12 @@ BOOL LLMenuGL::handleKey( KEY key, MASK mask, BOOL called_from_parent ) BOOL LLMenuGL::handleAcceleratorKey(KEY key, MASK mask) { + // don't handle if not enabled + if(!mEnabled) + { + return FALSE; + } + // Pass down even if not visible item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 0d78a45b26..68fb3f8e23 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -420,6 +420,9 @@ const LLString LLLocale::SYSTEM_LOCALE("English_United States.1252"); #elif LL_DARWIN const LLString LLLocale::USER_LOCALE("en_US.iso8859-1");// = LLString::null; const LLString LLLocale::SYSTEM_LOCALE("en_US.iso8859-1"); +#elif LL_SOLARIS +const LLString LLLocale::USER_LOCALE("en_US.ISO8859-1"); +const LLString LLLocale::SYSTEM_LOCALE("C"); #else // LL_LINUX likes this const LLString LLLocale::USER_LOCALE("en_US.utf8"); const LLString LLLocale::SYSTEM_LOCALE("C"); diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index d8d77e6a23..94c1b5de24 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -25,6 +25,9 @@ LLDir_Win32 gDirUtil; #elif LL_DARWIN #include "lldir_mac.h" LLDir_Mac gDirUtil; +#elif LL_SOLARIS +#include "lldir_solaris.h" +LLDir_Solaris gDirUtil; #else #include "lldir_linux.h" LLDir_Linux gDirUtil; diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp index bc8c173492..42e84edf44 100644 --- a/indra/llvfs/lldir_linux.cpp +++ b/indra/llvfs/lldir_linux.cpp @@ -55,7 +55,16 @@ LLDir_Linux::LLDir_Linux() mDirp = NULL; char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ - getcwd(tmp_str, LL_MAX_PATH); + if (getcwd(tmp_str, LL_MAX_PATH) == NULL) + { + strcpy(tmp_str, "/tmp"); + llwarns << "Could not get current directory; changing to " + << tmp_str << llendl; + if (chdir(tmp_str) == -1) + { + llerrs << "Could not change directory to " << tmp_str << llendl; + } + } mExecutableFilename = ""; mExecutablePathAndName = ""; @@ -308,7 +317,11 @@ void LLDir_Linux::getRandomFileInDir(const std::string &dirname, const std::stri std::string LLDir_Linux::getCurPath() { char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ - getcwd(tmp_str, LL_MAX_PATH); + if (getcwd(tmp_str, LL_MAX_PATH) == NULL) + { + llwarns << "Could not get current directory" << llendl; + tmp_str[0] = '\0'; + } return tmp_str; } diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp new file mode 100644 index 0000000000..d9d683741b --- /dev/null +++ b/indra/llvfs/lldir_solaris.cpp @@ -0,0 +1,354 @@ +/** + * @file fmodwrapper.cpp + * @brief dummy source file for building a shared library to wrap libfmod.a + * + * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "linden_common.h" + +#include "lldir_solaris.h" +#include "llerror.h" +#include "llrand.h" +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <sys/param.h> +#include <unistd.h> +#include <glob.h> +#include <pwd.h> +#include <sys/utsname.h> +#define _STRUCTURED_PROC 1 +#include <sys/procfs.h> + +static std::string getCurrentUserHome(char* fallback) +{ + const uid_t uid = getuid(); + struct passwd *pw; + char *result_cstr = fallback; + + pw = getpwuid(uid); + if ((pw != NULL) && (pw->pw_dir != NULL)) + { + result_cstr = (char*) pw->pw_dir; + } + else + { + llinfos << "Couldn't detect home directory from passwd - trying $HOME" << llendl; + const char *const home_env = getenv("HOME"); /* Flawfinder: ignore */ + if (home_env) + { + result_cstr = (char*) home_env; + } + else + { + llwarns << "Couldn't detect home directory! Falling back to " << fallback << llendl; + } + } + + return std::string(result_cstr); +} + + +LLDir_Solaris::LLDir_Solaris() +{ + mDirDelimiter = "/"; + mCurrentDirIndex = -1; + mCurrentDirCount = -1; + mDirp = NULL; + + char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ + getcwd(tmp_str, LL_MAX_PATH); + + mExecutableFilename = ""; + mExecutablePathAndName = ""; + mExecutableDir = strdup(tmp_str); + mWorkingDir = strdup(tmp_str); + mAppRODataDir = strdup(tmp_str); + mOSUserDir = getCurrentUserHome(tmp_str); + mOSUserAppDir = ""; + mLindenUserDir = tmp_str; + + char path [LL_MAX_PATH]; /* Flawfinder: ignore */ + + sprintf(path, "/proc/%d/psinfo", (int)getpid()); + int proc_fd = -1; + if((proc_fd = open(path, O_RDONLY)) == -1){ + llwarns << "unable to open " << path << llendl; + return; + } + psinfo_t proc_psinfo; + if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ + llwarns << "Unable to read " << path << llendl; + close(proc_fd); + return; + } + + close(proc_fd); + + mExecutableFilename = strdup(proc_psinfo.pr_fname); + llinfos << "mExecutableFilename = [" << mExecutableFilename << "]" << llendl; + + sprintf(path, "/proc/%d/path/a.out", (int)getpid()); + + char execpath[LL_MAX_PATH]; + if(readlink(path, execpath, LL_MAX_PATH) == -1){ + llwarns << "Unable to read link from " << path << llendl; + return; + } + + mExecutablePathAndName = strdup(execpath); + llinfos << "mExecutablePathAndName = [" << mExecutablePathAndName << "]" << llendl; + + // plunk a null at last '/' to get exec dir + char *s = execpath + strlen(execpath) -1; + while(*s != '/' && s != execpath){ + --s; + } + + if(s != execpath){ + *s = (char)NULL; + + mExecutableDir = strdup(execpath); + llinfos << "mExecutableDir = [" << mExecutableDir << "]" << llendl; + } + + // *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something. + mTempDir = "/tmp"; +} + +LLDir_Solaris::~LLDir_Solaris() +{ +} + +// Implementation + + +void LLDir_Solaris::initAppDirs(const std::string &app_name) +{ + mAppName = app_name; + + LLString upper_app_name(app_name); + LLString::toUpper(upper_app_name); + + char* app_home_env = getenv((upper_app_name + "_USER_DIR").c_str()); /* Flawfinder: ignore */ + if (app_home_env) + { + // user has specified own userappdir i.e. $SECONDLIFE_USER_DIR + mOSUserAppDir = app_home_env; + } + else + { + // traditionally on unixoids, MyApp gets ~/.myapp dir for data + mOSUserAppDir = mOSUserDir; + mOSUserAppDir += "/"; + mOSUserAppDir += "."; + LLString lower_app_name(app_name); + LLString::toLower(lower_app_name); + mOSUserAppDir += lower_app_name; + } + + // create any directories we expect to write to. + + int res = LLFile::mkdir(mOSUserAppDir.c_str()); + if (res == -1) + { + if (errno != EEXIST) + { + llwarns << "Couldn't create app user dir " << mOSUserAppDir << llendl; + llwarns << "Default to base dir" << mOSUserDir << llendl; + mOSUserAppDir = mOSUserDir; + } + } + + res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,"").c_str()); + if (res == -1) + { + if (errno != EEXIST) + { + llwarns << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << llendl; + } + } + + res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,"").c_str()); + if (res == -1) + { + if (errno != EEXIST) + { + llwarns << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << llendl; + } + } + + res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,"").c_str()); + if (res == -1) + { + if (errno != EEXIST) + { + llwarns << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << llendl; + } + } + + res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"").c_str()); + if (res == -1) + { + if (errno != EEXIST) + { + llwarns << "Couldn't create LL_PATH_MOZILLA_PROFILE dir " << getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"") << llendl; + } + } + + mCAFile = getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem"); +} + +U32 LLDir_Solaris::countFilesInDir(const std::string &dirname, const std::string &mask) +{ + U32 file_count = 0; + glob_t g; + + std::string tmp_str; + tmp_str = dirname; + tmp_str += mask; + + if(glob(tmp_str.c_str(), GLOB_NOSORT, NULL, &g) == 0) + { + file_count = g.gl_pathc; + + globfree(&g); + } + + return (file_count); +} + +// get the next file in the directory +// automatically wrap if we've hit the end +BOOL LLDir_Solaris::getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) +{ + glob_t g; + BOOL result = FALSE; + fname = ""; + + if(!(dirname == mCurrentDir)) + { + // different dir specified, close old search + mCurrentDirIndex = -1; + mCurrentDirCount = -1; + mCurrentDir = dirname; + } + + std::string tmp_str; + tmp_str = dirname; + tmp_str += mask; + + if(glob(tmp_str.c_str(), GLOB_NOSORT, NULL, &g) == 0) + { + if(g.gl_pathc > 0) + { + if((int)g.gl_pathc != mCurrentDirCount) + { + // Number of matches has changed since the last search, meaning a file has been added or deleted. + // Reset the index. + mCurrentDirIndex = -1; + mCurrentDirCount = g.gl_pathc; + } + + mCurrentDirIndex++; + + if((mCurrentDirIndex >= (int)g.gl_pathc) && wrap) + { + mCurrentDirIndex = 0; + } + + if(mCurrentDirIndex < (int)g.gl_pathc) + { +// llinfos << "getNextFileInDir: returning number " << mCurrentDirIndex << ", path is " << g.gl_pathv[mCurrentDirIndex] << llendl; + + // The API wants just the filename, not the full path. + //fname = g.gl_pathv[mCurrentDirIndex]; + + char *s = strrchr(g.gl_pathv[mCurrentDirIndex], '/'); + + if(s == NULL) + s = g.gl_pathv[mCurrentDirIndex]; + else if(s[0] == '/') + s++; + + fname = s; + + result = TRUE; + } + } + + globfree(&g); + } + + return(result); +} + + +// get a random file in the directory +// automatically wrap if we've hit the end +void LLDir_Solaris::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) +{ + S32 num_files; + S32 which_file; + DIR *dirp; + dirent *entryp = NULL; + + fname = ""; + + num_files = countFilesInDir(dirname,mask); + if (!num_files) + { + return; + } + + which_file = ll_rand(num_files); + +// llinfos << "Random select file #" << which_file << llendl; + + // which_file now indicates the (zero-based) index to which file to play + + if (!((dirp = opendir(dirname.c_str())))) + { + while (which_file--) + { + if (!((entryp = readdir(dirp)))) + { + return; + } + } + + if ((!which_file) && entryp) + { + fname = entryp->d_name; + } + + closedir(dirp); + } +} + +std::string LLDir_Solaris::getCurPath() +{ + char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ + getcwd(tmp_str, LL_MAX_PATH); + return tmp_str; +} + + +BOOL LLDir_Solaris::fileExists(const std::string &filename) +{ + struct stat stat_data; + // Check the age of the file + // Now, we see if the files we've gathered are recent... + int res = stat(filename.c_str(), &stat_data); + if (!res) + { + return TRUE; + } + else + { + return FALSE; + } +} + diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h new file mode 100644 index 0000000000..1ab76230ee --- /dev/null +++ b/indra/llvfs/lldir_solaris.h @@ -0,0 +1,41 @@ +/** + * @file fmodwrapper.cpp + * @brief dummy source file for building a shared library to wrap libfmod.a + * + * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#ifndef LL_LLDIR_SOLARIS_H +#define LL_LLDIR_SOLARIS_H + +#include "lldir.h" + +#include <stdio.h> +#include <dirent.h> +#include <errno.h> + +class LLDir_Solaris : public LLDir +{ +public: + LLDir_Solaris(); + virtual ~LLDir_Solaris(); + + virtual void initAppDirs(const std::string &app_name); +public: + virtual std::string getCurPath(); + virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); + virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap); + virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); + /*virtual*/ BOOL fileExists(const std::string &filename); + +private: + DIR *mDirp; + int mCurrentDirIndex; + int mCurrentDirCount; + std::string mCurrentDir; +}; + +#endif // LL_LLDIR_SOLARIS_H + + diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp index 8b31a50bdb..9094bdd24f 100644 --- a/indra/llvfs/llvfs.cpp +++ b/indra/llvfs/llvfs.cpp @@ -15,6 +15,10 @@ #include <map> #if LL_WINDOWS #include <share.h> +#elif LL_SOLARIS +#include <sys/types.h> +#include <unistd.h> +#include <fcntl.h> #else #include <sys/file.h> #endif @@ -359,13 +363,13 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r ) { U8 *buffer = new U8[fbuf.st_size]; - fread(buffer, fbuf.st_size, 1, mIndexFP); + size_t nread = fread(buffer, 1, fbuf.st_size, mIndexFP); U8 *tmp_ptr = buffer; std::vector<LLVFSFileBlock*> files_by_loc; - while (tmp_ptr < buffer + fbuf.st_size) + while (tmp_ptr < buffer + nread) { LLVFSFileBlock *block = new LLVFSFileBlock(); @@ -861,12 +865,18 @@ BOOL LLVFS::setMaxSize(const LLUUID &file_id, const LLAssetType::EType file_type // move the file into the new block U8 *buffer = new U8[block->mSize]; fseek(mDataFP, block->mLocation, SEEK_SET); - fread(buffer, block->mSize, 1, mDataFP); - fseek(mDataFP, free_block->mLocation, SEEK_SET); - fwrite(buffer, block->mSize, 1, mDataFP); - // fflush(mDataFP); - - delete[] buffer; + if (fread(buffer, block->mSize, 1, mDataFP) == 1) + { + fseek(mDataFP, free_block->mLocation, SEEK_SET); + if (fwrite(buffer, block->mSize, 1, mDataFP) != 1) + { + llwarns << "Short write" << llendl; + } + + delete[] buffer; + } else { + llwarns << "Short read" << llendl; + } } } @@ -1466,7 +1476,7 @@ void LLVFS::sync(LLVFSFileBlock *block, BOOL remove) } BOOL set_index_to_end = FALSE; - S32 seek_pos = block->mIndexLocation; + long seek_pos = block->mIndexLocation; if (-1 == seek_pos) { @@ -1514,7 +1524,11 @@ void LLVFS::sync(LLVFSFileBlock *block, BOOL remove) fseek(mIndexFP, seek_pos, SEEK_SET); } - fwrite(buffer, LLVFSFileBlock::SERIAL_SIZE, 1, mIndexFP); + if (fwrite(buffer, LLVFSFileBlock::SERIAL_SIZE, 1, mIndexFP) != 1) + { + llwarns << "Short write" << llendl; + } + // fflush(mIndexFP); lockData(); @@ -1643,18 +1657,24 @@ void LLVFS::pokeFiles() // only write data if we actually read 4 bytes // otherwise we're writing garbage and screwing up the file fseek(mDataFP, 0, SEEK_SET); - if (fread(&word, 1, 4, mDataFP) == 4) + if (fread(&word, sizeof(word), 1, mDataFP) == 1) { fseek(mDataFP, 0, SEEK_SET); - fwrite(&word, 1, 4, mDataFP); + if (fwrite(&word, sizeof(word), 1, mDataFP) != 1) + { + llwarns << "Could not write to data file" << llendl; + } fflush(mDataFP); } fseek(mIndexFP, 0, SEEK_SET); - if (fread(&word, 1, 4, mIndexFP) == 4) + if (fread(&word, sizeof(word), 1, mIndexFP) == 1) { fseek(mIndexFP, 0, SEEK_SET); - fwrite(&word, 1, 4, mIndexFP); + if (fwrite(&word, sizeof(word), 1, mIndexFP) != 1) + { + llwarns << "Could not write to index file" << llendl; + } fflush(mIndexFP); } } @@ -1689,21 +1709,26 @@ void LLVFS::audit() fflush(mIndexFP); fseek(mIndexFP, 0, SEEK_END); - S32 index_size = ftell(mIndexFP); + long index_size = ftell(mIndexFP); fseek(mIndexFP, 0, SEEK_SET); + BOOL vfs_corrupt = FALSE; + U8 *buffer = new U8[index_size]; - fread(buffer, index_size, 1, mIndexFP); + + if (fread(buffer, 1, index_size, mIndexFP) != index_size) + { + llwarns << "Index truncated" << llendl; + vfs_corrupt = TRUE; + } U8 *tmp_ptr = buffer; std::map<LLVFSFileSpecifier, LLVFSFileBlock*> found_files; U32 cur_time = (U32)time(NULL); - BOOL vfs_corrupt = FALSE; - std::vector<LLVFSFileBlock*> audit_blocks; - while (tmp_ptr < buffer + index_size) + while (!vfs_corrupt && tmp_ptr < buffer + index_size) { LLVFSFileBlock *block = new LLVFSFileBlock(); audit_blocks.push_back(block); @@ -1783,7 +1808,11 @@ void LLVFS::audit() llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " in memory, not on disk, loc " << block->mIndexLocation<< llendl; fseek(mIndexFP, block->mIndexLocation, SEEK_SET); U8 buf[LLVFSFileBlock::SERIAL_SIZE]; - fread(buf, LLVFSFileBlock::SERIAL_SIZE, 1, mIndexFP); + if (fread(buf, LLVFSFileBlock::SERIAL_SIZE, 1, mIndexFP) != 1) + { + llwarns << "VFile " << block->mFileID + << " gave short read" << llendl; + } LLVFSFileBlock disk_block; disk_block.deserialize(buf, block->mIndexLocation); @@ -2096,6 +2125,12 @@ FILE *LLVFS::openAndLock(const char *filename, const char *mode, BOOL read_lock) int fd; // first test the lock in a non-destructive way +#if LL_SOLARIS + struct flock fl; + fl.l_whence = SEEK_SET; + fl.l_start = 0; + fl.l_len = 1; +#else // !LL_SOLARIS if (strstr(mode, "w")) { fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ @@ -2111,13 +2146,19 @@ FILE *LLVFS::openAndLock(const char *filename, const char *mode, BOOL read_lock) fclose(fp); } } +#endif // !LL_SOLARIS // now actually open the file for use fp = LLFile::fopen(filename, mode); /* Flawfinder: ignore */ if (fp) { fd = fileno(fp); +#if LL_SOLARIS + fl.l_type = read_lock ? F_RDLCK : F_WRLCK; + if (fcntl(fd, F_SETLK, &fl) == -1) +#else if (flock(fd, (read_lock ? LOCK_SH : LOCK_EX) | LOCK_NB) == -1) +#endif { fclose(fp); fp = NULL; @@ -2145,7 +2186,14 @@ void LLVFS::unlockAndClose(FILE *fp) flock(fd, LOCK_UN); #endif */ - +#if LL_SOLARIS + struct flock fl; + fl.l_whence = SEEK_SET; + fl.l_start = 0; + fl.l_len = 1; + fl.l_type = F_UNLCK; + fcntl(fileno(fp), F_SETLK, &fl); +#endif fclose(fp); } } diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 3ccf0d1250..0fdb42436e 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -27,13 +27,13 @@ extern "C" { } #endif // LL_GTK -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS // not necessarily available on random SDL platforms, so #if LL_LINUX // for execv(), waitpid(), fork() # include <unistd.h> # include <sys/types.h> # include <sys/wait.h> -#endif // LL_LINUX +#endif // LL_LINUX || LL_SOLARIS extern BOOL gDebugWindowProc; @@ -329,6 +329,13 @@ static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str) static int x11_detect_VRAM_kb() { +#if LL_SOLARIS +#error Can this be done without an explicit architecture test, ie a test FOR xorg? Was followed by: && defined(__sparc) + // NOTE: there's no Xorg server on SPARC so just return 0 + // and allow SDL to attempt to get the amount of VRAM + return(0); +#else + std::string x_log_location("/var/log/"); std::string fname; int rtn = 0; // 'could not detect' @@ -400,6 +407,7 @@ static int x11_detect_VRAM_kb() } } return rtn; +#endif // LL_SOLARIS } #endif // LL_X11 @@ -469,7 +477,24 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); +#if !LL_SOLARIS SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, (bits <= 16) ? 16 : 24); +#else + // NOTE- use smaller Z-buffer to enable more graphics cards + // - This should not affect better GPUs and has been proven + // to provide 24-bit z-buffers when available. + // + // As the API states: + // + // GLX_DEPTH_SIZE Must be followed by a nonnegative + // minimum size specification. If this + // value is zero, visuals with no depth + // buffer are preferred. Otherwise, the + // largest available depth buffer of at + // least the minimum size is preferred. + + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); +#endif SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, (bits <= 16) ? 1 : 8); // *FIX: try to toggle vsync here? @@ -635,13 +660,26 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B // fixme: actually, it's REALLY important for picking that we get at // least 8 bits each of red,green,blue. Alpha we can be a bit more // relaxed about if we have to. +#if LL_SOLARIS +#error && defined(__sparc) + if(colorBits < 24) //HACK: on SPARC allow 24-bit color +#else if (colorBits < 32) +#endif { close(); setupFailure( +#if LL_SOLARIS +#error && defined(__sparc) + "Second Life requires at least 24-bit color on SPARC to run in a window.\n" + "Please use fbconfig to set your default color depth to 24 bits.\n" + "You may also need to adjust the X11 setting in SMF. To do so use\n" + " 'svccfg -s svc:/application/x11/x11-server setprop options/default_depth=24'\n" +#else "Second Life requires True Color (32-bit) to run in a window.\n" "Please go to Control Panels -> Display -> Settings and\n" "set the screen to 32-bit color.\n" +#endif "Alternately, if you choose to run fullscreen, Second Life\n" "will automatically adjust the screen each time it runs.", "Error", @@ -2637,7 +2675,7 @@ void spawn_web_browser(const char* escaped_url) { llinfos << "spawn_web_browser: " << escaped_url << llendl; -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS # if LL_X11 if (gWindowImplementation && gWindowImplementation->mSDL_Display) { @@ -2677,7 +2715,7 @@ void spawn_web_browser(const char* escaped_url) llwarns << "fork failure." << llendl; } } -#endif // LL_LINUX +#endif // LL_LINUX || LL_SOLARIS llinfos << "spawn_web_browser returning." << llendl; } diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 29e7214020..de4c7981e8 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -560,11 +560,11 @@ bool LLXMLNode::parseFile( fseek(fp, 0, SEEK_SET); U8* buffer = new U8[length+1]; - fread(buffer, 1, length, fp); - buffer[length] = 0; + size_t nread = fread(buffer, 1, length, fp); + buffer[nread] = 0; fclose(fp); - bool rv = parseBuffer(buffer, length, node, defaults_tree); + bool rv = parseBuffer(buffer, nread, node, defaults_tree); delete [] buffer; return rv; } @@ -734,7 +734,10 @@ void LLXMLNode::writeToFile(FILE *fOut, LLString indent) std::ostringstream ostream; writeToOstream(ostream, indent); LLString outstring = ostream.str(); - fwrite(outstring.c_str(), 1, outstring.length(), fOut); + if (fwrite(outstring.c_str(), 1, outstring.length(), fOut) != outstring.length()) + { + llwarns << "Short write" << llendl; + } } void LLXMLNode::writeToOstream(std::ostream& output_stream, const LLString& indent) diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index 524f2089fd..19c51b08b2 100644 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -42,6 +42,12 @@ void parse_string(); #define YYLMAX 16384 #define YY_NEVER_INTERACTIVE 1 /* stops flex from calling isatty() */ +#ifdef ECHO +#undef ECHO +#endif + +#define ECHO do { } while (0) + #if defined(__cplusplus) extern "C" { int yylex( void ); } extern "C" { int yyparse( void ); } diff --git a/indra/lscript/lscript_compile/lscript_bytecode.cpp b/indra/lscript/lscript_compile/lscript_bytecode.cpp index d6b0fe4926..b91f53503b 100644 --- a/indra/lscript/lscript_compile/lscript_bytecode.cpp +++ b/indra/lscript/lscript_compile/lscript_bytecode.cpp @@ -288,7 +288,10 @@ void LLScriptScriptCodeChunk::build(FILE *efp, FILE *bcfp) set_register(mCompleteCode, LREG_TM, mTotalSize); - fwrite(mCompleteCode, 1, mTotalSize, bcfp); + if (fwrite(mCompleteCode, 1, mTotalSize, bcfp) != mTotalSize) + { + llwarns << "Short write" << llendl; + } } else { diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index 196ca07d1d..b166e922a2 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -43,11 +43,19 @@ LLScriptExecute::LLScriptExecute(FILE *fp) U8 sizearray[4]; S32 filesize; S32 pos = 0; - fread(&sizearray, 1, 4, fp); - filesize = bytestream2integer(sizearray, pos); + if (fread(&sizearray, 1, 4, fp) != 4) + { + llwarns << "Short read" << llendl; + filesize = 0; + } else { + filesize = bytestream2integer(sizearray, pos); + } mBuffer = new U8[filesize]; fseek(fp, 0, SEEK_SET); - fread(mBuffer, 1, filesize, fp); + if (fread(mBuffer, 1, filesize, fp) != filesize) + { + llwarns << "Short read" << llendl; + } fclose(fp); init(); diff --git a/indra/lscript/lscript_execute/lscript_readlso.cpp b/indra/lscript/lscript_execute/lscript_readlso.cpp index 669a9b6a06..0021a87d65 100644 --- a/indra/lscript/lscript_execute/lscript_readlso.cpp +++ b/indra/lscript/lscript_execute/lscript_readlso.cpp @@ -17,11 +17,19 @@ LLScriptLSOParse::LLScriptLSOParse(FILE *fp) U8 sizearray[4]; S32 filesize; S32 pos = 0; - fread(&sizearray, 1, 4, fp); - filesize = bytestream2integer(sizearray, pos); + if (fread(&sizearray, 1, 4, fp) != 4) + { + llwarns << "Short read" << llendl; + filesize = 0; + } else { + filesize = bytestream2integer(sizearray, pos); + } mRawData = new U8[filesize]; fseek(fp, 0, SEEK_SET); - fread(mRawData, 1, filesize, fp); + if (fread(mRawData, 1, filesize, fp) != filesize) + { + llwarns << "Short read" << llendl; + } initOpCodePrinting(); } diff --git a/indra/newview/featuretable_solaris.txt b/indra/newview/featuretable_solaris.txt new file mode 100644 index 0000000000..6c7acfa187 --- /dev/null +++ b/indra/newview/featuretable_solaris.txt @@ -0,0 +1,173 @@ +version 10 + +// NOTE: This is mostly identical to featuretable.txt with a few differences +// Should be combined into one table + +// +// Generates lists of feature mask that can be applied on top of each other. +// +// // Begin comments +// list <name> +// Starts a feature list named <name> +// <name> <available> <recommended> +// <name> is the name of a feature +// <available> is 0 or 1, whether the feature is available +// <recommended> is an S32 which is the recommended value +// +// For now, the first list read sets up all of the default values +// + + +// +// All contains everything at their default settings for high end machines +// NOTE: All settings are set to the MIN of applied values, including 'all'! +// +list all +RenderVBO 1 1 +RenderAniso 1 0 +RenderAvatarMode 1 2 +RenderAvatarVP 1 1 +RenderDistance 1 128 +RenderLighting 1 1 +RenderObjectBump 1 1 +RenderParticleCount 1 4096 +RenderRippleWater 1 1 +RenderTerrainDetail 1 2 +VertexShaderEnable 1 1 + +// +// Class 0 Hardware (Unknown or just old) +// +list Class0 +VertexShaderEnable 1 0 +RenderVBO 1 0 +RenderDistance 1 64 +RenderAvatarVP 1 0 +RenderAvatarMode 1 0 +RenderLighting 1 0 +RenderObjectBump 1 0 +RenderRippleWater 1 0 + +// +// Class 1 Hardware +// +list Class1 +VertexShaderEnable 1 0 +RenderVBO 1 1 +RenderDistance 1 96 +RenderAvatarVP 1 1 +RenderAvatarMode 1 0 +RenderLighting 1 0 +RenderObjectBump 1 0 +RenderRippleWater 1 0 + +// +// Class 2 Hardware (make it purty) +// +list Class2 +VertexShaderEnable 1 1 +RenderAvatarVP 1 1 +RenderAvatarMode 1 1 +RenderLighting 1 1 +RenderObjectBump 1 1 +RenderRippleWater 1 1 + +// +// Class 3 Hardware (make it purty) +// +list Class3 +VertexShaderEnable 1 1 +RenderAvatarVP 1 1 +RenderAvatarMode 1 1 +RenderLighting 1 1 +RenderObjectBump 1 1 +RenderRippleWater 1 1 + +// +// No Pixel Shaders available +// +list NoPixelShaders +VertexShaderEnable 0 0 +RenderAvatarVP 0 0 + +// +// No Vertex Shaders available +// +list NoVertexShaders +VertexShaderEnable 0 0 +RenderAvatarVP 0 0 + +// +// "Default" setups for safe, low, medium, high +// +list safe +RenderVBO 1 0 +RenderAniso 1 0 +RenderAvatarVP 0 0 +RenderLighting 1 0 +RenderParticleCount 1 1024 +RenderTerrainDetail 1 0 + + +list low +RenderVBO 1 0 +RenderAniso 1 0 +RenderLighting 1 0 + +list medium +RenderLighting 1 0 + + +// +// CPU based feature masks +// + +// 1Ghz or less (equiv) +list CPUSlow +RenderParticleCount 1 1024 + + +// +// RAM based feature masks +// +list RAM256MB +RenderObjectBump 0 0 + + +// +// Graphics card based feature masks +// +list OpenGLPre15 +RenderVBO 1 0 + +list Intel +RenderVBO 1 0 +RenderAniso 1 0 +RenderLighting 1 0 +RenderTerrainDetail 1 0 + +list GeForce2 +RenderVBO 1 1 +RenderAniso 1 0 +RenderLighting 1 0 +RenderParticleCount 1 2048 +RenderTerrainDetail 1 0 + +list GeForce3 + +list ATI + +list Radeon8500 +RenderLighting 1 0 +RenderParticleCount 1 4096 + +// Hacked to be paranoid "safe" +list Radeon9700 +RenderParticleCount 1 4096 + +// Hacked to be paranoid "safe" +list MobilityRadeon9000 +RenderLighting 1 0 +RenderParticleCount 1 4096 + +list GeForceFX diff --git a/indra/newview/licenses-solaris.txt b/indra/newview/licenses-solaris.txt new file mode 100644 index 0000000000..a0dc048825 --- /dev/null +++ b/indra/newview/licenses-solaris.txt @@ -0,0 +1,516 @@ +=========== +APR License +=========== + +Copyright 2000-2004 The Apache Software Foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +============== +Base32 License +============== + + * Copyright (c) 2006 Christian Biere <christianbiere@gmx.de> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the authors nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +========== +Cg License +========== + +Copyright (c) 2002, NVIDIA Corporation. + + + +NVIDIA Corporation("NVIDIA") supplies this software to you in consideration +of your agreement to the following terms, and your use, installation, +modification or redistribution of this NVIDIA software constitutes +acceptance of these terms. If you do not agree with these terms, please do +not use, install, modify or redistribute this NVIDIA software. + + + +In consideration of your agreement to abide by the following terms, and +subject to these terms, NVIDIA grants you a personal, non-exclusive license, +under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA +Software"), to use, reproduce, modify and redistribute the NVIDIA +Software, with or without modifications, in source and/or binary forms; +provided that if you redistribute the NVIDIA Software, you must retain the +copyright notice of NVIDIA, this notice and the following text and +disclaimers in all such redistributions of the NVIDIA Software. Neither the +name, trademarks, service marks nor logos of NVIDIA Corporation may be used +to endorse or promote products derived from the NVIDIA Software without +specific prior written permission from NVIDIA. Except as expressly stated +in this notice, no other rights or licenses express or implied, are granted +by NVIDIA herein, including but not limited to any patent rights that may be +infringed by your derivative works or by other works in which the NVIDIA +Software may be incorporated. No hardware is licensed hereunder. + + + +THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING +WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION +EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. + + + +IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, +EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST +PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, +REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, +HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING +NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + + +============ +cURL License +============ + +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1996 - 2002, Daniel Stenberg, <daniel@haxx.se>. + +All rights reserved. + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright +notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization of the copyright holder. + + +============= +expat License +============= + +Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +================ +FreeType License +================ + +Portions of this software are copyright (c) 2003 The FreeType +Project (www.freetype.org). All rights reserved. + +========================== +FSI FontShop International +========================== + +Certain of the fonts in the Meta family of copyrighted typefaces are +used in Second Life under license from FSI FontShop +International. Copies of such Meta fonts that are included in the +Viewer are not themselves open source and are not available under the +GPL license, and they may not be copied. Developers may use those +fonts solely to the extent necessary to use or customize the Linden +Software in Second Life and to develop and distribute content solely +for use in the Second Life environment, and for no other purposes. +Second Life developers who wish to make other uses of Meta fonts must +obtain a license from FSI FontShop International at www.fontfont.com. + +========== +GL License +========== + +Mesa 3-D graphics library +Version: 6.2 + +Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +======================= +JPEG Library 6b License +======================= + +This software is based in part on the work of the Independent JPEG Group + +================ +JPEG2000 License +================ + +Copyright 2001, David Taubman, The University of New South Wales (UNSW) +The copyright owner is Unisearch Ltd, Australia (commercial arm of UNSW) +Neither this copyright statement, nor the licensing details below +may be removed from this file or dissociated from its contents. + +Licensee: Linden Research, Inc. +License number: 00024 +The licensee has been granted a COMMERCIAL license to the contents of +this source file. A brief summary of this license appears below. This +summary is not to be relied upon in preference to the full text of the +license agreement, accepted at purchase of the license. +1. The Licensee has the right to Commercial Use of the Kakadu software, + including distribution of one or more Applications built using the + software. +2. The Licensee has the right to Internal Use of the Kakadu software, + including use by employees of the Licensee or an Affiliate for the + purpose of performing services on behalf of the Licensee or Affiliate, + or in the performance of services for Third Parties who engage Licensee + or an Affiliate for such services. +3. The Licensee has the right to distribute Reusable Code (including + source code and dynamically or statically linked libraries) to a Third + Party, provided the Third Party possesses a license to use the Kakadu + software. + +================== +ogg/vorbis License +================== + +Copyright (c) 2001, Xiphophorus + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiphophorus nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +=========== +SDL License +=========== + +SDL - Simple DirectMedia Layer +Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Sam Lantinga +slouken@libsdl.org + +The GNU Library GPL is available at http://www.gnu.org/copyleft/lesser.html + +============= +ELFIO License +============= + +ELFIO.h - ELF reader and producer. +Copyright (C) 2001 Serge Lamikhov-Center <to_serge@users.sourceforge.net> + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +The GNU Library GPL is available at http://www.gnu.org/copyleft/lesser.html + +=============== +OpenSSL License +=============== + +Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +==================================================================== + +This product includes cryptographic software written by Eric Young +(eay@cryptsoft.com). This product includes software written by Tim +Hudson (tjh@cryptsoft.com). + + + +======================= +Original SSLeay License +======================= + +Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) +All rights reserved. + +This package is an SSL implementation written +by Eric Young (eay@cryptsoft.com). +The implementation was written so as to conform with Netscapes SSL. + +This library is free for commercial and non-commercial use as long as +the following conditions are aheared to. The following conditions +apply to all code found in this distribution, be it the RC4, RSA, +lhash, DES, etc., code; not just the SSL code. The SSL documentation +included with this distribution is covered by the same copyright terms +except that the holder is Tim Hudson (tjh@cryptsoft.com). + +Copyright remains Eric Young's, and as such any Copyright notices in +the code are not to be removed. +If this package is used in a product, Eric Young should be given attribution +as the author of the parts of the library used. +This can be in the form of a textual message at program startup or +in documentation (online or textual) provided with the package. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + "This product includes cryptographic software written by + Eric Young (eay@cryptsoft.com)" + The word 'cryptographic' can be left out if the rouines from the library + being used are not cryptographic related :-). +4. If you include any Windows specific code (or a derivative thereof) from + the apps directory (application code) you must include an acknowledgement: + "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + +THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +The licence and distribution terms for any publically available version or +derivative of this code cannot be changed. i.e. this code cannot simply be +copied and put under another distribution licence +[including the GNU Public Licence.] + + +================== +xmlrpc-epi License +================== + +Copyright 2000 Epinions, Inc. + +Subject to the following 3 conditions, Epinions, Inc. permits you, free of charge, to (a) use, copy, distribute, modify, perform and display this software and associated documentation files (the "Software"), and (b) permit others to whom the Software is furnished to do so as well. + +1) The above copyright notice and this permission notice shall be included without modification in all copies or substantial portions of the Software. + +2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. + +3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH DAMAGES. + + +=============== +libuuid License +=============== + +Copyright (C) 1999, 2000, 2003, 2004 by Theodore Ts'o + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, and the entire permission notice in its entirety, + including the disclaimer of warranties. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF +WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + + +============ +zlib License +============ + +'zlib' general purpose compression library version 1.1.4, March 11th, 2002 + +Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the +use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +The origin of this software must not be misrepresented; you must not claim +that you wrote the original software. If you use this software in a product, +an acknowledgment in the product documentation would be appreciated but is +not required. + +Altered source versions must be plainly marked as such, and must not be +misrepresented as being the original software. + +This notice may not be removed or altered from any source distribution. + +Jean-loup Gailly +jloup@gzip.org + +Mark Adler +madler@alumni.caltech.edu diff --git a/indra/newview/lldrawpoolsky.h b/indra/newview/lldrawpoolsky.h index 88d1ce03d0..b08075b3bf 100644 --- a/indra/newview/lldrawpoolsky.h +++ b/indra/newview/lldrawpoolsky.h @@ -37,7 +37,7 @@ public: /*virtual*/ void render(S32 pass = 0); /*virtual*/ void renderForSelect(); void setSkyTex(LLSkyTex* const st) { mSkyTex = st; } - void setSun(LLHeavenBody* sun) { mHB[0] = sun; } + void setSun(LLHeavenBody* sun_flag) { mHB[0] = sun_flag; } void setMoon(LLHeavenBody* moon) { mHB[1] = moon; } void renderSkyCubeFace(U8 side); diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index fd66d58851..bc35c167ea 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -575,7 +575,7 @@ void LLDrawPoolWater::shade() glUniform1fARB(gWaterProgram.mUniform[LLShaderMgr::WATER_TIME], sTime); glUniform3fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_SPECULAR], 1, light_diffuse.mV); glUniform1fARB(gWaterProgram.mUniform[LLShaderMgr::WATER_SPECULAR_EXP], light_exp); - glUniform3fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_EYEVEC], 1, gCamera->getOrigin().mV); + glUniform3fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_EYEVEC], 1, (GLfloat *)(gCamera->getOrigin().mV)); glUniform2fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_WAVE_DIR1], 1, d1.mV); glUniform2fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_WAVE_DIR2], 1, d2.mV); glUniform3fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_LIGHT_DIR], 1, light_dir.mV); diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 2b58e2b4c3..35849552b3 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -42,6 +42,8 @@ extern void write_debug(const std::string& str); const char FEATURE_TABLE_FILENAME[] = "featuretable_mac.txt"; #elif LL_LINUX const char FEATURE_TABLE_FILENAME[] = "featuretable_linux.txt"; +#elif LL_SOLARIS +const char FEATURE_TABLE_FILENAME[] = "featuretable_solaris.txt"; #else const char FEATURE_TABLE_FILENAME[] = "featuretable.txt"; #endif @@ -385,7 +387,12 @@ void LLFeatureManager::initCPUFeatureMasks() maskFeatures("RAM256MB"); } +#if LL_SOLARIS && defined(__sparc) // even low MHz SPARCs are fast +#error The 800 is hinky. Would something like a LL_MIN_MHZ make more sense here? + if (gSysCPU.getMhz() < 800) +#else if (gSysCPU.getMhz() < 1100) +#endif { maskFeatures("CPUSlow"); } diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index d50c54b938..79e3315115 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -4645,7 +4645,7 @@ void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) BOOL LLInventoryFilter::isSinceLogoff() { - return mFilterOps.mMinDate == mLastLogoff && mFilterOps.mMaxDate == U32_MAX; + return (mFilterOps.mMinDate == mLastLogoff) && (mFilterOps.mMaxDate == U32_MAX); } void LLInventoryFilter::setHoursAgo(U32 hours) @@ -4946,28 +4946,48 @@ void LLInventoryFilter::toLLSD(LLSD& data) data["permissions"] = (LLSD::Integer)getFilterPermissions(); data["substring"] = (LLSD::String)getFilterSubString(); data["sort_order"] = (LLSD::Integer)getSortOrder(); + data["since_logoff"] = (LLSD::Boolean)isSinceLogoff(); } void LLInventoryFilter::fromLLSD(LLSD& data) { if(data.has("filter_types")) + { setFilterTypes((U32)data["filter_types"].asInteger()); + } if(data.has("min_date") && data.has("max_date")) + { setDateRange((U32)data["min_date"].asInteger(), (U32)data["max_date"].asInteger()); + } if(data.has("hours_ago")) + { setHoursAgo((U32)data["hours_ago"].asInteger()); + } if(data.has("show_folder_state")) + { setShowFolderState((EFolderShow)data["show_folder_state"].asInteger()); + } if(data.has("permissions")) + { setFilterPermissions((PermissionMask)data["permissions"].asInteger()); + } if(data.has("substring")) + { setFilterSubString(LLString(data["substring"].asString())); + } if(data.has("sort_order")) + { setSortOrder((U32)data["sort_order"].asInteger()); + } + + if(data.has("since_logoff")) + { + setDateRangeLastLogoff((bool)data["since_logoff"].asBoolean()); + } } diff --git a/indra/newview/llhudmanager.cpp b/indra/newview/llhudmanager.cpp index 31e6318d25..b3e51de317 100644 --- a/indra/newview/llhudmanager.cpp +++ b/indra/newview/llhudmanager.cpp @@ -30,7 +30,6 @@ LLColor4 LLHUDManager::sChildColor; LLHUDManager::LLHUDManager() { - mShowPhysical = FALSE; LLHUDManager::sParentColor = gColors.getColor("FocusColor"); // rdw commented out since it's not used. Also removed from colors_base.xml @@ -39,110 +38,10 @@ LLHUDManager::LLHUDManager() LLHUDManager::~LLHUDManager() { - mHUDJoints.reset(); - mHUDSelectedJoints.reset(); mHUDEffects.reset(); } -void LLHUDManager::toggleShowPhysical(const BOOL show_physical) -{ - if (show_physical == mShowPhysical) - { - return; - } - - mShowPhysical = show_physical; - if (show_physical) - { - S32 i; - for (i = 0; i < gObjectList.getNumObjects(); i++) - { - LLViewerObject *vobjp = gObjectList.getObject(i); - - if (vobjp && vobjp->isJointChild() && vobjp->getParent()) - { - LLHUDConnector *connectorp = (LLHUDConnector *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_CONNECTOR); - connectorp->setTargets(vobjp, (LLViewerObject *)vobjp->getParent()); - connectorp->setColors(LLColor4(1.f, 1.f, 1.f, 1.f), sChildColor, sParentColor); - EHavokJointType joint_type = vobjp->getJointType(); - if (HJT_HINGE == joint_type) - { - connectorp->setLabel("Hinge"); - } - else if (HJT_POINT == joint_type) - { - connectorp->setLabel("P2P"); - } -#if 0 - else if (HJT_LPOINT == joint_type) - { - connectorp->setLabel("LP2P"); - } -#endif -#if 0 - else if (HJT_WHEEL == joint_type) - { - connectorp->setLabel("Wheel"); - } -#endif - mHUDJoints.put(connectorp); - } - } - } - else - { - mHUDJoints.reset(); - } -} - -void LLHUDManager::showJoints(LLDynamicArray < LLViewerObject* > *object_list) -{ - for (S32 i=0; i<object_list->count(); i++) - { - LLViewerObject *vobjp = object_list->get(i); - if (vobjp && vobjp->isJointChild() && vobjp->getParent()) - { - LLHUDConnector *connectorp = (LLHUDConnector *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_CONNECTOR); - connectorp->setTargets(vobjp, (LLViewerObject *)vobjp->getParent()); - connectorp->setColors(LLColor4(1.f, 1.f, 1.f, 1.f), sChildColor, sParentColor); - - EHavokJointType joint_type = vobjp->getJointType(); - if (HJT_HINGE == joint_type) - { - connectorp->setLabel("Hinge"); - } - else if (HJT_POINT == joint_type) - { - connectorp->setLabel("P2P"); - } -#if 0 - else if (HJT_LPOINT == joint_type) - { - connectorp->setLabel("LP2P"); - } -#endif -#if 0 - else if (HJT_WHEEL == joint_type) - { - connectorp->setLabel("Wheel"); - } -#endif - mHUDSelectedJoints.put(connectorp); - } - } -} - -void LLHUDManager::clearJoints() -{ - mHUDSelectedJoints.reset(); -} - -BOOL LLHUDManager::getShowPhysical() const -{ - return mShowPhysical; -} - void LLHUDManager::updateEffects() { LLFastTimer ftm(LLFastTimer::FTM_HUD_EFFECTS); diff --git a/indra/newview/llhudmanager.h b/indra/newview/llhudmanager.h index 4cb22a2477..dd519554f9 100644 --- a/indra/newview/llhudmanager.h +++ b/indra/newview/llhudmanager.h @@ -30,11 +30,6 @@ public: LLHUDManager(); ~LLHUDManager(); - void toggleShowPhysical(const BOOL show_physical); - void showJoints(LLDynamicArray < LLViewerObject* > *object_list); - void clearJoints(); - BOOL getShowPhysical() const; - LLHUDEffect *createViewerEffect(const U8 type, BOOL send_to_sim = TRUE, BOOL originated_here = TRUE); void updateEffects(); @@ -47,12 +42,7 @@ public: static LLColor4 sChildColor; protected: - LLDynamicArrayPtr<LLPointer<LLHUDObject> > mHUDJoints; - LLDynamicArrayPtr<LLPointer<LLHUDObject> > mHUDSelectedJoints; LLDynamicArrayPtr<LLPointer<LLHUDEffect> > mHUDEffects; - - // ALT held down this frame? - BOOL mShowPhysical; }; extern LLHUDManager *gHUDManager; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 336da9ac79..5a6cbb045d 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -536,11 +536,11 @@ void LLIMView::removeSession(const LLUUID& session_id) mFloaters.erase(floater->getHandle()); mTalkFloater->removeFloater(floater); //mTabContainer->removeTabPanel(floater); - } - - if ( session_id.notNull() && floater->getDialogType() != IM_NOTHING_SPECIAL ) - { - mSessionsDropRequested[session_id.asString()] = LLSD(); + if(session_id.notNull() + && (floater->getDialogType() != IM_NOTHING_SPECIAL)) + { + mSessionsDropRequested[session_id.asString()] = LLSD(); + } } } diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp index 125e1d211f..1e3be7c23f 100644 --- a/indra/newview/llpolymesh.cpp +++ b/indra/newview/llpolymesh.cpp @@ -258,7 +258,10 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName ) // Read a chunk //------------------------------------------------------------------------- char header[128]; /*Flawfinder: ignore*/ - fread(header, sizeof(char), 128, fp); + if (fread(header, sizeof(char), 128, fp) != 128) + { + llwarns << "Short read" << llendl; + } //------------------------------------------------------------------------- // Check for proper binary header diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 9c9c5a9582..2d4a6d11d9 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1322,7 +1322,10 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, LLString line; while(!feof(fp)) { - fgets(buffer, MAX_STRING, fp); + if (fgets(buffer, MAX_STRING, fp) == NULL) + { + buffer[0] = '\0'; + } if(feof(fp)) { break; @@ -1829,12 +1832,16 @@ void LLLiveLSLEditor::loadScriptText(const char* filename) { // read in the whole file fseek(file, 0L, SEEK_END); - S32 file_length = ftell(file); + long file_length = ftell(file); fseek(file, 0L, SEEK_SET); char* buffer = new char[file_length+1]; - fread(buffer, file_length, 1, file); + size_t nread = fread(buffer, 1, file_length, file); + if (nread < (size_t) file_length) + { + llwarns << "Short read" << llendl; + } + buffer[nread] = '\0'; fclose(file); - buffer[file_length] = 0; mScriptEd->mEditor->setText(buffer); mScriptEd->mEditor->makePristine(); delete[] buffer; @@ -2105,7 +2112,10 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, while(!feof(fp)) { - fgets(buffer, MAX_STRING, fp); + if (fgets(buffer, MAX_STRING, fp) == NULL) + { + buffer[0] = '\0'; + } if(feof(fp)) { break; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 54ac03a3c5..341dec4115 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -3460,7 +3460,6 @@ void LLSelectMgr::deselectAll() mLastSentSelectionCenterGlobal.clearVec(); updatePointAt(); - gHUDManager->clearJoints(); updateSelectionCenter(); } @@ -5497,7 +5496,7 @@ void LLSelectMgr::updateSelectionCenter() // have stuff selected LLVector3d select_center; // keep a list of jointed objects for showing the joint HUDEffects - gHUDManager->clearJoints(); + LLDynamicArray < LLViewerObject *> jointed_objects; for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) @@ -5523,10 +5522,6 @@ void LLSelectMgr::updateSelectionCenter() mSelectionCenterGlobal = gAgent.getPosGlobalFromAgent(bbox_center_agent); mSelectionBBox = bbox; - if (jointed_objects.count()) - { - gHUDManager->showJoints(&jointed_objects); - } } if ( !(gAgentID == LLUUID::null) && gToolMgr) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6d939ad3e9..ab735c97ad 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1139,12 +1139,13 @@ BOOL idle_startup() emsg << "Unable to connect to " << gSecondLife << ".\n"; emsg << gUserAuthp->errorMessage(); } else { + auth_uri_num++; std::ostringstream s; - s << "Logging in (attempt " << (auth_uri_num + 1) << "). "; + s << "Previous login attempt failed. Logging in, attempt " + << (auth_uri_num + 1) << ". "; auth_desc = s.str(); gStartupState = STATE_LOGIN_AUTHENTICATE; auth_uri_num++; - auth_uri_num++; return do_normal_idle; } break; @@ -2482,7 +2483,10 @@ void save_password_to_disk(const char* hashed_password) LLXORCipher cipher(gMACAddress, 6); cipher.encrypt(buffer, HASHED_LENGTH); - fwrite(buffer, HASHED_LENGTH, 1, fp); + if (fwrite(buffer, HASHED_LENGTH, 1, fp) != 1) + { + llwarns << "Short write" << llendl; + } fclose(fp); } diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 959af911b7..ad977a4c46 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -440,7 +440,11 @@ bool LLViewerInventoryCategory::importFileLocal(FILE* fp) valuestr[0] = '\0'; while(!feof(fp)) { - fgets(buffer, MAX_STRING, fp); + if (fgets(buffer, MAX_STRING, fp) == NULL) + { + buffer[0] = '\0'; + } + sscanf( /* Flawfinder: ignore */ buffer, " %254s %254s", keyword, valuestr); if(0 == strcmp("{",keyword)) diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 923d574499..7ba2208958 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -38,8 +38,7 @@ #include "m3math.h" #include "m4math.h" - -#if !LL_DARWIN && !LL_LINUX +#if !LL_DARWIN && !LL_LINUX && !LL_SOLARIS extern PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB; extern PFNGLWEIGHTFVARBPROC glWeightfvARB; extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 12ebca3b82..3e097d5600 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2538,7 +2538,7 @@ void load_url_local_file(const char* file_name) gAgent.changeCameraToDefault(); } -#if LL_DARWIN || LL_LINUX +#if LL_DARWIN || LL_LINUX || LL_SOLARIS // MBW -- If the Mac client is in fullscreen mode, it needs to go windowed so the browser will be visible. if(gViewerWindow->mWindow->getFullscreen()) { @@ -7300,22 +7300,66 @@ class LLViewToggleBeacon : public view_listener_t bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { LLString beacon = userdata.asString(); - if (beacon == "scripts") + if (beacon == "scriptsbeacon") { LLPipeline::toggleRenderScriptedBeacons(NULL); + gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons(NULL) ); + // toggle the other one off if it's on + if (LLPipeline::getRenderScriptedBeacons(NULL) && LLPipeline::getRenderScriptedTouchBeacons(NULL)) + { + LLPipeline::toggleRenderScriptedTouchBeacons(NULL); + gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons(NULL) ); + } } - else if (beacon == "physical") + else if (beacon == "physicalbeacon") { LLPipeline::toggleRenderPhysicalBeacons(NULL); + gSavedSettings.setBOOL( "physicalbeacon", LLPipeline::getRenderPhysicalBeacons(NULL) ); } - else if (beacon == "sounds") + else if (beacon == "soundsbeacon") { LLPipeline::toggleRenderSoundBeacons(NULL); + gSavedSettings.setBOOL( "soundsbeacon", LLPipeline::getRenderSoundBeacons(NULL) ); } - else if (beacon == "particles") + else if (beacon == "particlesbeacon") { LLPipeline::toggleRenderParticleBeacons(NULL); + gSavedSettings.setBOOL( "particlesbeacon", LLPipeline::getRenderParticleBeacons(NULL) ); + } + else if (beacon == "scripttouchbeacon") + { + LLPipeline::toggleRenderScriptedTouchBeacons(NULL); + gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons(NULL) ); + // toggle the other one off if it's on + if (LLPipeline::getRenderScriptedBeacons(NULL) && LLPipeline::getRenderScriptedTouchBeacons(NULL)) + { + LLPipeline::toggleRenderScriptedBeacons(NULL); + gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons(NULL) ); + } } + else if (beacon == "renderbeacons") + { + LLPipeline::toggleRenderBeacons(NULL); + gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons(NULL) ); + // toggle the other one on if it's not + if (!LLPipeline::getRenderBeacons(NULL) && !LLPipeline::getRenderHighlights(NULL)) + { + LLPipeline::toggleRenderHighlights(NULL); + gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights(NULL) ); + } + } + else if (beacon == "renderhighlights") + { + LLPipeline::toggleRenderHighlights(NULL); + gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights(NULL) ); + // toggle the other one on if it's not + if (!LLPipeline::getRenderBeacons(NULL) && !LLPipeline::getRenderHighlights(NULL)) + { + LLPipeline::toggleRenderBeacons(NULL); + gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons(NULL) ); + } + } + return true; } }; @@ -7326,21 +7370,40 @@ class LLViewCheckBeaconEnabled : public view_listener_t { LLString beacon = userdata["data"].asString(); bool new_value = false; - if (beacon == "scripts") + if (beacon == "scriptsbeacon") + { + new_value = gSavedSettings.getBOOL( "scriptsbeacon"); + LLPipeline::setRenderScriptedBeacons(new_value); + } + else if (beacon == "physicalbeacon") + { + new_value = gSavedSettings.getBOOL( "physicalbeacon"); + LLPipeline::setRenderPhysicalBeacons(new_value); + } + else if (beacon == "soundsbeacon") + { + new_value = gSavedSettings.getBOOL( "soundsbeacon"); + LLPipeline::setRenderSoundBeacons(new_value); + } + else if (beacon == "particlesbeacon") { - new_value = LLPipeline::getRenderScriptedBeacons(NULL); + new_value = gSavedSettings.getBOOL( "particlesbeacon"); + LLPipeline::setRenderParticleBeacons(new_value); } - else if (beacon == "physical") + else if (beacon == "scripttouchbeacon") { - new_value = LLPipeline::getRenderPhysicalBeacons(NULL); + new_value = gSavedSettings.getBOOL( "scripttouchbeacon"); + LLPipeline::setRenderScriptedTouchBeacons(new_value); } - else if (beacon == "sounds") + else if (beacon == "renderbeacons") { - new_value = LLPipeline::getRenderSoundBeacons(NULL); + new_value = gSavedSettings.getBOOL( "renderbeacons"); + LLPipeline::setRenderBeacons(new_value); } - else if (beacon == "particles") + else if (beacon == "renderhighlights") { - new_value = LLPipeline::getRenderParticleBeacons(NULL); + new_value = gSavedSettings.getBOOL( "renderhighlights"); + LLPipeline::setRenderHighlights(new_value); } gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 44f5cbb9db..0038c0cf1c 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -671,7 +671,10 @@ void upload_new_resource(const LLString& src_filename, std::string name, S16 type_num; // read in and throw out most of the header except for the type - fread(buf, header_size, 1, in); + if (fread(buf, header_size, 1, in) != 1) + { + llwarns << "Short read" << llendl; + } memcpy(&type_num, buf + 16, sizeof(S16)); /* Flawfinder: ignore */ asset_type = (LLAssetType::EType)type_num; } @@ -682,7 +685,10 @@ void upload_new_resource(const LLString& src_filename, std::string name, { while((read = fread(buf, 1, 16384, in))) /* Flawfinder: ignore */ { - fwrite(buf, 1, read, out); /* Flawfinder: ignore */ + if (fwrite(buf, 1, read, out) != read) + { + llwarns << "Short write" << llendl; + } } fclose(out); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3ee72b3d17..6a9b5a8031 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -322,10 +322,15 @@ void export_complete() FILE* fXML = LLFile::fopen(gExportedFile.c_str(), "rb"); /* Flawfinder: ignore */ fseek(fXML, 0, SEEK_END); - U32 length = ftell(fXML); + long length = ftell(fXML); fseek(fXML, 0, SEEK_SET); - U8 *buffer = new U8[length]; - fread(buffer, 1, length, fXML); + U8 *buffer = new U8[length + 1]; + size_t nread = fread(buffer, 1, length, fXML); + if (nread < (size_t) length) + { + llwarns << "Short read" << llendl; + } + buffer[nread] = '\0'; fclose(fXML); char *pos = (char *)buffer; @@ -361,7 +366,10 @@ void export_complete() } FILE* fXMLOut = LLFile::fopen(gExportedFile.c_str(), "wb"); /* Flawfinder: ignore */ - fwrite(buffer, 1, length, fXMLOut); + if (fwrite(buffer, 1, length, fXMLOut) != length) + { + llwarns << "Short write" << llendl; + } fclose(fXMLOut); delete [] buffer; @@ -423,7 +431,10 @@ void exported_j2c_complete(const LLTSCode status, void *user_data) S32 length = ftell(fIn); fseek(fIn, 0, SEEK_SET); U8 *buffer = ImageUtility->allocateData(length); - fread(buffer, 1, length, fIn); + if (fread(buffer, 1, length, fIn) != length) + { + llwarns << "Short read" << llendl; + } fclose(fIn); LLFile::remove(filename.c_str()); @@ -450,7 +461,10 @@ void exported_j2c_complete(const LLTSCode status, void *user_data) strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */ if (fOut) { - fwrite(data, 1, data_size, fOut); + if (fwrite(data, 1, data_size, fOut) != data_size) + { + llwarns << "Short write" << llendl; + } fseek(fOut, 0, SEEK_SET); fclose(fOut); fOut = LLFile::fopen(output_file.c_str(), "rb"); /* Flawfinder: ignore */ diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 223286b1c9..4040a6d21b 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -182,8 +182,9 @@ void LLViewerRegion::loadCache() } U32 zero; - fread(&zero, 1, sizeof(U32), fp); - if (zero) + size_t nread; + nread = fread(&zero, sizeof(U32), 1, fp); + if (nread != 1 || zero) { // a non-zero value here means bad things! // skip reading the cached values @@ -193,8 +194,8 @@ void LLViewerRegion::loadCache() } U32 version; - fread(&version, 1, sizeof(U32), fp); - if (version != INDRA_OBJECT_CACHE_VERSION) + nread = fread(&version, sizeof(U32), 1, fp); + if (nread != 1 || version != INDRA_OBJECT_CACHE_VERSION) { // a version mismatch here means we've changed the binary format! // skip reading the cached values @@ -204,8 +205,8 @@ void LLViewerRegion::loadCache() } LLUUID cache_id; - fread(&cache_id.mData, UUID_BYTES, sizeof(U8), fp); - if (mCacheID != cache_id) + nread = fread(&cache_id.mData, 1, UUID_BYTES, fp); + if (nread != UUID_BYTES || mCacheID != cache_id) { llinfos << "Cache ID doesn't match for this region, discarding" << llendl; @@ -214,7 +215,14 @@ void LLViewerRegion::loadCache() } S32 num_entries; - fread(&num_entries, 1, sizeof(S32), fp); + nread = fread(&num_entries, sizeof(S32), 1, fp); + if (nread != 1) + { + llinfos << "Short read, discarding" << llendl; + fclose(fp); + return; + } + S32 i; for (i = 0; i < num_entries; i++) { @@ -264,16 +272,28 @@ void LLViewerRegion::saveCache() // write out zero to indicate a version cache file U32 zero = 0; - fwrite(&zero, 1, sizeof(U32), fp); + if (fwrite(&zero, sizeof(U32), 1, fp) != 1) + { + llwarns << "Short write" << llendl; + } // write out version number U32 version = INDRA_OBJECT_CACHE_VERSION; - fwrite(&version, 1, sizeof(U32), fp); + if (fwrite(&version, sizeof(U32), 1, fp) != 1) + { + llwarns << "Short write" << llendl; + } // write the cache id for this sim - fwrite(&mCacheID.mData, UUID_BYTES, sizeof(U8), fp); + if (fwrite(&mCacheID.mData, 1, UUID_BYTES, fp) != UUID_BYTES) + { + llwarns << "Short write" << llendl; + } - fwrite(&num_entries, 1, sizeof(S32), fp); + if (fwrite(&num_entries, sizeof(S32), 1, fp) != 1) + { + llwarns << "Short write" << llendl; + } LLVOCacheEntry *entry; @@ -643,14 +663,7 @@ void LLViewerRegion::calculateCenterGlobal() mCenterGlobal = mOriginGlobal; mCenterGlobal.mdV[VX] += 0.5 * mWidth; mCenterGlobal.mdV[VY] += 0.5 * mWidth; - if (mLandp) - { - mCenterGlobal.mdV[VZ] = 0.5*mLandp->getMinZ() + mLandp->getMaxZ(); - } - else - { - mCenterGlobal.mdV[VZ] = F64( getWaterHeight() ); - } + mCenterGlobal.mdV[VZ] = 0.5*mLandp->getMinZ() + mLandp->getMaxZ(); } void LLViewerRegion::calculateCameraDistance() @@ -773,13 +786,23 @@ F32 LLViewerRegion::getLandHeightRegion(const LLVector3& region_pos) BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos) { - return mParcelOverlay->isOwnedSelf(pos); + if (mParcelOverlay) + { + return mParcelOverlay->isOwnedSelf(pos); + } else { + return FALSE; + } } // Owned by a group you belong to? (officer or member) BOOL LLViewerRegion::isOwnedGroup(const LLVector3& pos) { - return mParcelOverlay->isOwnedGroup(pos); + if (mParcelOverlay) + { + return mParcelOverlay->isOwnedGroup(pos); + } else { + return FALSE; + } } void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d04dda9109..d6b5534153 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -207,7 +207,9 @@ BOOL gPickTransparent = TRUE; BOOL gDebugFastUIRender = FALSE; BOOL gbCapturing = FALSE; +#if !LL_SOLARIS MovieMaker gMovieMaker; +#endif S32 CHAT_BAR_HEIGHT = 28; S32 OVERLAY_BAR_HEIGHT = 20; @@ -495,30 +497,40 @@ public: ypos += y_inc; } - if (LLPipeline::getRenderParticleBeacons(NULL)) - { - addText(xpos, ypos, "Viewing particle beacons (blue)"); - ypos += y_inc; - } - if (LLPipeline::toggleRenderTypeControlNegated((void*)LLPipeline::RENDER_TYPE_PARTICLES)) + // only display these messages if we are actually rendering beacons at this moment + if (LLPipeline::getRenderBeacons(NULL) && LLPipeline::getProcessBeacons(NULL)) { - addText(xpos, ypos, "Hiding particles"); - ypos += y_inc; - } - if (LLPipeline::getRenderPhysicalBeacons(NULL)) - { - addText(xpos, ypos, "Viewing physical object beacons (green)"); - ypos += y_inc; - } - if (LLPipeline::getRenderScriptedBeacons(NULL)) - { - addText(xpos, ypos, "Viewing scripted object beacons (red)"); - ypos += y_inc; - } - if (LLPipeline::getRenderSoundBeacons(NULL)) - { - addText(xpos, ypos, "Viewing sound beacons (yellow)"); - ypos += y_inc; + if (LLPipeline::getRenderParticleBeacons(NULL)) + { + addText(xpos, ypos, "Viewing particle beacons (blue)"); + ypos += y_inc; + } + if (LLPipeline::toggleRenderTypeControlNegated((void*)LLPipeline::RENDER_TYPE_PARTICLES)) + { + addText(xpos, ypos, "Hiding particles"); + ypos += y_inc; + } + if (LLPipeline::getRenderPhysicalBeacons(NULL)) + { + addText(xpos, ypos, "Viewing physical object beacons (green)"); + ypos += y_inc; + } + if (LLPipeline::getRenderScriptedBeacons(NULL)) + { + addText(xpos, ypos, "Viewing scripted object beacons (red)"); + ypos += y_inc; + } + else + if (LLPipeline::getRenderScriptedTouchBeacons(NULL)) + { + addText(xpos, ypos, "Viewing scripted object with touch function beacons (red)"); + ypos += y_inc; + } + if (LLPipeline::getRenderSoundBeacons(NULL)) + { + addText(xpos, ypos, "Viewing sound beacons (yellow)"); + ypos += y_inc; + } } } @@ -1445,8 +1457,8 @@ LLViewerWindow::LLViewerWindow( if (NULL == mWindow) { LLSplashScreen::update("Shutting down..."); -#if LL_LINUX - llwarns << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt for further information." +#if LL_LINUX || LL_SOLARIS + llwarns << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt or README-solaris.txt for further information." << llendl; #else llwarns << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings" @@ -2685,16 +2697,29 @@ BOOL LLViewerWindow::handlePerFrameHover() } } + gPipeline.sRenderProcessBeacons = FALSE; + KEY key = gKeyboard->currentKey(); + if (((mask & MASK_CONTROL) && ('N' == key || 'n' == key)) || (gFloaterTools && gFloaterTools->getVisible()) || gSavedSettings.getBOOL("BeaconAlwaysOn")) + { + gPipeline.sRenderProcessBeacons = TRUE; + } + +/* // Show joints while in edit mode and hold down alt key. if (gHUDManager) { - if (gSavedSettings.getBOOL("AltShowsPhysical") + BOOL menuOption = gSavedSettings.getBOOL("AltShowsPhysical"); + if (menuOption || (gFloaterTools && gFloaterTools->getVisible())) { gHUDManager->toggleShowPhysical( mask & MASK_ALT ); } + else + { + gHUDManager->toggleShowPhysical( FALSE ); + } } - +*/ BOOL handled = FALSE; BOOL handled_by_top_ctrl = FALSE; @@ -4125,11 +4150,15 @@ void LLViewerWindow::saveMovieNumbered(void*) S32 y = gViewerWindow->getWindowHeight(); gbCapturing = TRUE; +#if !LL_SOLARIS gMovieMaker.StartCapture((char *)filepath.c_str(), x, y); +#endif } else { +#if !LL_SOLARIS gMovieMaker.EndCapture(); +#endif gbCapturing = FALSE; } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 12149ecf77..1af8efaf79 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4798,7 +4798,6 @@ LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) return (LLJoint*)&mSkeleton[num]; } - //----------------------------------------------------------------------------- // requestStopMotion() //----------------------------------------------------------------------------- diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 611f5ddab0..2b70933eea 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -40,16 +40,25 @@ LLVOCacheEntry::LLVOCacheEntry() } +static inline void checkedRead(FILE *fp, void *data, size_t nbytes) +{ + if (fread(data, 1, nbytes, fp) != nbytes) + { + llwarns << "Short read" << llendl; + memset(data, 0, nbytes); + } +} + LLVOCacheEntry::LLVOCacheEntry(FILE *fp) { S32 size; - fread(&mLocalID, 1, sizeof(U32), fp); - fread(&mCRC, 1, sizeof(U32), fp); - fread(&mHitCount, 1, sizeof(S32), fp); - fread(&mDupeCount, 1, sizeof(S32), fp); - fread(&mCRCChangeCount, 1, sizeof(S32), fp); + checkedRead(fp, &mLocalID, sizeof(U32)); + checkedRead(fp, &mCRC, sizeof(U32)); + checkedRead(fp, &mHitCount, sizeof(S32)); + checkedRead(fp, &mDupeCount, sizeof(S32)); + checkedRead(fp, &mCRCChangeCount, sizeof(S32)); - fread(&size, 1, sizeof(S32), fp); + checkedRead(fp, &size, sizeof(S32)); // Corruption in the cache entries if ((size > 10000) || (size < 1)) @@ -65,7 +74,7 @@ LLVOCacheEntry::LLVOCacheEntry(FILE *fp) } mBuffer = new U8[size]; - fread(mBuffer, 1, size, fp); + checkedRead(fp, mBuffer, size); mDP.assignBuffer(mBuffer, size); } @@ -121,14 +130,22 @@ void LLVOCacheEntry::dump() const << llendl; } +static inline void checkedWrite(FILE *fp, const void *data, size_t nbytes) +{ + if (fwrite(data, 1, nbytes, fp) != nbytes) + { + llwarns << "Short write" << llendl; + } +} + void LLVOCacheEntry::writeToFile(FILE *fp) const { - fwrite(&mLocalID, 1, sizeof(U32), fp); - fwrite(&mCRC, 1, sizeof(U32), fp); - fwrite(&mHitCount, 1, sizeof(S32), fp); - fwrite(&mDupeCount, 1, sizeof(S32), fp); - fwrite(&mCRCChangeCount, 1, sizeof(S32), fp); + checkedWrite(fp, &mLocalID, sizeof(U32)); + checkedWrite(fp, &mCRC, sizeof(U32)); + checkedWrite(fp, &mHitCount, sizeof(S32)); + checkedWrite(fp, &mDupeCount, sizeof(S32)); + checkedWrite(fp, &mCRCChangeCount, sizeof(S32)); S32 size = mDP.getBufferSize(); - fwrite(&size, 1, sizeof(S32), fp); - fwrite(mBuffer, 1, size, fp); + checkedWrite(fp, &size, sizeof(S32)); + checkedWrite(fp, mBuffer, size); } diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index fc1d8f1711..8e8ae815d5 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -419,7 +419,8 @@ void LLVOGrass::getGeometry(S32 idx, LLStrider<U32>& indicesp) { mPatch = mRegionp->getLand().resolvePatchRegion(getPositionRegion()); - mLastPatchUpdateTime = mPatch->getLastUpdateTime(); + if (mPatch) + mLastPatchUpdateTime = mPatch->getLastUpdateTime(); LLVector3 position; // Create random blades of grass with gaussian distribution diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index aa4c6f0086..b8a06f4816 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -1386,17 +1386,17 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) const F32 camera_height = mCameraPosAgent.mV[2]; const F32 height_above_water = camera_height - water_height; - BOOL sun = FALSE; + BOOL sun_flag = FALSE; if (mSun.isVisible()) { if (mMoon.isVisible()) { - sun = look_at * mSun.getDirection() > 0; + sun_flag = look_at * mSun.getDirection() > 0; } else { - sun = TRUE; + sun_flag = TRUE; } } @@ -1407,7 +1407,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) #else BOOL render_ref = !(gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT) >= LLDrawPoolWater::SHADER_LEVEL_RIPPLE); #endif - if (sun) + if (sun_flag) { setDrawRefl(0); if (render_ref) diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 1f87cf225d..6ea9dfbbec 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -27,7 +27,9 @@ void LLWeb::loadURL(std::string url) void LLWeb::loadURLExternal(std::string url) { std::string escaped_url = escapeURL(url); +#if LL_LIBXUL_ENABLED spawn_web_browser(escaped_url.c_str()); +#endif } diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 294df75f2a..67e48e0f6b 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -220,6 +220,8 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) curl_easy_setopt(mCurl, CURLOPT_CAINFO, gDirUtilp->getCAFile().c_str()); curl_easy_setopt(mCurl, CURLOPT_SSL_VERIFYPEER, (long) gVerifySSLCert); curl_easy_setopt(mCurl, CURLOPT_SSL_VERIFYHOST, gVerifySSLCert? 2L : 0L); + // Be a little impatient about establishing connections. + curl_easy_setopt(mCurl, CURLOPT_CONNECTTIMEOUT, 40L); /* Setting the DNS cache timeout to -1 disables it completely. This might help with bug #503 */ diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d4d5cfc624..2858854a9a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -143,10 +143,14 @@ U32 nhpo2(U32 v) S32 LLPipeline::sCompiles = 0; BOOL LLPipeline::sShowHUDAttachments = TRUE; -BOOL LLPipeline::sRenderPhysicalBeacons = FALSE; +BOOL LLPipeline::sRenderPhysicalBeacons = TRUE; BOOL LLPipeline::sRenderScriptedBeacons = FALSE; +BOOL LLPipeline::sRenderScriptedTouchBeacons = TRUE; BOOL LLPipeline::sRenderParticleBeacons = FALSE; BOOL LLPipeline::sRenderSoundBeacons = FALSE; +BOOL LLPipeline::sRenderBeacons = FALSE; +BOOL LLPipeline::sRenderHighlight = TRUE; +BOOL LLPipeline::sRenderProcessBeacons = FALSE; BOOL LLPipeline::sUseOcclusion = FALSE; BOOL LLPipeline::sSkipUpdate = FALSE; BOOL LLPipeline::sDynamicReflections = FALSE; @@ -356,14 +360,22 @@ void LLPipeline::releaseGLBuffers() if (mCubeFrameBuffer) { +#if !defined(__sparc) glDeleteFramebuffersEXT(1, &mCubeFrameBuffer); glDeleteRenderbuffersEXT(1, &mCubeDepth); +#else +#error Can we generalize this without a CPU architecture test? +#endif mCubeDepth = mCubeFrameBuffer = 0; } if (mFramebuffer[0]) { +#if !defined(__sparc) glDeleteFramebuffersEXT(2, mFramebuffer); +#else +#error Can we generalize this without a CPU architecture test? +#endif mFramebuffer[0] = mFramebuffer[1] = 0; } } @@ -1469,7 +1481,44 @@ void renderScriptedBeacons(LLDrawable* drawablep) && !vobj->getParent() && vobj->flagScripted()) { - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + if (gPipeline.sRenderBeacons) + { + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + } + + if (gPipeline.sRenderHighlight) + { + S32 face_id; + for (face_id = 0; face_id < drawablep->getNumFaces(); face_id++) + { + gPipeline.mHighlightFaces.push_back(drawablep->getFace(face_id) ); + } + } + } +} + +void renderScriptedTouchBeacons(LLDrawable* drawablep) +{ + LLViewerObject *vobj = drawablep->getVObj(); + if (vobj + && !vobj->isAvatar() + && !vobj->getParent() + && vobj->flagScripted() + && vobj->flagHandleTouch()) + { + if (gPipeline.sRenderBeacons) + { + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + } + + if (gPipeline.sRenderHighlight) + { + S32 face_id; + for (face_id = 0; face_id < drawablep->getNumFaces(); face_id++) + { + gPipeline.mHighlightFaces.push_back(drawablep->getFace(face_id) ); + } + } } } @@ -1481,7 +1530,19 @@ void renderPhysicalBeacons(LLDrawable* drawablep) && !vobj->getParent() && vobj->usePhysics()) { - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + if (gPipeline.sRenderBeacons) + { + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + } + + if (gPipeline.sRenderHighlight) + { + S32 face_id; + for (face_id = 0; face_id < drawablep->getNumFaces(); face_id++) + { + gPipeline.mHighlightFaces.push_back(drawablep->getFace(face_id) ); + } + } } } @@ -1492,20 +1553,13 @@ void renderParticleBeacons(LLDrawable* drawablep) if (vobj && vobj->isParticleSource()) { - LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f); - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); - } -} + if (gPipeline.sRenderBeacons) + { + LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f); + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + } -void LLPipeline::highlightPhysical(LLDrawable* drawablep) -{ - LLMemType mt(LLMemType::MTYPE_PIPELINE); - LLViewerObject *vobj; - vobj = drawablep->getVObj(); - if (vobj && !vobj->isAvatar()) - { - if (!vobj->isAvatar() && - (vobj->usePhysics() || vobj->flagHandleTouch())) + if (gPipeline.sRenderHighlight) { S32 face_id; for (face_id = 0; face_id < drawablep->getNumFaces(); face_id++) @@ -1679,42 +1733,49 @@ void LLPipeline::postSort(LLCamera& camera) std::sort(mAlphaGroups.begin(), mAlphaGroups.end(), LLSpatialGroup::CompareDepthGreater()); std::sort(mAlphaGroupsPostWater.begin(), mAlphaGroupsPostWater.end(), LLSpatialGroup::CompareDepthGreater()); - if (sRenderScriptedBeacons) + // only render if the flag is set. The flag is only set if the right key is pressed, we are in edit mode or the toggle is set in the menus + if (sRenderProcessBeacons) { - // Only show the beacon on the root object. - forAllVisibleDrawables(renderScriptedBeacons); - } - - if (sRenderPhysicalBeacons) - { - // Only show the beacon on the root object. - forAllVisibleDrawables(renderPhysicalBeacons); - } + if (sRenderScriptedTouchBeacons) + { + // Only show the beacon on the root object. + forAllVisibleDrawables(renderScriptedTouchBeacons); + } + else + if (sRenderScriptedBeacons) + { + // Only show the beacon on the root object. + forAllVisibleDrawables(renderScriptedBeacons); + } - if (sRenderParticleBeacons) - { - forAllVisibleDrawables(renderParticleBeacons); - } + if (sRenderPhysicalBeacons) + { + // Only show the beacon on the root object. + forAllVisibleDrawables(renderPhysicalBeacons); + } - // Draw physical objects in red. - if (gHUDManager->getShowPhysical()) - { - forAllVisibleDrawables(highlightPhysical); - } + if (sRenderParticleBeacons) + { + forAllVisibleDrawables(renderParticleBeacons); + } - // If god mode, also show audio cues - if (sRenderSoundBeacons && gAudiop) - { - // Update all of our audio sources, clean up dead ones. - LLAudioEngine::source_map::iterator iter; - for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter) + // If god mode, also show audio cues + if (sRenderSoundBeacons && gAudiop) { - LLAudioSource *sourcep = iter->second; + // Update all of our audio sources, clean up dead ones. + LLAudioEngine::source_map::iterator iter; + for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter) + { + LLAudioSource *sourcep = iter->second; - LLVector3d pos_global = sourcep->getPositionGlobal(); - LLVector3 pos = gAgent.getPosAgentFromGlobal(pos_global); - //pos += LLVector3(0.f, 0.f, 0.2f); - gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + LLVector3d pos_global = sourcep->getPositionGlobal(); + LLVector3 pos = gAgent.getPosAgentFromGlobal(pos_global); + if (gPipeline.sRenderBeacons) + { + //pos += LLVector3(0.f, 0.f, 0.2f); + gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + } + } } } @@ -3428,6 +3489,12 @@ BOOL LLPipeline::toggleRenderDebugFeatureControl(void* data) } // static +void LLPipeline::setRenderScriptedBeacons(BOOL val) +{ + sRenderScriptedBeacons = val; +} + +// static void LLPipeline::toggleRenderScriptedBeacons(void*) { sRenderScriptedBeacons = !sRenderScriptedBeacons; @@ -3440,6 +3507,30 @@ BOOL LLPipeline::getRenderScriptedBeacons(void*) } // static +void LLPipeline::setRenderScriptedTouchBeacons(BOOL val) +{ + sRenderScriptedTouchBeacons = val; +} + +// static +void LLPipeline::toggleRenderScriptedTouchBeacons(void*) +{ + sRenderScriptedTouchBeacons = !sRenderScriptedTouchBeacons; +} + +// static +BOOL LLPipeline::getRenderScriptedTouchBeacons(void*) +{ + return sRenderScriptedTouchBeacons; +} + +// static +void LLPipeline::setRenderPhysicalBeacons(BOOL val) +{ + sRenderPhysicalBeacons = val; +} + +// static void LLPipeline::toggleRenderPhysicalBeacons(void*) { sRenderPhysicalBeacons = !sRenderPhysicalBeacons; @@ -3452,6 +3543,12 @@ BOOL LLPipeline::getRenderPhysicalBeacons(void*) } // static +void LLPipeline::setRenderParticleBeacons(BOOL val) +{ + sRenderParticleBeacons = val; +} + +// static void LLPipeline::toggleRenderParticleBeacons(void*) { sRenderParticleBeacons = !sRenderParticleBeacons; @@ -3464,6 +3561,12 @@ BOOL LLPipeline::getRenderParticleBeacons(void*) } // static +void LLPipeline::setRenderSoundBeacons(BOOL val) +{ + sRenderSoundBeacons = val; +} + +// static void LLPipeline::toggleRenderSoundBeacons(void*) { sRenderSoundBeacons = !sRenderSoundBeacons; @@ -3475,6 +3578,48 @@ BOOL LLPipeline::getRenderSoundBeacons(void*) return sRenderSoundBeacons; } +// static +void LLPipeline::setRenderBeacons(BOOL val) +{ + sRenderBeacons = val; +} + +// static +void LLPipeline::toggleRenderBeacons(void*) +{ + sRenderBeacons = !sRenderBeacons; +} + +// static +BOOL LLPipeline::getRenderBeacons(void*) +{ + return sRenderBeacons; +} + +// static +void LLPipeline::setRenderHighlights(BOOL val) +{ + sRenderHighlight = val; +} + +// static +void LLPipeline::toggleRenderHighlights(void*) +{ + sRenderHighlight = !sRenderHighlight; +} + +// static +BOOL LLPipeline::getRenderHighlights(void*) +{ + return sRenderHighlight; +} + +// static +BOOL LLPipeline::getProcessBeacons(void* data) +{ + return sRenderProcessBeacons; +} + LLViewerObject* LLPipeline::pickObject(const LLVector3 &start, const LLVector3 &end, LLVector3 &collision) { LLDrawable* drawable = mObjectPartition[PARTITION_VOLUME]->pickDrawable(start, end, collision); @@ -3613,8 +3758,12 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam, BOOL reattach = FALSE; if (mCubeFrameBuffer == 0) { +#if !defined(__sparc) glGenFramebuffersEXT(1, &mCubeFrameBuffer); glGenRenderbuffersEXT(1, &mCubeDepth); +#else +#error Can we generalize this without a CPU architecture test? +#endif reattach = TRUE; } @@ -3685,6 +3834,7 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam, if (reattach) { +#if !defined(__sparc) glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mCubeDepth); GLint res_x, res_y; glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_WIDTH_EXT, &res_x); @@ -3696,15 +3846,22 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam, } glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); +#else +#error Can we generalize this without a CPU architecture test? +#endif } for (S32 i = 0; i < 6; i++) { +#if !defined(__sparc) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mCubeFrameBuffer); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, cube_face[i], cube_map->getGLName(), 0); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mCubeDepth); +#else +#error Can we generalize this without a CPU architecture test? +#endif glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(90.f, 1.f, 0.1f, 1024.f); @@ -3724,7 +3881,11 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam, gPipeline.renderGeom(cube_cam); } +#if !defined(__sparc) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); +#else +#error Can we generalize this without a CPU architecture test? +#endif cube_cam.setOrigin(origin); gPipeline.resetDrawOrders(); @@ -3933,10 +4094,14 @@ void LLPipeline::renderBloom(GLuint source, GLuint dest, GLuint buffer, U32 res, LLGLDisable blend(GL_BLEND); LLGLDisable cull(GL_CULL_FACE); +#if !defined(__sparc) if (mFramebuffer[0] == 0) { glGenFramebuffersEXT(2, mFramebuffer); } +#else +#error Can we generalize this without a CPU architecture test? +#endif GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); @@ -3959,11 +4124,15 @@ void LLPipeline::renderBloom(GLuint source, GLuint dest, GLuint buffer, U32 res, for (S32 i = 0; i < kernel; i++) { +#if !defined(__sparc) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFramebuffer[i%2]); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, i%2 == 0 ? buffer : dest, 0); +#else +#error Can we generalize this without a CPU architecture test? +#endif glBindTexture(GL_TEXTURE_2D, i == 0 ? source : i%2==0 ? dest : @@ -3990,7 +4159,11 @@ void LLPipeline::renderBloom(GLuint source, GLuint dest, GLuint buffer, U32 res, } +#if !defined(__sparc) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); +#else +#error Can we generalize this without a CPU architecture test? +#endif gGlowProgram.unbind(); glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 390e139503..9a7336186c 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -134,7 +134,6 @@ public: void postSort(LLCamera& camera); void forAllDrawables(LLSpatialGroup::sg_vector_t& groups, void (*func)(LLDrawable*)); void forAllVisibleDrawables(void (*func)(LLDrawable*)); - static void highlightPhysical(LLDrawable* drawablep); void renderObjects(U32 type, U32 mask, BOOL texture = TRUE); @@ -187,18 +186,36 @@ public: static BOOL toggleRenderDebugControl(void* data); static BOOL toggleRenderDebugFeatureControl(void* data); + static void setRenderParticleBeacons(BOOL val); static void toggleRenderParticleBeacons(void* data); static BOOL getRenderParticleBeacons(void* data); + static void setRenderSoundBeacons(BOOL val); static void toggleRenderSoundBeacons(void* data); static BOOL getRenderSoundBeacons(void* data); + static void setRenderPhysicalBeacons(BOOL val); static void toggleRenderPhysicalBeacons(void* data); static BOOL getRenderPhysicalBeacons(void* data); + static void setRenderScriptedBeacons(BOOL val); static void toggleRenderScriptedBeacons(void* data); static BOOL getRenderScriptedBeacons(void* data); + static void setRenderScriptedTouchBeacons(BOOL val); + static void toggleRenderScriptedTouchBeacons(void* data); + static BOOL getRenderScriptedTouchBeacons(void* data); + + static void setRenderBeacons(BOOL val); + static void toggleRenderBeacons(void* data); + static BOOL getRenderBeacons(void* data); + + static void setRenderHighlights(BOOL val); + static void toggleRenderHighlights(void* data); + static BOOL getRenderHighlights(void* data); + + static BOOL getProcessBeacons(void* data); + private: void initShaders(BOOL force); void unloadShaders(); @@ -474,8 +491,9 @@ protected: LLDrawPool* mBumpPool; // Note: no need to keep an quick-lookup to avatar pools, since there's only one per avatar - +public: std::vector<LLFace*> mHighlightFaces; // highlight faces on physical objects +protected: std::vector<LLFace*> mSelectedFaces; LLPointer<LLViewerImage> mFaceSelectImagep; @@ -488,9 +506,14 @@ protected: F32 mSunShadowFactor; static BOOL sRenderPhysicalBeacons; + static BOOL sRenderScriptedTouchBeacons; static BOOL sRenderScriptedBeacons; static BOOL sRenderParticleBeacons; static BOOL sRenderSoundBeacons; +public: + static BOOL sRenderBeacons; + static BOOL sRenderHighlight; + static BOOL sRenderProcessBeacons; }; void render_bbox(const LLVector3 &min, const LLVector3 &max); |