Merge in changes from mani_linden/viewer-vs2010

meow-7.2.2
jenn 2011-01-25 10:36:14 -08:00
commit c2d1f9215a
10 changed files with 337 additions and 26 deletions

View File

@ -210,9 +210,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>de5559c2c497544b3d0da533390175dc</string>
<string>98be22c8833aa2bca184b9fa09fbb82b</string>
<key>url</key>
<string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/boost-1.39.0-windows-20101001a.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-boost/rev/219456/arch/CYGWIN/installer/boost-1.45.0-windows-20110124.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>
@ -1880,7 +1880,7 @@
<key>windows</key>
<map>
<key>build_directory</key>
<string>build-vc80</string>
<string>build-vc100</string>
<key>configurations</key>
<map>
<key>Debug</key>
@ -1908,7 +1908,7 @@
<key>options</key>
<array>
<string>-G</string>
<string>"Visual Studio 8 2005"</string>
<string>"Visual Studio 10"</string>
</array>
</map>
<key>name</key>
@ -1939,7 +1939,7 @@
<key>options</key>
<array>
<string>-G</string>
<string>"Visual Studio 8 2005"</string>
<string>"Visual Studio 10"</string>
</array>
</map>
<key>default</key>
@ -1972,7 +1972,7 @@
<key>options</key>
<array>
<string>-G</string>
<string>"Visual Studio 8 2005"</string>
<string>"Visual Studio 10"</string>
</array>
</map>
<key>name</key>

View File

@ -61,7 +61,7 @@ if (WINDOWS)
/Oy-
)
if(MSVC80 OR MSVC90)
if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
CACHE STRING "C++ compiler release options" FORCE)
@ -69,7 +69,7 @@ if (WINDOWS)
add_definitions(
/Zc:wchar_t-
)
endif (MSVC80 OR MSVC90)
endif (MSVC)
# Are we using the crummy Visual Studio KDU build workaround?
if (NOT VS_DISABLE_FATAL_WARNINGS)

View File

@ -10,23 +10,15 @@ if (STANDALONE)
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
set(BOOST_REGEX_LIBRARY boost_regex-mt)
set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
set(BOOST_SYSTEM_LIBRARY boost_system-mt)
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
else (STANDALONE)
use_prebuilt_binary(boost)
set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
if (WINDOWS)
set(BOOST_VERSION 1_39)
if (MSVC71)
set(BOOST_PROGRAM_OPTIONS_LIBRARY
optimized libboost_program_options-vc71-mt-s-${BOOST_VERSION}
debug libboost_program_options-vc71-mt-sgd-${BOOST_VERSION})
set(BOOST_REGEX_LIBRARY
optimized libboost_regex-vc71-mt-s-${BOOST_VERSION}
debug libboost_regex-vc71-mt-sgd-${BOOST_VERSION})
set(BOOST_SIGNALS_LIBRARY
optimized libboost_signals-vc71-mt-s-${BOOST_VERSION}
debug libboost_signals-vc71-mt-sgd-${BOOST_VERSION})
else (MSVC71)
set(BOOST_VERSION 1_45)
if(MSVC80)
set(BOOST_PROGRAM_OPTIONS_LIBRARY
optimized libboost_program_options-vc80-mt-${BOOST_VERSION}
debug libboost_program_options-vc80-mt-gd-${BOOST_VERSION})
@ -36,14 +28,38 @@ else (STANDALONE)
set(BOOST_SIGNALS_LIBRARY
optimized libboost_signals-vc80-mt-${BOOST_VERSION}
debug libboost_signals-vc80-mt-gd-${BOOST_VERSION})
endif (MSVC71)
set(BOOST_SYSTEM_LIBRARY
optimized libboost_system-vc80-mt-${BOOST_VERSION}
debug libboost_system-vc80-mt-gd-${BOOST_VERSION})
set(BOOST_FILESYSTEM_LIBRARY
optimized libboost_filesystem-vc80-mt-${BOOST_VERSION}
debug libboost_filesystem-vc80-mt-gd-${BOOST_VERSION})
else(MSVC80)
# MSVC 10.0 config
set(BOOST_PROGRAM_OPTIONS_LIBRARY
optimized libboost_program_options-vc100-mt-${BOOST_VERSION}
debug libboost_program_options-vc100-mt-gd-${BOOST_VERSION})
set(BOOST_REGEX_LIBRARY
optimized libboost_regex-vc100-mt-${BOOST_VERSION}
debug libboost_regex-vc100-mt-gd-${BOOST_VERSION})
set(BOOST_SYSTEM_LIBRARY
optimized libboost_system-vc100-mt-${BOOST_VERSION}
debug libboost_system-vc100-mt-gd-${BOOST_VERSION})
set(BOOST_FILESYSTEM_LIBRARY
optimized libboost_filesystem-vc100-mt-${BOOST_VERSION}
debug libboost_filesystem-vc100-mt-gd-${BOOST_VERSION})
endif (MSVC80)
elseif (DARWIN)
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-xgcc40-mt)
set(BOOST_REGEX_LIBRARY boost_regex-xgcc40-mt)
set(BOOST_SIGNALS_LIBRARY boost_signals-xgcc40-mt)
set(BOOST_SYSTEM_LIBRARY boost_system-xgcc40-mt)
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-xgcc40-mt)
elseif (LINUX)
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-gcc41-mt)
set(BOOST_REGEX_LIBRARY boost_regex-gcc41-mt)
set(BOOST_SIGNALS_LIBRARY boost_signals-gcc41-mt)
set(BOOST_SYSTEM_LIBRARY boost_system-gcc41-mt)
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-gcc41-mt)
endif (WINDOWS)
endif (STANDALONE)

