void LLFloaterAvatarTextures::refresh() { LLVOAvatar *avatarp = find_avatar(mID); if (avatarp) { char firstname[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ char lastname[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ if (gCacheName->getName(avatarp->getID(), firstname, lastname)) { LLString name; name.assign( firstname ); name.append( " " ); name.append( lastname ); setTitle(mTitle + ": " + name); } update_texture_ctrl(avatarp, mBakedHead, LLVOAvatar::TEX_HEAD_BAKED); update_texture_ctrl(avatarp, mBakedEyes, LLVOAvatar::TEX_EYES_BAKED); update_texture_ctrl(avatarp, mBakedUpper, LLVOAvatar::TEX_UPPER_BAKED); update_texture_ctrl(avatarp, mBakedLower, LLVOAvatar::TEX_LOWER_BAKED); update_texture_ctrl(avatarp, mBakedSkirt, LLVOAvatar::TEX_SKIRT_BAKED); update_texture_ctrl(avatarp, mMakeup, LLVOAvatar::TEX_HEAD_BODYPAINT); update_texture_ctrl(avatarp, mHair, LLVOAvatar::TEX_HAIR); update_texture_ctrl(avatarp, mEye, LLVOAvatar::TEX_EYES_IRIS); update_texture_ctrl(avatarp, mShirt, LLVOAvatar::TEX_UPPER_SHIRT); update_texture_ctrl(avatarp, mUpperTattoo, LLVOAvatar::TEX_UPPER_BODYPAINT); update_texture_ctrl(avatarp, mUpperJacket, LLVOAvatar::TEX_UPPER_JACKET); update_texture_ctrl(avatarp, mGloves, LLVOAvatar::TEX_UPPER_GLOVES); update_texture_ctrl(avatarp, mUndershirt, LLVOAvatar::TEX_UPPER_UNDERSHIRT); update_texture_ctrl(avatarp, mPants, LLVOAvatar::TEX_LOWER_PANTS); update_texture_ctrl(avatarp, mLowerTattoo, LLVOAvatar::TEX_LOWER_BODYPAINT); update_texture_ctrl(avatarp, mShoes, LLVOAvatar::TEX_LOWER_SHOES); update_texture_ctrl(avatarp, mSocks, LLVOAvatar::TEX_LOWER_SOCKS); update_texture_ctrl(avatarp, mJacket, LLVOAvatar::TEX_LOWER_JACKET); update_texture_ctrl(avatarp, mUnderpants, LLVOAvatar::TEX_LOWER_UNDERPANTS); update_texture_ctrl(avatarp, mSkirt, LLVOAvatar::TEX_SKIRT); } else { setTitle(mTitle + ": INVALID AVATAR (" + mID.asString() + ")"); } }
// Default constructor LLFloaterAbout::LLFloaterAbout() : LLFloater("floater_about", "FloaterAboutRect", "") { gUICtrlFactory->buildFloater(this, "floater_about.xml"); // Support for changing product name. LLString title("About "); title += gSecondLife; setTitle(title); LLString support; // Version string LLString version = gSecondLife + llformat(" %d.%d.%d (%d) %s %s", LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD, __DATE__, __TIME__); support.append(version); support.append("\n\n"); // Position LLViewerRegion* region = gAgent.getRegion(); if (region) { //XUI:translate const LLVector3d &pos = gAgent.getPositionGlobal(); LLString pos_text = llformat("You are at %.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]); support.append(pos_text); LLString region_text = llformat("in %s located at ", gAgent.getRegion()->getName().c_str()); support.append(region_text); char buffer[MAX_STRING]; /*Flawfinder: ignore*/ gAgent.getRegion()->getHost().getHostName(buffer, MAX_STRING); support.append(buffer); support.append(" ("); gAgent.getRegion()->getHost().getString(buffer, MAX_STRING); support.append(buffer); support.append(")\n\n"); } // CPU support.append("CPU: "); support.append( gSysCPU.getCPUString() ); support.append("\n"); U32 memory = gSysMemory.getPhysicalMemory() / 1024 / 1024; // For some reason, the reported amount of memory is always wrong by one meg memory++; LLString mem_text = llformat("Memory: %u MB\n", memory ); support.append(mem_text); support.append("OS Version: "); support.append( gSysOS.getOSString().c_str() ); support.append("\n"); support.append("Graphics Card Vendor: "); support.append( (const char*) glGetString(GL_VENDOR) ); support.append("\n"); support.append("Graphics Card: "); support.append( (const char*) glGetString(GL_RENDERER) ); support.append("\n"); support.append("OpenGL Version: "); support.append( (const char*) glGetString(GL_VERSION) ); support.append("\n"); #if LL_LIBXUL_ENABLED support.append("LLMozLib Version: "); support.append( (const char*) LLMozLib::getInstance()->getVersion().c_str() ); support.append("\n"); #endif // LL_LIBXUL_ENABLED if (gViewerStats && gPacketsIn > 0) { LLString packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", gViewerStats->mPacketsLostStat.getCurrent(), F32(gPacketsIn), 100.f*gViewerStats->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); support.append(packet_loss); support.append("\n"); } // MD5 digest of executable support.append("Viewer Digest: "); char viewer_digest_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ gViewerDigest.toString( viewer_digest_string ); support.append(viewer_digest_string); // Fix views childDisable("credits_editor"); childDisable("support_editor"); childSetText("support_editor", support); center(); sInstance = this; }
// Default constructor LLFloaterAbout::LLFloaterAbout() : LLFloater("floater_about", "FloaterAboutRect", "") { gUICtrlFactory->buildFloater(this, "floater_about.xml"); // Support for changing product name. LLString title("About "); title += LLAppViewer::instance()->getSecondLifeTitle(); setTitle(title); LLString support; // Version string LLString version = LLAppViewer::instance()->getSecondLifeTitle() + llformat(" %d.%d.%d.%d Netbook Edition v1.2 %s %s", LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD, __DATE__, __TIME__); //MK if (RRenabled) { version += "\n" + gAgent.mRRInterface.getVersion (); } //mk support.append(version); support.append("\n\n"); // Position LLViewerRegion* region = gAgent.getRegion(); if (region) { const LLVector3d &pos = gAgent.getPositionGlobal(); LLUIString pos_text = childGetText("you_are_at"); pos_text.setArg("[POSITION]", llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ])); //MK if (RRenabled && gAgent.mRRInterface.mContainsShowloc) { pos_text = "(Position hidden)\n"; } //mk support.append(pos_text); LLString region_text = llformat("in %s located at ", gAgent.getRegion()->getName().c_str()); //MK if (RRenabled && gAgent.mRRInterface.mContainsShowloc) { region_text = "(Region hidden)\n"; } //mk support.append(region_text); //MK if (!RRenabled || !gAgent.mRRInterface.mContainsShowloc) { //mk char buffer[MAX_STRING]; /*Flawfinder: ignore*/ gAgent.getRegion()->getHost().getHostName(buffer, MAX_STRING); support.append(buffer); support.append(" ("); gAgent.getRegion()->getHost().getString(buffer, MAX_STRING); support.append(buffer); support.append(")\n"); support.append(gLastVersionChannel); support.append("\n\n"); //MK } else { support.append ("(Server info hidden)\n\n"); } //mk } //*NOTE: Do not translate text like GPU, Graphics Card, etc - // Most PC users that know what these mean will be used to the english versions, // and this info sometimes gets sent to support // CPU support.append("CPU: "); support.append( gSysCPU.getCPUString() ); support.append("\n"); U32 memory = gSysMemory.getPhysicalMemoryKB() / 1024; // Moved hack adjustment to Windows memory size into llsys.cpp LLString mem_text = llformat("Memory: %u MB\n", memory ); support.append(mem_text); support.append("OS Version: "); support.append( LLAppViewer::instance()->getOSInfo().getOSString().c_str() ); support.append("\n"); support.append("Graphics Card Vendor: "); support.append( (const char*) glGetString(GL_VENDOR) ); support.append("\n"); support.append("Graphics Card: "); support.append( (const char*) glGetString(GL_RENDERER) ); support.append("\n"); support.append("OpenGL Version: "); support.append( (const char*) glGetString(GL_VERSION) ); support.append("\n"); #if LL_LIBXUL_ENABLED support.append("LLMozLib Version: "); support.append( (const char*) LLMozLib::getInstance()->getVersion().c_str() ); support.append("\n"); #endif // LL_LIBXUL_ENABLED if (gViewerStats && gPacketsIn > 0) { LLString packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", gViewerStats->mPacketsLostStat.getCurrent(), F32(gPacketsIn), 100.f*gViewerStats->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); support.append(packet_loss); support.append("\n"); } // MD5 digest of executable support.append("Viewer Digest: "); char viewer_digest_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ gViewerDigest.toString( viewer_digest_string ); support.append(viewer_digest_string); // Fix views childDisable("credits_editor"); LLTextEditor * support_widget = (LLTextEditor *) getChildByName("support_editor", true); if (support_widget) { support_widget->setEnabled( FALSE ); support_widget->setTakesFocus( TRUE ); support_widget->setText( support ); support_widget->setHandleEditKeysDirectly( TRUE ); } center(); sInstance = this; }
void LLFloaterClothing::buildClothingList() { //llinfos << "buildClothingList" << llendl; LLScrollListCtrl* list = gUICtrlFactory->getScrollListByName(this, "clothing_list"); if (!list) return; list->operateOnAll(LLCtrlListInterface::OP_DELETE); LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; LLIsClothing is_clothing; gInventory.collectDescendentsIf(gAgent.getInventoryRootID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_clothing); S32 count = items.count(); for(S32 i = 0; i < count; ++i) { LLInventoryItem* item = items.get(i); LLSD row; row["id"] = item->getUUID(); BOOL item_is_multi = FALSE; if ( item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) { item_is_multi = TRUE; } LLUUID image_id = get_item_icon_uuid(item->getType(), item->getInventoryType(), item->getFlags(), item_is_multi); // flags = wearable type row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; row["columns"][0]["value"] = image_id; LLString text = item->getName(); LLString style = "NORMAL"; if( gAgent.isWearingItem( item->getUUID() ) ) { text.append(" (worn)"); style = "BOLD"; } row["columns"][1]["column"] = "name"; row["columns"][1]["value"] = text; row["columns"][1]["font"] = "SANSSERIFSMALL"; row["columns"][1]["font-style"] = style; // hidden column for sorting U32 flags = item->getFlags(); // flags = wearable type enum EWearableType wearable_type = (enum EWearableType)flags; const char* wearable_label = LLWearable::typeToTypeLabel(wearable_type); //line->addColumn(wearable_label, FONT, -1); // invisible row["columns"][2]["column"] = "sort"; row["columns"][2]["value"] = wearable_label; list->addElement(row); } if (count > 0) { mAllowSelection = TRUE; } else if (LLInventoryModel::backgroundFetchActive()) { // We're loading list->addCommentText(LOADING_STRING); mAllowSelection = FALSE; } else { // Weird case, we're done loading but have no clothing list->addCommentText("No clothing found."); mAllowSelection = FALSE; } }
void *updatethreadproc(void*) { char tempDir[PATH_MAX] = ""; /* Flawfinder: ignore */ FSRef tempDirRef; char temp[PATH_MAX]; /* Flawfinder: ignore */ // *NOTE: This buffer length is used in a scanf() below. char deviceNode[1024] = ""; /* Flawfinder: ignore */ FILE *downloadFile = NULL; OSStatus err; ProcessSerialNumber psn; char target[PATH_MAX]; /* Flawfinder: ignore */ FSRef targetRef; FSRef targetParentRef; FSVolumeRefNum targetVol; FSRef trashFolderRef, tempFolderRef; Boolean replacingTarget = false; memset(&tempDirRef, 0, sizeof(tempDirRef)); memset(&targetRef, 0, sizeof(targetRef)); memset(&targetParentRef, 0, sizeof(targetParentRef)); try { // Attempt to get a reference to the Second Life application bundle containing this updater. // Any failures during this process will cause us to default to updating /Applications/Second Life.app { FSRef myBundle; err = GetCurrentProcess(&psn); if(err == noErr) { err = GetProcessBundleLocation(&psn, &myBundle); } if(err == noErr) { // Sanity check: Make sure the name of the item referenced by targetRef is "Second Life.app". FSRefMakePath(&myBundle, (UInt8*)target, sizeof(target)); llinfos << "Updater bundle location: " << target << llendl; } // Our bundle should be in Second Life.app/Contents/Resources/AutoUpdater.app // so we need to go up 3 levels to get the path to the main application bundle. if(err == noErr) { err = FSGetParentRef(&myBundle, &targetRef); } if(err == noErr) { err = FSGetParentRef(&targetRef, &targetRef); } if(err == noErr) { err = FSGetParentRef(&targetRef, &targetRef); } // And once more to get the parent of the target if(err == noErr) { err = FSGetParentRef(&targetRef, &targetParentRef); } if(err == noErr) { FSRefMakePath(&targetRef, (UInt8*)target, sizeof(target)); llinfos << "Path to target: " << target << llendl; } // Sanity check: make sure the target is a bundle with the right identifier if(err == noErr) { // Assume the worst... err = -1; if(isFSRefViewerBundle(&targetRef)) { // This is the bundle we're looking for. err = noErr; replacingTarget = true; } } // Make sure the target's parent directory is writable. if(err == noErr) { if(!isDirWritable(targetParentRef)) { // Parent directory isn't writable. llinfos << "Target parent directory not writable." << llendl; err = -1; replacingTarget = false; } } if(err != noErr) { Boolean isDirectory; llinfos << "Target search failed, defaulting to /Applications/" << gProductName << ".app." << llendl; // Set up the parent directory err = FSPathMakeRef((UInt8*)"/Applications", &targetParentRef, &isDirectory); if((err != noErr) || (!isDirectory)) { // We're so hosed. llinfos << "Applications directory not found, giving up." << llendl; throw 0; } snprintf(target, sizeof(target), "/Applications/%s.app", gProductName); memset(&targetRef, 0, sizeof(targetRef)); err = FSPathMakeRef((UInt8*)target, &targetRef, NULL); if(err == fnfErr) { // This is fine, just means we're not replacing anything. err = noErr; replacingTarget = false; } else { replacingTarget = true; } // Make sure the target's parent directory is writable. if(err == noErr) { if(!isDirWritable(targetParentRef)) { // Parent directory isn't writable. llinfos << "Target parent directory not writable." << llendl; err = -1; replacingTarget = false; } } } // If we haven't fixed all problems by this point, just bail. if(err != noErr) { llinfos << "Unable to pick a target, giving up." << llendl; throw 0; } } // Find the volID of the volume the target resides on { FSCatalogInfo info; err = FSGetCatalogInfo( &targetParentRef, kFSCatInfoVolume, &info, NULL, NULL, NULL); if(err != noErr) throw 0; targetVol = info.volume; } // Find the temporary items and trash folders on that volume. err = FSFindFolder( targetVol, kTrashFolderType, true, &trashFolderRef); if(err != noErr) throw 0; err = FSFindFolder( targetVol, kTemporaryFolderType, true, &tempFolderRef); if(err != noErr) throw 0; err = FSRefMakePath(&tempFolderRef, (UInt8*)temp, sizeof(temp)); if(err != noErr) throw 0; temp[0] = '\0'; strncat(temp, "/SecondLifeUpdate_XXXXXX", sizeof(temp) - 1); if(mkdtemp(temp) == NULL) { throw 0; } strcpy(tempDir, temp); /* Flawfinder: ignore */ llinfos << "tempDir is " << tempDir << llendl; err = FSPathMakeRef((UInt8*)tempDir, &tempDirRef, NULL); if(err != noErr) throw 0; chdir(tempDir); snprintf(temp, sizeof(temp), "SecondLife.dmg"); downloadFile = fopen(temp, "wb"); /* Flawfinder: ignore */ if(downloadFile == NULL) { throw 0; } { CURL *curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); // curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curl_download_callback); curl_easy_setopt(curl, CURLOPT_FILE, downloadFile); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, &curl_progress_callback_func); curl_easy_setopt(curl, CURLOPT_URL, gUpdateURL); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); sendProgress(0, 1, CFSTR("Downloading...")); CURLcode result = curl_easy_perform(curl); curl_easy_cleanup(curl); if(gCancelled) { llinfos << "User cancel, bailing out."<< llendl; throw 0; } if(result != CURLE_OK) { llinfos << "Error " << result << " while downloading disk image."<< llendl; throw 0; } fclose(downloadFile); downloadFile = NULL; } sendProgress(0, 0, CFSTR("Mounting image...")); LLFile::mkdir("mnt", 0700); // NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder, // but if our cleanup fails, this makes it much harder for the user to unmount the image. LLString mountOutput; FILE* mounter = popen("hdiutil attach SecondLife.dmg -mountpoint mnt", "r"); /* Flawfinder: ignore */ if(mounter == NULL) { llinfos << "Failed to mount disk image, exiting."<< llendl; throw 0; } // We need to scan the output from hdiutil to find the device node it uses to attach the disk image. // If we don't have this information, we can't detach it later. while(mounter != NULL) { size_t len = fread(temp, 1, sizeof(temp)-1, mounter); temp[len] = 0; mountOutput.append(temp); if(len < sizeof(temp)-1) { // End of file or error. if(pclose(mounter) != 0) { llinfos << "Failed to mount disk image, exiting."<< llendl; throw 0; } mounter = NULL; } } if(!mountOutput.empty()) { const char *s = mountOutput.c_str(); char *prefix = "/dev/"; char *sub = strstr(s, prefix); if(sub != NULL) { sub += strlen(prefix); /* Flawfinder: ignore */ sscanf(sub, "%1023s", deviceNode); /* Flawfinder: ignore */ } } if(deviceNode[0] != 0) { llinfos << "Disk image attached on /dev/" << deviceNode << llendl; } else { llinfos << "Disk image device node not found!" << llendl; } // Get an FSRef to the new application on the disk image FSRef sourceRef; FSRef mountRef; snprintf(temp, sizeof(temp), "%s/mnt", tempDir); llinfos << "Disk image mount point is: " << temp << llendl; err = FSPathMakeRef((UInt8 *)temp, &mountRef, NULL); if(err != noErr) { llinfos << "Couldn't make FSRef to disk image mount point." << llendl; throw 0; } err = findAppBundleOnDiskImage(&mountRef, &sourceRef); if(err != noErr) { llinfos << "Couldn't find application bundle on mounted disk image." << llendl; throw 0; } FSRef asideRef; char aside[MAX_PATH]; /* Flawfinder: ignore */ // this will hold the name of the destination target HFSUniStr255 appNameUniStr; if(replacingTarget) { // Get the name of the target we're replacing err = FSGetCatalogInfo(&targetRef, 0, NULL, &appNameUniStr, NULL, NULL); if(err != noErr) throw 0; // Move aside old version (into work directory) err = FSMoveObject(&targetRef, &tempDirRef, &asideRef); if(err != noErr) throw 0; // Grab the path for later use. err = FSRefMakePath(&asideRef, (UInt8*)aside, sizeof(aside)); } else { // Construct the name of the target based on the product name char appName[MAX_PATH]; /* Flawfinder: ignore */ snprintf(appName, sizeof(appName), "%s.app", gProductName); utf8str_to_HFSUniStr255( &appNameUniStr, appName ); } sendProgress(0, 0, CFSTR("Copying files...")); llinfos << "Starting copy..." << llendl; // Copy the new version from the disk image to the target location. err = FSCopyObject( &sourceRef, &targetParentRef, 0, kFSCatInfoNone, kDupeActionStandard, &appNameUniStr, false, false, NULL, NULL, &targetRef, NULL); // Grab the path for later use. err = FSRefMakePath(&targetRef, (UInt8*)target, sizeof(target)); if(err != noErr) throw 0; llinfos << "Copy complete. Target = " << target << llendl; if(err != noErr) { // Something went wrong during the copy. Attempt to put the old version back and bail. (void)FSDeleteObjects(&targetRef); if(replacingTarget) { (void)FSMoveObject(&asideRef, &targetParentRef, NULL); } throw 0; } else { // The update has succeeded. Clear the cache directory. sendProgress(0, 0, CFSTR("Clearing cache...")); llinfos << "Clearing cache..." << llendl; char mask[LL_MAX_PATH]; /* Flawfinder: ignore */ snprintf(mask, LL_MAX_PATH, "%s*.*", gDirUtilp->getDirDelimiter().c_str()); gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask); llinfos << "Clear complete." << llendl; } } catch(...) { if(!gCancelled) if(gFailure == noErr) gFailure = -1; } // Failures from here on out are all non-fatal and not reported. sendProgress(0, 3, CFSTR("Cleaning up...")); // Close disk image file if necessary if(downloadFile != NULL) { llinfos << "Closing download file." << llendl; fclose(downloadFile); downloadFile = NULL; } sendProgress(1, 3); // Unmount image if(deviceNode[0] != 0) { llinfos << "Detaching disk image." << llendl; snprintf(temp, sizeof(temp), "hdiutil detach '%s'", deviceNode); system(temp); /* Flawfinder: ignore */ } sendProgress(2, 3); // Move work directory to the trash if(tempDir[0] != 0) { // chdir("/"); // FSDeleteObjects(tempDirRef); llinfos << "Moving work directory to the trash." << llendl; err = FSMoveObject(&tempDirRef, &trashFolderRef, NULL); // snprintf(temp, sizeof(temp), "rm -rf '%s'", tempDir); // printf("%s\n", temp); // system(temp); } if(!gCancelled && !gFailure && (target[0] != 0)) { llinfos << "Touching application bundle." << llendl; snprintf(temp, sizeof(temp), "touch '%s'", target); system(temp); /* Flawfinder: ignore */ llinfos << "Launching updated application." << llendl; snprintf(temp, sizeof(temp), "open '%s'", target); system(temp); /* Flawfinder: ignore */ } sendDone(); return(NULL); }