diff options
| -rwxr-xr-x | indra/llcommon/llfile.cpp | 6 | ||||
| -rwxr-xr-x | indra/llcommon/llfile.h | 55 | ||||
| -rwxr-xr-x | indra/newview/llfloateruipreview.cpp | 34 |
3 files changed, 48 insertions, 47 deletions
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index cb3357419a..0751bde07c 100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -332,13 +332,13 @@ inline DWORD decode_open_create_flags(std::ios_base::openmode omode) { if (!(omode & LLFile::out)) { - return TRUNCATE_EXISTING; // open and truncatte if it exists, otherwise fail + return TRUNCATE_EXISTING; // open and truncate if it exists, otherwise fail } return CREATE_ALWAYS; // open and truncate if it exists, otherwise create it } if (!(omode & LLFile::out)) { - return OPEN_EXISTING; // open if exists, otherwise fail + return OPEN_EXISTING; // open if it exists, otherwise fail } // LLFile::app or (LLFile::out and (!LLFile::trunc or !LLFile::noreplace)) return OPEN_ALWAYS; // open if it exists, otherwise create it @@ -738,7 +738,7 @@ int LLFile::lock(int mode, std::error_code& ec) { flags |= LOCKFILE_EXCLUSIVE_LOCK; } - // We lock the maximum range, since flock only supports locking the entire file too + // We lock the maximum range, since flock only supports locking the entire file too if (LockFileEx(mHandle, flags, 0, MAXDWORD, MAXDWORD, &overlapped)) { return clear_error(ec); diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index ae8e755fe7..f48b0f5cad 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -77,30 +77,30 @@ public: any other combinations than listed here are not allowed and will cause an error - bin in out trunc app norep File exists File does not exist - ------------------------------------------------------------------------------- - - + - - - - Open at begin Failure to open - + + - - - - " " - - - + - - - " Create new - + - + - - - " " - - + + - - - " " - + + + - - - " " - ------------------------------------------------------------------------------- - - - + + - - Destroy contents Create new - + - + + - - " " - - + + + - - " " - + + + + - - " " - ------------------------------------------------------------------------------- - - - + x - + Failure to open Create new - + - + x - + " " - - + + x - + " " - + + + x - + " " - ------------------------------------------------------------------------------- - - - + - + - Write to end Create new - + - + - + - " " - - + + - + - " " - + + + - + - " " - ------------------------------------------------------------------------------- + bin in out trunc app noreplace File exists File doesn't exist + ---------------------------------------------------------------------------------- + - + - - - - Open at begin Failure to open + + + - - - - " " + - - + - - - " Create new + + - + - - - " " + - + + - - - " " + + + + - - - " " + ---------------------------------------------------------------------------------- + - - + + - - Destroy contents Create new + + - + + - - " " + - + + + - - " " + + + + + - - " " + ---------------------------------------------------------------------------------- + - - + x - + Failure to open Create new + + - + x - + " " + - + + x - + " " + + + + x - + " " + ---------------------------------------------------------------------------------- + - - + - + - Write to end Create new + + - + - + - " " + - + + - + - " " + + + + - + - " " + ---------------------------------------------------------------------------------- */ static const std::ios_base::openmode app = 1 << 1; // append to end static const std::ios_base::openmode ate = 1 << 2; // initialize to end @@ -241,7 +241,7 @@ public: /// otherwise the function will block until the lock can be acquired. /// @returns 0 on success, -1 on failure - /// close the file explicitely + /// close the file explicitly int close(std::error_code& ec); ///< @returns 0 on success, -1 on failure @@ -297,8 +297,9 @@ public: /// remove a file or directory static int remove(const std::string& filename, int suppress_warning = 0); - ///< pass ENOENT in the optional 'suppress_warning' parameter if you don't want - /// a warning in the log when the directory does not exist + ///< pass an errno value (e.g., ENOENT) in the optional 'suppress_warning' parameter if you want to + /// suppress a warning in the log when the failure matches that errno (e.g., suppress warning if + /// the file or directory does not exist) /// @returns 0 on success and -1 on failure. /// rename a file diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index db98a70573..0bf0946c42 100755 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -484,47 +484,47 @@ bool LLFloaterUIPreview::postBuild() bool found_en_us = false; std::string language_directory; std::string xui_dir = get_xui_dir(); // directory containing localizations -- don't forget trailing delim - mLanguageSelection->removeall(); // clear out anything temporarily in list from XML + mLanguageSelection->removeall(); // clear out anything temporarily in list from XML LLDirIterator iter(xui_dir, "*"); - while(found) // for every directory + while (found) // for every directory { - if((found = iter.next(language_directory))) // get next directory + if ((found = iter.next(language_directory))) // get next directory { std::string full_path = gDirUtilp->add(xui_dir, language_directory); - if(LLFile::isfile(full_path.c_str())) // if it's not a directory, skip it + if (!LLFile::isdir(full_path.c_str())) // if it's not a directory, skip it { continue; } - if(strncmp("template",language_directory.c_str(),8) && -1 == language_directory.find(".")) // if it's not the template directory or a hidden directory + if (strncmp("template",language_directory.c_str(), 8) && -1 == language_directory.find(".")) // if it's not the template directory or a hidden directory { - if(!strncmp("en",language_directory.c_str(),5)) // remember if we've seen en, so we can make it default + if (!strncmp("en",language_directory.c_str(), 5)) // remember if we've seen en, so we can make it default { found_en_us = true; } else { - mLanguageSelection->add(std::string(language_directory)); // add it to the language selection dropdown menu + mLanguageSelection->add(std::string(language_directory)); // add it to the language selection dropdown menu mLanguageSelection_2->add(std::string(language_directory)); } } } } - if(found_en_us) + if (found_en_us) { - mLanguageSelection->add(std::string("en"),ADD_TOP); // make en first item if we found it - mLanguageSelection_2->add(std::string("en"),ADD_TOP); + mLanguageSelection->add(std::string("en"), ADD_TOP); // make en first item if we found it + mLanguageSelection_2->add(std::string("en"), ADD_TOP); } else { std::string warning = std::string("No EN localization found; check your XUI directories!"); popupAndPrintWarning(warning); } - mLanguageSelection->selectFirstItem(); // select the first item + mLanguageSelection->selectFirstItem(); // select the first item mLanguageSelection_2->selectFirstItem(); - refreshList(); // refresh the list of available floaters + refreshList(); // refresh the list of available floaters return true; } @@ -892,7 +892,7 @@ void LLFloaterUIPreview::displayFloater(bool click, S32 ID) // Add localization to title so user knows whether it's localized or defaulted to en std::string full_path = getLocalizedDirectory() + path; std::string floater_lang = "EN"; - if (LLFile::isfile(full_path.c_str())) // if the file does not exist + if (LLFile::isfile(full_path.c_str())) // use localized language if the file exists { floater_lang = getLocStr(ID); } @@ -965,8 +965,8 @@ void LLFloaterUIPreview::onClickEditFloater() } file_path = getLocalizedDirectory() + file_name; - // does it exist? (some localized versions may not have it there are no diffs, and then we try to open an nonexistent file - if(!LLFile::isfile(file_path.c_str())) // if the file does not exist + // Does it exist? (Some localized versions may not have it when there are no diffs, and then we try to open a nonexistent file) + if (!LLFile::isfile(file_path.c_str())) // if the file does not exist { popupAndPrintWarning("No file for this floater exists in the selected localization. Opening the EN version instead."); file_path = get_xui_dir() + mDelim + "en" + mDelim + file_name; // open the en version instead, by default @@ -1115,14 +1115,14 @@ void LLFloaterUIPreview::onClickToggleDiffHighlighting() std::string path_in_textfield = mDiffPathTextBox->getText(); // get file path bool error = false; - if(std::string("") == path_in_textfield) // check for blank file + if(std::string("") == path_in_textfield) // check for blank file { std::string warning = "Unable to highlight differences because no file was provided; fill in the relevant text field"; popupAndPrintWarning(warning); error = true; } - if (!LLFile::isfile(path_in_textfield.c_str()) && !error) // check if the file exists (empty check is reduntant but useful for the informative error message) + if (!LLFile::isfile(path_in_textfield.c_str()) && !error) // check if the file exists (empty check is redundant but useful for the informative error message) { std::string warning = std::string("Unable to highlight differences because an invalid path to a difference file was provided:\"") + path_in_textfield + "\""; popupAndPrintWarning(warning); |