View File

@ -0,0 +1,203 @@
/**
* @file lldiriterator.cpp
* @brief Iterator through directory entries matching the search pattern.
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* 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;
* version 2.1 of the License only.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "lldiriterator.h"
#include <boost/filesystem.hpp>
#include <boost/regex.hpp>
namespace fs = boost::filesystem;
static std::string glob_to_regex(const std::string& glob);
class LLDirIterator::Impl
{
public:
Impl(const std::string &dirname, const std::string &mask);
~Impl();
bool next(std::string &fname);
private:
boost::regex mFilterExp;
fs::directory_iterator mIter;
bool mIsValid;
};
LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
: mIsValid(false)
{
fs::path dir_path(dirname);
// Check if path exists.
if (!fs::exists(dir_path))
{
llerrs << "Invalid path: \"" << dir_path.string() << "\"" << llendl;
return;
}
// Initialize the directory iterator for the given path.
try
{
mIter = fs::directory_iterator(dir_path);
}
catch (fs::basic_filesystem_error<fs::path>& e)
{
llerrs << e.what() << llendl;
return;
}
// Convert the glob mask to a regular expression
std::string exp = glob_to_regex(mask);
// Initialize boost::regex with the expression converted from
// the glob mask.
// An exception is thrown if the expression is not valid.
try
{
mFilterExp.assign(exp);
}
catch (boost::regex_error& e)
{
llerrs << "\"" << exp << "\" is not a valid regular expression: "
<< e.what() << llendl;
return;
}
mIsValid = true;
}
LLDirIterator::Impl::~Impl()
{
}
bool LLDirIterator::Impl::next(std::string &fname)
{
fname = "";
if (!mIsValid)
{
llerrs << "The iterator is not correctly initialized." << llendl;
return false;
}
fs::directory_iterator end_itr; // default construction yields past-the-end
bool found = false;
while (mIter != end_itr && !found)
{
boost::smatch match;
std::string name = mIter->path().filename();
if (found = boost::regex_match(name, match, mFilterExp))
{
fname = name;
}
++mIter;
}
return found;
}
std::string glob_to_regex(const std::string& glob)
{
std::string regex;
regex.reserve(glob.size()<<1);
S32 braces = 0;
bool escaped = false;
bool square_brace_open = false;
for (std::string::const_iterator i = glob.begin(); i != glob.end(); ++i)
{
char c = *i;
switch (c)
{
case '.':
regex+="\\.";
break;
case '*':
if (glob.begin() == i)
{
regex+="[^.].*";
}
else
{
regex+= escaped ? "*" : ".*";
}
break;
case '?':
regex+= escaped ? '?' : '.';
break;
case '{':
braces++;
regex+='(';
break;
case '}':
if (!braces)
{
llerrs << "glob_to_regex: Closing brace without an equivalent opening brace: " << glob << llendl;
}
regex+=')';
braces--;
break;
case ',':
regex+= braces ? '|' : c;
break;
case '!':
regex+= square_brace_open ? '^' : c;
break;
default:
regex+=c;
break;
}
escaped = ('\\' == c);
square_brace_open = ('[' == c);
}
if (braces)
{
llerrs << "glob_to_regex: Unterminated brace expression: " << glob << llendl;
}
return regex;
}
LLDirIterator::LLDirIterator(const std::string &dirname, const std::string &mask)
{
mImpl = new Impl(dirname, mask);
}
LLDirIterator::~LLDirIterator()
{
delete mImpl;
}
bool LLDirIterator::next(std::string &fname)
{
return mImpl->next(fname);
}

View File

@ -0,0 +1,87 @@
/**
* @file lldiriterator.h
* @brief Iterator through directory entries matching the search pattern.
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* 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;
* version 2.1 of the License only.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLDIRITERATOR_H
#define LL_LLDIRITERATOR_H
#include "linden_common.h"
/**
* Class LLDirIterator
*
* Iterates through directory entries matching the search pattern.
*/
class LLDirIterator
{
public:
/**
* Constructs LLDirIterator object to search for glob pattern
* matches in a directory.
*
* @param dirname - name of a directory to search in.
* @param mask - search pattern, a glob expression
*
* Wildcards supported in glob expressions:
* --------------------------------------------------------------
* | Wildcard | Matches |
* --------------------------------------------------------------
* | * |zero or more characters |
* | ? |exactly one character |
* | [abcde] |exactly one character listed |
* | [a-e] |exactly one character in the given range |
* | [!abcde] |any character that is not listed |
* | [!a-e] |any character that is not in the given range |
* | {abc,xyz} |exactly one entire word in the options given |
* --------------------------------------------------------------
*/
LLDirIterator(const std::string &dirname, const std::string &mask);
~LLDirIterator();
/**
* Searches for the next directory entry matching the glob mask
* specified upon iterator construction.
* Returns true if a match is found, sets fname
* parameter to the name of the matched directory entry and
* increments the iterator position.
*
* Typical usage:
* <code>
* LLDirIterator iter(directory, pattern);
* if ( iter.next(scanResult) )
* </code>
*
* @param fname - name of the matched directory entry.
* @return true if a match is found, false otherwise.
*/
bool next(std::string &fname);
protected:
class Impl;
Impl* mImpl;
};
#endif //LL_LLDIRITERATOR_H

View File

@ -8,8 +8,11 @@ FS (f|F)
%n 4000
%p 5000
%top {
#include "linden_common.h"
}
%{
#include "linden_common.h"
// Deal with the fact that lex/yacc generates unreachable code
#ifdef LL_WINDOWS
#pragma warning (disable : 4018) // warning C4018: signed/unsigned mismatch

View File

@ -1547,7 +1547,7 @@ if (WINDOWS)
${ARCH_PREBUILT_DIRS_RELEASE}/codecs/qtwcodecsd4.dll
SLPlugin
media_plugin_quicktime
media_plugin_webkit
#media_plugin_webkit
winmm_shim
windows-crash-logger
windows-updater

View File

@ -52,6 +52,7 @@
#include <boost/regex.hpp>
#if LL_MSVC
#pragma warning(push)
// disable boost::lexical_cast warning
#pragma warning (disable:4702)
#endif

View File

@ -41,6 +41,7 @@
#include <boost/regex/v4/match_results.hpp>
#if LL_MSVC
#pragma warning(push)
// disable warning about boost::lexical_cast unreachable code
// when it fails to parse the string
#pragma warning (disable:4702)

View File

@ -1323,19 +1323,19 @@ void LLPanelOutfitEdit::getCurrentItemUUID(LLUUID& selected_id)
void LLPanelOutfitEdit::getSelectedItemsUUID(uuid_vec_t& uuid_list)
{
void (uuid_vec_t::* tmp)(LLUUID const &) = &uuid_vec_t::push_back;
if (mInventoryItemsPanel->getVisible())
{
std::set<LLUUID> item_set = mInventoryItemsPanel->getRootFolder()->getSelectionList();
std::for_each(item_set.begin(), item_set.end(), boost::bind( &uuid_vec_t::push_back, &uuid_list, _1));
std::for_each(item_set.begin(), item_set.end(), boost::bind( tmp, &uuid_list, _1));
}
else if (mWearablesListViewPanel->getVisible())
{
std::vector<LLSD> item_set;
mWearableItemsList->getSelectedValues(item_set);
std::for_each(item_set.begin(), item_set.end(), boost::bind( &uuid_vec_t::push_back, &uuid_list, boost::bind(&LLSD::asUUID, _1 )));
std::for_each(item_set.begin(), item_set.end(), boost::bind( tmp, &uuid_list, boost::bind(&LLSD::asUUID, _1 )));
}
// return selected_id;