Compare commits
121 Commits
curlthread
...
shycurl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68ad5411c9 | ||
|
|
6ed9a62501 | ||
|
|
89be317a00 | ||
|
|
1ad4597d7a | ||
|
|
c65b659538 | ||
|
|
3c23163a29 | ||
|
|
c3900ee4f3 | ||
|
|
9c5da9e42c | ||
|
|
efa970c6a5 | ||
|
|
179f04739d | ||
|
|
b2f513caae | ||
|
|
9c1e74b0c0 | ||
|
|
e53af58d4a | ||
|
|
d9cb2ce6c7 | ||
|
|
a967f2b037 | ||
|
|
db5a7578c9 | ||
|
|
15086833a3 | ||
|
|
72a9b6b7fe | ||
|
|
0d3fab40e5 | ||
|
|
4e4d554ea4 | ||
|
|
c7bdaf6632 | ||
|
|
92c7792e95 | ||
|
|
1e81966b89 | ||
|
|
b785b9d219 | ||
|
|
85da7163a7 | ||
|
|
f3f8bee83b | ||
|
|
7843f51110 | ||
|
|
8bfdc98ef4 | ||
|
|
6673c89791 | ||
|
|
a8a30ae3b9 | ||
|
|
15af410e6f | ||
|
|
756a284048 | ||
|
|
32e2b584b9 | ||
|
|
add52b4d57 | ||
|
|
a4d2cb3d12 | ||
|
|
72fbb3f63e | ||
|
|
c62290accb | ||
|
|
8ad40c5d66 | ||
|
|
cd5a721c23 | ||
|
|
643844c01d | ||
|
|
c84f080fc8 | ||
|
|
5fcdbfdd9e | ||
|
|
96fa4af939 | ||
|
|
2334793554 | ||
|
|
20e445b4be | ||
|
|
085db93fc8 | ||
|
|
8fe6925414 | ||
|
|
57ad7e62d2 | ||
|
|
03608103b8 | ||
|
|
675d171104 | ||
|
|
405af67f45 | ||
|
|
72d93b8723 | ||
|
|
51c5933b76 | ||
|
|
465c6b9ed6 | ||
|
|
39847c4688 | ||
|
|
7721c6e3da | ||
|
|
c0fbf4bf55 | ||
|
|
01818582cf | ||
|
|
9a0620f140 | ||
|
|
0216925e05 | ||
|
|
32b24a98ca | ||
|
|
93d7a4938a | ||
|
|
56265b78ec | ||
|
|
6ee76aa6f7 | ||
|
|
32d6aefe00 | ||
|
|
84795863e5 | ||
|
|
92a5b14347 | ||
|
|
3cee90fe8b | ||
|
|
2bb58bac2e | ||
|
|
9dc1897b35 | ||
|
|
7a7da24df5 | ||
|
|
46f7250f08 | ||
|
|
58bfe23e5a | ||
|
|
ccb914ea83 | ||
|
|
10fe67f4a6 | ||
|
|
0243c61ea1 | ||
|
|
d73d4e9d48 | ||
|
|
3d60d9e3c5 | ||
|
|
59e0367dd4 | ||
|
|
102eca7d65 | ||
|
|
55a1d54b8e | ||
|
|
1e24b889dd | ||
|
|
988e2c3fdf | ||
|
|
92dc20850d | ||
|
|
3acaf773b8 | ||
|
|
5080746fa0 | ||
|
|
07e1f0e802 | ||
|
|
340f8f1f17 | ||
|
|
0316b7ff9a | ||
|
|
533675416c | ||
|
|
8baceee06c | ||
|
|
f7bf5c33bc | ||
|
|
8805e3fb27 | ||
|
|
64d8397ea5 | ||
|
|
4d4496fc4d | ||
|
|
af67342969 | ||
|
|
d9cbd52ea8 | ||
|
|
8b25d44bcf | ||
|
|
3d6733bed8 | ||
|
|
c3f3db518b | ||
|
|
385ec62e53 | ||
|
|
881524831f | ||
|
|
376be8b990 | ||
|
|
96ddbf2a8b | ||
|
|
c2ee420917 | ||
|
|
74a1ba0d1e | ||
|
|
0dc05a39e6 | ||
|
|
72fe406f64 | ||
|
|
90ac174260 | ||
|
|
b555e02220 | ||
|
|
507c94c24c | ||
|
|
2699fa8cf9 | ||
|
|
513002416c | ||
|
|
22530cd77e | ||
|
|
81521b98fd | ||
|
|
73c2feee97 | ||
|
|
d4212d390d | ||
|
|
2b8a55f396 | ||
|
|
f253da09ec | ||
|
|
e232abdab2 | ||
|
|
fae40e0bdf |
@@ -77,7 +77,6 @@ if (VIEWER)
|
|||||||
add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger)
|
add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger)
|
||||||
add_subdirectory(${LIBS_OPEN_PREFIX}llplugin)
|
add_subdirectory(${LIBS_OPEN_PREFIX}llplugin)
|
||||||
add_subdirectory(${LIBS_OPEN_PREFIX}llui)
|
add_subdirectory(${LIBS_OPEN_PREFIX}llui)
|
||||||
add_subdirectory(${LIBS_OPEN_PREFIX}llxuixml)
|
|
||||||
|
|
||||||
# viewer plugins directory
|
# viewer plugins directory
|
||||||
add_subdirectory(${LIBS_OPEN_PREFIX}plugins)
|
add_subdirectory(${LIBS_OPEN_PREFIX}plugins)
|
||||||
|
|||||||
@@ -190,10 +190,10 @@ if (LINUX)
|
|||||||
endif (NOT STANDALONE)
|
endif (NOT STANDALONE)
|
||||||
if (${ARCH} STREQUAL "x86_64")
|
if (${ARCH} STREQUAL "x86_64")
|
||||||
add_definitions(-DLINUX64=1 -pipe)
|
add_definitions(-DLINUX64=1 -pipe)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops")
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops")
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ffast-math")
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ffast-math")
|
||||||
else (${ARCH} STREQUAL "x86_64")
|
else (${ARCH} STREQUAL "x86_64")
|
||||||
if (NOT STANDALONE)
|
if (NOT STANDALONE)
|
||||||
set(MARCH_FLAG " -march=pentium4")
|
set(MARCH_FLAG " -march=pentium4")
|
||||||
@@ -269,14 +269,23 @@ if (DARWIN)
|
|||||||
add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE)
|
add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE)
|
||||||
set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
|
set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlong-branch")
|
if(${CMAKE_C_COMPILER} MATCHES "gcc*")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-branch")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlong-branch")
|
||||||
# NOTE: it's critical that the optimization flag is put in front.
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-branch")
|
||||||
# NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered.
|
# NOTE: it's critical that the optimization flag is put in front.
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
# NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered.
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O3 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O3 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||||
|
elseif(${CMAKE_C_COMPILER} MATCHES "clang*")
|
||||||
|
# NOTE: it's critical that the optimization flag is put in front.
|
||||||
|
# NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered.
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -msse3")
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -msse3")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3 -msse3")
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O3 -msse3")
|
||||||
|
endif()
|
||||||
endif (DARWIN)
|
endif (DARWIN)
|
||||||
|
|
||||||
|
|
||||||
@@ -318,7 +327,7 @@ else (STANDALONE)
|
|||||||
glib-2.0
|
glib-2.0
|
||||||
gstreamer-0.10
|
gstreamer-0.10
|
||||||
gtk-2.0
|
gtk-2.0
|
||||||
llfreetype2
|
freetype2
|
||||||
pango-1.0
|
pango-1.0
|
||||||
)
|
)
|
||||||
endif (STANDALONE)
|
endif (STANDALONE)
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ else (STANDALONE)
|
|||||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.0.dylib
|
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.0.dylib
|
||||||
)
|
)
|
||||||
set(APRUTIL_LIBRARIES
|
set(APRUTIL_LIBRARIES
|
||||||
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libaprutil-1.0.dylib
|
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libaprutil-1.dylib
|
||||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.0.dylib
|
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.dylib
|
||||||
)
|
)
|
||||||
set(APRICONV_LIBRARIES iconv)
|
set(APRICONV_LIBRARIES iconv)
|
||||||
else (WINDOWS)
|
else (WINDOWS)
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ else (STANDALONE)
|
|||||||
debug libboost_regex-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
|
debug libboost_regex-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
|
||||||
|
|
||||||
elseif (DARWIN)
|
elseif (DARWIN)
|
||||||
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
|
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem)
|
||||||
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
|
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options)
|
||||||
set(BOOST_REGEX_LIBRARY boost_regex-mt)
|
set(BOOST_REGEX_LIBRARY boost_regex)
|
||||||
set(BOOST_SYSTEM_LIBRARY boost_system-mt)
|
set(BOOST_SYSTEM_LIBRARY boost_system)
|
||||||
elseif (LINUX)
|
elseif (LINUX)
|
||||||
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
|
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
|
||||||
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
|
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ else (STANDALONE)
|
|||||||
optimized libcurl)
|
optimized libcurl)
|
||||||
else (WINDOWS)
|
else (WINDOWS)
|
||||||
set(CURL_LIBRARIES curl)
|
set(CURL_LIBRARIES curl)
|
||||||
|
if(LINUX AND WORD_SIZE EQUAL 64)
|
||||||
|
list(APPEND CURL_LIBRARIES idn)
|
||||||
|
endif(LINUX AND WORD_SIZE EQUAL 64)
|
||||||
endif (WINDOWS)
|
endif (WINDOWS)
|
||||||
set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
|
set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
|
||||||
endif (STANDALONE)
|
endif (STANDALONE)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ if (NOT FMODEX_LIBRARY)
|
|||||||
set(FMODEX_SDK_DIR CACHE PATH "Path to the FMOD Ex SDK.")
|
set(FMODEX_SDK_DIR CACHE PATH "Path to the FMOD Ex SDK.")
|
||||||
if (FMODEX_SDK_DIR)
|
if (FMODEX_SDK_DIR)
|
||||||
find_library(FMODEX_LIBRARY
|
find_library(FMODEX_LIBRARY
|
||||||
fmodex fmodex_vc fmodexL_vc
|
fmodex_vc fmodexL_vc fmodex fmodexL fmodex64 fmodexL64
|
||||||
PATHS
|
PATHS
|
||||||
${FMODEX_SDK_DIR}/api/lib
|
${FMODEX_SDK_DIR}/api/lib
|
||||||
${FMODEX_SDK_DIR}/api
|
${FMODEX_SDK_DIR}/api
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
# -*- cmake -*-
|
# -*- cmake -*-
|
||||||
include(Prebuilt)
|
include(Prebuilt)
|
||||||
|
|
||||||
|
if(WORD_SIZE EQUAL 64)
|
||||||
|
set(DISABLE_TCMALLOC TRUE)
|
||||||
|
endif(WORD_SIZE EQUAL 64)
|
||||||
|
|
||||||
if (STANDALONE)
|
if (STANDALONE)
|
||||||
include(FindGooglePerfTools)
|
include(FindGooglePerfTools)
|
||||||
else (STANDALONE)
|
else (STANDALONE)
|
||||||
if (LINUX OR WINDOWS)
|
if (LINUX OR WINDOWS AND NOT WORD_SIZE EQUAL 64)
|
||||||
use_prebuilt_binary(gperftools)
|
use_prebuilt_binary(gperftools)
|
||||||
endif (LINUX OR WINDOWS)
|
endif (LINUX OR WINDOWS AND NOT WORD_SIZE EQUAL 64)
|
||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
set(TCMALLOC_LIBRARIES libtcmalloc_minimal.lib)
|
set(TCMALLOC_LIBRARIES libtcmalloc_minimal.lib)
|
||||||
set(TCMALLOC_LINKER_FLAGS "/INCLUDE:\"__tcmalloc\"")
|
set(TCMALLOC_LINKER_FLAGS "/INCLUDE:\"__tcmalloc\"")
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ if (STANDALONE)
|
|||||||
else (STANDALONE)
|
else (STANDALONE)
|
||||||
use_prebuilt_binary(hunspell)
|
use_prebuilt_binary(hunspell)
|
||||||
|
|
||||||
set(HUNSPELL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/hunspell)
|
set(HUNSPELL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/hunspell)
|
||||||
|
|
||||||
if (LINUX OR DARWIN)
|
if (LINUX OR DARWIN)
|
||||||
set(HUNSPELL_LIBRARY hunspell-1.3)
|
set(HUNSPELL_LIBRARY hunspell-1.3)
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ else (STANDALONE)
|
|||||||
set(JPEG_LIBRARIES jpeg)
|
set(JPEG_LIBRARIES jpeg)
|
||||||
elseif (DARWIN)
|
elseif (DARWIN)
|
||||||
set(JPEG_LIBRARIES
|
set(JPEG_LIBRARIES
|
||||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/liblljpeg.a
|
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libjpeg.a
|
||||||
debug ${ARCH_PREBUILT_DIRS_DEBUG}/liblljpeg.a
|
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libjpeg.a
|
||||||
)
|
)
|
||||||
elseif (WINDOWS)
|
elseif (WINDOWS)
|
||||||
set(JPEG_LIBRARIES jpeglib)
|
set(JPEG_LIBRARIES jpeglib)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ else (STANDALONE)
|
|||||||
debug json_vc${MSVC_SUFFIX}d
|
debug json_vc${MSVC_SUFFIX}d
|
||||||
optimized json_vc${MSVC_SUFFIX})
|
optimized json_vc${MSVC_SUFFIX})
|
||||||
elseif (DARWIN)
|
elseif (DARWIN)
|
||||||
set(JSONCPP_LIBRARIES json_mac-universal-gcc_libmt)
|
set(JSONCPP_LIBRARIES json_linux-gcc-4.0.1_libmt)
|
||||||
elseif (LINUX)
|
elseif (LINUX)
|
||||||
set(JSONCPP_LIBRARIES jsoncpp)
|
set(JSONCPP_LIBRARIES jsoncpp)
|
||||||
endif (WINDOWS)
|
endif (WINDOWS)
|
||||||
|
|||||||
@@ -18,7 +18,11 @@ else (STANDALONE)
|
|||||||
use_prebuilt_binary(SDL)
|
use_prebuilt_binary(SDL)
|
||||||
set (SDL_FOUND TRUE)
|
set (SDL_FOUND TRUE)
|
||||||
set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR})
|
set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR})
|
||||||
set (SDL_LIBRARY SDL directfb fusion direct)
|
if(WORD_SIZE EQUAL 64)
|
||||||
|
set (SDL_LIBRARY SDL)
|
||||||
|
else(WORD_SIZE EQUAL 64)
|
||||||
|
set (SDL_LIBRARY SDL directfb fusion direct)
|
||||||
|
endif(WORD_SIZE EQUAL 64)
|
||||||
endif (LINUX)
|
endif (LINUX)
|
||||||
endif (STANDALONE)
|
endif (STANDALONE)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
# -*- cmake -*-
|
|
||||||
|
|
||||||
set(LLXUIXML_INCLUDE_DIRS
|
|
||||||
${LIBS_OPEN_DIR}/llxuixml
|
|
||||||
)
|
|
||||||
|
|
||||||
set(LLXUIXML_LIBRARIES llxuixml)
|
|
||||||
@@ -10,9 +10,9 @@ if (NOT STANDALONE)
|
|||||||
set(ARCH_PREBUILT_DIRS_RELEASE ${ARCH_PREBUILT_DIRS})
|
set(ARCH_PREBUILT_DIRS_RELEASE ${ARCH_PREBUILT_DIRS})
|
||||||
set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS})
|
set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS})
|
||||||
elseif (DARWIN)
|
elseif (DARWIN)
|
||||||
set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release)
|
set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib)
|
||||||
set(ARCH_PREBUILT_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
|
set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release)
|
||||||
set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS_RELEASE})
|
set(ARCH_PREBUILT_DIRS_DEBUG ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/debug)
|
||||||
endif (WINDOWS)
|
endif (WINDOWS)
|
||||||
endif (NOT STANDALONE)
|
endif (NOT STANDALONE)
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ else (STANDALONE)
|
|||||||
set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
|
set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
|
||||||
endif (STANDALONE)
|
endif (STANDALONE)
|
||||||
|
|
||||||
if (LINUX)
|
if (LINUX OR DARWIN)
|
||||||
set(CRYPTO_LIBRARIES crypto)
|
set(CRYPTO_LIBRARIES crypto)
|
||||||
elseif (DARWIN)
|
endif (LINUX OR DARWIN)
|
||||||
set(CRYPTO_LIBRARIES llcrypto)
|
|
||||||
endif (LINUX)
|
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ else (STANDALONE)
|
|||||||
else(LINUX)
|
else(LINUX)
|
||||||
set(PNG_LIBRARIES png15)
|
set(PNG_LIBRARIES png15)
|
||||||
endif()
|
endif()
|
||||||
set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/libpng15)
|
set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/)
|
||||||
endif (STANDALONE)
|
endif (STANDALONE)
|
||||||
|
|||||||
@@ -76,37 +76,36 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
set(DARWIN 1)
|
set(DARWIN 1)
|
||||||
|
|
||||||
#SDK Compiler and Deployment targets for XCode
|
if(${CMAKE_GENERATOR} MATCHES Xcode)
|
||||||
if (${XCODE_VERSION} VERSION_LESS 4.0.0)
|
#SDK Compiler and Deployment targets for XCode
|
||||||
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
|
if (${XCODE_VERSION} VERSION_LESS 4.0.0)
|
||||||
set(CMAKE_XCODE_ATTIBUTE_GCC_VERSION "4.2")
|
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
|
||||||
else (${XCODE_VERSION} VERSION_LESS 4.0.0)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.5)
|
||||||
|
set(CMAKE_XCODE_ATTIBUTE_GCC_VERSION "4.2")
|
||||||
|
else (${XCODE_VERSION} VERSION_LESS 4.0.0)
|
||||||
|
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk)
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6)
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
|
||||||
|
endif (${XCODE_VERSION} VERSION_LESS 4.0.0)
|
||||||
|
else()
|
||||||
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk)
|
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk)
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6)
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
|
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
|
||||||
endif (${XCODE_VERSION} VERSION_LESS 4.0.0)
|
endif(${CMAKE_GENERATOR} MATCHES Xcode)
|
||||||
|
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.5)
|
## We currently support only 32-bit i386 builds, so use these:
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES i386)
|
||||||
|
set(ARCH i386)
|
||||||
|
set(WORD_SIZE 32)
|
||||||
|
|
||||||
# NOTE: To attempt an i386/PPC Universal build, add this on the configure line:
|
## But if you want to compile for mixed 32/64 bit, try these:
|
||||||
# -DCMAKE_OSX_ARCHITECTURES:STRING='i386;ppc'
|
# set(CMAKE_OSX_ARCHITECTURES i386;x86_64)
|
||||||
# Build only for i386 by default, system default on MacOSX 10.6 is x86_64
|
# set(ARCH universal)
|
||||||
if (NOT CMAKE_OSX_ARCHITECTURES)
|
# set(WORD_SIZE 64)
|
||||||
set(CMAKE_OSX_ARCHITECTURES i386)
|
|
||||||
endif (NOT CMAKE_OSX_ARCHITECTURES)
|
|
||||||
|
|
||||||
if (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
|
|
||||||
set(ARCH universal)
|
|
||||||
else (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
|
|
||||||
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc")
|
|
||||||
set(ARCH ppc)
|
|
||||||
else (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc")
|
|
||||||
set(ARCH i386)
|
|
||||||
endif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc")
|
|
||||||
endif (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
|
|
||||||
|
|
||||||
|
## Finally, set up the build output directories
|
||||||
set(LL_ARCH ${ARCH}_darwin)
|
set(LL_ARCH ${ARCH}_darwin)
|
||||||
set(LL_ARCH_DIR universal-darwin)
|
set(LL_ARCH_DIR universal-darwin)
|
||||||
set(WORD_SIZE 32)
|
|
||||||
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,11 @@
|
|||||||
#include "lluuid.h"
|
#include "lluuid.h"
|
||||||
#include "llframetimer.h"
|
#include "llframetimer.h"
|
||||||
#include "llassettype.h"
|
#include "llassettype.h"
|
||||||
|
#include "llextendedstatus.h"
|
||||||
|
|
||||||
#include "lllistener.h"
|
#include "lllistener.h"
|
||||||
|
|
||||||
const F32 LL_WIND_UPDATE_INTERVAL = 0.1f;
|
const F32 LL_WIND_UPDATE_INTERVAL = 0.1f;
|
||||||
const F32 LL_ROLLOFF_MULTIPLIER_UNDER_WATER = 5.f; // How much sounds are weaker under water
|
|
||||||
const F32 LL_WIND_UNDERWATER_CENTER_FREQ = 20.f;
|
const F32 LL_WIND_UNDERWATER_CENTER_FREQ = 20.f;
|
||||||
|
|
||||||
const F32 ATTACHED_OBJECT_TIMEOUT = 5.0f;
|
const F32 ATTACHED_OBJECT_TIMEOUT = 5.0f;
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ bool attemptDelayLoad()
|
|||||||
|
|
||||||
FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels);
|
FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels);
|
||||||
|
|
||||||
|
FMOD::ChannelGroup *LLAudioEngine_FMODEX::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0};
|
||||||
|
|
||||||
LLAudioEngine_FMODEX::LLAudioEngine_FMODEX(bool enable_profiler)
|
LLAudioEngine_FMODEX::LLAudioEngine_FMODEX(bool enable_profiler)
|
||||||
{
|
{
|
||||||
mInited = false;
|
mInited = false;
|
||||||
@@ -95,6 +97,28 @@ inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* F_STDCALL decode_alloc(unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr)
|
||||||
|
{
|
||||||
|
if(type & FMOD_MEMORY_STREAM_DECODE)
|
||||||
|
{
|
||||||
|
llinfos << "Decode buffer size: " << size << llendl;
|
||||||
|
}
|
||||||
|
else if(type & FMOD_MEMORY_STREAM_FILE)
|
||||||
|
{
|
||||||
|
llinfos << "Strean buffer size: " << size << llendl;
|
||||||
|
}
|
||||||
|
return new char[size];
|
||||||
|
}
|
||||||
|
void* F_STDCALL decode_realloc(void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr)
|
||||||
|
{
|
||||||
|
memset(ptr,0,size);
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
void F_STDCALL decode_dealloc(void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr)
|
||||||
|
{
|
||||||
|
delete[] (char*)ptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -108,6 +132,10 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
|||||||
|
|
||||||
LL_DEBUGS("AppInit") << "LLAudioEngine_FMODEX::init() initializing FMOD" << LL_ENDL;
|
LL_DEBUGS("AppInit") << "LLAudioEngine_FMODEX::init() initializing FMOD" << LL_ENDL;
|
||||||
|
|
||||||
|
result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE);
|
||||||
|
if(Check_FMOD_Error(result, "FMOD::Memory_Initialize"))
|
||||||
|
return false;
|
||||||
|
|
||||||
result = FMOD::System_Create(&mSystem);
|
result = FMOD::System_Create(&mSystem);
|
||||||
if(Check_FMOD_Error(result, "FMOD::System_Create"))
|
if(Check_FMOD_Error(result, "FMOD::System_Create"))
|
||||||
return false;
|
return false;
|
||||||
@@ -124,54 +152,8 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
|||||||
<< ")! You should be using FMOD Ex" << FMOD_VERSION << LL_ENDL;
|
<< ")! You should be using FMOD Ex" << FMOD_VERSION << LL_ENDL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LL_WINDOWS
|
result = mSystem->setSoftwareFormat(44100, FMOD_SOUND_FORMAT_PCM16, 0, 0, FMOD_DSP_RESAMPLER_LINEAR);
|
||||||
int numdrivers;
|
Check_FMOD_Error(result,"FMOD::System::setSoftwareFormat");
|
||||||
FMOD_SPEAKERMODE speakermode;
|
|
||||||
FMOD_CAPS caps;
|
|
||||||
char name[256];
|
|
||||||
|
|
||||||
//Is this block applicable to linux?
|
|
||||||
{
|
|
||||||
result = mSystem->getNumDrivers(&numdrivers);
|
|
||||||
Check_FMOD_Error(result, "FMOD::System::getNumDrivers");
|
|
||||||
if (numdrivers == 0)
|
|
||||||
{
|
|
||||||
result = mSystem->setOutput(FMOD_OUTPUTTYPE_NOSOUND);
|
|
||||||
Check_FMOD_Error(result, "FMOD::System::setOutput");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = mSystem->getDriverCaps(0, &caps, 0, &speakermode);
|
|
||||||
Check_FMOD_Error(result,"FMOD::System::getDriverCaps");
|
|
||||||
/*
|
|
||||||
Set the user selected speaker mode.
|
|
||||||
*/
|
|
||||||
result = mSystem->setSpeakerMode(speakermode);
|
|
||||||
Check_FMOD_Error(result, "FMOD::System::setSpeakerMode");
|
|
||||||
if (caps & FMOD_CAPS_HARDWARE_EMULATED)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
The user has the 'Acceleration' slider set to off! This is really bad
|
|
||||||
for latency! You might want to warn the user about this.
|
|
||||||
*/
|
|
||||||
result = mSystem->setDSPBufferSize(1024, 10);
|
|
||||||
Check_FMOD_Error(result, "FMOD::System::setDSPBufferSize");
|
|
||||||
}
|
|
||||||
result = mSystem->getDriverInfo(0, name, 256, 0);
|
|
||||||
Check_FMOD_Error(result, "FMOD::System::getDriverInfo");
|
|
||||||
|
|
||||||
if (strstr(name, "SigmaTel"))
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Sigmatel sound devices crackle for some reason if the format is PCM 16bit.
|
|
||||||
PCM floating point output seems to solve it.
|
|
||||||
*/
|
|
||||||
result = mSystem->setSoftwareFormat(48000, FMOD_SOUND_FORMAT_PCMFLOAT, 0,0, FMOD_DSP_RESAMPLER_LINEAR);
|
|
||||||
Check_FMOD_Error(result,"FMOD::System::setSoftwareFormat");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif //LL_WINDOWS
|
|
||||||
|
|
||||||
// In this case, all sounds, PLUS wind and stream will be software.
|
// In this case, all sounds, PLUS wind and stream will be software.
|
||||||
result = mSystem->setSoftwareChannels(num_channels + 2);
|
result = mSystem->setSoftwareChannels(num_channels + 2);
|
||||||
@@ -179,7 +161,13 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
|||||||
|
|
||||||
U32 fmod_flags = FMOD_INIT_NORMAL;
|
U32 fmod_flags = FMOD_INIT_NORMAL;
|
||||||
if(mEnableProfiler)
|
if(mEnableProfiler)
|
||||||
|
{
|
||||||
fmod_flags |= FMOD_INIT_ENABLE_PROFILE;
|
fmod_flags |= FMOD_INIT_ENABLE_PROFILE;
|
||||||
|
mSystem->createChannelGroup("None", &mChannelGroups[AUDIO_TYPE_NONE]);
|
||||||
|
mSystem->createChannelGroup("SFX", &mChannelGroups[AUDIO_TYPE_SFX]);
|
||||||
|
mSystem->createChannelGroup("UI", &mChannelGroups[AUDIO_TYPE_UI]);
|
||||||
|
mSystem->createChannelGroup("Ambient", &mChannelGroups[AUDIO_TYPE_AMBIENT]);
|
||||||
|
}
|
||||||
|
|
||||||
#if LL_LINUX
|
#if LL_LINUX
|
||||||
bool audio_ok = false;
|
bool audio_ok = false;
|
||||||
@@ -297,6 +285,19 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
|||||||
|
|
||||||
LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init() FMOD Ex initialized correctly" << LL_ENDL;
|
LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init() FMOD Ex initialized correctly" << LL_ENDL;
|
||||||
|
|
||||||
|
int r_numbuffers, r_samplerate, r_channels, r_bits;
|
||||||
|
unsigned int r_bufferlength;
|
||||||
|
char r_name[256];
|
||||||
|
mSystem->getDSPBufferSize(&r_bufferlength, &r_numbuffers);
|
||||||
|
mSystem->getSoftwareFormat(&r_samplerate, NULL, &r_channels, NULL, NULL, &r_bits);
|
||||||
|
mSystem->getDriverInfo(0, r_name, 255, 0);
|
||||||
|
r_name[255] = '\0';
|
||||||
|
int latency = 1000.0 * r_bufferlength * r_numbuffers /r_samplerate;
|
||||||
|
|
||||||
|
LL_INFOS("AppInit") << "FMOD device: "<< r_name << "\n"
|
||||||
|
<< "FMOD Ex parameters: " << r_samplerate << " Hz * " << r_channels << " * " <<r_bits <<" bit\n"
|
||||||
|
<< "\tbuffer " << r_bufferlength << " * " << r_numbuffers << " (" << latency <<"ms)" << LL_ENDL;
|
||||||
|
|
||||||
mInited = true;
|
mInited = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -611,6 +612,9 @@ void LLAudioChannelFMODEX::play()
|
|||||||
Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::pause");
|
Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::pause");
|
||||||
|
|
||||||
getSource()->setPlayedOnce(true);
|
getSource()->setPlayedOnce(true);
|
||||||
|
|
||||||
|
if(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()])
|
||||||
|
mChannelp->setChannelGroup(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace FMOD
|
|||||||
{
|
{
|
||||||
class System;
|
class System;
|
||||||
class Channel;
|
class Channel;
|
||||||
|
class ChannelGroup;
|
||||||
class Sound;
|
class Sound;
|
||||||
class DSP;
|
class DSP;
|
||||||
}
|
}
|
||||||
@@ -83,6 +84,9 @@ protected:
|
|||||||
FMOD::DSP *mWindDSP;
|
FMOD::DSP *mWindDSP;
|
||||||
FMOD::System *mSystem;
|
FMOD::System *mSystem;
|
||||||
bool mEnableProfiler;
|
bool mEnableProfiler;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static FMOD::ChannelGroup *mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,15 @@ void LLListener_FMODEX::commitDeferredChanges()
|
|||||||
|
|
||||||
void LLListener_FMODEX::setRolloffFactor(F32 factor)
|
void LLListener_FMODEX::setRolloffFactor(F32 factor)
|
||||||
{
|
{
|
||||||
|
//An internal FMODEx optimization skips 3D updates if there have not been changes to the 3D sound environment.
|
||||||
|
//Sadly, a change in rolloff is not accounted for, thus we must touch the listener properties as well.
|
||||||
|
//In short: Changing the position ticks a dirtyflag inside fmodex, which makes it not skip 3D processing next update call.
|
||||||
|
if(mRolloffFactor != factor)
|
||||||
|
{
|
||||||
|
LLVector3 pos = mVelocity - LLVector3(0.f,0.f,.1f);
|
||||||
|
mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)pos.mV, NULL, NULL, NULL);
|
||||||
|
mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mVelocity.mV, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
mRolloffFactor = factor;
|
mRolloffFactor = factor;
|
||||||
mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor);
|
mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ class LLStreamingAudioInterface
|
|||||||
virtual const LLSD *getMetaData() = 0;
|
virtual const LLSD *getMetaData() = 0;
|
||||||
virtual bool supportsWaveData() = 0;
|
virtual bool supportsWaveData() = 0;
|
||||||
virtual bool getWaveData(float* arr, S32 count, S32 stride = 1) = 0;
|
virtual bool getWaveData(float* arr, S32 count, S32 stride = 1) = 0;
|
||||||
|
|
||||||
|
virtual bool supportsAdjustableBufferSizes(){return false;}
|
||||||
|
virtual void setBufferSizes(U32 streambuffertime, U32 decodebuffertime){};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_STREAMINGAUDIO_H
|
#endif // LL_STREAMINGAUDIO_H
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
const std::string& getURL() { return mInternetStreamURL; }
|
const std::string& getURL() { return mInternetStreamURL; }
|
||||||
|
|
||||||
FMOD_OPENSTATE getOpenState();
|
FMOD_OPENSTATE getOpenState(unsigned int* percentbuffered=NULL, bool* starving=NULL, bool* diskbusy=NULL);
|
||||||
protected:
|
protected:
|
||||||
FMOD::System* mSystem;
|
FMOD::System* mSystem;
|
||||||
FMOD::Channel* mStreamChannel;
|
FMOD::Channel* mStreamChannel;
|
||||||
@@ -74,7 +74,7 @@ LLStreamingAudio_FMODEX::LLStreamingAudio_FMODEX(FMOD::System *system) :
|
|||||||
{
|
{
|
||||||
// Number of milliseconds of audio to buffer for the audio card.
|
// Number of milliseconds of audio to buffer for the audio card.
|
||||||
// Must be larger than the usual Second Life frame stutter time.
|
// Must be larger than the usual Second Life frame stutter time.
|
||||||
const U32 buffer_seconds = 5; //sec
|
const U32 buffer_seconds = 10; //sec
|
||||||
const U32 estimated_bitrate = 128; //kbit/sec
|
const U32 estimated_bitrate = 128; //kbit/sec
|
||||||
mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES);
|
mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES);
|
||||||
|
|
||||||
@@ -145,7 +145,10 @@ void LLStreamingAudio_FMODEX::update()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FMOD_OPENSTATE open_state = mCurrentInternetStreamp->getOpenState();
|
unsigned int progress;
|
||||||
|
bool starving;
|
||||||
|
bool diskbusy;
|
||||||
|
FMOD_OPENSTATE open_state = mCurrentInternetStreamp->getOpenState(&progress, &starving, &diskbusy);
|
||||||
|
|
||||||
if (open_state == FMOD_OPENSTATE_READY)
|
if (open_state == FMOD_OPENSTATE_READY)
|
||||||
{
|
{
|
||||||
@@ -158,6 +161,7 @@ void LLStreamingAudio_FMODEX::update()
|
|||||||
// Reset volume to previously set volume
|
// Reset volume to previously set volume
|
||||||
setGain(getGain());
|
setGain(getGain());
|
||||||
mFMODInternetStreamChannelp->setPaused(false);
|
mFMODInternetStreamChannelp->setPaused(false);
|
||||||
|
mLastStarved.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(open_state == FMOD_OPENSTATE_ERROR)
|
else if(open_state == FMOD_OPENSTATE_ERROR)
|
||||||
@@ -237,12 +241,29 @@ void LLStreamingAudio_FMODEX::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(starving)
|
||||||
|
{
|
||||||
|
if(!mLastStarved.getStarted())
|
||||||
|
{
|
||||||
|
llinfos << "Stream starvation detected! Muting stream audio until it clears." << llendl;
|
||||||
|
llinfos << " (diskbusy="<<diskbusy<<")" << llendl;
|
||||||
|
llinfos << " (progress="<<progress<<")" << llendl;
|
||||||
|
mFMODInternetStreamChannelp->setMute(true);
|
||||||
|
}
|
||||||
|
mLastStarved.start();
|
||||||
|
}
|
||||||
|
else if(mLastStarved.getStarted() && mLastStarved.getElapsedTimeF32() > 1.f)
|
||||||
|
{
|
||||||
|
mLastStarved.stop();
|
||||||
|
mFMODInternetStreamChannelp->setMute(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLStreamingAudio_FMODEX::stop()
|
void LLStreamingAudio_FMODEX::stop()
|
||||||
{
|
{
|
||||||
|
mLastStarved.stop();
|
||||||
if(mMetaData)
|
if(mMetaData)
|
||||||
{
|
{
|
||||||
delete mMetaData;
|
delete mMetaData;
|
||||||
@@ -341,6 +362,11 @@ void LLStreamingAudio_FMODEX::setGain(F32 vol)
|
|||||||
if(!mFMODInternetStreamChannelp || !mCurrentInternetStreamp)
|
if(!mFMODInternetStreamChannelp || !mCurrentInternetStreamp)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool muted=false;
|
||||||
|
mFMODInternetStreamChannelp->getMute(&muted);
|
||||||
|
if(muted)
|
||||||
|
return false;
|
||||||
|
|
||||||
static std::vector<float> local_array(count); //Have to have an extra buffer to mix channels. Bleh.
|
static std::vector<float> local_array(count); //Have to have an extra buffer to mix channels. Bleh.
|
||||||
if(count > (S32)local_array.size()) //Expand the array if needed. Try to minimize allocation calls, so don't ever shrink.
|
if(count > (S32)local_array.size()) //Expand the array if needed. Try to minimize allocation calls, so don't ever shrink.
|
||||||
local_array.resize(count);
|
local_array.resize(count);
|
||||||
@@ -442,9 +468,19 @@ bool LLAudioStreamManagerFMODEX::stopStream()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FMOD_OPENSTATE LLAudioStreamManagerFMODEX::getOpenState()
|
FMOD_OPENSTATE LLAudioStreamManagerFMODEX::getOpenState(unsigned int* percentbuffered, bool* starving, bool* diskbusy)
|
||||||
{
|
{
|
||||||
FMOD_OPENSTATE state;
|
FMOD_OPENSTATE state;
|
||||||
mInternetStream->getOpenState(&state,NULL,NULL,NULL);
|
mInternetStream->getOpenState(&state,percentbuffered,starving,diskbusy);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLStreamingAudio_FMODEX::setBufferSizes(U32 streambuffertime, U32 decodebuffertime)
|
||||||
|
{
|
||||||
|
mSystem->setStreamBufferSize(streambuffertime/1000*128*128, FMOD_TIMEUNIT_RAWBYTES);
|
||||||
|
FMOD_ADVANCEDSETTINGS settings;
|
||||||
|
memset(&settings,0,sizeof(settings));
|
||||||
|
settings.cbsize=sizeof(settings);
|
||||||
|
settings.defaultDecodeBufferSize = decodebuffertime;//ms
|
||||||
|
mSystem->setAdvancedSettings(&settings);
|
||||||
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "stdtypes.h" // from llcommon
|
#include "stdtypes.h" // from llcommon
|
||||||
|
|
||||||
#include "llstreamingaudio.h"
|
#include "llstreamingaudio.h"
|
||||||
|
#include "lltimer.h"
|
||||||
|
|
||||||
//Stubs
|
//Stubs
|
||||||
class LLAudioStreamManagerFMODEX;
|
class LLAudioStreamManagerFMODEX;
|
||||||
@@ -66,6 +67,8 @@ class LLStreamingAudio_FMODEX : public LLStreamingAudioInterface
|
|||||||
/*virtual*/ const LLSD *getMetaData(){return mMetaData;} //return NULL if not playing.
|
/*virtual*/ const LLSD *getMetaData(){return mMetaData;} //return NULL if not playing.
|
||||||
/*virtual*/ bool supportsWaveData(){return true;}
|
/*virtual*/ bool supportsWaveData(){return true;}
|
||||||
/*virtual*/ bool getWaveData(float* arr, S32 count, S32 stride = 1);
|
/*virtual*/ bool getWaveData(float* arr, S32 count, S32 stride = 1);
|
||||||
|
/*virtual*/ bool supportsAdjustableBufferSizes(){return true;}
|
||||||
|
/*virtual*/ void setBufferSizes(U32 streambuffertime, U32 decodebuffertime);
|
||||||
private:
|
private:
|
||||||
FMOD::System *mSystem;
|
FMOD::System *mSystem;
|
||||||
|
|
||||||
@@ -76,6 +79,8 @@ private:
|
|||||||
std::string mURL;
|
std::string mURL;
|
||||||
F32 mGain;
|
F32 mGain;
|
||||||
|
|
||||||
|
LLTimer mLastStarved;
|
||||||
|
|
||||||
LLSD *mMetaData;
|
LLSD *mMetaData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
#include "llcharacter.h"
|
#include "llcharacter.h"
|
||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
#include "llfasttimer.h"
|
|
||||||
|
|
||||||
#define SKEL_HEADER "Linden Skeleton 1.0"
|
#define SKEL_HEADER "Linden Skeleton 1.0"
|
||||||
|
|
||||||
|
|||||||
@@ -250,9 +250,9 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask)
|
|||||||
head_rot_local = nlerp(head_slerp_amt, mLastHeadRot, head_rot_local);
|
head_rot_local = nlerp(head_slerp_amt, mLastHeadRot, head_rot_local);
|
||||||
mLastHeadRot = head_rot_local;
|
mLastHeadRot = head_rot_local;
|
||||||
|
|
||||||
if(mNeckState->getJoint() && mNeckState->getJoint()->getParent()) //Guess this has crashed? Taken from snowglobe -Shyotl
|
// Set the head rotation.
|
||||||
|
if(mNeckState->getJoint() && mNeckState->getJoint()->getParent())
|
||||||
{
|
{
|
||||||
// Set the head rotation.
|
|
||||||
LLQuaternion torsoRotLocal = mNeckState->getJoint()->getParent()->getWorldRotation() * currentInvRootRotWorld;
|
LLQuaternion torsoRotLocal = mNeckState->getJoint()->getParent()->getWorldRotation() * currentInvRootRotWorld;
|
||||||
head_rot_local = head_rot_local * ~torsoRotLocal;
|
head_rot_local = head_rot_local * ~torsoRotLocal;
|
||||||
mNeckState->setRotation( nlerp(NECK_LAG, LLQuaternion::DEFAULT, head_rot_local) );
|
mNeckState->setRotation( nlerp(NECK_LAG, LLQuaternion::DEFAULT, head_rot_local) );
|
||||||
|
|||||||
@@ -637,9 +637,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
|
|||||||
motionp->fadeIn();
|
motionp->fadeIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
// **********************
|
//**********************
|
||||||
// MOTION INACTIVE
|
// MOTION INACTIVE
|
||||||
// **********************
|
//**********************
|
||||||
if (motionp->isStopped() && mAnimTime > motionp->getStopTime() + motionp->getEaseOutDuration())
|
if (motionp->isStopped() && mAnimTime > motionp->getStopTime() + motionp->getEaseOutDuration())
|
||||||
{
|
{
|
||||||
// this motion has gone on too long, deactivate it
|
// this motion has gone on too long, deactivate it
|
||||||
@@ -659,9 +659,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// **********************
|
//**********************
|
||||||
// MOTION EASE OUT
|
// MOTION EASE OUT
|
||||||
// **********************
|
//**********************
|
||||||
else if (motionp->isStopped() && mAnimTime > motionp->getStopTime())
|
else if (motionp->isStopped() && mAnimTime > motionp->getStopTime())
|
||||||
{
|
{
|
||||||
// is this the first iteration in the ease out phase?
|
// is this the first iteration in the ease out phase?
|
||||||
@@ -684,9 +684,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
|
|||||||
update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature);
|
update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
// **********************
|
//**********************
|
||||||
// MOTION ACTIVE
|
// MOTION ACTIVE
|
||||||
// **********************
|
//**********************
|
||||||
else if (mAnimTime > motionp->mActivationTimestamp + motionp->getEaseInDuration())
|
else if (mAnimTime > motionp->mActivationTimestamp + motionp->getEaseInDuration())
|
||||||
{
|
{
|
||||||
posep->setWeight(motionp->getFadeWeight());
|
posep->setWeight(motionp->getFadeWeight());
|
||||||
@@ -707,9 +707,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
|
|||||||
update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature);
|
update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
// **********************
|
//**********************
|
||||||
// MOTION EASE IN
|
// MOTION EASE IN
|
||||||
// **********************
|
//**********************
|
||||||
else if (mAnimTime >= motionp->mActivationTimestamp)
|
else if (mAnimTime >= motionp->mActivationTimestamp)
|
||||||
{
|
{
|
||||||
if (mLastTime < motionp->mActivationTimestamp)
|
if (mLastTime < motionp->mActivationTimestamp)
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ class LLVisualParam
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef boost::function<LLVisualParam*(S32)> visual_param_mapper;
|
typedef boost::function<LLVisualParam*(S32)> visual_param_mapper;
|
||||||
|
|
||||||
LLVisualParam();
|
LLVisualParam();
|
||||||
virtual ~LLVisualParam();
|
virtual ~LLVisualParam();
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ include_directories(
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(llcommon_SOURCE_FILES
|
set(llcommon_SOURCE_FILES
|
||||||
aiframetimer.cpp
|
aiframetimer.cpp
|
||||||
imageids.cpp
|
imageids.cpp
|
||||||
indra_constants.cpp
|
indra_constants.cpp
|
||||||
llallocator.cpp
|
llallocator.cpp
|
||||||
llallocator_heap_profile.cpp
|
llallocator_heap_profile.cpp
|
||||||
@@ -24,7 +24,7 @@ set(llcommon_SOURCE_FILES
|
|||||||
llapr.cpp
|
llapr.cpp
|
||||||
llaprpool.cpp
|
llaprpool.cpp
|
||||||
llassettype.cpp
|
llassettype.cpp
|
||||||
llavatarname.cpp
|
llavatarname.cpp
|
||||||
llbase32.cpp
|
llbase32.cpp
|
||||||
llbase64.cpp
|
llbase64.cpp
|
||||||
llcommon.cpp
|
llcommon.cpp
|
||||||
@@ -53,6 +53,7 @@ set(llcommon_SOURCE_FILES
|
|||||||
llformat.cpp
|
llformat.cpp
|
||||||
llframetimer.cpp
|
llframetimer.cpp
|
||||||
llheartbeat.cpp
|
llheartbeat.cpp
|
||||||
|
llinitparam.cpp
|
||||||
llinstancetracker.cpp
|
llinstancetracker.cpp
|
||||||
llindraconfigfile.cpp
|
llindraconfigfile.cpp
|
||||||
llliveappconfig.cpp
|
llliveappconfig.cpp
|
||||||
@@ -171,6 +172,7 @@ set(llcommon_HEADER_FILES
|
|||||||
llheartbeat.h
|
llheartbeat.h
|
||||||
llhttpstatuscodes.h
|
llhttpstatuscodes.h
|
||||||
llindexedqueue.h
|
llindexedqueue.h
|
||||||
|
llinitparam.h
|
||||||
llinstancetracker.h
|
llinstancetracker.h
|
||||||
llindraconfigfile.h
|
llindraconfigfile.h
|
||||||
llkeythrottle.h
|
llkeythrottle.h
|
||||||
@@ -212,6 +214,7 @@ set(llcommon_HEADER_FILES
|
|||||||
llsingleton.h
|
llsingleton.h
|
||||||
llskiplist.h
|
llskiplist.h
|
||||||
llskipmap.h
|
llskipmap.h
|
||||||
|
llsortedvector.h
|
||||||
llstack.h
|
llstack.h
|
||||||
llstacktrace.h
|
llstacktrace.h
|
||||||
llstat.h
|
llstat.h
|
||||||
@@ -226,6 +229,7 @@ set(llcommon_HEADER_FILES
|
|||||||
llthreadsafequeue.h
|
llthreadsafequeue.h
|
||||||
lltimer.h
|
lltimer.h
|
||||||
lltreeiterators.h
|
lltreeiterators.h
|
||||||
|
lltypeinfolookup.h
|
||||||
lluri.h
|
lluri.h
|
||||||
lluuid.h
|
lluuid.h
|
||||||
lluuidhashmap.h
|
lluuidhashmap.h
|
||||||
|
|||||||
@@ -33,6 +33,11 @@
|
|||||||
#ifndef LL_LINDEN_COMMON_H
|
#ifndef LL_LINDEN_COMMON_H
|
||||||
#define LL_LINDEN_COMMON_H
|
#define LL_LINDEN_COMMON_H
|
||||||
|
|
||||||
|
// *NOTE: Please keep includes here to a minimum!
|
||||||
|
//
|
||||||
|
// Files included here are included in every library .cpp file and
|
||||||
|
// are not precompiled.
|
||||||
|
|
||||||
#include "cwdebug.h"
|
#include "cwdebug.h"
|
||||||
|
|
||||||
#if defined(LL_WINDOWS) && defined(_DEBUG)
|
#if defined(LL_WINDOWS) && defined(_DEBUG)
|
||||||
@@ -55,34 +60,11 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
|
||||||
// Work around Microsoft compiler warnings in STL headers
|
|
||||||
#ifdef LL_WINDOWS
|
|
||||||
#pragma warning (disable : 4702) // unreachable code
|
|
||||||
#pragma warning (disable : 4244) // conversion from time_t to S32
|
|
||||||
#endif // LL_WINDOWS
|
|
||||||
|
|
||||||
// *TODO: Eliminate these, most library .cpp files don't need them.
|
|
||||||
// Add them to llviewerprecompiledheaders.h if necessary.
|
|
||||||
#include <list>
|
|
||||||
#include <map>
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#ifdef LL_WINDOWS
|
|
||||||
// Reenable warnings we disabled above
|
|
||||||
#pragma warning (3 : 4702) // unreachable code, we like level 3, not 4
|
|
||||||
// moved msvc warnings to llpreprocessor.h *TODO - delete this comment after merge conflicts are unlikely -brad
|
|
||||||
#endif // LL_WINDOWS
|
|
||||||
|
|
||||||
// Linden only libs in alpha-order other than stdtypes.h
|
// Linden only libs in alpha-order other than stdtypes.h
|
||||||
// *NOTE: Please keep includes here to a minimum, see above.
|
// *NOTE: Please keep includes here to a minimum, see above.
|
||||||
#include "stdtypes.h"
|
#include "stdtypes.h"
|
||||||
#include "lldefs.h"
|
#include "lldefs.h"
|
||||||
#include "llerror.h"
|
#include "llerror.h"
|
||||||
#include "llextendedstatus.h"
|
|
||||||
// Don't do this, adds 15K lines of header code to every library file.
|
|
||||||
//#include "llfasttimer.h"
|
|
||||||
#include "llfile.h"
|
#include "llfile.h"
|
||||||
#include "llformat.h"
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,10 +43,14 @@ template <typename Type> class LLAtomic32;
|
|||||||
typedef LLAtomic32<U32> LLAtomicU32;
|
typedef LLAtomic32<U32> LLAtomicU32;
|
||||||
class LLErrorThread;
|
class LLErrorThread;
|
||||||
class LLLiveFile;
|
class LLLiveFile;
|
||||||
|
|
||||||
|
|
||||||
#if LL_LINUX
|
#if LL_LINUX
|
||||||
typedef struct siginfo siginfo_t;
|
#include <signal.h>
|
||||||
|
//typedef struct siginfo siginfo_t; //Removed as per changes in glibc 2.16 - Drake Arconis
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef void (*LLAppErrorHandler)();
|
typedef void (*LLAppErrorHandler)();
|
||||||
typedef void (*LLAppChildCallback)(int pid, bool exited, int status);
|
typedef void (*LLAppChildCallback)(int pid, bool exited, int status);
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include "llerror.h"
|
#include "llerror.h"
|
||||||
|
#include "lltypeinfolookup.h"
|
||||||
|
|
||||||
namespace LLInitParam
|
namespace LLInitParam
|
||||||
{
|
{
|
||||||
@@ -205,7 +206,7 @@ namespace LLInitParam
|
|||||||
mutable std::string mValueName;
|
mutable std::string mValueName;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Parser
|
class LL_COMMON_API Parser
|
||||||
{
|
{
|
||||||
LOG_CLASS(Parser);
|
LOG_CLASS(Parser);
|
||||||
|
|
||||||
@@ -227,9 +228,9 @@ namespace LLInitParam
|
|||||||
typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&);
|
typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&);
|
||||||
typedef boost::function<void (name_stack_t&, S32, S32, const possible_values_t*)> parser_inspect_func_t;
|
typedef boost::function<void (name_stack_t&, S32, S32, const possible_values_t*)> parser_inspect_func_t;
|
||||||
|
|
||||||
typedef std::map<const std::type_info*, parser_read_func_t, CompareTypeID> parser_read_func_map_t;
|
typedef LLTypeInfoLookup<parser_read_func_t> parser_read_func_map_t;
|
||||||
typedef std::map<const std::type_info*, parser_write_func_t, CompareTypeID> parser_write_func_map_t;
|
typedef LLTypeInfoLookup<parser_write_func_t> parser_write_func_map_t;
|
||||||
typedef std::map<const std::type_info*, parser_inspect_func_t, CompareTypeID> parser_inspect_func_map_t;
|
typedef LLTypeInfoLookup<parser_inspect_func_t> parser_inspect_func_map_t;
|
||||||
|
|
||||||
Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map)
|
Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map)
|
||||||
: mParseSilently(false),
|
: mParseSilently(false),
|
||||||
@@ -301,7 +302,7 @@ namespace LLInitParam
|
|||||||
class Param;
|
class Param;
|
||||||
|
|
||||||
// various callbacks and constraints associated with an individual param
|
// various callbacks and constraints associated with an individual param
|
||||||
struct ParamDescriptor
|
struct LL_COMMON_API ParamDescriptor
|
||||||
{
|
{
|
||||||
struct UserData
|
struct UserData
|
||||||
{
|
{
|
||||||
@@ -341,7 +342,7 @@ namespace LLInitParam
|
|||||||
typedef boost::shared_ptr<ParamDescriptor> ParamDescriptorPtr;
|
typedef boost::shared_ptr<ParamDescriptor> ParamDescriptorPtr;
|
||||||
|
|
||||||
// each derived Block class keeps a static data structure maintaining offsets to various params
|
// each derived Block class keeps a static data structure maintaining offsets to various params
|
||||||
class BlockDescriptor
|
class LL_COMMON_API BlockDescriptor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BlockDescriptor();
|
BlockDescriptor();
|
||||||
@@ -369,7 +370,7 @@ namespace LLInitParam
|
|||||||
class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed
|
class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed
|
||||||
};
|
};
|
||||||
|
|
||||||
class BaseBlock
|
class LL_COMMON_API BaseBlock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//TODO: implement in terms of owned_ptr
|
//TODO: implement in terms of owned_ptr
|
||||||
@@ -566,7 +567,7 @@ namespace LLInitParam
|
|||||||
static bool equals(const BaseBlock::Lazy<T>& a, const BaseBlock::Lazy<T>& b) { return !a.empty() || !b.empty(); }
|
static bool equals(const BaseBlock::Lazy<T>& a, const BaseBlock::Lazy<T>& b) { return !a.empty() || !b.empty(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Param
|
class LL_COMMON_API Param
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void setProvided(bool is_provided = true)
|
void setProvided(bool is_provided = true)
|
||||||
@@ -1253,15 +1254,16 @@ namespace LLInitParam
|
|||||||
return mValues.back();
|
return mValues.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const value_t& item)
|
self_t& add(const value_t& item)
|
||||||
{
|
{
|
||||||
param_value_t param_value;
|
param_value_t param_value;
|
||||||
param_value.setValue(item);
|
param_value.setValue(item);
|
||||||
mValues.push_back(param_value);
|
mValues.push_back(param_value);
|
||||||
setProvided();
|
setProvided();
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const typename name_value_lookup_t::name_t& name)
|
self_t& add(const typename name_value_lookup_t::name_t& name)
|
||||||
{
|
{
|
||||||
value_t value;
|
value_t value;
|
||||||
|
|
||||||
@@ -1271,6 +1273,8 @@ namespace LLInitParam
|
|||||||
add(value);
|
add(value);
|
||||||
mValues.back().setValueName(name);
|
mValues.back().setValueName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// implicit conversion
|
// implicit conversion
|
||||||
@@ -1441,13 +1445,14 @@ namespace LLInitParam
|
|||||||
return mValues.back();
|
return mValues.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const value_t& item)
|
self_t& add(const value_t& item)
|
||||||
{
|
{
|
||||||
mValues.push_back(item);
|
mValues.push_back(item);
|
||||||
setProvided();
|
setProvided();
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const typename name_value_lookup_t::name_t& name)
|
self_t& add(const typename name_value_lookup_t::name_t& name)
|
||||||
{
|
{
|
||||||
value_t value;
|
value_t value;
|
||||||
|
|
||||||
@@ -1457,6 +1462,7 @@ namespace LLInitParam
|
|||||||
add(value);
|
add(value);
|
||||||
mValues.back().setValueName(name);
|
mValues.back().setValueName(name);
|
||||||
}
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// implicit conversion
|
// implicit conversion
|
||||||
@@ -2057,8 +2063,8 @@ namespace LLInitParam
|
|||||||
|
|
||||||
|
|
||||||
// block param interface
|
// block param interface
|
||||||
bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name);
|
LL_COMMON_API bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name);
|
||||||
void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const;
|
LL_COMMON_API void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const;
|
||||||
bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const
|
bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const
|
||||||
{
|
{
|
||||||
//TODO: implement LLSD params as schema type Any
|
//TODO: implement LLSD params as schema type Any
|
||||||
152
indra/llcommon/llsortedvector.h
Normal file
152
indra/llcommon/llsortedvector.h
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
/**
|
||||||
|
* @file llsortedvector.h
|
||||||
|
* @author Nat Goodspeed
|
||||||
|
* @date 2012-04-08
|
||||||
|
* @brief LLSortedVector class wraps a vector that we maintain in sorted
|
||||||
|
* order so we can perform binary-search lookups.
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||||
|
* Copyright (c) 2012, Linden Research, Inc.
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if ! defined(LL_LLSORTEDVECTOR_H)
|
||||||
|
#define LL_LLSORTEDVECTOR_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LLSortedVector contains a std::vector<std::pair> that we keep sorted on the
|
||||||
|
* first of the pair. This makes insertion somewhat more expensive than simple
|
||||||
|
* std::vector::push_back(), but allows us to use binary search for lookups.
|
||||||
|
* It's intended for small aggregates where lookup is far more performance-
|
||||||
|
* critical than insertion; in such cases a binary search on a small, sorted
|
||||||
|
* std::vector can be more performant than a std::map lookup.
|
||||||
|
*/
|
||||||
|
template <typename KEY, typename VALUE>
|
||||||
|
class LLSortedVector
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef LLSortedVector<KEY, VALUE> self;
|
||||||
|
typedef KEY key_type;
|
||||||
|
typedef VALUE mapped_type;
|
||||||
|
typedef std::pair<key_type, mapped_type> value_type;
|
||||||
|
typedef std::vector<value_type> PairVector;
|
||||||
|
typedef typename PairVector::iterator iterator;
|
||||||
|
typedef typename PairVector::const_iterator const_iterator;
|
||||||
|
|
||||||
|
/// Empty
|
||||||
|
LLSortedVector() {}
|
||||||
|
|
||||||
|
/// Fixed initial size
|
||||||
|
LLSortedVector(std::size_t size):
|
||||||
|
mVector(size)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/// Bulk load
|
||||||
|
template <typename ITER>
|
||||||
|
LLSortedVector(ITER begin, ITER end):
|
||||||
|
mVector(begin, end)
|
||||||
|
{
|
||||||
|
// Allow caller to dump in a bunch of (pairs convertible to)
|
||||||
|
// value_type if desired, but make sure we sort afterwards.
|
||||||
|
std::sort(mVector.begin(), mVector.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// insert(key, value)
|
||||||
|
std::pair<iterator, bool> insert(const key_type& key, const mapped_type& value)
|
||||||
|
{
|
||||||
|
return insert(value_type(key, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// insert(value_type)
|
||||||
|
std::pair<iterator, bool> insert(const value_type& pair)
|
||||||
|
{
|
||||||
|
typedef std::pair<iterator, bool> iterbool;
|
||||||
|
iterator found = std::lower_bound(mVector.begin(), mVector.end(), pair,
|
||||||
|
less<value_type>());
|
||||||
|
// have to check for end() before it's even valid to dereference
|
||||||
|
if (found == mVector.end())
|
||||||
|
{
|
||||||
|
std::size_t index(mVector.size());
|
||||||
|
mVector.push_back(pair);
|
||||||
|
// don't forget that push_back() invalidates 'found'
|
||||||
|
return iterbool(mVector.begin() + index, true);
|
||||||
|
}
|
||||||
|
if (found->first == pair.first)
|
||||||
|
{
|
||||||
|
return iterbool(found, false);
|
||||||
|
}
|
||||||
|
// remember that insert() invalidates 'found' -- save index
|
||||||
|
std::size_t index(found - mVector.begin());
|
||||||
|
mVector.insert(found, pair);
|
||||||
|
// okay, convert from index back to iterator
|
||||||
|
return iterbool(mVector.begin() + index, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator begin() { return mVector.begin(); }
|
||||||
|
iterator end() { return mVector.end(); }
|
||||||
|
const_iterator begin() const { return mVector.begin(); }
|
||||||
|
const_iterator end() const { return mVector.end(); }
|
||||||
|
|
||||||
|
bool empty() const { return mVector.empty(); }
|
||||||
|
std::size_t size() const { return mVector.size(); }
|
||||||
|
|
||||||
|
/// find
|
||||||
|
iterator find(const key_type& key)
|
||||||
|
{
|
||||||
|
iterator found = std::lower_bound(mVector.begin(), mVector.end(),
|
||||||
|
value_type(key, mapped_type()),
|
||||||
|
less<value_type>());
|
||||||
|
if (found == mVector.end() || found->first != key)
|
||||||
|
return mVector.end();
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
const_iterator find(const key_type& key) const
|
||||||
|
{
|
||||||
|
return const_cast<self*>(this)->find(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Define our own 'less' comparator so we can specialize without messing
|
||||||
|
// with std::less.
|
||||||
|
template <typename T>
|
||||||
|
struct less: public std::less<T> {};
|
||||||
|
|
||||||
|
// Specialize 'less' for an LLSortedVector::value_type involving
|
||||||
|
// std::type_info*. This is one of LLSortedVector's foremost use cases. We
|
||||||
|
// specialize 'less' rather than just defining a specific comparator
|
||||||
|
// because LLSortedVector should be usable for other key_types as well.
|
||||||
|
template <typename T>
|
||||||
|
struct less< std::pair<std::type_info*, T> >:
|
||||||
|
public std::binary_function<std::pair<std::type_info*, T>,
|
||||||
|
std::pair<std::type_info*, T>,
|
||||||
|
bool>
|
||||||
|
{
|
||||||
|
bool operator()(const std::pair<std::type_info*, T>& lhs,
|
||||||
|
const std::pair<std::type_info*, T>& rhs) const
|
||||||
|
{
|
||||||
|
return lhs.first->before(*rhs.first);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Same as above, but with const std::type_info*.
|
||||||
|
template <typename T>
|
||||||
|
struct less< std::pair<const std::type_info*, T> >:
|
||||||
|
public std::binary_function<std::pair<const std::type_info*, T>,
|
||||||
|
std::pair<const std::type_info*, T>,
|
||||||
|
bool>
|
||||||
|
{
|
||||||
|
bool operator()(const std::pair<const std::type_info*, T>& lhs,
|
||||||
|
const std::pair<const std::type_info*, T>& rhs) const
|
||||||
|
{
|
||||||
|
return lhs.first->before(*rhs.first);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
PairVector mVector;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* ! defined(LL_LLSORTEDVECTOR_H) */
|
||||||
@@ -42,10 +42,10 @@ template <class Object> class LLStrider
|
|||||||
U8* mBytep;
|
U8* mBytep;
|
||||||
};
|
};
|
||||||
U32 mSkip;
|
U32 mSkip;
|
||||||
//U32 mTypeSize;
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LLStrider() { mObjectp = NULL; /*mTypeSize = */mSkip = sizeof(Object); }
|
LLStrider() { mObjectp = NULL; mSkip = sizeof(Object); }
|
||||||
~LLStrider() { }
|
~LLStrider() { }
|
||||||
|
|
||||||
const LLStrider<Object>& operator = (Object *first) { mObjectp = first; return *this;}
|
const LLStrider<Object>& operator = (Object *first) { mObjectp = first; return *this;}
|
||||||
@@ -60,9 +60,6 @@ public:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//void setTypeSize (S32 typeBytes){ mTypeSize = (typeBytes ? typeBytes : sizeof(Object)); }
|
|
||||||
|
|
||||||
//bool isStrided() const { return mTypeSize != mSkip; }
|
|
||||||
void skip(const U32 index) { mBytep += mSkip*index;}
|
void skip(const U32 index) { mBytep += mSkip*index;}
|
||||||
U32 getSkip() const { return mSkip; }
|
U32 getSkip() const { return mSkip; }
|
||||||
Object* get() { return mObjectp; }
|
Object* get() { return mObjectp; }
|
||||||
@@ -70,72 +67,9 @@ public:
|
|||||||
Object& operator *() { return *mObjectp; }
|
Object& operator *() { return *mObjectp; }
|
||||||
Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; }
|
Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; }
|
||||||
Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; }
|
Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; }
|
||||||
|
|
||||||
Object& operator[](U32 index) { return *(Object*)(mBytep + (mSkip * index)); }
|
Object& operator[](U32 index) { return *(Object*)(mBytep + (mSkip * index)); }
|
||||||
/*void assignArray(U8* __restrict source, const size_t elem_size, const size_t elem_count)
|
|
||||||
{
|
|
||||||
llassert_always(sizeof(Object) <= elem_size);
|
|
||||||
|
|
||||||
U8* __restrict dest = mBytep; //refer to dest instead of mBytep to benefit from __restrict hint
|
|
||||||
const U32 bytes = elem_size * elem_count; //total bytes to copy from source to dest
|
|
||||||
|
|
||||||
//stride == sizeof(element) implies entire buffer is unstrided and thus memcpy-able, provided source buffer elements match in size.
|
|
||||||
//Because LLStrider is often passed an LLVector3 even if the reprensentation is LLVector4 in the vertex buffer, mTypeSize is set to
|
|
||||||
//the TRUE vbo datatype size via VertexBufferStrider::get
|
|
||||||
if(!isStrided() && mTypeSize == elem_size)
|
|
||||||
{
|
|
||||||
if(bytes >= sizeof(LLVector4) * 4) //Should be able to pull at least 3 16byte blocks from this. Smaller isn't really beneficial.
|
|
||||||
{
|
|
||||||
U8* __restrict aligned_source = LL_NEXT_ALIGNED_ADDRESS(source);
|
|
||||||
U8* __restrict aligned_dest = LL_NEXT_ALIGNED_ADDRESS(dest);
|
|
||||||
const U32 source_offset = aligned_source - source; //Offset to first aligned location in source buffer.
|
|
||||||
const U32 dest_offset = aligned_dest - dest; //Offset to first aligned location in dest buffer.
|
|
||||||
llassert_always(source_offset < 16);
|
|
||||||
llassert_always(dest_offset < 16);
|
|
||||||
if(source_offset == dest_offset) //delta to aligned location matches between source and destination! _mm_*_ps should be viable.
|
|
||||||
{
|
|
||||||
const U32 end_offset = (bytes - source_offset) % sizeof(LLVector4); //buffers may not neatly end on a 16byte alignment boundary.
|
|
||||||
const U32 aligned_bytes = bytes - source_offset - end_offset; //how many bytes to copy from aligned start to aligned end.
|
|
||||||
|
|
||||||
llassert_always(aligned_bytes > 0);
|
|
||||||
|
|
||||||
if(source_offset) //memcpy up to the aligned location if needed
|
|
||||||
memcpy(dest,source,source_offset);
|
|
||||||
LLVector4a::memcpyNonAliased16((F32*) aligned_dest, (F32*) aligned_source, aligned_bytes);
|
|
||||||
if(end_offset) //memcpy to the very end if needed.
|
|
||||||
memcpy(aligned_dest+aligned_bytes,aligned_source+aligned_bytes,end_offset);
|
|
||||||
}
|
|
||||||
else //buffers non-uniformly offset from aligned location. Using _mm_*u_ps.
|
|
||||||
{
|
|
||||||
U32 end = bytes/sizeof(LLVector4); //sizeof(LLVector4) = 16 bytes = 128 bits
|
|
||||||
|
|
||||||
llassert_always(end > 0);
|
|
||||||
|
|
||||||
__m128* dst = (__m128*) dest;
|
|
||||||
__m128* src = (__m128*) source;
|
|
||||||
|
|
||||||
for (U32 i = 0; i < end; i++) //copy 128bit chunks
|
|
||||||
{
|
|
||||||
__m128 res = _mm_loadu_ps((F32*)&src[i]);
|
|
||||||
_mm_storeu_ps((F32*)&dst[i], res);
|
|
||||||
}
|
|
||||||
end*=16;//Convert to real byte offset
|
|
||||||
if(end < bytes) //just memcopy the rest
|
|
||||||
memcpy(dest+end,source+end,bytes-end);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else //Too small. just do a simple memcpy.
|
|
||||||
memcpy(dest,source,bytes);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(U32 i=0;i<elem_count;i++)
|
|
||||||
{
|
|
||||||
memcpy(dest,source,sizeof(Object));
|
|
||||||
dest+=mSkip;
|
|
||||||
source+=elem_size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLSTRIDER_H
|
#endif // LL_LLSTRIDER_H
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
#include "llerror.h"
|
#include "llerror.h"
|
||||||
#include "llfasttimer.h"
|
|
||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
@@ -604,16 +603,10 @@ std::string utf8str_removeCRLF(const std::string& utf8str)
|
|||||||
}
|
}
|
||||||
const char CR = 13;
|
const char CR = 13;
|
||||||
|
|
||||||
S32 i = utf8str.find(CR);
|
|
||||||
if(i == std::string::npos)
|
|
||||||
return utf8str; //Save us from a reserve call.
|
|
||||||
|
|
||||||
std::string out;
|
std::string out;
|
||||||
out.reserve(utf8str.length());
|
out.reserve(utf8str.length());
|
||||||
const S32 len = (S32)utf8str.length();
|
const S32 len = (S32)utf8str.length();
|
||||||
if(i)
|
for( S32 i = 0; i < len; i++ )
|
||||||
out.assign(utf8str,0,i); //Copy previous text to buffer
|
|
||||||
for( ++i; i < len; i++ )
|
|
||||||
{
|
{
|
||||||
if( utf8str[i] != CR )
|
if( utf8str[i] != CR )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,11 +35,10 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <algorithm>
|
|
||||||
#include <map>
|
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include "llsd.h"
|
#include "llsd.h"
|
||||||
|
#include "llfasttimer.h"
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX || LL_SOLARIS
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
@@ -47,6 +46,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
#if LL_SOLARIS
|
#if LL_SOLARIS
|
||||||
// stricmp and strnicmp do not exist on Solaris:
|
// stricmp and strnicmp do not exist on Solaris:
|
||||||
@@ -246,40 +246,77 @@ private:
|
|||||||
static std::string sLocale;
|
static std::string sLocale;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename std::basic_string<T>::size_type size_type;
|
typedef std::basic_string<T> string_type;
|
||||||
|
typedef typename string_type::size_type size_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Static Utility functions that operate on std::strings
|
// Static Utility functions that operate on std::strings
|
||||||
|
|
||||||
static const std::basic_string<T> null;
|
static const string_type null;
|
||||||
|
|
||||||
typedef std::map<LLFormatMapString, LLFormatMapString> format_map_t;
|
typedef std::map<LLFormatMapString, LLFormatMapString> format_map_t;
|
||||||
LL_COMMON_API static void getTokens(const std::basic_string<T>& instr, std::vector<std::basic_string<T> >& tokens, const std::basic_string<T>& delims);
|
/// considers any sequence of delims as a single field separator
|
||||||
LL_COMMON_API static void formatNumber(std::basic_string<T>& numStr, std::basic_string<T> decimals);
|
LL_COMMON_API static void getTokens(const string_type& instr,
|
||||||
LL_COMMON_API static bool formatDatetime(std::basic_string<T>& replacement, std::basic_string<T> token, std::basic_string<T> param, S32 secFromEpoch);
|
std::vector<string_type >& tokens,
|
||||||
LL_COMMON_API static S32 format(std::basic_string<T>& s, const format_map_t& substitutions);
|
const string_type& delims);
|
||||||
LL_COMMON_API static S32 format(std::basic_string<T>& s, const LLSD& substitutions);
|
/// like simple scan overload, but returns scanned vector
|
||||||
LL_COMMON_API static bool simpleReplacement(std::basic_string<T>& replacement, std::basic_string<T> token, const format_map_t& substitutions);
|
static std::vector<string_type> getTokens(const string_type& instr,
|
||||||
LL_COMMON_API static bool simpleReplacement(std::basic_string<T>& replacement, std::basic_string<T> token, const LLSD& substitutions);
|
const string_type& delims);
|
||||||
|
/// add support for keep_delims and quotes (either could be empty string)
|
||||||
|
static void getTokens(const string_type& instr,
|
||||||
|
std::vector<string_type>& tokens,
|
||||||
|
const string_type& drop_delims,
|
||||||
|
const string_type& keep_delims,
|
||||||
|
const string_type& quotes=string_type());
|
||||||
|
/// like keep_delims-and-quotes overload, but returns scanned vector
|
||||||
|
static std::vector<string_type> getTokens(const string_type& instr,
|
||||||
|
const string_type& drop_delims,
|
||||||
|
const string_type& keep_delims,
|
||||||
|
const string_type& quotes=string_type());
|
||||||
|
/// add support for escapes (could be empty string)
|
||||||
|
static void getTokens(const string_type& instr,
|
||||||
|
std::vector<string_type>& tokens,
|
||||||
|
const string_type& drop_delims,
|
||||||
|
const string_type& keep_delims,
|
||||||
|
const string_type& quotes,
|
||||||
|
const string_type& escapes);
|
||||||
|
/// like escapes overload, but returns scanned vector
|
||||||
|
static std::vector<string_type> getTokens(const string_type& instr,
|
||||||
|
const string_type& drop_delims,
|
||||||
|
const string_type& keep_delims,
|
||||||
|
const string_type& quotes,
|
||||||
|
const string_type& escapes);
|
||||||
|
|
||||||
|
LL_COMMON_API static void formatNumber(string_type& numStr, string_type decimals);
|
||||||
|
LL_COMMON_API static bool formatDatetime(string_type& replacement, string_type token, string_type param, S32 secFromEpoch);
|
||||||
|
LL_COMMON_API static S32 format(string_type& s, const format_map_t& substitutions);
|
||||||
|
LL_COMMON_API static S32 format(string_type& s, const LLSD& substitutions);
|
||||||
|
LL_COMMON_API static bool simpleReplacement(string_type& replacement, string_type token, const format_map_t& substitutions);
|
||||||
|
LL_COMMON_API static bool simpleReplacement(string_type& replacement, string_type token, const LLSD& substitutions);
|
||||||
LL_COMMON_API static void setLocale (std::string inLocale);
|
LL_COMMON_API static void setLocale (std::string inLocale);
|
||||||
LL_COMMON_API static std::string getLocale (void);
|
LL_COMMON_API static std::string getLocale (void);
|
||||||
|
|
||||||
static bool isValidIndex(const std::basic_string<T>& string, size_type i)
|
static bool isValidIndex(const string_type& string, size_type i)
|
||||||
{
|
{
|
||||||
return !string.empty() && (0 <= i) && (i <= string.size());
|
return !string.empty() && (0 <= i) && (i <= string.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void trimHead(std::basic_string<T>& string);
|
static bool contains(const string_type& string, T c, size_type i=0)
|
||||||
static void trimTail(std::basic_string<T>& string);
|
{
|
||||||
static void trim(std::basic_string<T>& string) { trimHead(string); trimTail(string); }
|
return string.find(c, i) != string_type::npos;
|
||||||
static void truncate(std::basic_string<T>& string, size_type count);
|
}
|
||||||
|
|
||||||
static void toUpper(std::basic_string<T>& string);
|
static void trimHead(string_type& string);
|
||||||
static void toLower(std::basic_string<T>& string);
|
static void trimTail(string_type& string);
|
||||||
|
static void trim(string_type& string) { trimHead(string); trimTail(string); }
|
||||||
|
static void truncate(string_type& string, size_type count);
|
||||||
|
|
||||||
|
static void toUpper(string_type& string);
|
||||||
|
static void toLower(string_type& string);
|
||||||
|
|
||||||
// True if this is the head of s.
|
// True if this is the head of s.
|
||||||
static BOOL isHead( const std::basic_string<T>& string, const T* s );
|
static BOOL isHead( const string_type& string, const T* s );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns true if string starts with substr
|
* @brief Returns true if string starts with substr
|
||||||
@@ -287,8 +324,8 @@ public:
|
|||||||
* If etither string or substr are empty, this method returns false.
|
* If etither string or substr are empty, this method returns false.
|
||||||
*/
|
*/
|
||||||
static bool startsWith(
|
static bool startsWith(
|
||||||
const std::basic_string<T>& string,
|
const string_type& string,
|
||||||
const std::basic_string<T>& substr);
|
const string_type& substr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns true if string ends in substr
|
* @brief Returns true if string ends in substr
|
||||||
@@ -296,19 +333,32 @@ public:
|
|||||||
* If etither string or substr are empty, this method returns false.
|
* If etither string or substr are empty, this method returns false.
|
||||||
*/
|
*/
|
||||||
static bool endsWith(
|
static bool endsWith(
|
||||||
const std::basic_string<T>& string,
|
const string_type& string,
|
||||||
const std::basic_string<T>& substr);
|
const string_type& substr);
|
||||||
|
|
||||||
static void addCRLF(std::basic_string<T>& string);
|
static void addCRLF(string_type& string);
|
||||||
static void removeCRLF(std::basic_string<T>& string);
|
static void removeCRLF(string_type& string);
|
||||||
|
|
||||||
static void replaceTabsWithSpaces( std::basic_string<T>& string, size_type spaces_per_tab );
|
static void replaceTabsWithSpaces( string_type& string, size_type spaces_per_tab );
|
||||||
static void replaceNonstandardASCII( std::basic_string<T>& string, T replacement );
|
static void replaceNonstandardASCII( string_type& string, T replacement );
|
||||||
static void replaceChar( std::basic_string<T>& string, T target, T replacement );
|
static void replaceChar( string_type& string, T target, T replacement );
|
||||||
static void replaceString( std::basic_string<T>& string, std::basic_string<T> target, std::basic_string<T> replacement );
|
static void replaceString( string_type& string, string_type target, string_type replacement );
|
||||||
|
|
||||||
static BOOL containsNonprintable(const std::basic_string<T>& string);
|
static BOOL containsNonprintable(const string_type& string);
|
||||||
static void stripNonprintable(std::basic_string<T>& string);
|
static void stripNonprintable(string_type& string);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Double-quote an argument string if needed, unless it's already
|
||||||
|
* double-quoted. Decide whether it's needed based on the presence of any
|
||||||
|
* character in @a triggers (default space or double-quote). If we quote
|
||||||
|
* it, escape any embedded double-quote with the @a escape string (default
|
||||||
|
* backslash).
|
||||||
|
*
|
||||||
|
* Passing triggers="" means always quote, unless it's already double-quoted.
|
||||||
|
*/
|
||||||
|
static string_type quote(const string_type& str,
|
||||||
|
const string_type& triggers=" \"",
|
||||||
|
const string_type& escape="\\");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Unsafe way to make ascii characters. You should probably
|
* @brief Unsafe way to make ascii characters. You should probably
|
||||||
@@ -317,18 +367,18 @@ public:
|
|||||||
* The 2 and 4 byte std::string probably work, so LLWStringUtil::_makeASCII
|
* The 2 and 4 byte std::string probably work, so LLWStringUtil::_makeASCII
|
||||||
* should work.
|
* should work.
|
||||||
*/
|
*/
|
||||||
static void _makeASCII(std::basic_string<T>& string);
|
static void _makeASCII(string_type& string);
|
||||||
|
|
||||||
// Conversion to other data types
|
// Conversion to other data types
|
||||||
static BOOL convertToBOOL(const std::basic_string<T>& string, BOOL& value);
|
static BOOL convertToBOOL(const string_type& string, BOOL& value);
|
||||||
static BOOL convertToU8(const std::basic_string<T>& string, U8& value);
|
static BOOL convertToU8(const string_type& string, U8& value);
|
||||||
static BOOL convertToS8(const std::basic_string<T>& string, S8& value);
|
static BOOL convertToS8(const string_type& string, S8& value);
|
||||||
static BOOL convertToS16(const std::basic_string<T>& string, S16& value);
|
static BOOL convertToS16(const string_type& string, S16& value);
|
||||||
static BOOL convertToU16(const std::basic_string<T>& string, U16& value);
|
static BOOL convertToU16(const string_type& string, U16& value);
|
||||||
static BOOL convertToU32(const std::basic_string<T>& string, U32& value);
|
static BOOL convertToU32(const string_type& string, U32& value);
|
||||||
static BOOL convertToS32(const std::basic_string<T>& string, S32& value);
|
static BOOL convertToS32(const string_type& string, S32& value);
|
||||||
static BOOL convertToF32(const std::basic_string<T>& string, F32& value);
|
static BOOL convertToF32(const string_type& string, F32& value);
|
||||||
static BOOL convertToF64(const std::basic_string<T>& string, F64& value);
|
static BOOL convertToF64(const string_type& string, F64& value);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Utility functions for working with char*'s and strings
|
// Utility functions for working with char*'s and strings
|
||||||
@@ -336,24 +386,24 @@ public:
|
|||||||
// Like strcmp but also handles empty strings. Uses
|
// Like strcmp but also handles empty strings. Uses
|
||||||
// current locale.
|
// current locale.
|
||||||
static S32 compareStrings(const T* lhs, const T* rhs);
|
static S32 compareStrings(const T* lhs, const T* rhs);
|
||||||
static S32 compareStrings(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs);
|
static S32 compareStrings(const string_type& lhs, const string_type& rhs);
|
||||||
|
|
||||||
// case insensitive version of above. Uses current locale on
|
// case insensitive version of above. Uses current locale on
|
||||||
// Win32, and falls back to a non-locale aware comparison on
|
// Win32, and falls back to a non-locale aware comparison on
|
||||||
// Linux.
|
// Linux.
|
||||||
static S32 compareInsensitive(const T* lhs, const T* rhs);
|
static S32 compareInsensitive(const T* lhs, const T* rhs);
|
||||||
static S32 compareInsensitive(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs);
|
static S32 compareInsensitive(const string_type& lhs, const string_type& rhs);
|
||||||
|
|
||||||
// Case sensitive comparison with good handling of numbers. Does not use current locale.
|
// Case sensitive comparison with good handling of numbers. Does not use current locale.
|
||||||
// a.k.a. strdictcmp()
|
// a.k.a. strdictcmp()
|
||||||
static S32 compareDict(const std::basic_string<T>& a, const std::basic_string<T>& b);
|
static S32 compareDict(const string_type& a, const string_type& b);
|
||||||
|
|
||||||
// Case *in*sensitive comparison with good handling of numbers. Does not use current locale.
|
// Case *in*sensitive comparison with good handling of numbers. Does not use current locale.
|
||||||
// a.k.a. strdictcmp()
|
// a.k.a. strdictcmp()
|
||||||
static S32 compareDictInsensitive(const std::basic_string<T>& a, const std::basic_string<T>& b);
|
static S32 compareDictInsensitive(const string_type& a, const string_type& b);
|
||||||
|
|
||||||
// Puts compareDict() in a form appropriate for LL container classes to use for sorting.
|
// Puts compareDict() in a form appropriate for LL container classes to use for sorting.
|
||||||
static BOOL precedesDict( const std::basic_string<T>& a, const std::basic_string<T>& b );
|
static BOOL precedesDict( const string_type& a, const string_type& b );
|
||||||
|
|
||||||
// A replacement for strncpy.
|
// A replacement for strncpy.
|
||||||
// If the dst buffer is dst_size bytes long or more, ensures that dst is null terminated and holds
|
// If the dst buffer is dst_size bytes long or more, ensures that dst is null terminated and holds
|
||||||
@@ -361,7 +411,7 @@ public:
|
|||||||
static void copy(T* dst, const T* src, size_type dst_size);
|
static void copy(T* dst, const T* src, size_type dst_size);
|
||||||
|
|
||||||
// Copies src into dst at a given offset.
|
// Copies src into dst at a given offset.
|
||||||
static void copyInto(std::basic_string<T>& dst, const std::basic_string<T>& src, size_type offset);
|
static void copyInto(string_type& dst, const string_type& src, size_type offset);
|
||||||
|
|
||||||
static bool isPartOfWord(T c) { return (c == (T)'_') || LLStringOps::isAlnum(c); }
|
static bool isPartOfWord(T c) { return (c == (T)'_') || LLStringOps::isAlnum(c); }
|
||||||
|
|
||||||
@@ -371,7 +421,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LL_COMMON_API static size_type getSubstitution(const std::basic_string<T>& instr, size_type& start, std::vector<std::basic_string<T> >& tokens);
|
LL_COMMON_API static size_type getSubstitution(const string_type& instr, size_type& start, std::vector<string_type >& tokens);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T> const std::basic_string<T> LLStringUtilBase<T>::null;
|
template<class T> const std::basic_string<T> LLStringUtilBase<T>::null;
|
||||||
@@ -649,6 +699,321 @@ namespace LLStringFn
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// static
|
||||||
|
template <class T>
|
||||||
|
std::vector<typename LLStringUtilBase<T>::string_type>
|
||||||
|
LLStringUtilBase<T>::getTokens(const string_type& instr, const string_type& delims)
|
||||||
|
{
|
||||||
|
std::vector<string_type> tokens;
|
||||||
|
getTokens(instr, tokens, delims);
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
template <class T>
|
||||||
|
std::vector<typename LLStringUtilBase<T>::string_type>
|
||||||
|
LLStringUtilBase<T>::getTokens(const string_type& instr,
|
||||||
|
const string_type& drop_delims,
|
||||||
|
const string_type& keep_delims,
|
||||||
|
const string_type& quotes)
|
||||||
|
{
|
||||||
|
std::vector<string_type> tokens;
|
||||||
|
getTokens(instr, tokens, drop_delims, keep_delims, quotes);
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
template <class T>
|
||||||
|
std::vector<typename LLStringUtilBase<T>::string_type>
|
||||||
|
LLStringUtilBase<T>::getTokens(const string_type& instr,
|
||||||
|
const string_type& drop_delims,
|
||||||
|
const string_type& keep_delims,
|
||||||
|
const string_type& quotes,
|
||||||
|
const string_type& escapes)
|
||||||
|
{
|
||||||
|
std::vector<string_type> tokens;
|
||||||
|
getTokens(instr, tokens, drop_delims, keep_delims, quotes, escapes);
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace LLStringUtilBaseImpl
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Input string scanner helper for getTokens(), or really any other
|
||||||
|
* character-parsing routine that may have to deal with escape characters.
|
||||||
|
* This implementation defines the concept (also an interface, should you
|
||||||
|
* choose to implement the concept by subclassing) and provides trivial
|
||||||
|
* implementations for a string @em without escape processing.
|
||||||
|
*/
|
||||||
|
template <class T>
|
||||||
|
struct InString
|
||||||
|
{
|
||||||
|
typedef std::basic_string<T> string_type;
|
||||||
|
typedef typename string_type::const_iterator const_iterator;
|
||||||
|
|
||||||
|
InString(const_iterator b, const_iterator e):
|
||||||
|
mIter(b),
|
||||||
|
mEnd(e)
|
||||||
|
{}
|
||||||
|
virtual ~InString() {}
|
||||||
|
|
||||||
|
bool done() const { return mIter == mEnd; }
|
||||||
|
/// Is the current character (*mIter) escaped? This implementation can
|
||||||
|
/// answer trivially because it doesn't support escapes.
|
||||||
|
virtual bool escaped() const { return false; }
|
||||||
|
/// Obtain the current character and advance @c mIter.
|
||||||
|
virtual T next() { return *mIter++; }
|
||||||
|
/// Does the current character match specified character?
|
||||||
|
virtual bool is(T ch) const { return (! done()) && *mIter == ch; }
|
||||||
|
/// Is the current character any one of the specified characters?
|
||||||
|
virtual bool oneof(const string_type& delims) const
|
||||||
|
{
|
||||||
|
return (! done()) && LLStringUtilBase<T>::contains(delims, *mIter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scan forward from @from until either @a delim or end. This is primarily
|
||||||
|
* useful for processing quoted substrings.
|
||||||
|
*
|
||||||
|
* If we do see @a delim, append everything from @from until (excluding)
|
||||||
|
* @a delim to @a into, advance @c mIter to skip @a delim, and return @c
|
||||||
|
* true.
|
||||||
|
*
|
||||||
|
* If we do not see @a delim, do not alter @a into or @c mIter and return
|
||||||
|
* @c false. Do not pass GO, do not collect $200.
|
||||||
|
*
|
||||||
|
* @note The @c false case described above implements normal getTokens()
|
||||||
|
* treatment of an unmatched open quote: treat the quote character as if
|
||||||
|
* escaped, that is, simply collect it as part of the current token. Other
|
||||||
|
* plausible behaviors directly affect the way getTokens() deals with an
|
||||||
|
* unmatched quote: e.g. throwing an exception to treat it as an error, or
|
||||||
|
* assuming a close quote beyond end of string (in which case return @c
|
||||||
|
* true).
|
||||||
|
*/
|
||||||
|
virtual bool collect_until(string_type& into, const_iterator from, T delim)
|
||||||
|
{
|
||||||
|
const_iterator found = std::find(from, mEnd, delim);
|
||||||
|
// If we didn't find delim, change nothing, just tell caller.
|
||||||
|
if (found == mEnd)
|
||||||
|
return false;
|
||||||
|
// Found delim! Append everything between from and found.
|
||||||
|
into.append(from, found);
|
||||||
|
// advance past delim in input
|
||||||
|
mIter = found + 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const_iterator mIter, mEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// InString subclass that handles escape characters
|
||||||
|
template <class T>
|
||||||
|
class InEscString: public InString<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef InString<T> super;
|
||||||
|
typedef typename super::string_type string_type;
|
||||||
|
typedef typename super::const_iterator const_iterator;
|
||||||
|
using super::done;
|
||||||
|
using super::mIter;
|
||||||
|
using super::mEnd;
|
||||||
|
|
||||||
|
InEscString(const_iterator b, const_iterator e, const string_type& escapes):
|
||||||
|
super(b, e),
|
||||||
|
mEscapes(escapes)
|
||||||
|
{
|
||||||
|
// Even though we've already initialized 'mIter' via our base-class
|
||||||
|
// constructor, set it again to check for initial escape char.
|
||||||
|
setiter(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This implementation uses the answer cached by setiter().
|
||||||
|
virtual bool escaped() const { return mIsEsc; }
|
||||||
|
virtual T next()
|
||||||
|
{
|
||||||
|
// If we're looking at the escape character of an escape sequence,
|
||||||
|
// skip that character. This is the one time we can modify 'mIter'
|
||||||
|
// without using setiter: for this one case we DO NOT CARE if the
|
||||||
|
// escaped character is itself an escape.
|
||||||
|
if (mIsEsc)
|
||||||
|
++mIter;
|
||||||
|
// If we were looking at an escape character, this is the escaped
|
||||||
|
// character; otherwise it's just the next character.
|
||||||
|
T result(*mIter);
|
||||||
|
// Advance mIter, checking for escape sequence.
|
||||||
|
setiter(mIter + 1);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool is(T ch) const
|
||||||
|
{
|
||||||
|
// Like base-class is(), except that an escaped character matches
|
||||||
|
// nothing.
|
||||||
|
return (! done()) && (! mIsEsc) && *mIter == ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool oneof(const string_type& delims) const
|
||||||
|
{
|
||||||
|
// Like base-class oneof(), except that an escaped character matches
|
||||||
|
// nothing.
|
||||||
|
return (! done()) && (! mIsEsc) && LLStringUtilBase<T>::contains(delims, *mIter);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool collect_until(string_type& into, const_iterator from, T delim)
|
||||||
|
{
|
||||||
|
// Deal with escapes in the characters we collect; that is, an escaped
|
||||||
|
// character must become just that character without the preceding
|
||||||
|
// escape. Collect characters in a separate string rather than
|
||||||
|
// directly appending to 'into' in case we do not find delim, in which
|
||||||
|
// case we're supposed to leave 'into' unmodified.
|
||||||
|
string_type collected;
|
||||||
|
// For scanning purposes, we're going to work directly with 'mIter'.
|
||||||
|
// Save its current value in case we fail to see delim.
|
||||||
|
const_iterator save_iter(mIter);
|
||||||
|
// Okay, set 'mIter', checking for escape.
|
||||||
|
setiter(from);
|
||||||
|
while (! done())
|
||||||
|
{
|
||||||
|
// If we see an unescaped delim, stop and report success.
|
||||||
|
if ((! mIsEsc) && *mIter == delim)
|
||||||
|
{
|
||||||
|
// Append collected chars to 'into'.
|
||||||
|
into.append(collected);
|
||||||
|
// Don't forget to advance 'mIter' past delim.
|
||||||
|
setiter(mIter + 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// We're not at end, and either we're not looking at delim or it's
|
||||||
|
// escaped. Collect this character and keep going.
|
||||||
|
collected.push_back(next());
|
||||||
|
}
|
||||||
|
// Here we hit 'mEnd' without ever seeing delim. Restore mIter and tell
|
||||||
|
// caller.
|
||||||
|
setiter(save_iter);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setiter(const_iterator i)
|
||||||
|
{
|
||||||
|
mIter = i;
|
||||||
|
|
||||||
|
// Every time we change 'mIter', set 'mIsEsc' to be able to repetitively
|
||||||
|
// answer escaped() without having to rescan 'mEscapes'. mIsEsc caches
|
||||||
|
// contains(mEscapes, *mIter).
|
||||||
|
|
||||||
|
// We're looking at an escaped char if we're not already at end (that
|
||||||
|
// is, *mIter is even meaningful); if *mIter is in fact one of the
|
||||||
|
// specified escape characters; and if there's one more character
|
||||||
|
// following it. That is, if an escape character is the very last
|
||||||
|
// character of the input string, it loses its special meaning.
|
||||||
|
mIsEsc = (! done()) &&
|
||||||
|
LLStringUtilBase<T>::contains(mEscapes, *mIter) &&
|
||||||
|
(mIter+1) != mEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
const string_type mEscapes;
|
||||||
|
bool mIsEsc;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// getTokens() implementation based on InString concept
|
||||||
|
template <typename INSTRING, typename string_type>
|
||||||
|
void getTokens(INSTRING& instr, std::vector<string_type>& tokens,
|
||||||
|
const string_type& drop_delims, const string_type& keep_delims,
|
||||||
|
const string_type& quotes)
|
||||||
|
{
|
||||||
|
// There are times when we want to match either drop_delims or
|
||||||
|
// keep_delims. Concatenate them up front to speed things up.
|
||||||
|
string_type all_delims(drop_delims + keep_delims);
|
||||||
|
// no tokens yet
|
||||||
|
tokens.clear();
|
||||||
|
|
||||||
|
// try for another token
|
||||||
|
while (! instr.done())
|
||||||
|
{
|
||||||
|
// scan past any drop_delims
|
||||||
|
while (instr.oneof(drop_delims))
|
||||||
|
{
|
||||||
|
// skip this drop_delim
|
||||||
|
instr.next();
|
||||||
|
// but if that was the end of the string, done
|
||||||
|
if (instr.done())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// found the start of another token: make a slot for it
|
||||||
|
tokens.push_back(string_type());
|
||||||
|
if (instr.oneof(keep_delims))
|
||||||
|
{
|
||||||
|
// *iter is a keep_delim, a token of exactly 1 character. Append
|
||||||
|
// that character to the new token and proceed.
|
||||||
|
tokens.back().push_back(instr.next());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Here we have a non-delimiter token, which might consist of a mix of
|
||||||
|
// quoted and unquoted parts. Use bash rules for quoting: you can
|
||||||
|
// embed a quoted substring in the midst of an unquoted token (e.g.
|
||||||
|
// ~/"sub dir"/myfile.txt); you can ram two quoted substrings together
|
||||||
|
// to make a single token (e.g. 'He said, "'"Don't."'"'). We diverge
|
||||||
|
// from bash in that bash considers an unmatched quote an error. Our
|
||||||
|
// param signature doesn't allow for errors, so just pretend it's not
|
||||||
|
// a quote and embed it.
|
||||||
|
// At this level, keep scanning until we hit the next delimiter of
|
||||||
|
// either type (drop_delims or keep_delims).
|
||||||
|
while (! instr.oneof(all_delims))
|
||||||
|
{
|
||||||
|
// If we're looking at an open quote, search forward for
|
||||||
|
// a close quote, collecting characters along the way.
|
||||||
|
if (instr.oneof(quotes) &&
|
||||||
|
instr.collect_until(tokens.back(), instr.mIter+1, *instr.mIter))
|
||||||
|
{
|
||||||
|
// collect_until is cleverly designed to do exactly what we
|
||||||
|
// need here. No further action needed if it returns true.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Either *iter isn't a quote, or there's no matching close
|
||||||
|
// quote: in other words, just an ordinary char. Append it to
|
||||||
|
// current token.
|
||||||
|
tokens.back().push_back(instr.next());
|
||||||
|
}
|
||||||
|
// having scanned that segment of this token, if we've reached the
|
||||||
|
// end of the string, we're done
|
||||||
|
if (instr.done())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LLStringUtilBaseImpl
|
||||||
|
|
||||||
|
// static
|
||||||
|
template <class T>
|
||||||
|
void LLStringUtilBase<T>::getTokens(const string_type& string, std::vector<string_type>& tokens,
|
||||||
|
const string_type& drop_delims, const string_type& keep_delims,
|
||||||
|
const string_type& quotes)
|
||||||
|
{
|
||||||
|
// Because this overload doesn't support escapes, use simple InString to
|
||||||
|
// manage input range.
|
||||||
|
LLStringUtilBaseImpl::InString<T> instring(string.begin(), string.end());
|
||||||
|
LLStringUtilBaseImpl::getTokens(instring, tokens, drop_delims, keep_delims, quotes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
template <class T>
|
||||||
|
void LLStringUtilBase<T>::getTokens(const string_type& string, std::vector<string_type>& tokens,
|
||||||
|
const string_type& drop_delims, const string_type& keep_delims,
|
||||||
|
const string_type& quotes, const string_type& escapes)
|
||||||
|
{
|
||||||
|
// This overload must deal with escapes. Delegate that to InEscString
|
||||||
|
// (unless there ARE no escapes).
|
||||||
|
boost::scoped_ptr< LLStringUtilBaseImpl::InString<T> > instrp;
|
||||||
|
if (escapes.empty())
|
||||||
|
instrp.reset(new LLStringUtilBaseImpl::InString<T>(string.begin(), string.end()));
|
||||||
|
else
|
||||||
|
instrp.reset(new LLStringUtilBaseImpl::InEscString<T>(string.begin(), string.end(), escapes));
|
||||||
|
LLStringUtilBaseImpl::getTokens(*instrp, tokens, drop_delims, keep_delims, quotes);
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -678,7 +1043,7 @@ S32 LLStringUtilBase<T>::compareStrings(const T* lhs, const T* rhs)
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
S32 LLStringUtilBase<T>::compareStrings(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs)
|
S32 LLStringUtilBase<T>::compareStrings(const string_type& lhs, const string_type& rhs)
|
||||||
{
|
{
|
||||||
return LLStringOps::collate(lhs.c_str(), rhs.c_str());
|
return LLStringOps::collate(lhs.c_str(), rhs.c_str());
|
||||||
}
|
}
|
||||||
@@ -704,8 +1069,8 @@ S32 LLStringUtilBase<T>::compareInsensitive(const T* lhs, const T* rhs )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::basic_string<T> lhs_string(lhs);
|
string_type lhs_string(lhs);
|
||||||
std::basic_string<T> rhs_string(rhs);
|
string_type rhs_string(rhs);
|
||||||
LLStringUtilBase<T>::toUpper(lhs_string);
|
LLStringUtilBase<T>::toUpper(lhs_string);
|
||||||
LLStringUtilBase<T>::toUpper(rhs_string);
|
LLStringUtilBase<T>::toUpper(rhs_string);
|
||||||
result = LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str());
|
result = LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str());
|
||||||
@@ -715,10 +1080,10 @@ S32 LLStringUtilBase<T>::compareInsensitive(const T* lhs, const T* rhs )
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
S32 LLStringUtilBase<T>::compareInsensitive(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs)
|
S32 LLStringUtilBase<T>::compareInsensitive(const string_type& lhs, const string_type& rhs)
|
||||||
{
|
{
|
||||||
std::basic_string<T> lhs_string(lhs);
|
string_type lhs_string(lhs);
|
||||||
std::basic_string<T> rhs_string(rhs);
|
string_type rhs_string(rhs);
|
||||||
LLStringUtilBase<T>::toUpper(lhs_string);
|
LLStringUtilBase<T>::toUpper(lhs_string);
|
||||||
LLStringUtilBase<T>::toUpper(rhs_string);
|
LLStringUtilBase<T>::toUpper(rhs_string);
|
||||||
return LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str());
|
return LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str());
|
||||||
@@ -729,7 +1094,7 @@ S32 LLStringUtilBase<T>::compareInsensitive(const std::basic_string<T>& lhs, con
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
S32 LLStringUtilBase<T>::compareDict(const std::basic_string<T>& astr, const std::basic_string<T>& bstr)
|
S32 LLStringUtilBase<T>::compareDict(const string_type& astr, const string_type& bstr)
|
||||||
{
|
{
|
||||||
const T* a = astr.c_str();
|
const T* a = astr.c_str();
|
||||||
const T* b = bstr.c_str();
|
const T* b = bstr.c_str();
|
||||||
@@ -770,7 +1135,7 @@ S32 LLStringUtilBase<T>::compareDict(const std::basic_string<T>& astr, const std
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
template<class T>
|
template<class T>
|
||||||
S32 LLStringUtilBase<T>::compareDictInsensitive(const std::basic_string<T>& astr, const std::basic_string<T>& bstr)
|
S32 LLStringUtilBase<T>::compareDictInsensitive(const string_type& astr, const string_type& bstr)
|
||||||
{
|
{
|
||||||
const T* a = astr.c_str();
|
const T* a = astr.c_str();
|
||||||
const T* b = bstr.c_str();
|
const T* b = bstr.c_str();
|
||||||
@@ -805,7 +1170,7 @@ S32 LLStringUtilBase<T>::compareDictInsensitive(const std::basic_string<T>& astr
|
|||||||
// Puts compareDict() in a form appropriate for LL container classes to use for sorting.
|
// Puts compareDict() in a form appropriate for LL container classes to use for sorting.
|
||||||
// static
|
// static
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::precedesDict( const std::basic_string<T>& a, const std::basic_string<T>& b )
|
BOOL LLStringUtilBase<T>::precedesDict( const string_type& a, const string_type& b )
|
||||||
{
|
{
|
||||||
if( a.size() && b.size() )
|
if( a.size() && b.size() )
|
||||||
{
|
{
|
||||||
@@ -819,7 +1184,7 @@ BOOL LLStringUtilBase<T>::precedesDict( const std::basic_string<T>& a, const std
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::toUpper(std::basic_string<T>& string)
|
void LLStringUtilBase<T>::toUpper(string_type& string)
|
||||||
{
|
{
|
||||||
if( !string.empty() )
|
if( !string.empty() )
|
||||||
{
|
{
|
||||||
@@ -833,7 +1198,7 @@ void LLStringUtilBase<T>::toUpper(std::basic_string<T>& string)
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::toLower(std::basic_string<T>& string)
|
void LLStringUtilBase<T>::toLower(string_type& string)
|
||||||
{
|
{
|
||||||
if( !string.empty() )
|
if( !string.empty() )
|
||||||
{
|
{
|
||||||
@@ -847,7 +1212,7 @@ void LLStringUtilBase<T>::toLower(std::basic_string<T>& string)
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::trimHead(std::basic_string<T>& string)
|
void LLStringUtilBase<T>::trimHead(string_type& string)
|
||||||
{
|
{
|
||||||
if( !string.empty() )
|
if( !string.empty() )
|
||||||
{
|
{
|
||||||
@@ -862,7 +1227,7 @@ void LLStringUtilBase<T>::trimHead(std::basic_string<T>& string)
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::trimTail(std::basic_string<T>& string)
|
void LLStringUtilBase<T>::trimTail(string_type& string)
|
||||||
{
|
{
|
||||||
if( string.size() )
|
if( string.size() )
|
||||||
{
|
{
|
||||||
@@ -881,7 +1246,7 @@ void LLStringUtilBase<T>::trimTail(std::basic_string<T>& string)
|
|||||||
// Replace line feeds with carriage return-line feed pairs.
|
// Replace line feeds with carriage return-line feed pairs.
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::addCRLF(std::basic_string<T>& string)
|
void LLStringUtilBase<T>::addCRLF(string_type& string)
|
||||||
{
|
{
|
||||||
const T LF = 10;
|
const T LF = 10;
|
||||||
const T CR = 13;
|
const T CR = 13;
|
||||||
@@ -923,7 +1288,7 @@ void LLStringUtilBase<T>::addCRLF(std::basic_string<T>& string)
|
|||||||
// Remove all carriage returns
|
// Remove all carriage returns
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::removeCRLF(std::basic_string<T>& string)
|
void LLStringUtilBase<T>::removeCRLF(string_type& string)
|
||||||
{
|
{
|
||||||
const T CR = 13;
|
const T CR = 13;
|
||||||
|
|
||||||
@@ -944,10 +1309,10 @@ void LLStringUtilBase<T>::removeCRLF(std::basic_string<T>& string)
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::replaceChar( std::basic_string<T>& string, T target, T replacement )
|
void LLStringUtilBase<T>::replaceChar( string_type& string, T target, T replacement )
|
||||||
{
|
{
|
||||||
size_type found_pos = 0;
|
size_type found_pos = 0;
|
||||||
while( (found_pos = string.find(target, found_pos)) != std::basic_string<T>::npos )
|
while( (found_pos = string.find(target, found_pos)) != string_type::npos )
|
||||||
{
|
{
|
||||||
string[found_pos] = replacement;
|
string[found_pos] = replacement;
|
||||||
found_pos++; // avoid infinite defeat if target == replacement
|
found_pos++; // avoid infinite defeat if target == replacement
|
||||||
@@ -956,10 +1321,10 @@ void LLStringUtilBase<T>::replaceChar( std::basic_string<T>& string, T target, T
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::replaceString( std::basic_string<T>& string, std::basic_string<T> target, std::basic_string<T> replacement )
|
void LLStringUtilBase<T>::replaceString( string_type& string, string_type target, string_type replacement )
|
||||||
{
|
{
|
||||||
size_type found_pos = 0;
|
size_type found_pos = 0;
|
||||||
while( (found_pos = string.find(target, found_pos)) != std::basic_string<T>::npos )
|
while( (found_pos = string.find(target, found_pos)) != string_type::npos )
|
||||||
{
|
{
|
||||||
string.replace( found_pos, target.length(), replacement );
|
string.replace( found_pos, target.length(), replacement );
|
||||||
found_pos += replacement.length(); // avoid infinite defeat if replacement contains target
|
found_pos += replacement.length(); // avoid infinite defeat if replacement contains target
|
||||||
@@ -968,7 +1333,7 @@ void LLStringUtilBase<T>::replaceString( std::basic_string<T>& string, std::basi
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::replaceNonstandardASCII( std::basic_string<T>& string, T replacement )
|
void LLStringUtilBase<T>::replaceNonstandardASCII( string_type& string, T replacement )
|
||||||
{
|
{
|
||||||
const char LF = 10;
|
const char LF = 10;
|
||||||
const S8 MIN = 32;
|
const S8 MIN = 32;
|
||||||
@@ -988,12 +1353,12 @@ void LLStringUtilBase<T>::replaceNonstandardASCII( std::basic_string<T>& string,
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::replaceTabsWithSpaces( std::basic_string<T>& str, size_type spaces_per_tab )
|
void LLStringUtilBase<T>::replaceTabsWithSpaces( string_type& str, size_type spaces_per_tab )
|
||||||
{
|
{
|
||||||
const T TAB = '\t';
|
const T TAB = '\t';
|
||||||
const T SPACE = ' ';
|
const T SPACE = ' ';
|
||||||
|
|
||||||
std::basic_string<T> out_str;
|
string_type out_str;
|
||||||
// Replace tabs with spaces
|
// Replace tabs with spaces
|
||||||
for (size_type i = 0; i < str.length(); i++)
|
for (size_type i = 0; i < str.length(); i++)
|
||||||
{
|
{
|
||||||
@@ -1012,7 +1377,7 @@ void LLStringUtilBase<T>::replaceTabsWithSpaces( std::basic_string<T>& str, size
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::containsNonprintable(const std::basic_string<T>& string)
|
BOOL LLStringUtilBase<T>::containsNonprintable(const string_type& string)
|
||||||
{
|
{
|
||||||
const char MIN = 32;
|
const char MIN = 32;
|
||||||
BOOL rv = FALSE;
|
BOOL rv = FALSE;
|
||||||
@@ -1029,7 +1394,7 @@ BOOL LLStringUtilBase<T>::containsNonprintable(const std::basic_string<T>& strin
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::stripNonprintable(std::basic_string<T>& string)
|
void LLStringUtilBase<T>::stripNonprintable(string_type& string)
|
||||||
{
|
{
|
||||||
const char MIN = 32;
|
const char MIN = 32;
|
||||||
size_type j = 0;
|
size_type j = 0;
|
||||||
@@ -1060,8 +1425,43 @@ void LLStringUtilBase<T>::stripNonprintable(std::basic_string<T>& string)
|
|||||||
delete []c_string;
|
delete []c_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
std::basic_string<T> LLStringUtilBase<T>::quote(const string_type& str,
|
||||||
|
const string_type& triggers,
|
||||||
|
const string_type& escape)
|
||||||
|
{
|
||||||
|
size_type len(str.length());
|
||||||
|
// If the string is already quoted, assume user knows what s/he's doing.
|
||||||
|
if (len >= 2 && str[0] == '"' && str[len-1] == '"')
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not already quoted: do we need to? triggers.empty() is a special case
|
||||||
|
// meaning "always quote."
|
||||||
|
if ((! triggers.empty()) && str.find_first_of(triggers) == string_type::npos)
|
||||||
|
{
|
||||||
|
// no trigger characters, don't bother quoting
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For whatever reason, we must quote this string.
|
||||||
|
string_type result;
|
||||||
|
result.push_back('"');
|
||||||
|
for (typename string_type::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci)
|
||||||
|
{
|
||||||
|
if (*ci == '"')
|
||||||
|
{
|
||||||
|
result.append(escape);
|
||||||
|
}
|
||||||
|
result.push_back(*ci);
|
||||||
|
}
|
||||||
|
result.push_back('"');
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::_makeASCII(std::basic_string<T>& string)
|
void LLStringUtilBase<T>::_makeASCII(string_type& string)
|
||||||
{
|
{
|
||||||
// Replace non-ASCII chars with LL_UNKNOWN_CHAR
|
// Replace non-ASCII chars with LL_UNKNOWN_CHAR
|
||||||
for (size_type i = 0; i < string.length(); i++)
|
for (size_type i = 0; i < string.length(); i++)
|
||||||
@@ -1091,7 +1491,7 @@ void LLStringUtilBase<T>::copy( T* dst, const T* src, size_type dst_size )
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_string<T>& src, size_type offset)
|
void LLStringUtilBase<T>::copyInto(string_type& dst, const string_type& src, size_type offset)
|
||||||
{
|
{
|
||||||
if ( offset == dst.length() )
|
if ( offset == dst.length() )
|
||||||
{
|
{
|
||||||
@@ -1101,7 +1501,7 @@ void LLStringUtilBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_s
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::basic_string<T> tail = dst.substr(offset);
|
string_type tail = dst.substr(offset);
|
||||||
|
|
||||||
dst = dst.substr(0, offset);
|
dst = dst.substr(0, offset);
|
||||||
dst += src;
|
dst += src;
|
||||||
@@ -1112,7 +1512,7 @@ void LLStringUtilBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_s
|
|||||||
// True if this is the head of s.
|
// True if this is the head of s.
|
||||||
//static
|
//static
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::isHead( const std::basic_string<T>& string, const T* s )
|
BOOL LLStringUtilBase<T>::isHead( const string_type& string, const T* s )
|
||||||
{
|
{
|
||||||
if( string.empty() )
|
if( string.empty() )
|
||||||
{
|
{
|
||||||
@@ -1128,8 +1528,8 @@ BOOL LLStringUtilBase<T>::isHead( const std::basic_string<T>& string, const T* s
|
|||||||
// static
|
// static
|
||||||
template<class T>
|
template<class T>
|
||||||
bool LLStringUtilBase<T>::startsWith(
|
bool LLStringUtilBase<T>::startsWith(
|
||||||
const std::basic_string<T>& string,
|
const string_type& string,
|
||||||
const std::basic_string<T>& substr)
|
const string_type& substr)
|
||||||
{
|
{
|
||||||
if(string.empty() || (substr.empty())) return false;
|
if(string.empty() || (substr.empty())) return false;
|
||||||
if(0 == string.find(substr)) return true;
|
if(0 == string.find(substr)) return true;
|
||||||
@@ -1139,8 +1539,8 @@ bool LLStringUtilBase<T>::startsWith(
|
|||||||
// static
|
// static
|
||||||
template<class T>
|
template<class T>
|
||||||
bool LLStringUtilBase<T>::endsWith(
|
bool LLStringUtilBase<T>::endsWith(
|
||||||
const std::basic_string<T>& string,
|
const string_type& string,
|
||||||
const std::basic_string<T>& substr)
|
const string_type& substr)
|
||||||
{
|
{
|
||||||
if(string.empty() || (substr.empty())) return false;
|
if(string.empty() || (substr.empty())) return false;
|
||||||
std::string::size_type idx = string.rfind(substr);
|
std::string::size_type idx = string.rfind(substr);
|
||||||
@@ -1150,14 +1550,14 @@ bool LLStringUtilBase<T>::endsWith(
|
|||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::convertToBOOL(const std::basic_string<T>& string, BOOL& value)
|
BOOL LLStringUtilBase<T>::convertToBOOL(const string_type& string, BOOL& value)
|
||||||
{
|
{
|
||||||
if( string.empty() )
|
if( string.empty() )
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::basic_string<T> temp( string );
|
string_type temp( string );
|
||||||
trim(temp);
|
trim(temp);
|
||||||
if(
|
if(
|
||||||
(temp == "1") ||
|
(temp == "1") ||
|
||||||
@@ -1187,7 +1587,7 @@ BOOL LLStringUtilBase<T>::convertToBOOL(const std::basic_string<T>& string, BOOL
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::convertToU8(const std::basic_string<T>& string, U8& value)
|
BOOL LLStringUtilBase<T>::convertToU8(const string_type& string, U8& value)
|
||||||
{
|
{
|
||||||
S32 value32 = 0;
|
S32 value32 = 0;
|
||||||
BOOL success = convertToS32(string, value32);
|
BOOL success = convertToS32(string, value32);
|
||||||
@@ -1200,7 +1600,7 @@ BOOL LLStringUtilBase<T>::convertToU8(const std::basic_string<T>& string, U8& va
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::convertToS8(const std::basic_string<T>& string, S8& value)
|
BOOL LLStringUtilBase<T>::convertToS8(const string_type& string, S8& value)
|
||||||
{
|
{
|
||||||
S32 value32 = 0;
|
S32 value32 = 0;
|
||||||
BOOL success = convertToS32(string, value32);
|
BOOL success = convertToS32(string, value32);
|
||||||
@@ -1213,7 +1613,7 @@ BOOL LLStringUtilBase<T>::convertToS8(const std::basic_string<T>& string, S8& va
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::convertToS16(const std::basic_string<T>& string, S16& value)
|
BOOL LLStringUtilBase<T>::convertToS16(const string_type& string, S16& value)
|
||||||
{
|
{
|
||||||
S32 value32 = 0;
|
S32 value32 = 0;
|
||||||
BOOL success = convertToS32(string, value32);
|
BOOL success = convertToS32(string, value32);
|
||||||
@@ -1226,7 +1626,7 @@ BOOL LLStringUtilBase<T>::convertToS16(const std::basic_string<T>& string, S16&
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::convertToU16(const std::basic_string<T>& string, U16& value)
|
BOOL LLStringUtilBase<T>::convertToU16(const string_type& string, U16& value)
|
||||||
{
|
{
|
||||||
S32 value32 = 0;
|
S32 value32 = 0;
|
||||||
BOOL success = convertToS32(string, value32);
|
BOOL success = convertToS32(string, value32);
|
||||||
@@ -1239,17 +1639,17 @@ BOOL LLStringUtilBase<T>::convertToU16(const std::basic_string<T>& string, U16&
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::convertToU32(const std::basic_string<T>& string, U32& value)
|
BOOL LLStringUtilBase<T>::convertToU32(const string_type& string, U32& value)
|
||||||
{
|
{
|
||||||
if( string.empty() )
|
if( string.empty() )
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::basic_string<T> temp( string );
|
string_type temp( string );
|
||||||
trim(temp);
|
trim(temp);
|
||||||
U32 v;
|
U32 v;
|
||||||
std::basic_istringstream<T> i_stream((std::basic_string<T>)temp);
|
std::basic_istringstream<T> i_stream((string_type)temp);
|
||||||
if(i_stream >> v)
|
if(i_stream >> v)
|
||||||
{
|
{
|
||||||
value = v;
|
value = v;
|
||||||
@@ -1259,17 +1659,17 @@ BOOL LLStringUtilBase<T>::convertToU32(const std::basic_string<T>& string, U32&
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::convertToS32(const std::basic_string<T>& string, S32& value)
|
BOOL LLStringUtilBase<T>::convertToS32(const string_type& string, S32& value)
|
||||||
{
|
{
|
||||||
if( string.empty() )
|
if( string.empty() )
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::basic_string<T> temp( string );
|
string_type temp( string );
|
||||||
trim(temp);
|
trim(temp);
|
||||||
S32 v;
|
S32 v;
|
||||||
std::basic_istringstream<T> i_stream((std::basic_string<T>)temp);
|
std::basic_istringstream<T> i_stream((string_type)temp);
|
||||||
if(i_stream >> v)
|
if(i_stream >> v)
|
||||||
{
|
{
|
||||||
//TODO: figure out overflow and underflow reporting here
|
//TODO: figure out overflow and underflow reporting here
|
||||||
@@ -1286,7 +1686,7 @@ BOOL LLStringUtilBase<T>::convertToS32(const std::basic_string<T>& string, S32&
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::convertToF32(const std::basic_string<T>& string, F32& value)
|
BOOL LLStringUtilBase<T>::convertToF32(const string_type& string, F32& value)
|
||||||
{
|
{
|
||||||
F64 value64 = 0.0;
|
F64 value64 = 0.0;
|
||||||
BOOL success = convertToF64(string, value64);
|
BOOL success = convertToF64(string, value64);
|
||||||
@@ -1299,17 +1699,17 @@ BOOL LLStringUtilBase<T>::convertToF32(const std::basic_string<T>& string, F32&
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOL LLStringUtilBase<T>::convertToF64(const std::basic_string<T>& string, F64& value)
|
BOOL LLStringUtilBase<T>::convertToF64(const string_type& string, F64& value)
|
||||||
{
|
{
|
||||||
if( string.empty() )
|
if( string.empty() )
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::basic_string<T> temp( string );
|
string_type temp( string );
|
||||||
trim(temp);
|
trim(temp);
|
||||||
F64 v;
|
F64 v;
|
||||||
std::basic_istringstream<T> i_stream((std::basic_string<T>)temp);
|
std::basic_istringstream<T> i_stream((string_type)temp);
|
||||||
if(i_stream >> v)
|
if(i_stream >> v)
|
||||||
{
|
{
|
||||||
//TODO: figure out overflow and underflow reporting here
|
//TODO: figure out overflow and underflow reporting here
|
||||||
@@ -1326,7 +1726,7 @@ BOOL LLStringUtilBase<T>::convertToF64(const std::basic_string<T>& string, F64&
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void LLStringUtilBase<T>::truncate(std::basic_string<T>& string, size_type count)
|
void LLStringUtilBase<T>::truncate(string_type& string, size_type count)
|
||||||
{
|
{
|
||||||
size_type cur_size = string.size();
|
size_type cur_size = string.size();
|
||||||
string.resize(count < cur_size ? count : cur_size);
|
string.resize(count < cur_size ? count : cur_size);
|
||||||
|
|||||||
110
indra/llcommon/lltypeinfolookup.h
Normal file
110
indra/llcommon/lltypeinfolookup.h
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
/**
|
||||||
|
* @file lltypeinfolookup.h
|
||||||
|
* @author Nat Goodspeed
|
||||||
|
* @date 2012-04-08
|
||||||
|
* @brief Template data structure like std::map<std::type_info*, T>
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||||
|
* Copyright (c) 2012, Linden Research, Inc.
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if ! defined(LL_LLTYPEINFOLOOKUP_H)
|
||||||
|
#define LL_LLTYPEINFOLOOKUP_H
|
||||||
|
|
||||||
|
#include "llsortedvector.h"
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LLTypeInfoLookup is specifically designed for use cases for which you might
|
||||||
|
* consider std::map<std::type_info*, VALUE>. We have several such data
|
||||||
|
* structures in the viewer. The trouble with them is that at least on Linux,
|
||||||
|
* you can't rely on always getting the same std::type_info* for a given type:
|
||||||
|
* different load modules will produce different std::type_info*.
|
||||||
|
* LLTypeInfoLookup contains a workaround to address this issue.
|
||||||
|
*
|
||||||
|
* Specifically, when we don't find the passed std::type_info*,
|
||||||
|
* LLTypeInfoLookup performs a linear search over registered entries to
|
||||||
|
* compare name() strings. Presuming that this succeeds, we cache the new
|
||||||
|
* (previously unrecognized) std::type_info* to speed future lookups.
|
||||||
|
*
|
||||||
|
* This worst-case fallback search (linear search with string comparison)
|
||||||
|
* should only happen the first time we look up a given type from a particular
|
||||||
|
* load module other than the one from which we initially registered types.
|
||||||
|
* (However, a lookup which wouldn't succeed anyway will always have
|
||||||
|
* worst-case performance.) This class is probably best used with less than a
|
||||||
|
* few dozen different types.
|
||||||
|
*/
|
||||||
|
template <typename VALUE>
|
||||||
|
class LLTypeInfoLookup
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef LLTypeInfoLookup<VALUE> self;
|
||||||
|
typedef LLSortedVector<const std::type_info*, VALUE> vector_type;
|
||||||
|
typedef typename vector_type::key_type key_type;
|
||||||
|
typedef typename vector_type::mapped_type mapped_type;
|
||||||
|
typedef typename vector_type::value_type value_type;
|
||||||
|
typedef typename vector_type::iterator iterator;
|
||||||
|
typedef typename vector_type::const_iterator const_iterator;
|
||||||
|
|
||||||
|
LLTypeInfoLookup() {}
|
||||||
|
|
||||||
|
iterator begin() { return mVector.begin(); }
|
||||||
|
iterator end() { return mVector.end(); }
|
||||||
|
const_iterator begin() const { return mVector.begin(); }
|
||||||
|
const_iterator end() const { return mVector.end(); }
|
||||||
|
bool empty() const { return mVector.empty(); }
|
||||||
|
std::size_t size() const { return mVector.size(); }
|
||||||
|
|
||||||
|
std::pair<iterator, bool> insert(const std::type_info* key, const VALUE& value)
|
||||||
|
{
|
||||||
|
return insert(value_type(key, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::pair<iterator, bool> insert(const value_type& pair)
|
||||||
|
{
|
||||||
|
return mVector.insert(pair);
|
||||||
|
}
|
||||||
|
|
||||||
|
// const find() forwards to non-const find(): this can alter mVector!
|
||||||
|
const_iterator find(const std::type_info* key) const
|
||||||
|
{
|
||||||
|
return const_cast<self*>(this)->find(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// non-const find() caches previously-unknown type_info* to speed future
|
||||||
|
// lookups.
|
||||||
|
iterator find(const std::type_info* key)
|
||||||
|
{
|
||||||
|
iterator found = mVector.find(key);
|
||||||
|
if (found != mVector.end())
|
||||||
|
{
|
||||||
|
// If LLSortedVector::find() found, great, we're done.
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
// Here we didn't find the passed type_info*. On Linux, though, even
|
||||||
|
// for the same type, typeid(sametype) produces a different type_info*
|
||||||
|
// when used in different load modules. So the fact that we didn't
|
||||||
|
// find the type_info* we seek doesn't mean this type isn't
|
||||||
|
// registered. Scan for matching name() string.
|
||||||
|
for (typename vector_type::iterator ti(mVector.begin()), tend(mVector.end());
|
||||||
|
ti != tend; ++ti)
|
||||||
|
{
|
||||||
|
if (std::string(ti->first->name()) == key->name())
|
||||||
|
{
|
||||||
|
// This unrecognized 'key' is for the same type as ti->first.
|
||||||
|
// To speed future lookups, insert a new entry that lets us
|
||||||
|
// look up ti->second using this same 'key'.
|
||||||
|
return insert(key, ti->second).first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// We simply have never seen a type with this type_info* from any load
|
||||||
|
// module.
|
||||||
|
return mVector.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
vector_type mVector;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* ! defined(LL_LLTYPEINFOLOOKUP_H) */
|
||||||
@@ -460,7 +460,7 @@ typedef struct _ASTAT_
|
|||||||
}ASTAT, * PASTAT;
|
}ASTAT, * PASTAT;
|
||||||
|
|
||||||
// static
|
// static
|
||||||
S32 LLUUID::getNodeID(unsigned char * node_id)
|
S32 LLUUID::getNodeID(unsigned char *node_id)
|
||||||
{
|
{
|
||||||
ASTAT Adapter;
|
ASTAT Adapter;
|
||||||
NCB Ncb;
|
NCB Ncb;
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
|
||||||
#include "stdtypes.h"
|
#include "stdtypes.h"
|
||||||
#include "llpreprocessor.h"
|
#include "llpreprocessor.h"
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@
|
|||||||
|
|
||||||
#include "lluuid.h"
|
#include "lluuid.h"
|
||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
#include "llmemtype.h"
|
|
||||||
#include "llthread.h"
|
#include "llthread.h"
|
||||||
|
#include "llmemtype.h"
|
||||||
#include "aithreadsafe.h"
|
#include "aithreadsafe.h"
|
||||||
|
|
||||||
const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2
|
const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#ifndef LL_LLPNGWRAPPER_H
|
#ifndef LL_LLPNGWRAPPER_H
|
||||||
#define LL_LLPNGWRAPPER_H
|
#define LL_LLPNGWRAPPER_H
|
||||||
|
|
||||||
#include "png.h"
|
#include "libpng15/png.h"
|
||||||
#include "llimage.h"
|
#include "llimage.h"
|
||||||
|
|
||||||
class LLPngWrapper
|
class LLPngWrapper
|
||||||
|
|||||||
@@ -1700,6 +1700,6 @@ LLPointer<LLInventoryCategory> ll_create_category_from_sd(const LLSD& sd_cat)
|
|||||||
LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString()));
|
LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString()));
|
||||||
rv->setPreferredType(
|
rv->setPreferredType(
|
||||||
LLFolderType::lookup(
|
LLFolderType::lookup(
|
||||||
sd_cat[INV_PREFERRED_TYPE_LABEL].asString()));
|
sd_cat[INV_PREFERRED_TYPE_LABEL].asString()));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
|
|||||||
LLInventoryType::IT_NONE, // 46 AT_NONE
|
LLInventoryType::IT_NONE, // 46 AT_NONE
|
||||||
LLInventoryType::IT_NONE, // 47 AT_NONE
|
LLInventoryType::IT_NONE, // 47 AT_NONE
|
||||||
LLInventoryType::IT_NONE, // 48 AT_NONE
|
LLInventoryType::IT_NONE, // 48 AT_NONE
|
||||||
LLInventoryType::IT_MESH // 49 AT_MESH
|
LLInventoryType::IT_MESH // 49 AT_MESH
|
||||||
};
|
};
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const S32 PARCEL_UNIT_AREA = 16;
|
|||||||
const F32 PARCEL_HEIGHT = 50.f;
|
const F32 PARCEL_HEIGHT = 50.f;
|
||||||
|
|
||||||
//Height above ground which parcel boundries exist for explicitly banned avatars
|
//Height above ground which parcel boundries exist for explicitly banned avatars
|
||||||
const F32 BAN_HEIGHT = 768.f;
|
const F32 BAN_HEIGHT = 5000.f;
|
||||||
|
|
||||||
// Maximum number of entries in an access list
|
// Maximum number of entries in an access list
|
||||||
const S32 PARCEL_MAX_ACCESS_LIST = 300;
|
const S32 PARCEL_MAX_ACCESS_LIST = 300;
|
||||||
@@ -260,7 +260,7 @@ public:
|
|||||||
void setMediaURLResetTimer(F32 time);
|
void setMediaURLResetTimer(F32 time);
|
||||||
virtual void setLocalID(S32 local_id);
|
virtual void setLocalID(S32 local_id);
|
||||||
|
|
||||||
// blow away all the extra crap lurking in parcels, including urls, access lists, etc
|
// blow away all the extra stuff lurking in parcels, including urls, access lists, etc
|
||||||
void clearParcel();
|
void clearParcel();
|
||||||
|
|
||||||
// This value is not persisted out to the parcel file, it is only
|
// This value is not persisted out to the parcel file, it is only
|
||||||
@@ -686,6 +686,7 @@ public:
|
|||||||
std::map<LLUUID,LLAccessEntry> mBanList;
|
std::map<LLUUID,LLAccessEntry> mBanList;
|
||||||
std::map<LLUUID,LLAccessEntry> mTempBanList;
|
std::map<LLUUID,LLAccessEntry> mTempBanList;
|
||||||
std::map<LLUUID,LLAccessEntry> mTempAccessList;
|
std::map<LLUUID,LLAccessEntry> mTempAccessList;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,6 @@
|
|||||||
#ifndef LL_LLPERMISSIONSFLAGS_H
|
#ifndef LL_LLPERMISSIONSFLAGS_H
|
||||||
#define LL_LLPERMISSIONSFLAGS_H
|
#define LL_LLPERMISSIONSFLAGS_H
|
||||||
|
|
||||||
// llpermissionsflags.h
|
|
||||||
// Copyright 2002, Linden Research, Inc.
|
|
||||||
//
|
|
||||||
// Flags for various permissions bits.
|
// Flags for various permissions bits.
|
||||||
// Shared between viewer and simulator.
|
// Shared between viewer and simulator.
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#include "lltransactiontypes.h"
|
#include "lltransactiontypes.h"
|
||||||
|
|
||||||
#include "../newview/hippogridmanager.h"
|
#include "../newview/hippogridmanager.h"
|
||||||
|
|
||||||
const U8 TRANSACTION_FLAGS_NONE = 0;
|
const U8 TRANSACTION_FLAGS_NONE = 0;
|
||||||
const U8 TRANSACTION_FLAG_SOURCE_GROUP = 1;
|
const U8 TRANSACTION_FLAG_SOURCE_GROUP = 1;
|
||||||
const U8 TRANSACTION_FLAG_DEST_GROUP = 2;
|
const U8 TRANSACTION_FLAG_DEST_GROUP = 2;
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ const S32 TRANS_CLASSIFIED_RENEW = 2005;
|
|||||||
// automatically end up in the list below :-(
|
// automatically end up in the list below :-(
|
||||||
// So make sure you check the transaction_description table
|
// So make sure you check the transaction_description table
|
||||||
const S32 TRANS_RECURRING_GENERIC = 2100;
|
const S32 TRANS_RECURRING_GENERIC = 2100;
|
||||||
|
|
||||||
// Codes 3000-3999 reserved for inventory transactions
|
// Codes 3000-3999 reserved for inventory transactions
|
||||||
const S32 TRANS_GIVE_INVENTORY = 3000;
|
const S32 TRANS_GIVE_INVENTORY = 3000;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
|
|
||||||
#include "llapr.h"
|
#include "llapr.h"
|
||||||
#include "llareslistener.h"
|
#include "llareslistener.h"
|
||||||
#include "llscopedvolatileaprpool.h"
|
|
||||||
|
|
||||||
#if defined(LL_WINDOWS)
|
#if defined(LL_WINDOWS)
|
||||||
#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
|
#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
|
||||||
@@ -469,6 +468,7 @@ bool LLAres::process(U64 timeout)
|
|||||||
ares_socket_t socks[ARES_GETSOCK_MAXNUM];
|
ares_socket_t socks[ARES_GETSOCK_MAXNUM];
|
||||||
apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM];
|
apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM];
|
||||||
apr_int32_t nsds = 0;
|
apr_int32_t nsds = 0;
|
||||||
|
apr_status_t status;
|
||||||
int nactive = 0;
|
int nactive = 0;
|
||||||
int bitmask;
|
int bitmask;
|
||||||
|
|
||||||
@@ -479,8 +479,6 @@ bool LLAres::process(U64 timeout)
|
|||||||
return nsds > 0;
|
return nsds > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLScopedVolatileAPRPool scoped_pool;
|
|
||||||
|
|
||||||
for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++)
|
for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++)
|
||||||
{
|
{
|
||||||
if (ARES_GETSOCK_READABLE(bitmask, i))
|
if (ARES_GETSOCK_READABLE(bitmask, i))
|
||||||
@@ -496,7 +494,7 @@ bool LLAres::process(U64 timeout)
|
|||||||
|
|
||||||
apr_socket_t *aprSock = NULL;
|
apr_socket_t *aprSock = NULL;
|
||||||
|
|
||||||
apr_status_t status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], scoped_pool);
|
status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], LLAPRRootPool::get()());
|
||||||
if (status != APR_SUCCESS)
|
if (status != APR_SUCCESS)
|
||||||
{
|
{
|
||||||
ll_apr_warn_status(status);
|
ll_apr_warn_status(status);
|
||||||
@@ -505,7 +503,7 @@ bool LLAres::process(U64 timeout)
|
|||||||
|
|
||||||
aprFds[nactive].desc.s = aprSock;
|
aprFds[nactive].desc.s = aprSock;
|
||||||
aprFds[nactive].desc_type = APR_POLL_SOCKET;
|
aprFds[nactive].desc_type = APR_POLL_SOCKET;
|
||||||
aprFds[nactive].p = scoped_pool;
|
aprFds[nactive].p = LLAPRRootPool::get()();
|
||||||
aprFds[nactive].rtnevents = 0;
|
aprFds[nactive].rtnevents = 0;
|
||||||
aprFds[nactive].client_data = &socks[i];
|
aprFds[nactive].client_data = &socks[i];
|
||||||
|
|
||||||
@@ -514,7 +512,7 @@ bool LLAres::process(U64 timeout)
|
|||||||
|
|
||||||
if (nactive > 0)
|
if (nactive > 0)
|
||||||
{
|
{
|
||||||
apr_status_t status = apr_poll(aprFds, nactive, &nsds, timeout);
|
status = apr_poll(aprFds, nactive, &nsds, timeout);
|
||||||
|
|
||||||
if (status != APR_SUCCESS && status != APR_TIMEUP)
|
if (status != APR_SUCCESS && status != APR_TIMEUP)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "linden_common.h"
|
#include "linden_common.h"
|
||||||
#include "llbuffer.h"
|
#include "llbuffer.h"
|
||||||
#include <iterator>
|
|
||||||
|
|
||||||
#include "llmath.h"
|
#include "llmath.h"
|
||||||
#include "llmemtype.h"
|
#include "llmemtype.h"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -42,11 +42,8 @@
|
|||||||
#include "lliopipe.h"
|
#include "lliopipe.h"
|
||||||
#include "llsd.h"
|
#include "llsd.h"
|
||||||
#include "llthread.h"
|
#include "llthread.h"
|
||||||
#include "llqueuedthread.h"
|
|
||||||
#include "llframetimer.h"
|
|
||||||
|
|
||||||
class LLMutex;
|
class LLMutex;
|
||||||
class LLCurlThread;
|
|
||||||
|
|
||||||
// For whatever reason, this is not typedef'd in curl.h
|
// For whatever reason, this is not typedef'd in curl.h
|
||||||
typedef size_t (*curl_header_callback)(void *ptr, size_t size, size_t nmemb, void *stream);
|
typedef size_t (*curl_header_callback)(void *ptr, size_t size, size_t nmemb, void *stream);
|
||||||
@@ -59,6 +56,8 @@ public:
|
|||||||
class Easy;
|
class Easy;
|
||||||
class Multi;
|
class Multi;
|
||||||
|
|
||||||
|
static bool sMultiThreaded;
|
||||||
|
|
||||||
struct TransferInfo
|
struct TransferInfo
|
||||||
{
|
{
|
||||||
TransferInfo() : mSizeDownload(0.0), mTotalTime(0.0), mSpeedDownload(0.0) {}
|
TransferInfo() : mSizeDownload(0.0), mTotalTime(0.0), mSpeedDownload(0.0) {}
|
||||||
@@ -125,7 +124,6 @@ public:
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public: /* but not really -- don't touch this */
|
public: /* but not really -- don't touch this */
|
||||||
U32 mReferenceCount;
|
U32 mReferenceCount;
|
||||||
|
|
||||||
@@ -163,7 +161,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @ brief Initialize LLCurl class
|
* @ brief Initialize LLCurl class
|
||||||
*/
|
*/
|
||||||
static void initClass(F32 curl_reuest_timeout = 120.f, S32 max_number_handles = 256, bool multi_threaded = false);
|
static void initClass(bool multi_threaded = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ brief Cleanup LLCurl class
|
* @ brief Cleanup LLCurl class
|
||||||
@@ -182,25 +180,10 @@ public:
|
|||||||
static void ssl_locking_callback(int mode, int type, const char *file, int line);
|
static void ssl_locking_callback(int mode, int type, const char *file, int line);
|
||||||
static unsigned long ssl_thread_id(void);
|
static unsigned long ssl_thread_id(void);
|
||||||
|
|
||||||
static LLCurlThread* getCurlThread() { return sCurlThread ;}
|
|
||||||
|
|
||||||
static CURLM* newMultiHandle() ;
|
|
||||||
static CURLMcode deleteMultiHandle(CURLM* handle) ;
|
|
||||||
static CURL* newEasyHandle() ;
|
|
||||||
static void deleteEasyHandle(CURL* handle) ;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::string sCAPath;
|
static std::string sCAPath;
|
||||||
static std::string sCAFile;
|
static std::string sCAFile;
|
||||||
static const unsigned int MAX_REDIRECTS;
|
static const unsigned int MAX_REDIRECTS;
|
||||||
static LLCurlThread* sCurlThread;
|
|
||||||
|
|
||||||
static LLMutex* sHandleMutexp ;
|
|
||||||
static S32 sTotalHandles ;
|
|
||||||
static S32 sMaxHandles;
|
|
||||||
public:
|
|
||||||
static bool sNotQuitting;
|
|
||||||
static F32 sCurlRequestTimeOut;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLCurl::Easy
|
class LLCurl::Easy
|
||||||
@@ -209,7 +192,7 @@ class LLCurl::Easy
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Easy();
|
Easy();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Easy* getEasy();
|
static Easy* getEasy();
|
||||||
~Easy();
|
~Easy();
|
||||||
@@ -218,41 +201,41 @@ public:
|
|||||||
|
|
||||||
void setErrorBuffer();
|
void setErrorBuffer();
|
||||||
void setCA();
|
void setCA();
|
||||||
|
|
||||||
void setopt(CURLoption option, S32 value);
|
void setopt(CURLoption option, S32 value);
|
||||||
// These assume the setter does not free value!
|
// These assume the setter does not free value!
|
||||||
void setopt(CURLoption option, void* value);
|
void setopt(CURLoption option, void* value);
|
||||||
void setopt(CURLoption option, char* value);
|
void setopt(CURLoption option, char* value);
|
||||||
// Copies the string so that it is guaranteed to stick around
|
// Copies the string so that it is gauranteed to stick around
|
||||||
void setoptString(CURLoption option, const std::string& value);
|
void setoptString(CURLoption option, const std::string& value);
|
||||||
|
|
||||||
void slist_append(const char* str);
|
void slist_append(const char* str);
|
||||||
void setHeaders();
|
void setHeaders();
|
||||||
|
|
||||||
U32 report(CURLcode);
|
U32 report(CURLcode);
|
||||||
void getTransferInfo(LLCurl::TransferInfo* info);
|
void getTransferInfo(LLCurl::TransferInfo* info);
|
||||||
|
|
||||||
void prepRequest(const std::string& url, const std::vector<std::string>& headers, LLCurl::ResponderPtr, S32 time_out = 0, bool post = false);
|
void prepRequest(const std::string& url, const std::vector<std::string>& headers, ResponderPtr, S32 time_out = 0, bool post = false);
|
||||||
|
|
||||||
const char* getErrorBuffer();
|
const char* getErrorBuffer();
|
||||||
|
|
||||||
std::stringstream& getInput() { return mInput; }
|
std::stringstream& getInput() { return mInput; }
|
||||||
std::stringstream& getHeaderOutput() { return mHeaderOutput; }
|
std::stringstream& getHeaderOutput() { return mHeaderOutput; }
|
||||||
LLIOPipe::buffer_ptr_t& getOutput() { return mOutput; }
|
LLIOPipe::buffer_ptr_t& getOutput() { return mOutput; }
|
||||||
const LLChannelDescriptors& getChannels() { return mChannels; }
|
const LLChannelDescriptors& getChannels() { return mChannels; }
|
||||||
|
|
||||||
void resetState();
|
void resetState();
|
||||||
|
|
||||||
static CURL* allocEasyHandle();
|
static CURL* allocEasyHandle();
|
||||||
static void releaseEasyHandle(CURL* handle);
|
static void releaseEasyHandle(CURL* handle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class LLCurl;
|
friend class LLCurl;
|
||||||
friend class LLCurl::Multi;
|
friend class LLCurl::Multi;
|
||||||
|
|
||||||
CURL* mCurlEasyHandle;
|
CURL* mCurlEasyHandle;
|
||||||
struct curl_slist* mHeaders;
|
struct curl_slist* mHeaders;
|
||||||
|
|
||||||
std::stringstream mRequest;
|
std::stringstream mRequest;
|
||||||
LLChannelDescriptors mChannels;
|
LLChannelDescriptors mChannels;
|
||||||
LLIOPipe::buffer_ptr_t mOutput;
|
LLIOPipe::buffer_ptr_t mOutput;
|
||||||
@@ -262,127 +245,70 @@ private:
|
|||||||
|
|
||||||
// Note: char*'s not strings since we pass pointers to curl
|
// Note: char*'s not strings since we pass pointers to curl
|
||||||
std::vector<char*> mStrings;
|
std::vector<char*> mStrings;
|
||||||
|
|
||||||
LLCurl::ResponderPtr mResponder;
|
ResponderPtr mResponder;
|
||||||
|
|
||||||
static std::set<CURL*> sFreeHandles;
|
static std::set<CURL*> sFreeHandles;
|
||||||
static std::set<CURL*> sActiveHandles;
|
static std::set<CURL*> sActiveHandles;
|
||||||
static LLMutex* sHandleMutexp ;
|
static LLMutex* sHandleMutex;
|
||||||
|
static LLMutex* sMultiMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLCurl::Multi
|
class LLCurl::Multi : public LLThread
|
||||||
{
|
{
|
||||||
LOG_CLASS(Multi);
|
LOG_CLASS(Multi);
|
||||||
|
|
||||||
friend class LLCurlThread ;
|
|
||||||
|
|
||||||
private:
|
|
||||||
~Multi();
|
|
||||||
|
|
||||||
void markDead() ;
|
|
||||||
bool doPerform();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
STATE_READY=0,
|
PERFORM_STATE_READY=0,
|
||||||
STATE_PERFORMING=1,
|
PERFORM_STATE_PERFORMING=1,
|
||||||
STATE_COMPLETED=2
|
PERFORM_STATE_COMPLETED=2
|
||||||
} ePerformState;
|
} ePerformState;
|
||||||
|
|
||||||
Multi(F32 idle_time_out = 0.f);
|
Multi();
|
||||||
|
~Multi();
|
||||||
|
|
||||||
LLCurl::Easy* allocEasy();
|
Easy* allocEasy();
|
||||||
bool addEasy(LLCurl::Easy* easy);
|
bool addEasy(Easy* easy);
|
||||||
void removeEasy(LLCurl::Easy* easy);
|
|
||||||
|
|
||||||
void lock() ;
|
void removeEasy(Easy* easy);
|
||||||
void unlock() ;
|
|
||||||
|
|
||||||
void setState(ePerformState state) ;
|
|
||||||
ePerformState getState() ;
|
|
||||||
|
|
||||||
bool isCompleted() ;
|
|
||||||
bool isValid() {return mCurlMultiHandle != NULL && mValid;}
|
|
||||||
bool isDead() {return mDead;}
|
|
||||||
|
|
||||||
bool waitToComplete() ;
|
|
||||||
|
|
||||||
S32 process();
|
S32 process();
|
||||||
|
void perform();
|
||||||
|
void doPerform();
|
||||||
|
|
||||||
|
virtual void run();
|
||||||
|
|
||||||
CURLMsg* info_read(S32* msgs_in_queue);
|
CURLMsg* info_read(S32* msgs_in_queue);
|
||||||
|
|
||||||
S32 mQueued;
|
S32 mQueued;
|
||||||
S32 mErrorCount;
|
S32 mErrorCount;
|
||||||
|
|
||||||
|
S32 mPerformState;
|
||||||
|
|
||||||
|
LLCondition* mSignal;
|
||||||
|
bool mQuitting;
|
||||||
|
bool mThreaded;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void easyFree(LLCurl::Easy*);
|
void easyFree(Easy*);
|
||||||
void cleanup(bool deleted = false);
|
|
||||||
|
|
||||||
CURLM* mCurlMultiHandle;
|
CURLM* mCurlMultiHandle;
|
||||||
|
|
||||||
typedef std::set<LLCurl::Easy*> easy_active_list_t;
|
typedef std::set<Easy*> easy_active_list_t;
|
||||||
easy_active_list_t mEasyActiveList;
|
easy_active_list_t mEasyActiveList;
|
||||||
typedef std::map<CURL*, LLCurl::Easy*> easy_active_map_t;
|
typedef std::map<CURL*, Easy*> easy_active_map_t;
|
||||||
easy_active_map_t mEasyActiveMap;
|
easy_active_map_t mEasyActiveMap;
|
||||||
typedef std::set<LLCurl::Easy*> easy_free_list_t;
|
typedef std::set<Easy*> easy_free_list_t;
|
||||||
easy_free_list_t mEasyFreeList;
|
easy_free_list_t mEasyFreeList;
|
||||||
|
|
||||||
LLQueuedThread::handle_t mHandle ;
|
|
||||||
ePerformState mState;
|
|
||||||
|
|
||||||
BOOL mDead ;
|
|
||||||
BOOL mValid ;
|
|
||||||
LLMutex* mMutexp ;
|
|
||||||
LLMutex* mDeletionMutexp ;
|
|
||||||
LLMutex* mEasyMutexp ;
|
|
||||||
LLFrameTimer mIdleTimer ;
|
|
||||||
F32 mIdleTimeOut;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLCurlThread : public LLQueuedThread
|
namespace boost
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
|
||||||
class CurlRequest : public LLQueuedThread::QueuedRequest
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
virtual ~CurlRequest(); // use deleteRequest()
|
|
||||||
|
|
||||||
public:
|
|
||||||
CurlRequest(handle_t handle, LLCurl::Multi* multi, LLCurlThread* curl_thread);
|
|
||||||
|
|
||||||
/*virtual*/ bool processRequest();
|
|
||||||
/*virtual*/ void finishRequest(bool completed);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// input
|
|
||||||
LLCurl::Multi* mMulti;
|
|
||||||
LLCurlThread* mCurlThread;
|
|
||||||
};
|
|
||||||
friend class CurlRequest;
|
|
||||||
|
|
||||||
public:
|
|
||||||
LLCurlThread(bool threaded = true) ;
|
|
||||||
virtual ~LLCurlThread() ;
|
|
||||||
|
|
||||||
S32 update(F32 max_time_ms);
|
|
||||||
|
|
||||||
void addMulti(LLCurl::Multi* multi) ;
|
|
||||||
void killMulti(LLCurl::Multi* multi) ;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool doMultiPerform(LLCurl::Multi* multi) ;
|
|
||||||
void deleteMulti(LLCurl::Multi* multi) ;
|
|
||||||
void cleanupMulti(LLCurl::Multi* multi) ;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
//namespace boost
|
|
||||||
//{
|
|
||||||
void intrusive_ptr_add_ref(LLCurl::Responder* p);
|
void intrusive_ptr_add_ref(LLCurl::Responder* p);
|
||||||
void intrusive_ptr_release(LLCurl::Responder* p);
|
void intrusive_ptr_release(LLCurl::Responder* p);
|
||||||
//};
|
};
|
||||||
|
|
||||||
|
|
||||||
class LLCurlRequest
|
class LLCurlRequest
|
||||||
@@ -412,6 +338,7 @@ private:
|
|||||||
LLCurl::Multi* mActiveMulti;
|
LLCurl::Multi* mActiveMulti;
|
||||||
S32 mActiveRequestCount;
|
S32 mActiveRequestCount;
|
||||||
BOOL mProcessing;
|
BOOL mProcessing;
|
||||||
|
U32 mThreadID; // debug
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLCurlEasyRequest
|
class LLCurlEasyRequest
|
||||||
@@ -429,11 +356,9 @@ public:
|
|||||||
void slist_append(const char* str);
|
void slist_append(const char* str);
|
||||||
void sendRequest(const std::string& url);
|
void sendRequest(const std::string& url);
|
||||||
void requestComplete();
|
void requestComplete();
|
||||||
|
void perform();
|
||||||
bool getResult(CURLcode* result, LLCurl::TransferInfo* info = NULL);
|
bool getResult(CURLcode* result, LLCurl::TransferInfo* info = NULL);
|
||||||
std::string getErrorString();
|
std::string getErrorString();
|
||||||
bool isCompleted() {return mMulti->isCompleted() ;}
|
|
||||||
bool wait() { return mMulti->waitToComplete(); }
|
|
||||||
bool isValid() {return mMulti && mMulti->isValid(); }
|
|
||||||
|
|
||||||
LLCurl::Easy* getEasy() const { return mEasy; }
|
LLCurl::Easy* getEasy() const { return mEasy; }
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
#include "lldispatcher.h"
|
#include "lldispatcher.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
|
||||||
#include "llstl.h"
|
#include "llstl.h"
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,6 @@
|
|||||||
|
|
||||||
#include "llbuffer.h"
|
#include "llbuffer.h"
|
||||||
#include "llbufferstream.h"
|
#include "llbufferstream.h"
|
||||||
#include "llfasttimer.h"
|
|
||||||
#include "llmemorystream.h"
|
#include "llmemorystream.h"
|
||||||
#include "llsd.h"
|
#include "llsd.h"
|
||||||
#include "llsdserialize.h"
|
#include "llsdserialize.h"
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "linden_common.h"
|
#include "linden_common.h"
|
||||||
#include <openssl/x509_vfy.h>
|
|
||||||
#include "llhttpclient.h"
|
#include "llhttpclient.h"
|
||||||
|
|
||||||
#include "llassetstorage.h"
|
#include "llassetstorage.h"
|
||||||
@@ -40,10 +40,8 @@
|
|||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
|
||||||
const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
|
const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
|
||||||
LLURLRequest::SSLCertVerifyCallback LLHTTPClient::mCertVerifyCallback = NULL;
|
LLURLRequest::SSLCertVerifyCallback LLHTTPClient::mCertVerifyCallback = NULL;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Responder class moved to LLCurl
|
// Responder class moved to LLCurl
|
||||||
@@ -158,9 +156,9 @@ namespace
|
|||||||
if(fstream.is_open())
|
if(fstream.is_open())
|
||||||
{
|
{
|
||||||
fstream.seekg(0, std::ios::end);
|
fstream.seekg(0, std::ios::end);
|
||||||
U32 fileSize = fstream.tellg();
|
U32 fileSize = (U32)fstream.tellg();
|
||||||
fstream.seekg(0, std::ios::beg);
|
fstream.seekg(0, std::ios::beg);
|
||||||
std::vector<char> fileBuffer(fileSize);
|
std::vector<char> fileBuffer(fileSize); //Mem leak fix'd
|
||||||
fstream.read(&fileBuffer[0], fileSize);
|
fstream.read(&fileBuffer[0], fileSize);
|
||||||
ostream.write(&fileBuffer[0], fileSize);
|
ostream.write(&fileBuffer[0], fileSize);
|
||||||
fstream.close();
|
fstream.close();
|
||||||
@@ -189,11 +187,9 @@ namespace
|
|||||||
|
|
||||||
LLVFile vfile(gVFS, mUUID, mAssetType, LLVFile::READ);
|
LLVFile vfile(gVFS, mUUID, mAssetType, LLVFile::READ);
|
||||||
S32 fileSize = vfile.getSize();
|
S32 fileSize = vfile.getSize();
|
||||||
U8* fileBuffer;
|
std::vector<U8> fileBuffer(fileSize);
|
||||||
fileBuffer = new U8 [fileSize];
|
vfile.read(&fileBuffer[0], fileSize);
|
||||||
vfile.read(fileBuffer, fileSize);
|
ostream.write((char*)&fileBuffer[0], fileSize);
|
||||||
ostream.write((char*)fileBuffer, fileSize);
|
|
||||||
delete [] fileBuffer;
|
|
||||||
eos = true;
|
eos = true;
|
||||||
return STATUS_DONE;
|
return STATUS_DONE;
|
||||||
}
|
}
|
||||||
@@ -202,7 +198,6 @@ namespace
|
|||||||
LLAssetType::EType mAssetType;
|
LLAssetType::EType mAssetType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
LLPumpIO* theClientPump = NULL;
|
LLPumpIO* theClientPump = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,8 +212,7 @@ static void request(
|
|||||||
Injector* body_injector,
|
Injector* body_injector,
|
||||||
LLCurl::ResponderPtr responder,
|
LLCurl::ResponderPtr responder,
|
||||||
const F32 timeout = HTTP_REQUEST_EXPIRY_SECS,
|
const F32 timeout = HTTP_REQUEST_EXPIRY_SECS,
|
||||||
const LLSD& headers = LLSD()
|
const LLSD& headers = LLSD())
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (!LLHTTPClient::hasPump())
|
if (!LLHTTPClient::hasPump())
|
||||||
{
|
{
|
||||||
@@ -228,26 +222,12 @@ static void request(
|
|||||||
LLPumpIO::chain_t chain;
|
LLPumpIO::chain_t chain;
|
||||||
|
|
||||||
LLURLRequest* req = new LLURLRequest(method, url);
|
LLURLRequest* req = new LLURLRequest(method, url);
|
||||||
if(!req->isValid())//failed
|
|
||||||
{
|
|
||||||
delete req ;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
|
req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
|
||||||
|
|
||||||
|
// Insert custom headers is the caller sent any
|
||||||
lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " "
|
if (headers.isMap())
|
||||||
<< headers << llendl;
|
{
|
||||||
|
|
||||||
// Insert custom headers if the caller sent any
|
|
||||||
if (headers.isMap())
|
|
||||||
{
|
|
||||||
if (headers.has("Cookie"))
|
|
||||||
{
|
|
||||||
req->allowCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
LLSD::map_const_iterator iter = headers.beginMap();
|
LLSD::map_const_iterator iter = headers.beginMap();
|
||||||
LLSD::map_const_iterator end = headers.endMap();
|
LLSD::map_const_iterator end = headers.endMap();
|
||||||
|
|
||||||
@@ -429,16 +409,11 @@ static LLSD blocking_request(
|
|||||||
{
|
{
|
||||||
lldebugs << "blockingRequest of " << url << llendl;
|
lldebugs << "blockingRequest of " << url << llendl;
|
||||||
char curl_error_buffer[CURL_ERROR_SIZE] = "\0";
|
char curl_error_buffer[CURL_ERROR_SIZE] = "\0";
|
||||||
CURL* curlp = LLCurl::newEasyHandle();
|
CURL* curlp = curl_easy_init();
|
||||||
llassert_always(curlp != NULL) ;
|
|
||||||
|
|
||||||
LLHTTPBuffer http_buffer;
|
LLHTTPBuffer http_buffer;
|
||||||
std::string body_str;
|
std::string body_str;
|
||||||
|
|
||||||
// other request method checks root cert first, we skip?
|
// other request method checks root cert first, we skip?
|
||||||
|
|
||||||
// Apply configured proxy settings
|
|
||||||
LLProxy::getInstance()->applyProxySettings(curlp);
|
|
||||||
|
|
||||||
// * Set curl handle options
|
// * Set curl handle options
|
||||||
curl_easy_setopt(curlp, CURLOPT_NOSIGNAL, 1); // don't use SIGALRM for timeouts
|
curl_easy_setopt(curlp, CURLOPT_NOSIGNAL, 1); // don't use SIGALRM for timeouts
|
||||||
@@ -447,7 +422,7 @@ static LLSD blocking_request(
|
|||||||
curl_easy_setopt(curlp, CURLOPT_WRITEDATA, &http_buffer);
|
curl_easy_setopt(curlp, CURLOPT_WRITEDATA, &http_buffer);
|
||||||
curl_easy_setopt(curlp, CURLOPT_URL, url.c_str());
|
curl_easy_setopt(curlp, CURLOPT_URL, url.c_str());
|
||||||
curl_easy_setopt(curlp, CURLOPT_ERRORBUFFER, curl_error_buffer);
|
curl_easy_setopt(curlp, CURLOPT_ERRORBUFFER, curl_error_buffer);
|
||||||
|
|
||||||
// * Setup headers (don't forget to free them after the call!)
|
// * Setup headers (don't forget to free them after the call!)
|
||||||
curl_slist* headers_list = NULL;
|
curl_slist* headers_list = NULL;
|
||||||
if (headers.isMap())
|
if (headers.isMap())
|
||||||
@@ -525,7 +500,7 @@ static LLSD blocking_request(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * Cleanup
|
// * Cleanup
|
||||||
LLCurl::deleteEasyHandle(curlp);
|
curl_easy_cleanup(curlp);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,8 +600,7 @@ bool LLHTTPClient::hasPump()
|
|||||||
return theClientPump != NULL;
|
return theClientPump != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
LLPumpIO &LLHTTPClient::getPump()
|
||||||
LLPumpIO& LLHTTPClient::getPump()
|
|
||||||
{
|
{
|
||||||
return *theClientPump;
|
return *theClientPump;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,10 +34,11 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <boost/intrusive_ptr.hpp>
|
#include <boost/intrusive_ptr.hpp>
|
||||||
#include "llurlrequest.h"
|
|
||||||
#include "llassettype.h"
|
#include "llassettype.h"
|
||||||
#include "llcurl.h"
|
#include "llcurl.h"
|
||||||
#include "lliopipe.h"
|
#include "lliopipe.h"
|
||||||
|
#include "llurlrequest.h"
|
||||||
|
|
||||||
extern const F32 HTTP_REQUEST_EXPIRY_SECS;
|
extern const F32 HTTP_REQUEST_EXPIRY_SECS;
|
||||||
|
|
||||||
@@ -55,7 +56,6 @@ public:
|
|||||||
typedef LLCurl::Responder Responder;
|
typedef LLCurl::Responder Responder;
|
||||||
typedef LLCurl::ResponderPtr ResponderPtr;
|
typedef LLCurl::ResponderPtr ResponderPtr;
|
||||||
|
|
||||||
|
|
||||||
/** @name non-blocking API */
|
/** @name non-blocking API */
|
||||||
//@{
|
//@{
|
||||||
static void head(
|
static void head(
|
||||||
@@ -155,7 +155,7 @@ public:
|
|||||||
///< Hippo special
|
///< Hippo special
|
||||||
|
|
||||||
static void setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback);
|
static void setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback);
|
||||||
static LLURLRequest::SSLCertVerifyCallback getCertVerifyCallback() { return mCertVerifyCallback; }
|
static LLURLRequest::SSLCertVerifyCallback getCertVerifyCallback() { return mCertVerifyCallback; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static LLURLRequest::SSLCertVerifyCallback mCertVerifyCallback;
|
static LLURLRequest::SSLCertVerifyCallback mCertVerifyCallback;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include "llapr.h"
|
#include "llapr.h"
|
||||||
#include "llbuffer.h"
|
#include "llbuffer.h"
|
||||||
#include "llbufferstream.h"
|
#include "llbufferstream.h"
|
||||||
#include "llfasttimer.h"
|
|
||||||
#include "llhttpnode.h"
|
#include "llhttpnode.h"
|
||||||
#include "lliopipe.h"
|
#include "lliopipe.h"
|
||||||
#include "lliosocket.h"
|
#include "lliosocket.h"
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include "llapr.h"
|
#include "llapr.h"
|
||||||
|
|
||||||
#include "llbuffer.h"
|
#include "llbuffer.h"
|
||||||
#include "llfasttimer.h"
|
|
||||||
#include "llhost.h"
|
#include "llhost.h"
|
||||||
#include "llmemtype.h"
|
#include "llmemtype.h"
|
||||||
#include "llpumpio.h"
|
#include "llpumpio.h"
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
* OS poll indicates it will not block.
|
* OS poll indicates it will not block.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "llaprpool.h"
|
||||||
#include "lliopipe.h"
|
#include "lliopipe.h"
|
||||||
#include "apr_network_io.h"
|
#include "apr_network_io.h"
|
||||||
#include "llchainio.h"
|
#include "llchainio.h"
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "linden_common.h"
|
#include "linden_common.h"
|
||||||
#include "llfasttimer.h"
|
|
||||||
#include "llioutil.h"
|
#include "llioutil.h"
|
||||||
|
#include "llfasttimer.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LLIOFlush
|
* LLIOFlush
|
||||||
|
|||||||
@@ -50,7 +50,6 @@
|
|||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
#include "lluuid.h"
|
#include "lluuid.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "llaprpool.h"
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// constants
|
// constants
|
||||||
@@ -58,7 +57,7 @@
|
|||||||
const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE = 4096;
|
const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE = 4096;
|
||||||
|
|
||||||
static bool gMailEnabled = true;
|
static bool gMailEnabled = true;
|
||||||
static LLAPRPool gMailPool;
|
static apr_pool_t* gMailPool;
|
||||||
static apr_sockaddr_t* gSockAddr;
|
static apr_sockaddr_t* gSockAddr;
|
||||||
static apr_socket_t* gMailSocket;
|
static apr_socket_t* gMailSocket;
|
||||||
|
|
||||||
@@ -83,7 +82,7 @@ bool connect_smtp()
|
|||||||
gSockAddr->sa.sin.sin_family,
|
gSockAddr->sa.sin.sin_family,
|
||||||
SOCK_STREAM,
|
SOCK_STREAM,
|
||||||
APR_PROTO_TCP,
|
APR_PROTO_TCP,
|
||||||
gMailPool());
|
gMailPool);
|
||||||
if(ll_apr_warn_status(status)) return false;
|
if(ll_apr_warn_status(status)) return false;
|
||||||
status = apr_socket_connect(gMailSocket, gSockAddr);
|
status = apr_socket_connect(gMailSocket, gSockAddr);
|
||||||
if(ll_apr_warn_status(status))
|
if(ll_apr_warn_status(status))
|
||||||
@@ -140,19 +139,19 @@ BOOL LLMail::send(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLMail::init(const std::string& hostname)
|
void LLMail::init(const std::string& hostname, apr_pool_t* pool)
|
||||||
{
|
{
|
||||||
gMailSocket = NULL;
|
gMailSocket = NULL;
|
||||||
if (hostname.empty())
|
if(hostname.empty() || !pool)
|
||||||
{
|
{
|
||||||
|
gMailPool = NULL;
|
||||||
gSockAddr = NULL;
|
gSockAddr = NULL;
|
||||||
gMailPool.destroy();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gMailPool.create();
|
gMailPool = pool;
|
||||||
|
|
||||||
// Collect all the information into a sockaddr structure. the
|
// collect all the information into a socaddr sturcture. the
|
||||||
// documentation is a bit unclear, but I either have to
|
// documentation is a bit unclear, but I either have to
|
||||||
// specify APR_UNSPEC or not specify any flags. I am not sure
|
// specify APR_UNSPEC or not specify any flags. I am not sure
|
||||||
// which option is better.
|
// which option is better.
|
||||||
@@ -162,7 +161,7 @@ void LLMail::init(const std::string& hostname)
|
|||||||
APR_UNSPEC,
|
APR_UNSPEC,
|
||||||
25,
|
25,
|
||||||
APR_IPV4_ADDR_OK,
|
APR_IPV4_ADDR_OK,
|
||||||
gMailPool());
|
gMailPool);
|
||||||
ll_apr_warn_status(status);
|
ll_apr_warn_status(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,13 +27,15 @@
|
|||||||
#ifndef LL_LLMAIL_H
|
#ifndef LL_LLMAIL_H
|
||||||
#define LL_LLMAIL_H
|
#define LL_LLMAIL_H
|
||||||
|
|
||||||
|
typedef struct apr_pool_t apr_pool_t;
|
||||||
|
|
||||||
#include "llsd.h"
|
#include "llsd.h"
|
||||||
|
|
||||||
class LLMail
|
class LLMail
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// if hostname is NULL, then the host is resolved as 'mail'
|
// if hostname is NULL, then the host is resolved as 'mail'
|
||||||
static void init(const std::string& hostname);
|
static void init(const std::string& hostname, apr_pool_t* pool);
|
||||||
|
|
||||||
// Allow all email transmission to be disabled/enabled.
|
// Allow all email transmission to be disabled/enabled.
|
||||||
static void enable(bool mail_enabled);
|
static void enable(bool mail_enabled);
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ bool LLMimeParser::Impl::parseHeaders(
|
|||||||
// not to read past limit when we get() the newline.
|
// not to read past limit when we get() the newline.
|
||||||
S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
|
S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
|
||||||
istr.getline(mBuffer, max_get, '\r');
|
istr.getline(mBuffer, max_get, '\r');
|
||||||
mScanCount += istr.gcount();
|
mScanCount += (S32)istr.gcount();
|
||||||
int c = istr.get();
|
int c = istr.get();
|
||||||
if(EOF == c)
|
if(EOF == c)
|
||||||
{
|
{
|
||||||
@@ -496,7 +496,7 @@ void LLMimeParser::Impl::scanPastSeparator(
|
|||||||
// past limit when we get() the newline.
|
// past limit when we get() the newline.
|
||||||
S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
|
S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
|
||||||
istr.getline(mBuffer, max_get, '\r');
|
istr.getline(mBuffer, max_get, '\r');
|
||||||
mScanCount += istr.gcount();
|
mScanCount += (S32)istr.gcount();
|
||||||
if(istr.gcount() >= LINE_BUFFER_LENGTH - 1)
|
if(istr.gcount() >= LINE_BUFFER_LENGTH - 1)
|
||||||
{
|
{
|
||||||
// that's way too long to be a separator, so ignore it.
|
// that's way too long to be a separator, so ignore it.
|
||||||
|
|||||||
@@ -4,25 +4,31 @@
|
|||||||
* @date 2004-11-21
|
* @date 2004-11-21
|
||||||
* @brief Implementation of the i/o pump and related functions.
|
* @brief Implementation of the i/o pump and related functions.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2004&license=viewergpl$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2009, Linden Research, Inc.
|
||||||
|
*
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* Copyright (C) 2010, Linden Research, Inc.
|
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||||
|
* to you under the terms of the GNU General Public License, version 2.0
|
||||||
|
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||||
|
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||||
|
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||||
|
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* There are special exceptions to the terms and conditions of the GPL as
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* it is applied to this Source Code. View the full text of the exception
|
||||||
* License as published by the Free Software Foundation;
|
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||||
* version 2.1 of the License only.
|
* online at
|
||||||
|
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* By copying, modifying or distributing this software, you acknowledge
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* that you have read and understood your obligations described above,
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* and agree to abide by those obligations.
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||||
* License along with this library; if not, write to the Free Software
|
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* COMPLETENESS OR PERFORMANCE.
|
||||||
*
|
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -34,11 +40,12 @@
|
|||||||
#include "apr_poll.h"
|
#include "apr_poll.h"
|
||||||
|
|
||||||
#include "llapr.h"
|
#include "llapr.h"
|
||||||
#include "llfasttimer.h"
|
|
||||||
#include "llmemtype.h"
|
#include "llmemtype.h"
|
||||||
#include "llstl.h"
|
#include "llstl.h"
|
||||||
#include "llstat.h"
|
#include "llstat.h"
|
||||||
#include "llthread.h"
|
#include "llthread.h"
|
||||||
|
#include "llfasttimer.h"
|
||||||
|
#include <iterator> //VS2010
|
||||||
|
|
||||||
// These should not be enabled in production, but they can be
|
// These should not be enabled in production, but they can be
|
||||||
// intensely useful during development for finding certain kinds of
|
// intensely useful during development for finding certain kinds of
|
||||||
@@ -184,21 +191,10 @@ LLPumpIO::LLPumpIO(void) :
|
|||||||
LLPumpIO::~LLPumpIO()
|
LLPumpIO::~LLPumpIO()
|
||||||
{
|
{
|
||||||
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
||||||
#if LL_THREADS_APR
|
cleanup();
|
||||||
if (mChainsMutex) apr_thread_mutex_destroy(mChainsMutex);
|
|
||||||
if (mCallbackMutex) apr_thread_mutex_destroy(mCallbackMutex);
|
|
||||||
#endif
|
|
||||||
mChainsMutex = NULL;
|
|
||||||
mCallbackMutex = NULL;
|
|
||||||
if(mPollset)
|
|
||||||
{
|
|
||||||
// lldebugs << "cleaning up pollset" << llendl;
|
|
||||||
apr_pollset_destroy(mPollset);
|
|
||||||
mPollset = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request)
|
bool LLPumpIO::addChain(const chain_t& chain, F32 timeout)
|
||||||
{
|
{
|
||||||
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
||||||
if(chain.empty()) return false;
|
if(chain.empty()) return false;
|
||||||
@@ -207,10 +203,8 @@ bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request
|
|||||||
LLScopedLock lock(mChainsMutex);
|
LLScopedLock lock(mChainsMutex);
|
||||||
#endif
|
#endif
|
||||||
LLChainInfo info;
|
LLChainInfo info;
|
||||||
info.mHasCurlRequest = has_curl_request;
|
|
||||||
info.setTimeoutSeconds(timeout);
|
info.setTimeoutSeconds(timeout);
|
||||||
info.mData = LLIOPipe::buffer_ptr_t(new LLBufferArray);
|
info.mData = LLIOPipe::buffer_ptr_t(new LLBufferArray);
|
||||||
info.mData->setThreaded(has_curl_request);
|
|
||||||
LLLinkInfo link;
|
LLLinkInfo link;
|
||||||
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
|
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
|
||||||
lldebugs << "LLPumpIO::addChain() " << chain[0] << " '"
|
lldebugs << "LLPumpIO::addChain() " << chain[0] << " '"
|
||||||
@@ -444,15 +438,6 @@ void LLPumpIO::pump()
|
|||||||
|
|
||||||
static LLFastTimer::DeclareTimer FTM_PUMP_IO("Pump IO");
|
static LLFastTimer::DeclareTimer FTM_PUMP_IO("Pump IO");
|
||||||
|
|
||||||
LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t& run_chain)
|
|
||||||
{
|
|
||||||
std::for_each(
|
|
||||||
(*run_chain).mDescriptors.begin(),
|
|
||||||
(*run_chain).mDescriptors.end(),
|
|
||||||
ll_delete_apr_pollset_fd_client_data());
|
|
||||||
return mRunningChains.erase(run_chain);
|
|
||||||
}
|
|
||||||
|
|
||||||
//timeout is in microseconds
|
//timeout is in microseconds
|
||||||
void LLPumpIO::pump(const S32& poll_timeout)
|
void LLPumpIO::pump(const S32& poll_timeout)
|
||||||
{
|
{
|
||||||
@@ -598,16 +583,10 @@ void LLPumpIO::pump(const S32& poll_timeout)
|
|||||||
// << (*run_chain).mChainLinks[0].mPipe
|
// << (*run_chain).mChainLinks[0].mPipe
|
||||||
// << " because we reached the end." << llendl;
|
// << " because we reached the end." << llendl;
|
||||||
#endif
|
#endif
|
||||||
run_chain = removeRunningChain(run_chain);
|
run_chain = mRunningChains.erase(run_chain);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(isChainExpired(*run_chain))
|
|
||||||
{
|
|
||||||
run_chain = removeRunningChain(run_chain);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
PUMP_DEBUG;
|
PUMP_DEBUG;
|
||||||
if((*run_chain).mLock)
|
if((*run_chain).mLock)
|
||||||
{
|
{
|
||||||
@@ -715,7 +694,11 @@ void LLPumpIO::pump(const S32& poll_timeout)
|
|||||||
PUMP_DEBUG;
|
PUMP_DEBUG;
|
||||||
// This chain is done. Clean up any allocated memory and
|
// This chain is done. Clean up any allocated memory and
|
||||||
// erase the chain info.
|
// erase the chain info.
|
||||||
run_chain = removeRunningChain(run_chain);
|
std::for_each(
|
||||||
|
(*run_chain).mDescriptors.begin(),
|
||||||
|
(*run_chain).mDescriptors.end(),
|
||||||
|
ll_delete_apr_pollset_fd_client_data());
|
||||||
|
run_chain = mRunningChains.erase(run_chain);
|
||||||
|
|
||||||
// *NOTE: may not always need to rebuild the pollset.
|
// *NOTE: may not always need to rebuild the pollset.
|
||||||
mRebuildPollset = true;
|
mRebuildPollset = true;
|
||||||
@@ -850,6 +833,22 @@ void LLPumpIO::initialize(void)
|
|||||||
apr_thread_mutex_create(&mCallbackMutex, APR_THREAD_MUTEX_UNNESTED, mPool());
|
apr_thread_mutex_create(&mCallbackMutex, APR_THREAD_MUTEX_UNNESTED, mPool());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
void LLPumpIO::cleanup()
|
||||||
|
{
|
||||||
|
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
||||||
|
#if LL_THREADS_APR
|
||||||
|
if (mChainsMutex) apr_thread_mutex_destroy(mChainsMutex);
|
||||||
|
if (mCallbackMutex) apr_thread_mutex_destroy(mCallbackMutex);
|
||||||
|
#endif
|
||||||
|
mChainsMutex = NULL;
|
||||||
|
mCallbackMutex = NULL;
|
||||||
|
if(mPollset)
|
||||||
|
{
|
||||||
|
// lldebugs << "cleaning up pollset" << llendl;
|
||||||
|
apr_pollset_destroy(mPollset);
|
||||||
|
mPollset = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LLPumpIO::rebuildPollset()
|
void LLPumpIO::rebuildPollset()
|
||||||
{
|
{
|
||||||
@@ -1084,24 +1083,6 @@ void LLPumpIO::processChain(LLChainInfo& chain)
|
|||||||
PUMP_DEBUG;
|
PUMP_DEBUG;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLPumpIO::isChainExpired(LLChainInfo& chain)
|
|
||||||
{
|
|
||||||
if(!chain.mHasCurlRequest)
|
|
||||||
{
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(links_t::iterator iter = chain.mChainLinks.begin(); iter != chain.mChainLinks.end(); ++iter)
|
|
||||||
{
|
|
||||||
if(!(*iter).mPipe->isValid())
|
|
||||||
{
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LLPumpIO::handleChainError(
|
bool LLPumpIO::handleChainError(
|
||||||
LLChainInfo& chain,
|
LLChainInfo& chain,
|
||||||
LLIOPipe::EStatus error)
|
LLIOPipe::EStatus error)
|
||||||
@@ -1143,9 +1124,6 @@ bool LLPumpIO::handleChainError(
|
|||||||
#endif
|
#endif
|
||||||
keep_going = false;
|
keep_going = false;
|
||||||
break;
|
break;
|
||||||
case LLIOPipe::STATUS_EXPIRED:
|
|
||||||
keep_going = false;
|
|
||||||
break ;
|
|
||||||
default:
|
default:
|
||||||
if(LLIOPipe::isSuccess(error))
|
if(LLIOPipe::isSuccess(error))
|
||||||
{
|
{
|
||||||
@@ -1168,7 +1146,6 @@ LLPumpIO::LLChainInfo::LLChainInfo() :
|
|||||||
mInit(false),
|
mInit(false),
|
||||||
mLock(0),
|
mLock(0),
|
||||||
mEOS(false),
|
mEOS(false),
|
||||||
mHasCurlRequest(false),
|
|
||||||
mDescriptorsPool(new LLAPRPool(LLThread::tldata().mRootPool))
|
mDescriptorsPool(new LLAPRPool(LLThread::tldata().mRootPool))
|
||||||
{
|
{
|
||||||
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
||||||
@@ -1180,9 +1157,7 @@ void LLPumpIO::LLChainInfo::setTimeoutSeconds(F32 timeout)
|
|||||||
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
||||||
if(timeout > 0.0f)
|
if(timeout > 0.0f)
|
||||||
{
|
{
|
||||||
mTimer.start();
|
mTimer.start(timeout);
|
||||||
mTimer.reset();
|
|
||||||
mTimer.setTimerExpirySec(timeout);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,25 +4,31 @@
|
|||||||
* @date 2004-11-19
|
* @date 2004-11-19
|
||||||
* @brief Declaration of pump class which manages io chains.
|
* @brief Declaration of pump class which manages io chains.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2004&license=viewergpl$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2009, Linden Research, Inc.
|
||||||
|
*
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* Copyright (C) 2010, Linden Research, Inc.
|
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||||
|
* to you under the terms of the GNU General Public License, version 2.0
|
||||||
|
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||||
|
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||||
|
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||||
|
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* There are special exceptions to the terms and conditions of the GPL as
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* it is applied to this Source Code. View the full text of the exception
|
||||||
* License as published by the Free Software Foundation;
|
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||||
* version 2.1 of the License only.
|
* online at
|
||||||
|
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* By copying, modifying or distributing this software, you acknowledge
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* that you have read and understood your obligations described above,
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* and agree to abide by those obligations.
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||||
* License along with this library; if not, write to the Free Software
|
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* COMPLETENESS OR PERFORMANCE.
|
||||||
*
|
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -100,10 +106,9 @@ public:
|
|||||||
* @param chain The pipes for the chain
|
* @param chain The pipes for the chain
|
||||||
* @param timeout The number of seconds in the future to
|
* @param timeout The number of seconds in the future to
|
||||||
* expire. Pass in 0.0f to never expire.
|
* expire. Pass in 0.0f to never expire.
|
||||||
* @param has_curl_request The chain contains LLURLRequest if true.
|
|
||||||
* @return Returns true if anything was added to the pump.
|
* @return Returns true if anything was added to the pump.
|
||||||
*/
|
*/
|
||||||
bool addChain(const chain_t& chain, F32 timeout, bool has_curl_request = false);
|
bool addChain(const chain_t& chain, F32 timeout);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Struct to associate a pipe with it's buffer io indexes.
|
* @brief Struct to associate a pipe with it's buffer io indexes.
|
||||||
@@ -346,13 +351,12 @@ protected:
|
|||||||
|
|
||||||
// basic member data
|
// basic member data
|
||||||
bool mInit;
|
bool mInit;
|
||||||
bool mEOS;
|
|
||||||
bool mHasCurlRequest;
|
|
||||||
S32 mLock;
|
S32 mLock;
|
||||||
LLFrameTimer mTimer;
|
LLFrameTimer mTimer;
|
||||||
links_t::iterator mHead;
|
links_t::iterator mHead;
|
||||||
links_t mChainLinks;
|
links_t mChainLinks;
|
||||||
LLIOPipe::buffer_ptr_t mData;
|
LLIOPipe::buffer_ptr_t mData;
|
||||||
|
bool mEOS;
|
||||||
LLSD mContext;
|
LLSD mContext;
|
||||||
|
|
||||||
// tracking inside the pump
|
// tracking inside the pump
|
||||||
@@ -393,8 +397,8 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initialize();
|
void initialize();
|
||||||
|
void cleanup();
|
||||||
|
|
||||||
current_chain_t removeRunningChain(current_chain_t& chain) ;
|
|
||||||
/**
|
/**
|
||||||
* @brief Given the internal state of the chains, rebuild the pollset
|
* @brief Given the internal state of the chains, rebuild the pollset
|
||||||
* @see setConditional()
|
* @see setConditional()
|
||||||
@@ -421,9 +425,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
bool handleChainError(LLChainInfo& chain, LLIOPipe::EStatus error);
|
bool handleChainError(LLChainInfo& chain, LLIOPipe::EStatus error);
|
||||||
|
|
||||||
//if the chain is expired, remove it
|
|
||||||
bool isChainExpired(LLChainInfo& chain) ;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Return number of running chains.
|
* @brief Return number of running chains.
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ bool LLSDMessage::httpListener(const LLSD& request)
|
|||||||
request,
|
request,
|
||||||
url, "POST", reply, error),
|
url, "POST", reply, error),
|
||||||
LLSD(), // headers
|
LLSD(), // headers
|
||||||
timeout);
|
(F32)timeout);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data)
|
|||||||
|
|
||||||
// S64 not supported in LLSD so we just truncate it
|
// S64 not supported in LLSD so we just truncate it
|
||||||
case MVT_S64:
|
case MVT_S64:
|
||||||
addS32(varname, *(S64*)mvci.getData());
|
addS32(varname, (S32)*(S64*)mvci.getData());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MVT_F32:
|
case MVT_F32:
|
||||||
|
|||||||
@@ -32,17 +32,17 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <openssl/x509_vfy.h>
|
#include <openssl/x509_vfy.h>
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
|
|
||||||
#include "llcurl.h"
|
#include "llcurl.h"
|
||||||
#include "llfasttimer.h"
|
|
||||||
#include "llioutil.h"
|
#include "llioutil.h"
|
||||||
#include "llmemtype.h"
|
#include "llmemtype.h"
|
||||||
#include "llproxy.h"
|
|
||||||
#include "llpumpio.h"
|
#include "llpumpio.h"
|
||||||
#include "llsd.h"
|
#include "llsd.h"
|
||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
#include "apr_env.h"
|
#include "apr_env.h"
|
||||||
#include "llapr.h"
|
#include "llapr.h"
|
||||||
#include "llscopedvolatileaprpool.h"
|
#include "llscopedvolatileaprpool.h"
|
||||||
|
#include "llfasttimer.h"
|
||||||
static const U32 HTTP_STATUS_PIPE_ERROR = 499;
|
static const U32 HTTP_STATUS_PIPE_ERROR = 499;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
~LLURLRequestDetail();
|
~LLURLRequestDetail();
|
||||||
std::string mURL;
|
std::string mURL;
|
||||||
LLCurlEasyRequest* mCurlRequest;
|
LLCurlEasyRequest* mCurlRequest;
|
||||||
LLIOPipe::buffer_ptr_t mResponseBuffer;
|
LLBufferArray* mResponseBuffer;
|
||||||
LLChannelDescriptors mChannels;
|
LLChannelDescriptors mChannels;
|
||||||
U8* mLastRead;
|
U8* mLastRead;
|
||||||
U32 mBodyLimit;
|
U32 mBodyLimit;
|
||||||
@@ -77,26 +77,21 @@ public:
|
|||||||
|
|
||||||
LLURLRequestDetail::LLURLRequestDetail() :
|
LLURLRequestDetail::LLURLRequestDetail() :
|
||||||
mCurlRequest(NULL),
|
mCurlRequest(NULL),
|
||||||
|
mResponseBuffer(NULL),
|
||||||
mLastRead(NULL),
|
mLastRead(NULL),
|
||||||
mBodyLimit(0),
|
mBodyLimit(0),
|
||||||
mByteAccumulator(0),
|
mByteAccumulator(0),
|
||||||
mIsBodyLimitSet(false),
|
mIsBodyLimitSet(false)
|
||||||
mSSLVerifyCallback(NULL)
|
|
||||||
{
|
{
|
||||||
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
||||||
mCurlRequest = new LLCurlEasyRequest();
|
mCurlRequest = new LLCurlEasyRequest();
|
||||||
|
|
||||||
if(!mCurlRequest->isValid()) //failed.
|
|
||||||
{
|
|
||||||
delete mCurlRequest ;
|
|
||||||
mCurlRequest = NULL ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LLURLRequestDetail::~LLURLRequestDetail()
|
LLURLRequestDetail::~LLURLRequestDetail()
|
||||||
{
|
{
|
||||||
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
||||||
delete mCurlRequest;
|
delete mCurlRequest;
|
||||||
|
mResponseBuffer = NULL;
|
||||||
mLastRead = NULL;
|
mLastRead = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +100,7 @@ void LLURLRequest::setSSLVerifyCallback(SSLCertVerifyCallback callback, void *pa
|
|||||||
mDetail->mSSLVerifyCallback = callback;
|
mDetail->mSSLVerifyCallback = callback;
|
||||||
mDetail->mCurlRequest->setSSLCtxCallback(LLURLRequest::_sslCtxCallback, (void *)this);
|
mDetail->mCurlRequest->setSSLCtxCallback(LLURLRequest::_sslCtxCallback, (void *)this);
|
||||||
mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, true);
|
mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, true);
|
||||||
mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, 2);
|
mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -114,7 +109,7 @@ void LLURLRequest::setSSLVerifyCallback(SSLCertVerifyCallback callback, void *pa
|
|||||||
// used to configure the context for custom cert validation
|
// used to configure the context for custom cert validation
|
||||||
|
|
||||||
CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param)
|
CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param)
|
||||||
{
|
{
|
||||||
LLURLRequest *req = (LLURLRequest *)param;
|
LLURLRequest *req = (LLURLRequest *)param;
|
||||||
if(req == NULL || req->mDetail->mSSLVerifyCallback == NULL)
|
if(req == NULL || req->mDetail->mSSLVerifyCallback == NULL)
|
||||||
{
|
{
|
||||||
@@ -128,7 +123,6 @@ CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param)
|
|||||||
SSL_CTX_set_cert_verify_callback(ctx, req->mDetail->mSSLVerifyCallback, (void *)req);
|
SSL_CTX_set_cert_verify_callback(ctx, req->mDetail->mSSLVerifyCallback, (void *)req);
|
||||||
// the calls are void
|
// the calls are void
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -189,7 +183,6 @@ std::string LLURLRequest::getURL() const
|
|||||||
{
|
{
|
||||||
return mDetail->mURL;
|
return mDetail->mURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLURLRequest::addHeader(const char* header)
|
void LLURLRequest::addHeader(const char* header)
|
||||||
{
|
{
|
||||||
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
||||||
@@ -240,9 +233,9 @@ void LLURLRequest::useProxy(bool use_proxy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lldebugs << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = \"" << env_proxy << "\"" << llendl;
|
LL_DEBUGS("Proxy") << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << (!env_proxy.empty() ? env_proxy : "(null)") << LL_ENDL;
|
||||||
|
|
||||||
if (use_proxy)
|
if (use_proxy && !env_proxy.empty())
|
||||||
{
|
{
|
||||||
mDetail->mCurlRequest->setoptString(CURLOPT_PROXY, env_proxy);
|
mDetail->mCurlRequest->setoptString(CURLOPT_PROXY, env_proxy);
|
||||||
}
|
}
|
||||||
@@ -262,24 +255,12 @@ void LLURLRequest::allowCookies()
|
|||||||
mDetail->mCurlRequest->setoptString(CURLOPT_COOKIEFILE, "");
|
mDetail->mCurlRequest->setoptString(CURLOPT_COOKIEFILE, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
//virtual
|
|
||||||
bool LLURLRequest::isValid()
|
|
||||||
{
|
|
||||||
return mDetail->mCurlRequest && mDetail->mCurlRequest->isValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
LLIOPipe::EStatus LLURLRequest::handleError(
|
LLIOPipe::EStatus LLURLRequest::handleError(
|
||||||
LLIOPipe::EStatus status,
|
LLIOPipe::EStatus status,
|
||||||
LLPumpIO* pump)
|
LLPumpIO* pump)
|
||||||
{
|
{
|
||||||
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
||||||
|
|
||||||
if(!isValid())
|
|
||||||
{
|
|
||||||
return STATUS_EXPIRED ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mCompletionCallback && pump)
|
if(mCompletionCallback && pump)
|
||||||
{
|
{
|
||||||
LLURLRequestComplete* complete = NULL;
|
LLURLRequestComplete* complete = NULL;
|
||||||
@@ -309,7 +290,8 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
|
|||||||
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
||||||
//llinfos << "LLURLRequest::process_impl()" << llendl;
|
//llinfos << "LLURLRequest::process_impl()" << llendl;
|
||||||
if (!buffer) return STATUS_ERROR;
|
if (!buffer) return STATUS_ERROR;
|
||||||
|
if (!mDetail) return STATUS_ERROR; //Seems to happen on occasion. Need to hunt down why.
|
||||||
|
|
||||||
// we're still waiting or prcessing, check how many
|
// we're still waiting or prcessing, check how many
|
||||||
// bytes we have accumulated.
|
// bytes we have accumulated.
|
||||||
const S32 MIN_ACCUMULATION = 100000;
|
const S32 MIN_ACCUMULATION = 100000;
|
||||||
@@ -348,7 +330,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
|
|||||||
|
|
||||||
// *FIX: bit of a hack, but it should work. The configure and
|
// *FIX: bit of a hack, but it should work. The configure and
|
||||||
// callback method expect this information to be ready.
|
// callback method expect this information to be ready.
|
||||||
mDetail->mResponseBuffer = buffer;
|
mDetail->mResponseBuffer = buffer.get();
|
||||||
mDetail->mChannels = channels;
|
mDetail->mChannels = channels;
|
||||||
if(!configure())
|
if(!configure())
|
||||||
{
|
{
|
||||||
@@ -367,10 +349,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
|
|||||||
static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform");
|
static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform");
|
||||||
{
|
{
|
||||||
LLFastTimer t(FTM_URL_PERFORM);
|
LLFastTimer t(FTM_URL_PERFORM);
|
||||||
if(!mDetail->mCurlRequest->wait())
|
mDetail->mCurlRequest->perform();
|
||||||
{
|
|
||||||
return status ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
@@ -465,12 +444,6 @@ void LLURLRequest::initialize()
|
|||||||
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
||||||
mState = STATE_INITIALIZED;
|
mState = STATE_INITIALIZED;
|
||||||
mDetail = new LLURLRequestDetail;
|
mDetail = new LLURLRequestDetail;
|
||||||
|
|
||||||
if(!isValid())
|
|
||||||
{
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
mDetail->mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1);
|
mDetail->mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1);
|
||||||
mDetail->mCurlRequest->setWriteCallback(&downCallback, (void*)this);
|
mDetail->mCurlRequest->setWriteCallback(&downCallback, (void*)this);
|
||||||
mDetail->mCurlRequest->setReadCallback(&upCallback, (void*)this);
|
mDetail->mCurlRequest->setReadCallback(&upCallback, (void*)this);
|
||||||
|
|||||||
@@ -40,7 +40,6 @@
|
|||||||
#include "llerror.h"
|
#include "llerror.h"
|
||||||
#include "llcurl.h"
|
#include "llcurl.h"
|
||||||
|
|
||||||
|
|
||||||
extern const std::string CONTEXT_REQUEST;
|
extern const std::string CONTEXT_REQUEST;
|
||||||
extern const std::string CONTEXT_DEST_URI_SD_LABEL;
|
extern const std::string CONTEXT_DEST_URI_SD_LABEL;
|
||||||
extern const std::string CONTEXT_RESPONSE;
|
extern const std::string CONTEXT_RESPONSE;
|
||||||
@@ -145,7 +144,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setSSLVerifyCallback(SSLCertVerifyCallback callback, void * param);
|
void setSSLVerifyCallback(SSLCertVerifyCallback callback, void * param);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return at most size bytes of body.
|
* @brief Return at most size bytes of body.
|
||||||
*
|
*
|
||||||
@@ -190,14 +188,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void allowCookies();
|
void allowCookies();
|
||||||
|
|
||||||
/*virtual*/ bool isValid() ;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Give this pipe a chance to handle a generated error
|
* @brief Give this pipe a chance to handle a generated error
|
||||||
*/
|
*/
|
||||||
virtual EStatus handleError(EStatus status, LLPumpIO* pump);
|
virtual EStatus handleError(EStatus status, LLPumpIO* pump);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@@ -223,11 +218,11 @@ protected:
|
|||||||
ERequestAction mAction;
|
ERequestAction mAction;
|
||||||
LLURLRequestDetail* mDetail;
|
LLURLRequestDetail* mDetail;
|
||||||
LLIOPipe::ptr_t mCompletionCallback;
|
LLIOPipe::ptr_t mCompletionCallback;
|
||||||
S32 mRequestTransferedBytes;
|
S32 mRequestTransferedBytes;
|
||||||
S32 mResponseTransferedBytes;
|
S32 mResponseTransferedBytes;
|
||||||
|
|
||||||
static CURLcode _sslCtxCallback(CURL * curl, void *sslctx, void *param);
|
static CURLcode _sslCtxCallback(CURL * curl, void *sslctx, void *param);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the object. Called during construction.
|
* @brief Initialize the object. Called during construction.
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "lltimer.h"
|
#include "lltimer.h"
|
||||||
|
#include "llextendedstatus.h"
|
||||||
|
|
||||||
const S32 LL_XFER_LARGE_PAYLOAD = 7680;
|
const S32 LL_XFER_LARGE_PAYLOAD = 7680;
|
||||||
|
|
||||||
|
|||||||
@@ -97,10 +97,8 @@ std::string get_shared_secret();
|
|||||||
class LLMessagePollInfo
|
class LLMessagePollInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLMessagePollInfo(void) : mPool(LLThread::tldata().mRootPool) { }
|
|
||||||
apr_socket_t *mAPRSocketp;
|
apr_socket_t *mAPRSocketp;
|
||||||
apr_pollfd_t mPollFD;
|
apr_pollfd_t mPollFD;
|
||||||
LLAPRPool mPool;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -289,13 +287,15 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
|
|||||||
}
|
}
|
||||||
// LL_DEBUGS("Messaging") << << "*** port: " << mPort << llendl;
|
// LL_DEBUGS("Messaging") << << "*** port: " << mPort << llendl;
|
||||||
|
|
||||||
mPollInfop = new LLMessagePollInfo;
|
//
|
||||||
|
// Create the data structure that we can poll on
|
||||||
|
//
|
||||||
apr_socket_t *aprSocketp = NULL;
|
apr_socket_t *aprSocketp = NULL;
|
||||||
apr_os_sock_put(&aprSocketp, (apr_os_sock_t*)&mSocket, mPollInfop->mPool());
|
apr_os_sock_put(&aprSocketp, (apr_os_sock_t*)&mSocket, LLAPRRootPool::get()());
|
||||||
|
|
||||||
|
mPollInfop = new LLMessagePollInfo;
|
||||||
mPollInfop->mAPRSocketp = aprSocketp;
|
mPollInfop->mAPRSocketp = aprSocketp;
|
||||||
mPollInfop->mPollFD.p = mPollInfop->mPool();
|
mPollInfop->mPollFD.p = LLAPRRootPool::get()();
|
||||||
mPollInfop->mPollFD.desc_type = APR_POLL_SOCKET;
|
mPollInfop->mPollFD.desc_type = APR_POLL_SOCKET;
|
||||||
mPollInfop->mPollFD.reqevents = APR_POLLIN;
|
mPollInfop->mPollFD.reqevents = APR_POLLIN;
|
||||||
mPollInfop->mPollFD.rtnevents = 0;
|
mPollInfop->mPollFD.rtnevents = 0;
|
||||||
@@ -3142,7 +3142,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi
|
|||||||
LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
|
LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 now = time(NULL);
|
U32 now = (U32)time(NULL);
|
||||||
|
|
||||||
now /= window;
|
now /= window;
|
||||||
|
|
||||||
@@ -3162,7 +3162,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
|
char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
|
||||||
U32 now = time(NULL);
|
U32 now = (U32)time(NULL);
|
||||||
|
|
||||||
now /= window;
|
now /= window;
|
||||||
|
|
||||||
@@ -3208,7 +3208,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co
|
|||||||
LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
|
LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 now = time(NULL);
|
U32 now = (U32)time(NULL);
|
||||||
|
|
||||||
now /= window;
|
now /= window;
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ set_target_properties(SLPlugin
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(SLPlugin
|
target_link_libraries(SLPlugin
|
||||||
${GOOGLE_PERFTOOLS_LIBRARIES}
|
|
||||||
${LLPLUGIN_LIBRARIES}
|
${LLPLUGIN_LIBRARIES}
|
||||||
${LLMESSAGE_LIBRARIES}
|
${LLMESSAGE_LIBRARIES}
|
||||||
${LLCOMMON_LIBRARIES}
|
${LLCOMMON_LIBRARIES}
|
||||||
@@ -82,11 +81,4 @@ if (DARWIN)
|
|||||||
)
|
)
|
||||||
endif (DARWIN)
|
endif (DARWIN)
|
||||||
|
|
||||||
if (WINDOWS)
|
|
||||||
set_target_properties(SLPlugin
|
|
||||||
PROPERTIES
|
|
||||||
LINK_FLAGS "${GOOGLE_PERFTOOLS_LINKER_FLAGS}"
|
|
||||||
)
|
|
||||||
endif (WINDOWS)
|
|
||||||
|
|
||||||
#ll_deploy_sharedlibs_command(SLPlugin)
|
#ll_deploy_sharedlibs_command(SLPlugin)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ include_directories(
|
|||||||
|
|
||||||
set(llprimitive_SOURCE_FILES
|
set(llprimitive_SOURCE_FILES
|
||||||
llmaterialtable.cpp
|
llmaterialtable.cpp
|
||||||
|
llmediaentry.cpp
|
||||||
llmodel.cpp
|
llmodel.cpp
|
||||||
llprimitive.cpp
|
llprimitive.cpp
|
||||||
llprimtexturelist.cpp
|
llprimtexturelist.cpp
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ void LLMaterialTable::initTableTransNames(std::map<std::string, std::string> nam
|
|||||||
infop->mName = namemap[name];
|
infop->mName = namemap[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLMaterialTable::initBasicTable()
|
void LLMaterialTable::initBasicTable()
|
||||||
{
|
{
|
||||||
// *TODO: Translate
|
// *TODO: Translate
|
||||||
|
|||||||
596
indra/llprimitive/llmediaentry.cpp
Normal file
596
indra/llprimitive/llmediaentry.cpp
Normal file
@@ -0,0 +1,596 @@
|
|||||||
|
/**
|
||||||
|
* @file llmediaentry.cpp
|
||||||
|
* @brief This is a single instance of media data related to the face of a prim
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&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 "linden_common.h"
|
||||||
|
#include "llmediaentry.h"
|
||||||
|
#include "lllslconstants.h"
|
||||||
|
|
||||||
|
#include <boost/regex.hpp>
|
||||||
|
|
||||||
|
// LLSD key defines
|
||||||
|
// DO NOT REORDER OR REMOVE THESE!
|
||||||
|
|
||||||
|
// Some LLSD keys. Do not change!
|
||||||
|
#define MEDIA_ALT_IMAGE_ENABLE_KEY_STR "alt_image_enable"
|
||||||
|
#define MEDIA_CONTROLS_KEY_STR "controls"
|
||||||
|
#define MEDIA_CURRENT_URL_KEY_STR "current_url"
|
||||||
|
#define MEDIA_HOME_URL_KEY_STR "home_url"
|
||||||
|
#define MEDIA_AUTO_LOOP_KEY_STR "auto_loop"
|
||||||
|
#define MEDIA_AUTO_PLAY_KEY_STR "auto_play"
|
||||||
|
#define MEDIA_AUTO_SCALE_KEY_STR "auto_scale"
|
||||||
|
#define MEDIA_AUTO_ZOOM_KEY_STR "auto_zoom"
|
||||||
|
#define MEDIA_FIRST_CLICK_INTERACT_KEY_STR "first_click_interact"
|
||||||
|
#define MEDIA_WIDTH_PIXELS_KEY_STR "width_pixels"
|
||||||
|
#define MEDIA_HEIGHT_PIXELS_KEY_STR "height_pixels"
|
||||||
|
|
||||||
|
// "security" fields
|
||||||
|
#define MEDIA_WHITELIST_ENABLE_KEY_STR "whitelist_enable"
|
||||||
|
#define MEDIA_WHITELIST_KEY_STR "whitelist"
|
||||||
|
|
||||||
|
// "permissions" fields
|
||||||
|
#define MEDIA_PERMS_INTERACT_KEY_STR "perms_interact"
|
||||||
|
#define MEDIA_PERMS_CONTROL_KEY_STR "perms_control"
|
||||||
|
|
||||||
|
// "general" fields
|
||||||
|
const char* LLMediaEntry::ALT_IMAGE_ENABLE_KEY = MEDIA_ALT_IMAGE_ENABLE_KEY_STR;
|
||||||
|
const char* LLMediaEntry::CONTROLS_KEY = MEDIA_CONTROLS_KEY_STR;
|
||||||
|
const char* LLMediaEntry::CURRENT_URL_KEY = MEDIA_CURRENT_URL_KEY_STR;
|
||||||
|
const char* LLMediaEntry::HOME_URL_KEY = MEDIA_HOME_URL_KEY_STR;
|
||||||
|
const char* LLMediaEntry::AUTO_LOOP_KEY = MEDIA_AUTO_LOOP_KEY_STR;
|
||||||
|
const char* LLMediaEntry::AUTO_PLAY_KEY = MEDIA_AUTO_PLAY_KEY_STR;
|
||||||
|
const char* LLMediaEntry::AUTO_SCALE_KEY = MEDIA_AUTO_SCALE_KEY_STR;
|
||||||
|
const char* LLMediaEntry::AUTO_ZOOM_KEY = MEDIA_AUTO_ZOOM_KEY_STR;
|
||||||
|
const char* LLMediaEntry::FIRST_CLICK_INTERACT_KEY = MEDIA_FIRST_CLICK_INTERACT_KEY_STR;
|
||||||
|
const char* LLMediaEntry::WIDTH_PIXELS_KEY = MEDIA_WIDTH_PIXELS_KEY_STR;
|
||||||
|
const char* LLMediaEntry::HEIGHT_PIXELS_KEY = MEDIA_HEIGHT_PIXELS_KEY_STR;
|
||||||
|
|
||||||
|
// "security" fields
|
||||||
|
const char* LLMediaEntry::WHITELIST_ENABLE_KEY = MEDIA_WHITELIST_ENABLE_KEY_STR;
|
||||||
|
const char* LLMediaEntry::WHITELIST_KEY = MEDIA_WHITELIST_KEY_STR;
|
||||||
|
|
||||||
|
// "permissions" fields
|
||||||
|
const char* LLMediaEntry::PERMS_INTERACT_KEY = MEDIA_PERMS_INTERACT_KEY_STR;
|
||||||
|
const char* LLMediaEntry::PERMS_CONTROL_KEY = MEDIA_PERMS_CONTROL_KEY_STR;
|
||||||
|
|
||||||
|
#define DEFAULT_URL_PREFIX "http://"
|
||||||
|
|
||||||
|
// Constructor(s)
|
||||||
|
LLMediaEntry::LLMediaEntry() :
|
||||||
|
mAltImageEnable(false),
|
||||||
|
mControls(STANDARD),
|
||||||
|
mCurrentURL(""),
|
||||||
|
mHomeURL(""),
|
||||||
|
mAutoLoop(false),
|
||||||
|
mAutoPlay(false),
|
||||||
|
mAutoScale(false),
|
||||||
|
mAutoZoom(false),
|
||||||
|
mFirstClickInteract(false),
|
||||||
|
mWidthPixels(0),
|
||||||
|
mHeightPixels(0),
|
||||||
|
mWhiteListEnable(false),
|
||||||
|
// mWhiteList
|
||||||
|
mPermsInteract(PERM_ALL),
|
||||||
|
mPermsControl(PERM_ALL),
|
||||||
|
mMediaIDp(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LLMediaEntry::LLMediaEntry(const LLMediaEntry &rhs) :
|
||||||
|
mMediaIDp(NULL)
|
||||||
|
{
|
||||||
|
// "general" fields
|
||||||
|
mAltImageEnable = rhs.mAltImageEnable;
|
||||||
|
mControls = rhs.mControls;
|
||||||
|
mCurrentURL = rhs.mCurrentURL;
|
||||||
|
mHomeURL = rhs.mHomeURL;
|
||||||
|
mAutoLoop = rhs.mAutoLoop;
|
||||||
|
mAutoPlay = rhs.mAutoPlay;
|
||||||
|
mAutoScale = rhs.mAutoScale;
|
||||||
|
mAutoZoom = rhs.mAutoZoom;
|
||||||
|
mFirstClickInteract = rhs.mFirstClickInteract;
|
||||||
|
mWidthPixels = rhs.mWidthPixels;
|
||||||
|
mHeightPixels = rhs.mHeightPixels;
|
||||||
|
|
||||||
|
// "security" fields
|
||||||
|
mWhiteListEnable = rhs.mWhiteListEnable;
|
||||||
|
mWhiteList = rhs.mWhiteList;
|
||||||
|
|
||||||
|
// "permissions" fields
|
||||||
|
mPermsInteract = rhs.mPermsInteract;
|
||||||
|
mPermsControl = rhs.mPermsControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
LLMediaEntry::~LLMediaEntry()
|
||||||
|
{
|
||||||
|
if (NULL != mMediaIDp)
|
||||||
|
{
|
||||||
|
delete mMediaIDp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSD LLMediaEntry::asLLSD() const
|
||||||
|
{
|
||||||
|
LLSD sd;
|
||||||
|
asLLSD(sd);
|
||||||
|
return sd;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// LLSD functions
|
||||||
|
//
|
||||||
|
void LLMediaEntry::asLLSD(LLSD& sd) const
|
||||||
|
{
|
||||||
|
// "general" fields
|
||||||
|
sd[ALT_IMAGE_ENABLE_KEY] = mAltImageEnable;
|
||||||
|
sd[CONTROLS_KEY] = (LLSD::Integer)mControls;
|
||||||
|
sd[CURRENT_URL_KEY] = mCurrentURL;
|
||||||
|
sd[HOME_URL_KEY] = mHomeURL;
|
||||||
|
sd[AUTO_LOOP_KEY] = mAutoLoop;
|
||||||
|
sd[AUTO_PLAY_KEY] = mAutoPlay;
|
||||||
|
sd[AUTO_SCALE_KEY] = mAutoScale;
|
||||||
|
sd[AUTO_ZOOM_KEY] = mAutoZoom;
|
||||||
|
sd[FIRST_CLICK_INTERACT_KEY] = mFirstClickInteract;
|
||||||
|
sd[WIDTH_PIXELS_KEY] = mWidthPixels;
|
||||||
|
sd[HEIGHT_PIXELS_KEY] = mHeightPixels;
|
||||||
|
|
||||||
|
// "security" fields
|
||||||
|
sd[WHITELIST_ENABLE_KEY] = mWhiteListEnable;
|
||||||
|
sd.erase(WHITELIST_KEY);
|
||||||
|
for (U32 i=0; i<mWhiteList.size(); i++)
|
||||||
|
{
|
||||||
|
sd[WHITELIST_KEY].append(mWhiteList[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// "permissions" fields
|
||||||
|
sd[PERMS_INTERACT_KEY] = mPermsInteract;
|
||||||
|
sd[PERMS_CONTROL_KEY] = mPermsControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool LLMediaEntry::checkLLSD(const LLSD& sd)
|
||||||
|
{
|
||||||
|
if (sd.isUndefined()) return true;
|
||||||
|
LLMediaEntry temp;
|
||||||
|
return temp.fromLLSDInternal(sd, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLMediaEntry::fromLLSD(const LLSD& sd)
|
||||||
|
{
|
||||||
|
(void)fromLLSDInternal(sd, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLMediaEntry::mergeFromLLSD(const LLSD& sd)
|
||||||
|
{
|
||||||
|
(void)fromLLSDInternal(sd, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// *NOTE: returns true if NO failures to set occurred, false otherwise.
|
||||||
|
// However, be aware that if a failure to set does occur, it does
|
||||||
|
// not stop setting fields from the LLSD!
|
||||||
|
bool LLMediaEntry::fromLLSDInternal(const LLSD& sd, bool overwrite)
|
||||||
|
{
|
||||||
|
// *HACK: we sort of cheat here and assume that status is a
|
||||||
|
// bit field. We "or" into status and instead of returning
|
||||||
|
// it, we return whether it finishes off as LSL_STATUS_OK or not.
|
||||||
|
U32 status = LSL_STATUS_OK;
|
||||||
|
|
||||||
|
// "general" fields
|
||||||
|
if ( overwrite || sd.has(ALT_IMAGE_ENABLE_KEY) )
|
||||||
|
{
|
||||||
|
status |= setAltImageEnable( sd[ALT_IMAGE_ENABLE_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(CONTROLS_KEY) )
|
||||||
|
{
|
||||||
|
status |= setControls( (MediaControls)(LLSD::Integer)sd[CONTROLS_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(CURRENT_URL_KEY) )
|
||||||
|
{
|
||||||
|
// Don't check whitelist
|
||||||
|
status |= setCurrentURLInternal( sd[CURRENT_URL_KEY], false );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(HOME_URL_KEY) )
|
||||||
|
{
|
||||||
|
status |= setHomeURL( sd[HOME_URL_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(AUTO_LOOP_KEY) )
|
||||||
|
{
|
||||||
|
status |= setAutoLoop( sd[AUTO_LOOP_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(AUTO_PLAY_KEY) )
|
||||||
|
{
|
||||||
|
status |= setAutoPlay( sd[AUTO_PLAY_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(AUTO_SCALE_KEY) )
|
||||||
|
{
|
||||||
|
status |= setAutoScale( sd[AUTO_SCALE_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(AUTO_ZOOM_KEY) )
|
||||||
|
{
|
||||||
|
status |= setAutoZoom( sd[AUTO_ZOOM_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(FIRST_CLICK_INTERACT_KEY) )
|
||||||
|
{
|
||||||
|
status |= setFirstClickInteract( sd[FIRST_CLICK_INTERACT_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(WIDTH_PIXELS_KEY) )
|
||||||
|
{
|
||||||
|
status |= setWidthPixels( (LLSD::Integer)sd[WIDTH_PIXELS_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(HEIGHT_PIXELS_KEY) )
|
||||||
|
{
|
||||||
|
status |= setHeightPixels( (LLSD::Integer)sd[HEIGHT_PIXELS_KEY] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// "security" fields
|
||||||
|
if ( overwrite || sd.has(WHITELIST_ENABLE_KEY) )
|
||||||
|
{
|
||||||
|
status |= setWhiteListEnable( sd[WHITELIST_ENABLE_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(WHITELIST_KEY) )
|
||||||
|
{
|
||||||
|
status |= setWhiteList( sd[WHITELIST_KEY] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// "permissions" fields
|
||||||
|
if ( overwrite || sd.has(PERMS_INTERACT_KEY) )
|
||||||
|
{
|
||||||
|
status |= setPermsInteract( 0xff & (LLSD::Integer)sd[PERMS_INTERACT_KEY] );
|
||||||
|
}
|
||||||
|
if ( overwrite || sd.has(PERMS_CONTROL_KEY) )
|
||||||
|
{
|
||||||
|
status |= setPermsControl( 0xff & (LLSD::Integer)sd[PERMS_CONTROL_KEY] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return LSL_STATUS_OK == status;
|
||||||
|
}
|
||||||
|
|
||||||
|
LLMediaEntry& LLMediaEntry::operator=(const LLMediaEntry &rhs)
|
||||||
|
{
|
||||||
|
if (this != &rhs)
|
||||||
|
{
|
||||||
|
// "general" fields
|
||||||
|
mAltImageEnable = rhs.mAltImageEnable;
|
||||||
|
mControls = rhs.mControls;
|
||||||
|
mCurrentURL = rhs.mCurrentURL;
|
||||||
|
mHomeURL = rhs.mHomeURL;
|
||||||
|
mAutoLoop = rhs.mAutoLoop;
|
||||||
|
mAutoPlay = rhs.mAutoPlay;
|
||||||
|
mAutoScale = rhs.mAutoScale;
|
||||||
|
mAutoZoom = rhs.mAutoZoom;
|
||||||
|
mFirstClickInteract = rhs.mFirstClickInteract;
|
||||||
|
mWidthPixels = rhs.mWidthPixels;
|
||||||
|
mHeightPixels = rhs.mHeightPixels;
|
||||||
|
|
||||||
|
// "security" fields
|
||||||
|
mWhiteListEnable = rhs.mWhiteListEnable;
|
||||||
|
mWhiteList = rhs.mWhiteList;
|
||||||
|
|
||||||
|
// "permissions" fields
|
||||||
|
mPermsInteract = rhs.mPermsInteract;
|
||||||
|
mPermsControl = rhs.mPermsControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LLMediaEntry::operator==(const LLMediaEntry &rhs) const
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
// "general" fields
|
||||||
|
mAltImageEnable == rhs.mAltImageEnable &&
|
||||||
|
mControls == rhs.mControls &&
|
||||||
|
mCurrentURL == rhs.mCurrentURL &&
|
||||||
|
mHomeURL == rhs.mHomeURL &&
|
||||||
|
mAutoLoop == rhs.mAutoLoop &&
|
||||||
|
mAutoPlay == rhs.mAutoPlay &&
|
||||||
|
mAutoScale == rhs.mAutoScale &&
|
||||||
|
mAutoZoom == rhs.mAutoZoom &&
|
||||||
|
mFirstClickInteract == rhs.mFirstClickInteract &&
|
||||||
|
mWidthPixels == rhs.mWidthPixels &&
|
||||||
|
mHeightPixels == rhs.mHeightPixels &&
|
||||||
|
|
||||||
|
// "security" fields
|
||||||
|
mWhiteListEnable == rhs.mWhiteListEnable &&
|
||||||
|
mWhiteList == rhs.mWhiteList &&
|
||||||
|
|
||||||
|
// "permissions" fields
|
||||||
|
mPermsInteract == rhs.mPermsInteract &&
|
||||||
|
mPermsControl == rhs.mPermsControl
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LLMediaEntry::operator!=(const LLMediaEntry &rhs) const
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
// "general" fields
|
||||||
|
mAltImageEnable != rhs.mAltImageEnable ||
|
||||||
|
mControls != rhs.mControls ||
|
||||||
|
mCurrentURL != rhs.mCurrentURL ||
|
||||||
|
mHomeURL != rhs.mHomeURL ||
|
||||||
|
mAutoLoop != rhs.mAutoLoop ||
|
||||||
|
mAutoPlay != rhs.mAutoPlay ||
|
||||||
|
mAutoScale != rhs.mAutoScale ||
|
||||||
|
mAutoZoom != rhs.mAutoZoom ||
|
||||||
|
mFirstClickInteract != rhs.mFirstClickInteract ||
|
||||||
|
mWidthPixels != rhs.mWidthPixels ||
|
||||||
|
mHeightPixels != rhs.mHeightPixels ||
|
||||||
|
|
||||||
|
// "security" fields
|
||||||
|
mWhiteListEnable != rhs.mWhiteListEnable ||
|
||||||
|
mWhiteList != rhs.mWhiteList ||
|
||||||
|
|
||||||
|
// "permissions" fields
|
||||||
|
mPermsInteract != rhs.mPermsInteract ||
|
||||||
|
mPermsControl != rhs.mPermsControl
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setWhiteList( const std::vector<std::string> &whitelist )
|
||||||
|
{
|
||||||
|
// *NOTE: This code is VERY similar to the setWhitelist below.
|
||||||
|
// IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER!
|
||||||
|
U32 size = 0;
|
||||||
|
U32 count = 0;
|
||||||
|
// First count to make sure the size constraint is not violated
|
||||||
|
std::vector<std::string>::const_iterator iter = whitelist.begin();
|
||||||
|
std::vector<std::string>::const_iterator end = whitelist.end();
|
||||||
|
for ( ; iter < end; ++iter)
|
||||||
|
{
|
||||||
|
const std::string &entry = (*iter);
|
||||||
|
size += entry.length() + 1; // Include one for \0
|
||||||
|
count ++;
|
||||||
|
if (size > MAX_WHITELIST_SIZE || count > MAX_WHITELIST_COUNT)
|
||||||
|
{
|
||||||
|
return LSL_STATUS_BOUNDS_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Next clear the vector
|
||||||
|
mWhiteList.clear();
|
||||||
|
// Then re-iterate and copy entries
|
||||||
|
iter = whitelist.begin();
|
||||||
|
for ( ; iter < end; ++iter)
|
||||||
|
{
|
||||||
|
const std::string &entry = (*iter);
|
||||||
|
mWhiteList.push_back(entry);
|
||||||
|
}
|
||||||
|
return LSL_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setWhiteList( const LLSD &whitelist )
|
||||||
|
{
|
||||||
|
// If whitelist is undef, the whitelist is cleared
|
||||||
|
if (whitelist.isUndefined())
|
||||||
|
{
|
||||||
|
mWhiteList.clear();
|
||||||
|
return LSL_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// However, if the whitelist is an empty array, erase it.
|
||||||
|
if (whitelist.isArray())
|
||||||
|
{
|
||||||
|
// *NOTE: This code is VERY similar to the setWhitelist above.
|
||||||
|
// IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER!
|
||||||
|
U32 size = 0;
|
||||||
|
U32 count = 0;
|
||||||
|
// First check to make sure the size and count constraints are not violated
|
||||||
|
LLSD::array_const_iterator iter = whitelist.beginArray();
|
||||||
|
LLSD::array_const_iterator end = whitelist.endArray();
|
||||||
|
for ( ; iter < end; ++iter)
|
||||||
|
{
|
||||||
|
const std::string &entry = (*iter).asString();
|
||||||
|
size += entry.length() + 1; // Include one for \0
|
||||||
|
count ++;
|
||||||
|
if (size > MAX_WHITELIST_SIZE || count > MAX_WHITELIST_COUNT)
|
||||||
|
{
|
||||||
|
return LSL_STATUS_BOUNDS_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Next clear the vector
|
||||||
|
mWhiteList.clear();
|
||||||
|
// Then re-iterate and copy entries
|
||||||
|
iter = whitelist.beginArray();
|
||||||
|
for ( ; iter < end; ++iter)
|
||||||
|
{
|
||||||
|
const std::string &entry = (*iter).asString();
|
||||||
|
mWhiteList.push_back(entry);
|
||||||
|
}
|
||||||
|
return LSL_STATUS_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return LSL_STATUS_MALFORMED_PARAMS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void prefix_with(std::string &str, const char *chars, const char *prefix)
|
||||||
|
{
|
||||||
|
// Given string 'str', prefix all instances of any character in 'chars'
|
||||||
|
// with 'prefix'
|
||||||
|
size_t found = str.find_first_of(chars);
|
||||||
|
size_t prefix_len = strlen(prefix);
|
||||||
|
while (found != std::string::npos)
|
||||||
|
{
|
||||||
|
str.insert(found, prefix, prefix_len);
|
||||||
|
found = str.find_first_of(chars, found+prefix_len+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool pattern_match(const std::string &candidate_str, const std::string &pattern)
|
||||||
|
{
|
||||||
|
// If the pattern is empty, it matches
|
||||||
|
if (pattern.empty()) return true;
|
||||||
|
|
||||||
|
// 'pattern' is a glob pattern, we only accept '*' chars
|
||||||
|
// copy it
|
||||||
|
std::string expression = pattern;
|
||||||
|
|
||||||
|
// Escape perl's regexp chars with a backslash, except all "*" chars
|
||||||
|
prefix_with(expression, ".[{()\\+?|^$", "\\");
|
||||||
|
prefix_with(expression, "*", ".");
|
||||||
|
|
||||||
|
// case-insensitive matching:
|
||||||
|
boost::regex regexp(expression, boost::regex::perl|boost::regex::icase);
|
||||||
|
return boost::regex_match(candidate_str, regexp);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LLMediaEntry::checkCandidateUrl(const std::string& url) const
|
||||||
|
{
|
||||||
|
if (getWhiteListEnable())
|
||||||
|
{
|
||||||
|
return checkUrlAgainstWhitelist(url, getWhiteList());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool LLMediaEntry::checkUrlAgainstWhitelist(const std::string& url,
|
||||||
|
const std::vector<std::string> &whitelist)
|
||||||
|
{
|
||||||
|
bool passes = true;
|
||||||
|
// *NOTE: no entries? Don't check
|
||||||
|
if (whitelist.size() > 0)
|
||||||
|
{
|
||||||
|
passes = false;
|
||||||
|
|
||||||
|
// Case insensitive: the reason why we toUpper both this and the
|
||||||
|
// filter
|
||||||
|
std::string candidate_url = url;
|
||||||
|
// Use lluri to see if there is a path part in the candidate URL. No path? Assume "/"
|
||||||
|
LLURI candidate_uri(candidate_url);
|
||||||
|
std::vector<std::string>::const_iterator iter = whitelist.begin();
|
||||||
|
std::vector<std::string>::const_iterator end = whitelist.end();
|
||||||
|
for ( ; iter < end; ++iter )
|
||||||
|
{
|
||||||
|
std::string filter = *iter;
|
||||||
|
|
||||||
|
LLURI filter_uri(filter);
|
||||||
|
bool scheme_passes = pattern_match( candidate_uri.scheme(), filter_uri.scheme() );
|
||||||
|
if (filter_uri.scheme().empty())
|
||||||
|
{
|
||||||
|
filter_uri = LLURI(DEFAULT_URL_PREFIX + filter);
|
||||||
|
}
|
||||||
|
bool authority_passes = pattern_match( candidate_uri.authority(), filter_uri.authority() );
|
||||||
|
bool path_passes = pattern_match( candidate_uri.escapedPath(), filter_uri.escapedPath() );
|
||||||
|
|
||||||
|
if (scheme_passes && authority_passes && path_passes)
|
||||||
|
{
|
||||||
|
passes = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return passes;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setStringFieldWithLimit( std::string &field, const std::string &value, U32 limit )
|
||||||
|
{
|
||||||
|
if ( value.length() > limit )
|
||||||
|
{
|
||||||
|
return LSL_STATUS_BOUNDS_ERROR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
field = value;
|
||||||
|
return LSL_STATUS_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setControls(LLMediaEntry::MediaControls controls)
|
||||||
|
{
|
||||||
|
if (controls == STANDARD ||
|
||||||
|
controls == MINI)
|
||||||
|
{
|
||||||
|
mControls = controls;
|
||||||
|
return LSL_STATUS_OK;
|
||||||
|
}
|
||||||
|
return LSL_STATUS_BOUNDS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setPermsInteract( U8 val )
|
||||||
|
{
|
||||||
|
mPermsInteract = val & PERM_MASK;
|
||||||
|
return LSL_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setPermsControl( U8 val )
|
||||||
|
{
|
||||||
|
mPermsControl = val & PERM_MASK;
|
||||||
|
return LSL_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setCurrentURL(const std::string& current_url)
|
||||||
|
{
|
||||||
|
return setCurrentURLInternal( current_url, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setCurrentURLInternal(const std::string& current_url, bool check_whitelist)
|
||||||
|
{
|
||||||
|
if ( ! check_whitelist || checkCandidateUrl(current_url))
|
||||||
|
{
|
||||||
|
return setStringFieldWithLimit( mCurrentURL, current_url, MAX_URL_LENGTH );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return LSL_STATUS_WHITELIST_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setHomeURL(const std::string& home_url)
|
||||||
|
{
|
||||||
|
return setStringFieldWithLimit( mHomeURL, home_url, MAX_URL_LENGTH );
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setWidthPixels(U16 width)
|
||||||
|
{
|
||||||
|
if (width > MAX_WIDTH_PIXELS) return LSL_STATUS_BOUNDS_ERROR;
|
||||||
|
mWidthPixels = width;
|
||||||
|
return LSL_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLMediaEntry::setHeightPixels(U16 height)
|
||||||
|
{
|
||||||
|
if (height > MAX_HEIGHT_PIXELS) return LSL_STATUS_BOUNDS_ERROR;
|
||||||
|
mHeightPixels = height;
|
||||||
|
return LSL_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
const LLUUID &LLMediaEntry::getMediaID() const
|
||||||
|
{
|
||||||
|
// Lazily generate media ID
|
||||||
|
if (NULL == mMediaIDp)
|
||||||
|
{
|
||||||
|
mMediaIDp = new LLUUID();
|
||||||
|
mMediaIDp->generate();
|
||||||
|
}
|
||||||
|
return *mMediaIDp;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,6 @@ LLModel::~LLModel()
|
|||||||
bool get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S32& tc_offset, S32& norm_offset, S32 &idx_stride,
|
bool get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S32& tc_offset, S32& norm_offset, S32 &idx_stride,
|
||||||
domSource* &pos_source, domSource* &tc_source, domSource* &norm_source)
|
domSource* &pos_source, domSource* &tc_source, domSource* &norm_source)
|
||||||
{
|
{
|
||||||
|
|
||||||
idx_stride = 0;
|
idx_stride = 0;
|
||||||
|
|
||||||
for (U32 j = 0; j < inputs.getCount(); ++j)
|
for (U32 j = 0; j < inputs.getCount(); ++j)
|
||||||
@@ -209,7 +208,6 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
|
|||||||
n[idx[i+norm_offset]*3+1],
|
n[idx[i+norm_offset]*3+1],
|
||||||
n[idx[i+norm_offset]*3+2]));
|
n[idx[i+norm_offset]*3+2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL found = FALSE;
|
BOOL found = FALSE;
|
||||||
|
|
||||||
@@ -276,7 +274,6 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
|
|||||||
face = LLVolumeFace();
|
face = LLVolumeFace();
|
||||||
point_map.clear();
|
point_map.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!verts.empty())
|
if (!verts.empty())
|
||||||
@@ -509,7 +506,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
|
|||||||
{
|
{
|
||||||
material = std::string(poly->getMaterial());
|
material = std::string(poly->getMaterial());
|
||||||
}
|
}
|
||||||
|
|
||||||
materials.push_back(material);
|
materials.push_back(material);
|
||||||
face_list.push_back(face);
|
face_list.push_back(face);
|
||||||
face_list.rbegin()->fillFromLegacyData(verts, indices);
|
face_list.rbegin()->fillFromLegacyData(verts, indices);
|
||||||
@@ -539,7 +536,6 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
|
|||||||
|
|
||||||
const domInputLocalOffset_Array& inputs = poly->getInput_array();
|
const domInputLocalOffset_Array& inputs = poly->getInput_array();
|
||||||
|
|
||||||
|
|
||||||
S32 v_offset = -1;
|
S32 v_offset = -1;
|
||||||
S32 n_offset = -1;
|
S32 n_offset = -1;
|
||||||
S32 t_offset = -1;
|
S32 t_offset = -1;
|
||||||
@@ -651,8 +647,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
|
|||||||
vert.mTexCoord.setVec(t->get(t_idx),
|
vert.mTexCoord.setVec(t->get(t_idx),
|
||||||
t->get(t_idx+1));
|
t->get(t_idx+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
verts.push_back(vert);
|
verts.push_back(vert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1467,7 +1462,6 @@ LLSD LLModel::writeModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LLVector2 tc_range = max_tc - min_tc;
|
LLVector2 tc_range = max_tc - min_tc;
|
||||||
|
|
||||||
for (U32 j = 0; j < (U32)face.mNumVertices; ++j)
|
for (U32 j = 0; j < (U32)face.mNumVertices; ++j)
|
||||||
@@ -1983,6 +1977,7 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn
|
|||||||
|
|
||||||
//build a map of material slot names to face indexes
|
//build a map of material slot names to face indexes
|
||||||
bool reorder = false;
|
bool reorder = false;
|
||||||
|
|
||||||
std::set<std::string> base_mat;
|
std::set<std::string> base_mat;
|
||||||
std::set<std::string> cur_mat;
|
std::set<std::string> cur_mat;
|
||||||
|
|
||||||
|
|||||||
@@ -435,11 +435,7 @@ LLGLManager::LLGLManager() :
|
|||||||
mHasPointParameters(FALSE),
|
mHasPointParameters(FALSE),
|
||||||
mHasDrawBuffers(FALSE),
|
mHasDrawBuffers(FALSE),
|
||||||
mHasTextureRectangle(FALSE),
|
mHasTextureRectangle(FALSE),
|
||||||
mHasTextureMultisample(FALSE),
|
|
||||||
mHasTransformFeedback(FALSE),
|
mHasTransformFeedback(FALSE),
|
||||||
mMaxSampleMaskWords(0),
|
|
||||||
mMaxColorTextureSamples(0),
|
|
||||||
mMaxDepthTextureSamples(0),
|
|
||||||
mMaxIntegerSamples(0),
|
mMaxIntegerSamples(0),
|
||||||
|
|
||||||
mHasAnisotropic(FALSE),
|
mHasAnisotropic(FALSE),
|
||||||
@@ -732,12 +728,10 @@ bool LLGLManager::initGL()
|
|||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
if (mHasTextureMultisample)
|
if (mHasFramebufferMultisample)
|
||||||
{
|
{
|
||||||
glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &mMaxColorTextureSamples);
|
|
||||||
glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &mMaxDepthTextureSamples);
|
|
||||||
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples);
|
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples);
|
||||||
glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords);
|
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
@@ -749,24 +743,12 @@ bool LLGLManager::initGL()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
mHasTextureMultisample = FALSE;
|
|
||||||
#if LL_WINDOWS
|
|
||||||
if (mIsATI)
|
|
||||||
{ //using multisample textures on ATI results in black screen for some reason
|
|
||||||
mHasTextureMultisample = FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mIsIntel && mGLVersion <= 3.f)
|
if (mIsIntel && mGLVersion <= 3.f)
|
||||||
{ //never try to use framebuffer objects on older intel drivers (crashy)
|
{ //never try to use framebuffer objects on older intel drivers (crashy)
|
||||||
mHasFramebufferObject = FALSE;
|
mHasFramebufferObject = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mHasFramebufferObject)
|
|
||||||
{
|
|
||||||
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
setToDebugGPU();
|
setToDebugGPU();
|
||||||
@@ -847,14 +829,6 @@ std::string LLGLManager::getRawGLString()
|
|||||||
return gl_string;
|
return gl_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 LLGLManager::getNumFBOFSAASamples(U32 samples)
|
|
||||||
{
|
|
||||||
samples = llmin(samples, (U32) mMaxColorTextureSamples);
|
|
||||||
samples = llmin(samples, (U32) mMaxDepthTextureSamples);
|
|
||||||
samples = llmin(samples, (U32) 4);
|
|
||||||
return samples;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLGLManager::shutdownGL()
|
void LLGLManager::shutdownGL()
|
||||||
{
|
{
|
||||||
if (mInited)
|
if (mInited)
|
||||||
@@ -956,11 +930,10 @@ void LLGLManager::initExtensions()
|
|||||||
mHasFramebufferMultisample = mHasFramebufferObject && ExtensionExists("GL_EXT_framebuffer_multisample", gGLHExts.mSysExts);
|
mHasFramebufferMultisample = mHasFramebufferObject && ExtensionExists("GL_EXT_framebuffer_multisample", gGLHExts.mSysExts);
|
||||||
|
|
||||||
mHasMipMapGeneration = mHasFramebufferObject || mGLVersion >= 1.4f;
|
mHasMipMapGeneration = mHasFramebufferObject || mGLVersion >= 1.4f;
|
||||||
|
|
||||||
mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts);
|
mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts);
|
||||||
mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
|
mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
|
||||||
mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
|
mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
|
||||||
mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts);
|
|
||||||
mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts);
|
mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts);
|
||||||
mHasTransformFeedback = mGLVersion >= 4.f ? TRUE : FALSE;
|
mHasTransformFeedback = mGLVersion >= 4.f ? TRUE : FALSE;
|
||||||
#if !LL_DARWIN
|
#if !LL_DARWIN
|
||||||
@@ -1198,13 +1171,6 @@ void LLGLManager::initExtensions()
|
|||||||
{
|
{
|
||||||
glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBlendFuncSeparateEXT");
|
glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBlendFuncSeparateEXT");
|
||||||
}
|
}
|
||||||
if (mHasTextureMultisample)
|
|
||||||
{
|
|
||||||
glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glTexImage2DMultisample");
|
|
||||||
glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glTexImage3DMultisample");
|
|
||||||
glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetMultisamplefv");
|
|
||||||
glSampleMaski = (PFNGLSAMPLEMASKIPROC) GLH_EXT_GET_PROC_ADDRESS("glSampleMaski");
|
|
||||||
}
|
|
||||||
if (mHasTransformFeedback)
|
if (mHasTransformFeedback)
|
||||||
{
|
{
|
||||||
glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) GLH_EXT_GET_PROC_ADDRESS("glBeginTransformFeedback");
|
glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) GLH_EXT_GET_PROC_ADDRESS("glBeginTransformFeedback");
|
||||||
|
|||||||
@@ -104,11 +104,7 @@ public:
|
|||||||
BOOL mHasDrawBuffers;
|
BOOL mHasDrawBuffers;
|
||||||
BOOL mHasDepthClamp;
|
BOOL mHasDepthClamp;
|
||||||
BOOL mHasTextureRectangle;
|
BOOL mHasTextureRectangle;
|
||||||
BOOL mHasTextureMultisample;
|
|
||||||
BOOL mHasTransformFeedback;
|
BOOL mHasTransformFeedback;
|
||||||
S32 mMaxSampleMaskWords;
|
|
||||||
S32 mMaxColorTextureSamples;
|
|
||||||
S32 mMaxDepthTextureSamples;
|
|
||||||
S32 mMaxIntegerSamples;
|
S32 mMaxIntegerSamples;
|
||||||
|
|
||||||
// Other extensions.
|
// Other extensions.
|
||||||
@@ -155,7 +151,6 @@ public:
|
|||||||
void printGLInfoString();
|
void printGLInfoString();
|
||||||
void getGLInfo(LLSD& info);
|
void getGLInfo(LLSD& info);
|
||||||
|
|
||||||
U32 getNumFBOFSAASamples(U32 desired_samples = 32);
|
|
||||||
// In ALL CAPS
|
// In ALL CAPS
|
||||||
std::string mGLVendor;
|
std::string mGLVendor;
|
||||||
std::string mGLVendorShort;
|
std::string mGLVendorShort;
|
||||||
@@ -521,4 +516,5 @@ extern BOOL gGLActive;
|
|||||||
#ifndef GL_DEPTH24_STENCIL8
|
#ifndef GL_DEPTH24_STENCIL8
|
||||||
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_EXT
|
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_EXT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // LL_LLGL_H
|
#endif // LL_LLGL_H
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT;
|
|||||||
# include "GL/glh_extensions.h"
|
# include "GL/glh_extensions.h"
|
||||||
# undef __APPLE__
|
# undef __APPLE__
|
||||||
|
|
||||||
#elif LL_LINUX
|
#elif LL_LINUX
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Linux, MESA headers, but not necessarily assuming MESA runtime.
|
// Linux, MESA headers, but not necessarily assuming MESA runtime.
|
||||||
// quotes so we get libraries/.../GL/ version
|
// quotes so we get libraries/.../GL/ version
|
||||||
@@ -783,6 +783,7 @@ extern PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB;
|
|||||||
extern PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB;
|
extern PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB;
|
||||||
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
|
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
|
||||||
extern PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB;
|
extern PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB;
|
||||||
|
|
||||||
#elif LL_DARWIN
|
#elif LL_DARWIN
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// LL_DARWIN
|
// LL_DARWIN
|
||||||
@@ -825,6 +826,7 @@ extern void glGenerateMipmapEXT(GLenum target) AVAILABLE_MAC_OS_X_VERSION_10_4_A
|
|||||||
#define glGenerateMipmap glGenerateMipmapEXT
|
#define glGenerateMipmap glGenerateMipmapEXT
|
||||||
#define GL_MAX_SAMPLES 0x8D57
|
#define GL_MAX_SAMPLES 0x8D57
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GL_ARB_draw_buffers
|
// GL_ARB_draw_buffers
|
||||||
extern void glDrawBuffersARB(GLsizei n, const GLenum* bufs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
|
extern void glDrawBuffersARB(GLsizei n, const GLenum* bufs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
|
||||||
|
|
||||||
@@ -997,7 +999,7 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <AGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
|
|
||||||
#endif // LL_MESA / LL_WINDOWS / LL_DARWIN
|
#endif // LL_MESA / LL_WINDOWS / LL_DARWIN
|
||||||
|
|
||||||
@@ -1029,4 +1031,5 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
|
|||||||
#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
|
#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
|
||||||
#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
|
#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // LL_LLGLHEADERS_H
|
#endif // LL_LLGLHEADERS_H
|
||||||
|
|||||||
@@ -330,7 +330,6 @@ S32 LLImageGL::updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 categ
|
|||||||
//static
|
//static
|
||||||
void LLImageGL::destroyGL(BOOL save_state)
|
void LLImageGL::destroyGL(BOOL save_state)
|
||||||
{
|
{
|
||||||
deleteDeadTextures(); //Dump unimportant textures.
|
|
||||||
for (S32 stage = 0; stage < gGLManager.mNumTextureUnits; stage++)
|
for (S32 stage = 0; stage < gGLManager.mNumTextureUnits; stage++)
|
||||||
{
|
{
|
||||||
gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE);
|
gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE);
|
||||||
@@ -364,7 +363,6 @@ void LLImageGL::destroyGL(BOOL save_state)
|
|||||||
}
|
}
|
||||||
llinfos << "Storing " << stored_count << " images..." << llendl;
|
llinfos << "Storing " << stored_count << " images..." << llendl;
|
||||||
sAllowReadBackRaw = false ;
|
sAllowReadBackRaw = false ;
|
||||||
deleteDeadTextures();//Now, actually call glDeleteTextures for everything.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
@@ -1528,7 +1526,7 @@ void LLImageGL::deleteDeadTextures()
|
|||||||
{
|
{
|
||||||
bool reset = false;
|
bool reset = false;
|
||||||
|
|
||||||
for(U32 i=0;i<LLTexUnit::TT_NONE;++i)
|
/*for(U32 i=0;i<LLTexUnit::TT_NONE;++i)
|
||||||
{
|
{
|
||||||
for(dead_texturelist_t::iterator it=sDeadTextureList[i].begin();it!=sDeadTextureList[i].end();++it)
|
for(dead_texturelist_t::iterator it=sDeadTextureList[i].begin();it!=sDeadTextureList[i].end();++it)
|
||||||
{
|
{
|
||||||
@@ -1554,7 +1552,7 @@ void LLImageGL::deleteDeadTextures()
|
|||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (reset)
|
if (reset)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -699,6 +699,28 @@ bool LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth
|
|||||||
release();
|
release();
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
|
if (!gGLManager.mHasFramebufferMultisample || !gGLManager.mHasFramebufferObject || !(sUseFBO || use_fbo))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(color_fmt != GL_RGBA)
|
||||||
|
{
|
||||||
|
llwarns << "Unsupported color format: " << color_fmt << llendl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Restrict to valid sample count
|
||||||
|
{
|
||||||
|
mSamples = samples;
|
||||||
|
mSamples = llmin(mSamples, (U32)4); //Cap to prevent memory bloat.
|
||||||
|
mSamples = llmin(mSamples, (U32) gGLManager.mMaxIntegerSamples);//GL_RGBA
|
||||||
|
|
||||||
|
if(depth && !stencil)
|
||||||
|
mSamples = llmin(mSamples, (U32) gGLManager.mMaxSamples); //GL_DEPTH_COMPONENT16_ARB
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mSamples <= 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
mResX = resx;
|
mResX = resx;
|
||||||
mResY = resy;
|
mResY = resy;
|
||||||
|
|
||||||
@@ -706,30 +728,16 @@ bool LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth
|
|||||||
mUseDepth = depth;
|
mUseDepth = depth;
|
||||||
mStencil = stencil;
|
mStencil = stencil;
|
||||||
|
|
||||||
if (!gGLManager.mHasFramebufferMultisample)
|
|
||||||
{
|
|
||||||
llerrs << "Attempting to allocate unsupported render target type!" << llendl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mSamples = gGLManager.getNumFBOFSAASamples(samples);
|
|
||||||
|
|
||||||
if (mSamples <= 1)
|
|
||||||
{
|
|
||||||
llerrs << "Cannot create a multisample buffer with less than 2 samples." << llendl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_glerror();
|
|
||||||
|
|
||||||
if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (depth)
|
if (depth)
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
if(!allocateDepth())
|
if(!allocateDepth())
|
||||||
|
{
|
||||||
|
release();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
glGenFramebuffers(1, (GLuint *) &mFBO);
|
glGenFramebuffers(1, (GLuint *) &mFBO);
|
||||||
@@ -779,6 +787,7 @@ bool LLMultisampleBuffer::addColorAttachment(U32 color_fmt)
|
|||||||
if (glGetError() != GL_NO_ERROR)
|
if (glGetError() != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
llwarns << "Unable to allocate color buffer for multisample render target." << llendl;
|
llwarns << "Unable to allocate color buffer for multisample render target." << llendl;
|
||||||
|
release();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,6 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||||||
|
|
||||||
if (features->hasLighting)
|
if (features->hasLighting)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (features->hasWaterFog)
|
if (features->hasWaterFog)
|
||||||
{
|
{
|
||||||
if (features->disableTextureIndex)
|
if (features->disableTextureIndex)
|
||||||
@@ -308,7 +307,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||||||
}
|
}
|
||||||
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
|
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE order of shader object attaching is VERY IMPORTANT!!!
|
// NOTE order of shader object attaching is VERY IMPORTANT!!!
|
||||||
@@ -571,7 +570,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//we can't have any lines longer than 1024 characters
|
//we can't have any lines longer than 1024 characters
|
||||||
//or any shaders longer than 4096 lines... deal - DaveP
|
//or any shaders longer than 4096 lines... deal - DaveP
|
||||||
GLcharARB buff[1024];
|
GLcharARB buff[1024];
|
||||||
GLcharARB* text[4096];
|
GLcharARB* text[4096];
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ include(LLRender)
|
|||||||
include(LLWindow)
|
include(LLWindow)
|
||||||
include(LLVFS)
|
include(LLVFS)
|
||||||
include(LLXML)
|
include(LLXML)
|
||||||
include(LLXUIXML)
|
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${LLCOMMON_INCLUDE_DIRS}
|
${LLCOMMON_INCLUDE_DIRS}
|
||||||
@@ -24,7 +23,6 @@ include_directories(
|
|||||||
${LLWINDOW_INCLUDE_DIRS}
|
${LLWINDOW_INCLUDE_DIRS}
|
||||||
${LLVFS_INCLUDE_DIRS}
|
${LLVFS_INCLUDE_DIRS}
|
||||||
${LLXML_INCLUDE_DIRS}
|
${LLXML_INCLUDE_DIRS}
|
||||||
${LLXUIXML_INCLUDE_DIRS}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(llui_SOURCE_FILES
|
set(llui_SOURCE_FILES
|
||||||
@@ -73,6 +71,7 @@ set(llui_SOURCE_FILES
|
|||||||
lltextparser.cpp
|
lltextparser.cpp
|
||||||
lltrans.cpp
|
lltrans.cpp
|
||||||
llui.cpp
|
llui.cpp
|
||||||
|
lluicolor.cpp
|
||||||
lluictrl.cpp
|
lluictrl.cpp
|
||||||
lluictrlfactory.cpp
|
lluictrlfactory.cpp
|
||||||
lluiimage.cpp
|
lluiimage.cpp
|
||||||
@@ -142,6 +141,7 @@ set(llui_HEADER_FILES
|
|||||||
lluictrl.h
|
lluictrl.h
|
||||||
lluifwd.h
|
lluifwd.h
|
||||||
llui.h
|
llui.h
|
||||||
|
lluicolor.h
|
||||||
lluiimage.h
|
lluiimage.h
|
||||||
lluistring.h
|
lluistring.h
|
||||||
lluixmltags.h
|
lluixmltags.h
|
||||||
@@ -165,7 +165,6 @@ target_link_libraries(llui
|
|||||||
llwindow
|
llwindow
|
||||||
llimage
|
llimage
|
||||||
llvfs # ugh, just for LLDir
|
llvfs # ugh, just for LLDir
|
||||||
llxuixml
|
|
||||||
llxml
|
llxml
|
||||||
llcommon # must be after llimage, llwindow, llrender
|
llcommon # must be after llimage, llwindow, llrender
|
||||||
llmath
|
llmath
|
||||||
|
|||||||
@@ -45,17 +45,20 @@ class LLMouseHandler
|
|||||||
public:
|
public:
|
||||||
LLMouseHandler() {}
|
LLMouseHandler() {}
|
||||||
virtual ~LLMouseHandler() {}
|
virtual ~LLMouseHandler() {}
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SHOW_NEVER,
|
SHOW_NEVER,
|
||||||
SHOW_IF_NOT_BLOCKED,
|
SHOW_IF_NOT_BLOCKED,
|
||||||
SHOW_ALWAYS,
|
SHOW_ALWAYS,
|
||||||
} EShowToolTip;
|
} EShowToolTip;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CLICK_LEFT,
|
CLICK_LEFT,
|
||||||
CLICK_MIDDLE,
|
CLICK_MIDDLE,
|
||||||
CLICK_RIGHT,
|
CLICK_RIGHT,
|
||||||
CLICK_DOUBLELEFT
|
CLICK_DOUBLELEFT
|
||||||
} EClickType;
|
} EClickType;
|
||||||
|
|
||||||
virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down);
|
virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down);
|
||||||
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0;
|
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0;
|
||||||
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0;
|
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0;
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
|
|||||||
mSupportedResolutions(NULL),
|
mSupportedResolutions(NULL),
|
||||||
mNumSupportedResolutions(0),
|
mNumSupportedResolutions(0),
|
||||||
mCurrentCursor(UI_CURSOR_ARROW),
|
mCurrentCursor(UI_CURSOR_ARROW),
|
||||||
|
mNextCursor(UI_CURSOR_ARROW),
|
||||||
mCursorHidden(FALSE),
|
mCursorHidden(FALSE),
|
||||||
mBusyCount(0),
|
mBusyCount(0),
|
||||||
mIsMouseClipping(FALSE),
|
mIsMouseClipping(FALSE),
|
||||||
@@ -125,7 +126,6 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
|
|||||||
|
|
||||||
LLWindow::~LLWindow()
|
LLWindow::~LLWindow()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//virtual
|
//virtual
|
||||||
@@ -139,6 +139,7 @@ BOOL LLWindow::canDelete()
|
|||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
void LLWindow::incBusyCount()
|
void LLWindow::incBusyCount()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -104,12 +104,14 @@ public:
|
|||||||
virtual S32 getBusyCount() const;
|
virtual S32 getBusyCount() const;
|
||||||
|
|
||||||
// Sets cursor, may set to arrow+hourglass
|
// Sets cursor, may set to arrow+hourglass
|
||||||
virtual void setCursor(ECursorType cursor) = 0;
|
virtual void setCursor(ECursorType cursor) { mNextCursor = cursor; };
|
||||||
virtual ECursorType getCursor() const;
|
virtual ECursorType getCursor() const;
|
||||||
|
virtual void updateCursor() = 0;
|
||||||
|
|
||||||
virtual void captureMouse() = 0;
|
virtual void captureMouse() = 0;
|
||||||
virtual void releaseMouse() = 0;
|
virtual void releaseMouse() = 0;
|
||||||
virtual void setMouseClipping( BOOL b ) = 0;
|
virtual void setMouseClipping( BOOL b ) = 0;
|
||||||
|
|
||||||
virtual BOOL isClipboardTextAvailable() = 0;
|
virtual BOOL isClipboardTextAvailable() = 0;
|
||||||
virtual BOOL pasteTextFromClipboard(LLWString &dst) = 0;
|
virtual BOOL pasteTextFromClipboard(LLWString &dst) = 0;
|
||||||
virtual BOOL copyTextToClipboard(const LLWString &src) = 0;
|
virtual BOOL copyTextToClipboard(const LLWString &src) = 0;
|
||||||
@@ -196,6 +198,7 @@ protected:
|
|||||||
LLWindowResolution* mSupportedResolutions;
|
LLWindowResolution* mSupportedResolutions;
|
||||||
S32 mNumSupportedResolutions;
|
S32 mNumSupportedResolutions;
|
||||||
ECursorType mCurrentCursor;
|
ECursorType mCurrentCursor;
|
||||||
|
ECursorType mNextCursor;
|
||||||
BOOL mCursorHidden;
|
BOOL mCursorHidden;
|
||||||
S32 mBusyCount; // how deep is the "cursor busy" stack?
|
S32 mBusyCount; // how deep is the "cursor busy" stack?
|
||||||
BOOL mIsMouseClipping; // Is this window currently clipping the mouse
|
BOOL mIsMouseClipping; // Is this window currently clipping the mouse
|
||||||
|
|||||||
@@ -91,5 +91,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
/*virtual*/ void showCursorFromMouseMove() {};
|
/*virtual*/ void showCursorFromMouseMove() {};
|
||||||
/*virtual*/ void hideCursorUntilMouseMove() {};
|
/*virtual*/ void hideCursorUntilMouseMove() {};
|
||||||
/*virtual*/ BOOL isCursorHidden() {return FALSE;};
|
/*virtual*/ BOOL isCursorHidden() {return FALSE;};
|
||||||
/*virtual*/ void setCursor(ECursorType cursor) {};
|
/*virtual*/ void updateCursor() {};
|
||||||
//virtual ECursorType getCursor() { return mCurrentCursor; };
|
//virtual ECursorType getCursor() { return mCurrentCursor; };
|
||||||
/*virtual*/ void captureMouse() {};
|
/*virtual*/ void captureMouse() {};
|
||||||
/*virtual*/ void releaseMouse() {};
|
/*virtual*/ void releaseMouse() {};
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ void setupCocoa()
|
|||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
|
// The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents.
|
||||||
|
// ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr'
|
||||||
|
// when init'ing the Cocoa App window.
|
||||||
|
[[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
|
||||||
|
|
||||||
// This is a bit of voodoo taken from the Apple sample code "CarbonCocoa_PictureCursor":
|
// This is a bit of voodoo taken from the Apple sample code "CarbonCocoa_PictureCursor":
|
||||||
// http://developer.apple.com/samplecode/CarbonCocoa_PictureCursor/index.html
|
// http://developer.apple.com/samplecode/CarbonCocoa_PictureCursor/index.html
|
||||||
|
|
||||||
@@ -60,6 +65,8 @@ void setupCocoa()
|
|||||||
[[[NSWindow alloc] init] release];
|
[[[NSWindow alloc] init] release];
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
|
inited = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -226,10 +226,10 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
|||||||
// Route them to a dummy callback structure until the end of constructor.
|
// Route them to a dummy callback structure until the end of constructor.
|
||||||
LLWindowCallbacks null_callbacks;
|
LLWindowCallbacks null_callbacks;
|
||||||
mCallbacks = &null_callbacks;
|
mCallbacks = &null_callbacks;
|
||||||
|
|
||||||
// Voodoo for calling cocoa from carbon (see llwindowmacosx-objc.mm).
|
// Voodoo for calling cocoa from carbon (see llwindowmacosx-objc.mm).
|
||||||
setupCocoa();
|
setupCocoa();
|
||||||
|
|
||||||
// Initialize the keyboard
|
// Initialize the keyboard
|
||||||
gKeyboard = new LLKeyboardMacOSX();
|
gKeyboard = new LLKeyboardMacOSX();
|
||||||
gKeyboard->setCallbacks(callbacks);
|
gKeyboard->setCallbacks(callbacks);
|
||||||
@@ -260,10 +260,10 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
|||||||
mRawKeyEvent = NULL;
|
mRawKeyEvent = NULL;
|
||||||
mFSAASamples = fsaa_samples;
|
mFSAASamples = fsaa_samples;
|
||||||
mForceRebuild = FALSE;
|
mForceRebuild = FALSE;
|
||||||
|
|
||||||
// For reasons that aren't clear to me, LLTimers seem to be created in the "started" state.
|
// For reasons that aren't clear to me, LLTimers seem to be created in the "started" state.
|
||||||
// Since the started state of this one is used to track whether the NMRec has been installed, it wants to start out in the "stopped" state.
|
// Since the started state of this one is used to track whether the NMRec has been installed, it wants to start out in the "stopped" state.
|
||||||
mBounceTimer.stop();
|
mBounceTimer.stop();
|
||||||
|
|
||||||
// Get the original aspect ratio of the main device.
|
// Get the original aspect ratio of the main device.
|
||||||
mOriginalAspectRatio = (double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay);
|
mOriginalAspectRatio = (double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay);
|
||||||
@@ -276,7 +276,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
|||||||
mMoveEventCampartorUPP = NewEventComparatorUPP(staticMoveEventComparator);
|
mMoveEventCampartorUPP = NewEventComparatorUPP(staticMoveEventComparator);
|
||||||
mGlobalHandlerRef = NULL;
|
mGlobalHandlerRef = NULL;
|
||||||
mWindowHandlerRef = NULL;
|
mWindowHandlerRef = NULL;
|
||||||
|
|
||||||
mDragOverrideCursor = -1;
|
mDragOverrideCursor = -1;
|
||||||
|
|
||||||
// We're not clipping yet
|
// We're not clipping yet
|
||||||
@@ -451,7 +451,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||||||
mFullscreenBits = -1;
|
mFullscreenBits = -1;
|
||||||
mFullscreenRefresh = -1;
|
mFullscreenRefresh = -1;
|
||||||
|
|
||||||
std::string error= llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
|
std::string error= llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
|
||||||
OSMessageBox(error, "Error", OSMB_OK);
|
OSMessageBox(error, "Error", OSMB_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -484,7 +484,6 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||||||
true,
|
true,
|
||||||
(long)this);
|
(long)this);
|
||||||
|
|
||||||
|
|
||||||
if (!mWindow)
|
if (!mWindow)
|
||||||
{
|
{
|
||||||
setupFailure("Window creation error", "Error", OSMB_OK);
|
setupFailure("Window creation error", "Error", OSMB_OK);
|
||||||
@@ -500,7 +499,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||||||
InstallStandardEventHandler(GetWindowEventTarget(mWindow));
|
InstallStandardEventHandler(GetWindowEventTarget(mWindow));
|
||||||
InstallWindowEventHandler(mWindow, mEventHandlerUPP, GetEventTypeCount (WindowHandlerEventList), WindowHandlerEventList, (void*)this, &mWindowHandlerRef); // add event handler
|
InstallWindowEventHandler(mWindow, mEventHandlerUPP, GetEventTypeCount (WindowHandlerEventList), WindowHandlerEventList, (void*)this, &mWindowHandlerRef); // add event handler
|
||||||
#if LL_OS_DRAGDROP_ENABLED
|
#if LL_OS_DRAGDROP_ENABLED
|
||||||
InstallTrackingHandler( dragTrackingHandler, mWindow, (void*)this );
|
InstallTrackingHandler( dragTrackingHandler, mWindow, (void*)this );
|
||||||
InstallReceiveHandler( dragReceiveHandler, mWindow, (void*)this );
|
InstallReceiveHandler( dragReceiveHandler, mWindow, (void*)this );
|
||||||
#endif // LL_OS_DRAGDROP_ENABLED
|
#endif // LL_OS_DRAGDROP_ENABLED
|
||||||
}
|
}
|
||||||
@@ -581,16 +580,16 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||||||
AGL_NO_RECOVERY,
|
AGL_NO_RECOVERY,
|
||||||
AGL_DOUBLEBUFFER,
|
AGL_DOUBLEBUFFER,
|
||||||
AGL_CLOSEST_POLICY,
|
AGL_CLOSEST_POLICY,
|
||||||
AGL_ACCELERATED,
|
AGL_ACCELERATED,
|
||||||
AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
|
AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
|
||||||
AGL_SAMPLES_ARB, mFSAASamples,
|
AGL_SAMPLES_ARB, mFSAASamples,
|
||||||
AGL_RED_SIZE, 8,
|
AGL_RED_SIZE, 8,
|
||||||
AGL_GREEN_SIZE, 8,
|
AGL_GREEN_SIZE, 8,
|
||||||
AGL_BLUE_SIZE, 8,
|
AGL_BLUE_SIZE, 8,
|
||||||
AGL_ALPHA_SIZE, 8,
|
AGL_ALPHA_SIZE, 8,
|
||||||
AGL_DEPTH_SIZE, 24,
|
AGL_DEPTH_SIZE, 24,
|
||||||
AGL_STENCIL_SIZE, 8,
|
AGL_STENCIL_SIZE, 8,
|
||||||
AGL_NONE
|
AGL_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
LL_DEBUGS("Window") << "createContext: creating windowed pixelformat" << LL_ENDL;
|
LL_DEBUGS("Window") << "createContext: creating windowed pixelformat" << LL_ENDL;
|
||||||
@@ -797,7 +796,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||||||
LL_DEBUGS("GLinit") << "Keeping vertical sync" << LL_ENDL;
|
LL_DEBUGS("GLinit") << "Keeping vertical sync" << LL_ENDL;
|
||||||
frames_per_swap = 1;
|
frames_per_swap = 1;
|
||||||
}
|
}
|
||||||
aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap);
|
aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap);
|
||||||
|
|
||||||
//enable multi-threaded OpenGL
|
//enable multi-threaded OpenGL
|
||||||
if (sUseMultGL)
|
if (sUseMultGL)
|
||||||
@@ -810,7 +809,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||||||
if (cgl_err != kCGLNoError )
|
if (cgl_err != kCGLNoError )
|
||||||
{
|
{
|
||||||
LL_DEBUGS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL;
|
LL_DEBUGS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LL_DEBUGS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL;
|
LL_DEBUGS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL;
|
||||||
@@ -1042,6 +1041,7 @@ void LLWindowMacOSX::hide()
|
|||||||
HideWindow(mWindow);
|
HideWindow(mWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//virtual
|
||||||
void LLWindowMacOSX::minimize()
|
void LLWindowMacOSX::minimize()
|
||||||
{
|
{
|
||||||
setMouseClipping(FALSE);
|
setMouseClipping(FALSE);
|
||||||
@@ -1049,6 +1049,7 @@ void LLWindowMacOSX::minimize()
|
|||||||
CollapseWindow(mWindow, true);
|
CollapseWindow(mWindow, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//virtual
|
||||||
void LLWindowMacOSX::restore()
|
void LLWindowMacOSX::restore()
|
||||||
{
|
{
|
||||||
show();
|
show();
|
||||||
@@ -1114,7 +1115,7 @@ BOOL LLWindowMacOSX::maximize()
|
|||||||
{
|
{
|
||||||
ZoomWindow(mWindow, inContent, true);
|
ZoomWindow(mWindow, inContent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mMaximized;
|
return mMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1169,6 +1170,8 @@ void LLWindowMacOSX::gatherInput()
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position)
|
BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position)
|
||||||
@@ -1437,11 +1440,11 @@ static void fixOrigin(void)
|
|||||||
GrafPtr port;
|
GrafPtr port;
|
||||||
Rect portrect;
|
Rect portrect;
|
||||||
|
|
||||||
::GetPort(&port);
|
::GetPort(&port);
|
||||||
::GetPortBounds(port, &portrect);
|
::GetPortBounds(port, &portrect);
|
||||||
if((portrect.left != 0) || (portrect.top != 0))
|
if((portrect.left != 0) || (portrect.top != 0))
|
||||||
{
|
{
|
||||||
// Mozilla sometimes changes our port origin. Fuckers.
|
// Mozilla sometimes changes our port origin.
|
||||||
::SetOrigin(0,0);
|
::SetOrigin(0,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1451,17 +1454,17 @@ BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position)
|
|||||||
Point cursor_point;
|
Point cursor_point;
|
||||||
LLCoordScreen screen_pos;
|
LLCoordScreen screen_pos;
|
||||||
GrafPtr save;
|
GrafPtr save;
|
||||||
|
|
||||||
if(mWindow == NULL)
|
if(mWindow == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
::GetPort(&save);
|
::GetPort(&save);
|
||||||
::SetPort(GetWindowPort(mWindow));
|
::SetPort(GetWindowPort(mWindow));
|
||||||
fixOrigin();
|
fixOrigin();
|
||||||
|
|
||||||
// gets the mouse location in local coordinates
|
// gets the mouse location in local coordinates
|
||||||
::GetMouse(&cursor_point);
|
::GetMouse(&cursor_point);
|
||||||
|
|
||||||
// lldebugs << "getCursorPosition(): cursor is at " << cursor_point.h << ", " << cursor_point.v << " port origin: " << portrect.left << ", " << portrect.top << llendl;
|
// lldebugs << "getCursorPosition(): cursor is at " << cursor_point.h << ", " << cursor_point.v << " port origin: " << portrect.left << ", " << portrect.top << llendl;
|
||||||
|
|
||||||
::SetPort(save);
|
::SetPort(save);
|
||||||
@@ -1526,7 +1529,7 @@ F32 LLWindowMacOSX::getNativeAspectRatio()
|
|||||||
{
|
{
|
||||||
// The constructor for this class grabs the aspect ratio of the monitor before doing any resolution
|
// The constructor for this class grabs the aspect ratio of the monitor before doing any resolution
|
||||||
// switching, and stashes it in mOriginalAspectRatio. Here, we just return it.
|
// switching, and stashes it in mOriginalAspectRatio. Here, we just return it.
|
||||||
|
|
||||||
if (mOverrideAspectRatio > 0.f)
|
if (mOverrideAspectRatio > 0.f)
|
||||||
{
|
{
|
||||||
return mOverrideAspectRatio;
|
return mOverrideAspectRatio;
|
||||||
@@ -2001,7 +2004,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
if (mPreeditor
|
if (mPreeditor
|
||||||
&& (result = GetEventParameter(event, kEventParamTextInputSendFixLen,
|
&& (result = GetEventParameter(event, kEventParamTextInputSendFixLen,
|
||||||
typeLongInteger, ¶m_type, sizeof(fix_len), NULL, &fix_len)) == noErr
|
typeLongInteger, ¶m_type, sizeof(fix_len), NULL, &fix_len)) == noErr
|
||||||
&& typeLongInteger == param_type
|
&& typeLongInteger == param_type
|
||||||
&& (result = GetEventParameter(event, kEventParamTextInputSendText,
|
&& (result = GetEventParameter(event, kEventParamTextInputSendText,
|
||||||
typeUnicodeText, ¶m_type, 0, &text_len, NULL)) == noErr
|
typeUnicodeText, ¶m_type, 0, &text_len, NULL)) == noErr
|
||||||
&& typeUnicodeText == param_type)
|
&& typeUnicodeText == param_type)
|
||||||
@@ -2021,7 +2024,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
mPreeditor->markAsPreedit(location, length);
|
mPreeditor->markAsPreedit(location, length);
|
||||||
}
|
}
|
||||||
mPreeditor->resetPreedit();
|
mPreeditor->resetPreedit();
|
||||||
|
|
||||||
// Receive the text from input method.
|
// Receive the text from input method.
|
||||||
U16 *const text = new U16[text_len / sizeof(U16)];
|
U16 *const text = new U16[text_len / sizeof(U16)];
|
||||||
GetEventParameter(event, kEventParamTextInputSendText, typeUnicodeText, NULL, text_len, NULL, text);
|
GetEventParameter(event, kEventParamTextInputSendText, typeUnicodeText, NULL, text_len, NULL, text);
|
||||||
@@ -2060,11 +2063,11 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
GetEventParameter(event, kEventParamTextInputSendHiliteRng, typeTextRangeArray,
|
GetEventParameter(event, kEventParamTextInputSendHiliteRng, typeTextRangeArray,
|
||||||
NULL, text_range_array_size, NULL, text_range_array);
|
NULL, text_range_array_size, NULL, text_range_array);
|
||||||
|
|
||||||
// WARNING: We assume ranges are in ascending order,
|
// WARNING: We assume ranges are in ascending order,
|
||||||
// although the condition is undocumented. It seems
|
// although the condition is undocumented. It seems
|
||||||
// OK to assume this. I also assumed
|
// OK to assume this. I also assumed
|
||||||
// the ranges are contiguous in previous versions, but I
|
// the ranges are contiguous in previous versions, but I
|
||||||
// have heard a rumore that older versions os ATOK may
|
// have heard a rumore that older versions os ATOK may
|
||||||
// return ranges with some _gap_. I don't know whether
|
// return ranges with some _gap_. I don't know whether
|
||||||
// it is true, but I'm preparing my code for the case.
|
// it is true, but I'm preparing my code for the case.
|
||||||
|
|
||||||
@@ -2128,15 +2131,16 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEventTextInputUnicodeForKeyEvent:
|
case kEventTextInputUnicodeForKeyEvent:
|
||||||
{
|
{
|
||||||
UInt32 modifiers = 0;
|
UInt32 modifiers = 0;
|
||||||
|
|
||||||
|
|
||||||
// First, process the raw event.
|
// First, process the raw event.
|
||||||
{
|
{
|
||||||
EventRef rawEvent = NULL;
|
EventRef rawEvent = NULL;
|
||||||
|
|
||||||
// Get the original event and extract the modifier keys, so we can ignore command-key events.
|
// Get the original event and extract the modifier keys, so we can ignore command-key events.
|
||||||
if (GetEventParameter(event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent) == noErr)
|
if (GetEventParameter(event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent) == noErr)
|
||||||
{
|
{
|
||||||
@@ -2145,7 +2149,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
|
|
||||||
// and call this function recursively to handle the raw key event.
|
// and call this function recursively to handle the raw key event.
|
||||||
eventHandler (myHandler, rawEvent);
|
eventHandler (myHandler, rawEvent);
|
||||||
|
|
||||||
// save the raw event until we're done processing the unicode input as well.
|
// save the raw event until we're done processing the unicode input as well.
|
||||||
mRawKeyEvent = rawEvent;
|
mRawKeyEvent = rawEvent;
|
||||||
}
|
}
|
||||||
@@ -2176,7 +2180,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
MASK mask = LLWindowMacOSX::modifiersToMask(modifiers);
|
MASK mask = LLWindowMacOSX::modifiersToMask(modifiers);
|
||||||
|
|
||||||
llassert( actualType == typeUnicodeText );
|
llassert( actualType == typeUnicodeText );
|
||||||
|
|
||||||
// The result is a UTF16 buffer. Pass the characters in turn to handleUnicodeChar.
|
// The result is a UTF16 buffer. Pass the characters in turn to handleUnicodeChar.
|
||||||
@@ -2202,7 +2206,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
result = err;
|
result = err;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEventTextInputOffsetToPos:
|
case kEventTextInputOffsetToPos:
|
||||||
{
|
{
|
||||||
EventParamType param_type;
|
EventParamType param_type;
|
||||||
@@ -2215,7 +2219,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
S32 preedit, preedit_length;
|
S32 preedit, preedit_length;
|
||||||
mPreeditor->getPreeditRange(&preedit, &preedit_length);
|
mPreeditor->getPreeditRange(&preedit, &preedit_length);
|
||||||
const LLWString & text = mPreeditor->getPreeditString();
|
const LLWString & text = mPreeditor->getPreeditString();
|
||||||
|
|
||||||
LLCoordGL caret_coord;
|
LLCoordGL caret_coord;
|
||||||
LLRect preedit_bounds;
|
LLRect preedit_bounds;
|
||||||
if (0 <= offset
|
if (0 <= offset
|
||||||
@@ -2229,10 +2233,10 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
qd_point.h = caret_base_coord_screen.mX;
|
qd_point.h = caret_base_coord_screen.mX;
|
||||||
qd_point.v = caret_base_coord_screen.mY;
|
qd_point.v = caret_base_coord_screen.mY;
|
||||||
SetEventParameter(event, kEventParamTextInputReplyPoint, typeQDPoint, sizeof(qd_point), &qd_point);
|
SetEventParameter(event, kEventParamTextInputReplyPoint, typeQDPoint, sizeof(qd_point), &qd_point);
|
||||||
|
|
||||||
short line_height = (short) preedit_bounds.getHeight();
|
short line_height = (short) preedit_bounds.getHeight();
|
||||||
SetEventParameter(event, kEventParamTextInputReplyLineHeight, typeShortInteger, sizeof(line_height), &line_height);
|
SetEventParameter(event, kEventParamTextInputReplyLineHeight, typeShortInteger, sizeof(line_height), &line_height);
|
||||||
|
|
||||||
result = noErr;
|
result = noErr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2285,7 +2289,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
case kEventRawKeyRepeat:
|
case kEventRawKeyRepeat:
|
||||||
if (gDebugWindowProc)
|
if (gDebugWindowProc)
|
||||||
{
|
{
|
||||||
printf("key down, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n",
|
printf("key down, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n",
|
||||||
(unsigned int)keyCode, charCode, (char)charCode, (unsigned int)modifiers);
|
(unsigned int)keyCode, charCode, (char)charCode, (unsigned int)modifiers);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
@@ -2296,7 +2300,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
case kEventRawKeyUp:
|
case kEventRawKeyUp:
|
||||||
if (gDebugWindowProc)
|
if (gDebugWindowProc)
|
||||||
{
|
{
|
||||||
printf("key up, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n",
|
printf("key up, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n",
|
||||||
(unsigned int)keyCode, charCode, (char)charCode, (unsigned int)modifiers);
|
(unsigned int)keyCode, charCode, (char)charCode, (unsigned int)modifiers);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
@@ -2354,7 +2358,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// When the state of the 'Fn' key (the one that changes some of the mappings on a powerbook/macbook keyboard
|
// When the state of the 'Fn' key (the one that changes some of the mappings on a powerbook/macbook keyboard
|
||||||
// to an embedded keypad) changes, it may subsequently cause a key up event to be lost, which may lead to
|
// to an embedded keypad) changes, it may subsequently cause a key up event to be lost, which may lead to
|
||||||
// a movement key getting "stuck" down. This is bad.
|
// a movement key getting "stuck" down. This is bad.
|
||||||
// This is an OS bug -- even the GetKeys() API doesn't tell you the key has been released.
|
// This is an OS bug -- even the GetKeys() API doesn't tell you the key has been released.
|
||||||
// This workaround causes all held-down keys to be reset whenever the state of the Fn key changes. This isn't
|
// This workaround causes all held-down keys to be reset whenever the state of the Fn key changes. This isn't
|
||||||
@@ -2364,14 +2368,14 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
if (gDebugWindowProc) printf("Fn key state change event\n");
|
if (gDebugWindowProc) printf("Fn key state change event\n");
|
||||||
gKeyboard->resetKeys();
|
gKeyboard->resetKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDebugWindowProc) fflush(stdout);
|
if (gDebugWindowProc) fflush(stdout);
|
||||||
|
|
||||||
mLastModifiers = modifiers;
|
mLastModifiers = modifiers;
|
||||||
result = eventNotHandledErr;
|
result = eventNotHandledErr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mRawKeyEvent = NULL;
|
mRawKeyEvent = NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2466,7 +2470,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
case kEventMouseButtonSecondary:
|
case kEventMouseButtonSecondary:
|
||||||
mCallbacks->handleRightMouseDown(this, outCoords, mask);
|
mCallbacks->handleRightMouseDown(this, outCoords, mask);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEventMouseButtonTertiary:
|
case kEventMouseButtonTertiary:
|
||||||
mCallbacks->handleMiddleMouseDown(this, outCoords, mask);
|
mCallbacks->handleMiddleMouseDown(this, outCoords, mask);
|
||||||
break;
|
break;
|
||||||
@@ -2528,7 +2532,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
|
|
||||||
case kEventClassWindow:
|
case kEventClassWindow:
|
||||||
switch(evtKind)
|
switch(evtKind)
|
||||||
{
|
{
|
||||||
case kEventWindowActivated:
|
case kEventWindowActivated:
|
||||||
if (mTSMDocument)
|
if (mTSMDocument)
|
||||||
{
|
{
|
||||||
@@ -2543,7 +2547,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
}
|
}
|
||||||
mCallbacks->handleFocusLost(this);
|
mCallbacks->handleFocusLost(this);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEventWindowBoundsChanging:
|
case kEventWindowBoundsChanging:
|
||||||
{
|
{
|
||||||
// This is where we would constrain move/resize to a particular screen
|
// This is where we would constrain move/resize to a particular screen
|
||||||
@@ -2553,7 +2557,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
|
|
||||||
GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, ¤tBounds);
|
GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, ¤tBounds);
|
||||||
GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &previousBounds);
|
GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &previousBounds);
|
||||||
|
|
||||||
// Put an offset into window un-maximize operation since the kEventWindowGetIdealSize
|
// Put an offset into window un-maximize operation since the kEventWindowGetIdealSize
|
||||||
// event only allows the specification of size and not position.
|
// event only allows the specification of size and not position.
|
||||||
if (mMaximized)
|
if (mMaximized)
|
||||||
@@ -2561,7 +2565,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
short leftOffset = mPreviousWindowRect.left - currentBounds.left;
|
short leftOffset = mPreviousWindowRect.left - currentBounds.left;
|
||||||
currentBounds.left += leftOffset;
|
currentBounds.left += leftOffset;
|
||||||
currentBounds.right += leftOffset;
|
currentBounds.right += leftOffset;
|
||||||
|
|
||||||
short topOffset = mPreviousWindowRect.top - currentBounds.top;
|
short topOffset = mPreviousWindowRect.top - currentBounds.top;
|
||||||
currentBounds.top += topOffset;
|
currentBounds.top += topOffset;
|
||||||
currentBounds.bottom += topOffset;
|
currentBounds.bottom += topOffset;
|
||||||
@@ -2581,7 +2585,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
{
|
{
|
||||||
currentBounds.bottom = currentBounds.top + MIN_WINDOW_HEIGHT;
|
currentBounds.bottom = currentBounds.top + MIN_WINDOW_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), ¤tBounds);
|
SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), ¤tBounds);
|
||||||
result = noErr;
|
result = noErr;
|
||||||
}
|
}
|
||||||
@@ -2592,38 +2596,38 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
// Get new window bounds
|
// Get new window bounds
|
||||||
Rect newBounds;
|
Rect newBounds;
|
||||||
GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &newBounds);
|
GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &newBounds);
|
||||||
|
|
||||||
// Get previous window bounds
|
// Get previous window bounds
|
||||||
Rect oldBounds;
|
Rect oldBounds;
|
||||||
GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &oldBounds);
|
GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &oldBounds);
|
||||||
|
|
||||||
// Determine if the new size is larger than the old
|
// Determine if the new size is larger than the old
|
||||||
bool newBoundsLarger = ((newBounds.right - newBounds.left) >= (oldBounds.right - oldBounds.left));
|
bool newBoundsLarger = ((newBounds.right - newBounds.left) >= (oldBounds.right - oldBounds.left));
|
||||||
newBoundsLarger &= ((newBounds.bottom - newBounds.top) >= (oldBounds.bottom - oldBounds.top));
|
newBoundsLarger &= ((newBounds.bottom - newBounds.top) >= (oldBounds.bottom - oldBounds.top));
|
||||||
|
|
||||||
// Check to see if this is a zoom event (+ button on window pane)
|
// Check to see if this is a zoom event (+ button on window pane)
|
||||||
unsigned int eventParams;
|
unsigned int eventParams;
|
||||||
GetEventParameter(event, kEventParamAttributes, typeUInt32, NULL, sizeof(int), NULL, &eventParams);
|
GetEventParameter(event, kEventParamAttributes, typeUInt32, NULL, sizeof(int), NULL, &eventParams);
|
||||||
bool isZoomEvent = ((eventParams & kWindowBoundsChangeZoom) != 0);
|
bool isZoomEvent = ((eventParams & kWindowBoundsChangeZoom) != 0);
|
||||||
|
|
||||||
// Maximized flag is if zoom event and increasing window size
|
// Maximized flag is if zoom event and increasing window size
|
||||||
mMaximized = (isZoomEvent && newBoundsLarger);
|
mMaximized = (isZoomEvent && newBoundsLarger);
|
||||||
|
|
||||||
aglUpdateContext(mContext);
|
aglUpdateContext(mContext);
|
||||||
|
|
||||||
mCallbacks->handleResize(this, newBounds.right - newBounds.left, newBounds.bottom - newBounds.top);
|
mCallbacks->handleResize(this, newBounds.right - newBounds.left, newBounds.bottom - newBounds.top);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEventWindowGetIdealSize:
|
case kEventWindowGetIdealSize:
|
||||||
// Only recommend a new ideal size when un-maximizing
|
// Only recommend a new ideal size when un-maximizing
|
||||||
if (mMaximized == TRUE)
|
if (mMaximized == TRUE)
|
||||||
{
|
{
|
||||||
Point nonMaximizedSize;
|
Point nonMaximizedSize;
|
||||||
|
|
||||||
nonMaximizedSize.v = mPreviousWindowRect.bottom - mPreviousWindowRect.top;
|
nonMaximizedSize.v = mPreviousWindowRect.bottom - mPreviousWindowRect.top;
|
||||||
nonMaximizedSize.h = mPreviousWindowRect.right - mPreviousWindowRect.left;
|
nonMaximizedSize.h = mPreviousWindowRect.right - mPreviousWindowRect.left;
|
||||||
|
|
||||||
SetEventParameter(event, kEventParamDimensions, typeQDPoint, sizeof(Point), &nonMaximizedSize);
|
SetEventParameter(event, kEventParamDimensions, typeQDPoint, sizeof(Point), &nonMaximizedSize);
|
||||||
result = noErr;
|
result = noErr;
|
||||||
}
|
}
|
||||||
@@ -2678,7 +2682,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
if (mPreeditor)
|
if (mPreeditor)
|
||||||
{
|
{
|
||||||
switch(evtKind)
|
switch(evtKind)
|
||||||
{
|
{
|
||||||
|
|
||||||
case kEventTSMDocumentAccessGetLength:
|
case kEventTSMDocumentAccessGetLength:
|
||||||
{
|
{
|
||||||
@@ -2697,14 +2701,14 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
{
|
{
|
||||||
// Return the selected range, excluding preedit.
|
// Return the selected range, excluding preedit.
|
||||||
// In our preeditor, preedit and selection are exclusive, so,
|
// In our preeditor, preedit and selection are exclusive, so,
|
||||||
// when it has a preedit, there is no selection and the
|
// when it has a preedit, there is no selection and the
|
||||||
// insertion point is on the preedit that corrupses into the
|
// insertion point is on the preedit that corrupses into the
|
||||||
// beginning of the preedit when the preedit was removed.
|
// beginning of the preedit when the preedit was removed.
|
||||||
|
|
||||||
S32 preedit, preedit_length;
|
S32 preedit, preedit_length;
|
||||||
mPreeditor->getPreeditRange(&preedit, &preedit_length);
|
mPreeditor->getPreeditRange(&preedit, &preedit_length);
|
||||||
const LLWString & text = mPreeditor->getPreeditString();
|
const LLWString & text = mPreeditor->getPreeditString();
|
||||||
|
|
||||||
CFRange range;
|
CFRange range;
|
||||||
if (preedit_length)
|
if (preedit_length)
|
||||||
{
|
{
|
||||||
@@ -2768,7 +2772,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
memcpy(target_pointer, text_utf16.c_str() + range.location, range.length * sizeof(UniChar));
|
memcpy(target_pointer, text_utf16.c_str() + range.location, range.length * sizeof(UniChar));
|
||||||
|
|
||||||
// Note that result has already been set above.
|
// Note that result has already been set above.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2815,7 +2819,7 @@ const char* cursorIDToName(int id)
|
|||||||
case UI_CURSOR_TOOLPLAY: return "UI_CURSOR_TOOLPLAY";
|
case UI_CURSOR_TOOLPLAY: return "UI_CURSOR_TOOLPLAY";
|
||||||
case UI_CURSOR_TOOLPAUSE: return "UI_CURSOR_TOOLPAUSE";
|
case UI_CURSOR_TOOLPAUSE: return "UI_CURSOR_TOOLPAUSE";
|
||||||
case UI_CURSOR_TOOLMEDIAOPEN: return "UI_CURSOR_TOOLMEDIAOPEN";
|
case UI_CURSOR_TOOLMEDIAOPEN: return "UI_CURSOR_TOOLMEDIAOPEN";
|
||||||
case UI_CURSOR_PIPETTE: return "UI_CURSOR_PIPETTE";
|
case UI_CURSOR_PIPETTE: return "UI_CURSOR_PIPETTE";
|
||||||
case UI_CURSOR_TOOLSIT: return "UI_CURSOR_TOOLSIT";
|
case UI_CURSOR_TOOLSIT: return "UI_CURSOR_TOOLSIT";
|
||||||
case UI_CURSOR_TOOLBUY: return "UI_CURSOR_TOOLBUY";
|
case UI_CURSOR_TOOLBUY: return "UI_CURSOR_TOOLBUY";
|
||||||
case UI_CURSOR_TOOLOPEN: return "UI_CURSOR_TOOLOPEN";
|
case UI_CURSOR_TOOLOPEN: return "UI_CURSOR_TOOLOPEN";
|
||||||
@@ -2823,7 +2827,7 @@ const char* cursorIDToName(int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
llerrs << "cursorIDToName: unknown cursor id" << id << llendl;
|
llerrs << "cursorIDToName: unknown cursor id" << id << llendl;
|
||||||
|
|
||||||
return "UI_CURSOR_ARROW";
|
return "UI_CURSOR_ARROW";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2839,42 +2843,42 @@ static void initPixmapCursor(int cursorid, int hotspotX, int hotspotY)
|
|||||||
fullpath += gDirUtilp->getDirDelimiter();
|
fullpath += gDirUtilp->getDirDelimiter();
|
||||||
fullpath += cursorIDToName(cursorid);
|
fullpath += cursorIDToName(cursorid);
|
||||||
fullpath += ".tif";
|
fullpath += ".tif";
|
||||||
|
|
||||||
gCursors[cursorid] = createImageCursor(fullpath.c_str(), hotspotX, hotspotY);
|
gCursors[cursorid] = createImageCursor(fullpath.c_str(), hotspotX, hotspotY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLWindowMacOSX::setCursor(ECursorType cursor)
|
void LLWindowMacOSX::updateCursor()
|
||||||
{
|
{
|
||||||
OSStatus result = noErr;
|
OSStatus result = noErr;
|
||||||
|
|
||||||
if (mDragOverrideCursor != -1)
|
if (mDragOverrideCursor != -1)
|
||||||
{
|
{
|
||||||
// A drag is in progress...remember the requested cursor and we'll
|
// A drag is in progress...remember the requested cursor and we'll
|
||||||
// restore it when it is done
|
// restore it when it is done
|
||||||
mCurrentCursor = cursor;
|
mCurrentCursor = mNextCursor;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor == UI_CURSOR_ARROW
|
if (mNextCursor == UI_CURSOR_ARROW
|
||||||
&& mBusyCount > 0)
|
&& mBusyCount > 0)
|
||||||
{
|
{
|
||||||
cursor = UI_CURSOR_WORKING;
|
mNextCursor = UI_CURSOR_WORKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mCurrentCursor == cursor)
|
if(mCurrentCursor == mNextCursor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// RN: replace multi-drag cursors with single versions
|
// RN: replace multi-drag cursors with single versions
|
||||||
if (cursor == UI_CURSOR_ARROWDRAGMULTI)
|
if (mNextCursor == UI_CURSOR_ARROWDRAGMULTI)
|
||||||
{
|
{
|
||||||
cursor = UI_CURSOR_ARROWDRAG;
|
mNextCursor = UI_CURSOR_ARROWDRAG;
|
||||||
}
|
}
|
||||||
else if (cursor == UI_CURSOR_ARROWCOPYMULTI)
|
else if (mNextCursor == UI_CURSOR_ARROWCOPYMULTI)
|
||||||
{
|
{
|
||||||
cursor = UI_CURSOR_ARROWCOPY;
|
mNextCursor = UI_CURSOR_ARROWCOPY;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(cursor)
|
switch(mNextCursor)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case UI_CURSOR_ARROW:
|
case UI_CURSOR_ARROW:
|
||||||
@@ -2926,7 +2930,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
|
|||||||
case UI_CURSOR_TOOLBUY:
|
case UI_CURSOR_TOOLBUY:
|
||||||
case UI_CURSOR_TOOLOPEN:
|
case UI_CURSOR_TOOLOPEN:
|
||||||
case UI_CURSOR_TOOLPAY:
|
case UI_CURSOR_TOOLPAY:
|
||||||
result = setImageCursor(gCursors[cursor]);
|
result = setImageCursor(gCursors[mNextCursor]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2936,7 +2940,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
|
|||||||
InitCursor();
|
InitCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
mCurrentCursor = cursor;
|
mCurrentCursor = mNextCursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
ECursorType LLWindowMacOSX::getCursor() const
|
ECursorType LLWindowMacOSX::getCursor() const
|
||||||
@@ -2967,9 +2971,9 @@ void LLWindowMacOSX::initCursors()
|
|||||||
initPixmapCursor(UI_CURSOR_TOOLPLAY, 1, 1);
|
initPixmapCursor(UI_CURSOR_TOOLPLAY, 1, 1);
|
||||||
initPixmapCursor(UI_CURSOR_TOOLPAUSE, 1, 1);
|
initPixmapCursor(UI_CURSOR_TOOLPAUSE, 1, 1);
|
||||||
initPixmapCursor(UI_CURSOR_TOOLMEDIAOPEN, 1, 1);
|
initPixmapCursor(UI_CURSOR_TOOLMEDIAOPEN, 1, 1);
|
||||||
initPixmapCursor(UI_CURSOR_TOOLSIT, 1, 1);
|
initPixmapCursor(UI_CURSOR_TOOLSIT, 20, 15);
|
||||||
initPixmapCursor(UI_CURSOR_TOOLBUY, 1, 1);
|
initPixmapCursor(UI_CURSOR_TOOLBUY, 20, 15);
|
||||||
initPixmapCursor(UI_CURSOR_TOOLOPEN, 1, 1);
|
initPixmapCursor(UI_CURSOR_TOOLOPEN, 20, 15);
|
||||||
initPixmapCursor(UI_CURSOR_TOOLPAY, 1, 1);
|
initPixmapCursor(UI_CURSOR_TOOLPAY, 1, 1);
|
||||||
|
|
||||||
initPixmapCursor(UI_CURSOR_SIZENWSE, 10, 10);
|
initPixmapCursor(UI_CURSOR_SIZENWSE, 10, 10);
|
||||||
@@ -3281,14 +3285,14 @@ void LLWindowMacOSX::setTitle(const std::string &title)
|
|||||||
LLSD LLWindowMacOSX::getNativeKeyData()
|
LLSD LLWindowMacOSX::getNativeKeyData()
|
||||||
{
|
{
|
||||||
LLSD result = LLSD::emptyMap();
|
LLSD result = LLSD::emptyMap();
|
||||||
|
|
||||||
if(mRawKeyEvent)
|
if(mRawKeyEvent)
|
||||||
{
|
{
|
||||||
char char_code = 0;
|
char char_code = 0;
|
||||||
UInt32 key_code = 0;
|
UInt32 key_code = 0;
|
||||||
UInt32 modifiers = 0;
|
UInt32 modifiers = 0;
|
||||||
UInt32 keyboard_type = 0;
|
UInt32 keyboard_type = 0;
|
||||||
|
|
||||||
GetEventParameter (mRawKeyEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &char_code);
|
GetEventParameter (mRawKeyEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &char_code);
|
||||||
GetEventParameter (mRawKeyEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &key_code);
|
GetEventParameter (mRawKeyEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &key_code);
|
||||||
GetEventParameter (mRawKeyEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
GetEventParameter (mRawKeyEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
||||||
@@ -3298,7 +3302,7 @@ LLSD LLWindowMacOSX::getNativeKeyData()
|
|||||||
result["key_code"] = (S32)key_code;
|
result["key_code"] = (S32)key_code;
|
||||||
result["modifiers"] = (S32)modifiers;
|
result["modifiers"] = (S32)modifiers;
|
||||||
result["keyboard_type"] = (S32)keyboard_type;
|
result["keyboard_type"] = (S32)keyboard_type;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// This causes trouble for control characters -- apparently character codes less than 32 (escape, control-A, etc)
|
// This causes trouble for control characters -- apparently character codes less than 32 (escape, control-A, etc)
|
||||||
// cause llsd serialization to create XML that the llsd deserializer won't parse!
|
// cause llsd serialization to create XML that the llsd deserializer won't parse!
|
||||||
@@ -3307,7 +3311,7 @@ LLSD LLWindowMacOSX::getNativeKeyData()
|
|||||||
EventParamType actualType = typeUTF8Text;
|
EventParamType actualType = typeUTF8Text;
|
||||||
UInt32 actualSize = 0;
|
UInt32 actualSize = 0;
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
|
|
||||||
err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, 0, &actualSize, NULL);
|
err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, 0, &actualSize, NULL);
|
||||||
if(err == noErr)
|
if(err == noErr)
|
||||||
{
|
{
|
||||||
@@ -3320,7 +3324,7 @@ LLSD LLWindowMacOSX::getNativeKeyData()
|
|||||||
}
|
}
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
result["unicode"] = unicode;
|
result["unicode"] = unicode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3328,7 +3332,7 @@ LLSD LLWindowMacOSX::getNativeKeyData()
|
|||||||
|
|
||||||
|
|
||||||
lldebugs << "native key data is: " << result << llendl;
|
lldebugs << "native key data is: " << result << llendl;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3375,17 +3379,17 @@ void *LLWindowMacOSX::getPlatformWindow()
|
|||||||
|
|
||||||
void *LLWindowMacOSX::getMediaWindow()
|
void *LLWindowMacOSX::getMediaWindow()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Mozilla needs to be initialized with a WindowRef to function properly.
|
Mozilla needs to be initialized with a WindowRef to function properly.
|
||||||
(There's no good reason for this, since it shouldn't be interacting with our window in any way, but that's another issue.)
|
(There's no good reason for this, since it shouldn't be interacting with our window in any way, but that's another issue.)
|
||||||
If we're in windowed mode, we _could_ hand it our actual window pointer, but a subsequent switch to fullscreen will destroy that window,
|
If we're in windowed mode, we _could_ hand it our actual window pointer, but a subsequent switch to fullscreen will destroy that window,
|
||||||
which trips up Mozilla.
|
which trips up Mozilla.
|
||||||
Instead of using our actual window, we create an invisible window which will persist for the lifetime of the application and pass that to Mozilla.
|
Instead of using our actual window, we create an invisible window which will persist for the lifetime of the application and pass that to Mozilla.
|
||||||
This satisfies its deep-seated need to latch onto a WindowRef and solves the issue with switching between fullscreen and windowed modes.
|
This satisfies its deep-seated need to latch onto a WindowRef and solves the issue with switching between fullscreen and windowed modes.
|
||||||
|
|
||||||
Note that we will never destroy this window (by design!), but since only one will ever be created per run of the application, that's okay.
|
Note that we will never destroy this window (by design!), but since only one will ever be created per run of the application, that's okay.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(sMediaWindow == NULL)
|
if(sMediaWindow == NULL)
|
||||||
{
|
{
|
||||||
Rect window_rect = {100, 100, 200, 200};
|
Rect window_rect = {100, 100, 200, 200};
|
||||||
@@ -3394,13 +3398,13 @@ void *LLWindowMacOSX::getMediaWindow()
|
|||||||
NULL,
|
NULL,
|
||||||
&window_rect,
|
&window_rect,
|
||||||
(ConstStr255Param) "\p",
|
(ConstStr255Param) "\p",
|
||||||
false, // Create the window invisible.
|
false, // Create the window invisible.
|
||||||
zoomDocProc, // Window with a grow box and a zoom box
|
zoomDocProc, // Window with a grow box and a zoom box
|
||||||
kLastWindowOfClass, // create it behind other windows
|
kLastWindowOfClass, // create it behind other windows
|
||||||
false, // no close box
|
false, // no close box
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (void*)sMediaWindow;
|
return (void*)sMediaWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3450,7 +3454,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
UseInputWindow(mTSMDocument, !b);
|
UseInputWindow(mTSMDocument, !b);
|
||||||
|
|
||||||
// Take care of old and new preeditors.
|
// Take care of old and new preeditors.
|
||||||
if (preeditor != mPreeditor || !b)
|
if (preeditor != mPreeditor || !b)
|
||||||
{
|
{
|
||||||
@@ -3469,7 +3473,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mLanguageTextInputAllowed = b;
|
mLanguageTextInputAllowed = b;
|
||||||
|
|
||||||
if (b)
|
if (b)
|
||||||
{
|
{
|
||||||
if (mTSMScriptCode != smRoman)
|
if (mTSMScriptCode != smRoman)
|
||||||
@@ -3518,7 +3522,7 @@ MASK LLWindowMacOSX::modifiersToMask(SInt16 modifiers)
|
|||||||
if(modifiers & (cmdKey | controlKey)) { mask |= MASK_CONTROL; }
|
if(modifiers & (cmdKey | controlKey)) { mask |= MASK_CONTROL; }
|
||||||
if(modifiers & optionKey) { mask |= MASK_ALT; }
|
if(modifiers & optionKey) { mask |= MASK_ALT; }
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LL_OS_DRAGDROP_ENABLED
|
#if LL_OS_DRAGDROP_ENABLED
|
||||||
|
|
||||||
@@ -3529,53 +3533,53 @@ OSErr LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef
|
|||||||
LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon;
|
LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon;
|
||||||
|
|
||||||
lldebugs << "drag tracking handler, message = " << message << llendl;
|
lldebugs << "drag tracking handler, message = " << message << llendl;
|
||||||
|
|
||||||
switch(message)
|
switch(message)
|
||||||
{
|
{
|
||||||
case kDragTrackingInWindow:
|
case kDragTrackingInWindow:
|
||||||
result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_TRACK);
|
result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_TRACK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDragTrackingEnterHandler:
|
case kDragTrackingEnterHandler:
|
||||||
result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_START_TRACKING);
|
result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_START_TRACKING);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDragTrackingLeaveHandler:
|
case kDragTrackingLeaveHandler:
|
||||||
result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_STOP_TRACKING);
|
result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_STOP_TRACKING);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr LLWindowMacOSX::dragReceiveHandler(WindowRef theWindow, void * handlerRefCon,
|
OSErr LLWindowMacOSX::dragReceiveHandler(WindowRef theWindow, void * handlerRefCon,
|
||||||
DragRef drag)
|
DragRef drag)
|
||||||
{
|
{
|
||||||
LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon;
|
LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon;
|
||||||
return self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_DROPPED);
|
return self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_DROPPED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDropAction action)
|
OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDropAction action)
|
||||||
{
|
{
|
||||||
OSErr result = dragNotAcceptedErr; // overall function result
|
OSErr result = dragNotAcceptedErr; // overall function result
|
||||||
OSErr err = noErr; // for local error handling
|
OSErr err = noErr; // for local error handling
|
||||||
|
|
||||||
// Get the mouse position and modifiers of this drag.
|
// Get the mouse position and modifiers of this drag.
|
||||||
SInt16 modifiers, mouseDownModifiers, mouseUpModifiers;
|
SInt16 modifiers, mouseDownModifiers, mouseUpModifiers;
|
||||||
::GetDragModifiers(drag, &modifiers, &mouseDownModifiers, &mouseUpModifiers);
|
::GetDragModifiers(drag, &modifiers, &mouseDownModifiers, &mouseUpModifiers);
|
||||||
MASK mask = LLWindowMacOSX::modifiersToMask(modifiers);
|
MASK mask = LLWindowMacOSX::modifiersToMask(modifiers);
|
||||||
|
|
||||||
Point mouse_point;
|
Point mouse_point;
|
||||||
// This will return the mouse point in global screen coords
|
// This will return the mouse point in global screen coords
|
||||||
::GetDragMouse(drag, &mouse_point, NULL);
|
::GetDragMouse(drag, &mouse_point, NULL);
|
||||||
LLCoordScreen screen_coords(mouse_point.h, mouse_point.v);
|
LLCoordScreen screen_coords(mouse_point.h, mouse_point.v);
|
||||||
LLCoordGL gl_pos;
|
LLCoordGL gl_pos;
|
||||||
convertCoords(screen_coords, &gl_pos);
|
convertCoords(screen_coords, &gl_pos);
|
||||||
|
|
||||||
// Look at the pasteboard and try to extract an URL from it
|
// Look at the pasteboard and try to extract an URL from it
|
||||||
PasteboardRef pasteboard;
|
PasteboardRef pasteboard;
|
||||||
if(GetDragPasteboard(drag, &pasteboard) == noErr)
|
if(GetDragPasteboard(drag, &pasteboard) == noErr)
|
||||||
@@ -3583,22 +3587,22 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
|
|||||||
ItemCount num_items = 0;
|
ItemCount num_items = 0;
|
||||||
// Treat an error here as an item count of 0
|
// Treat an error here as an item count of 0
|
||||||
(void)PasteboardGetItemCount(pasteboard, &num_items);
|
(void)PasteboardGetItemCount(pasteboard, &num_items);
|
||||||
|
|
||||||
// Only deal with single-item drags.
|
// Only deal with single-item drags.
|
||||||
if(num_items == 1)
|
if(num_items == 1)
|
||||||
{
|
{
|
||||||
PasteboardItemID item_id = NULL;
|
PasteboardItemID item_id = NULL;
|
||||||
CFArrayRef flavors = NULL;
|
CFArrayRef flavors = NULL;
|
||||||
CFDataRef data = NULL;
|
CFDataRef data = NULL;
|
||||||
|
|
||||||
err = PasteboardGetItemIdentifier(pasteboard, 1, &item_id); // Yes, this really is 1-based.
|
err = PasteboardGetItemIdentifier(pasteboard, 1, &item_id); // Yes, this really is 1-based.
|
||||||
|
|
||||||
// Try to extract an URL from the pasteboard
|
// Try to extract an URL from the pasteboard
|
||||||
if(err == noErr)
|
if(err == noErr)
|
||||||
{
|
{
|
||||||
err = PasteboardCopyItemFlavors( pasteboard, item_id, &flavors);
|
err = PasteboardCopyItemFlavors( pasteboard, item_id, &flavors);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(err == noErr)
|
if(err == noErr)
|
||||||
{
|
{
|
||||||
if(CFArrayContainsValue(flavors, CFRangeMake(0, CFArrayGetCount(flavors)), kUTTypeURL))
|
if(CFArrayContainsValue(flavors, CFRangeMake(0, CFArrayGetCount(flavors)), kUTTypeURL))
|
||||||
@@ -3611,9 +3615,9 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
|
|||||||
// This is a string that might be an URL.
|
// This is a string that might be an URL.
|
||||||
err = PasteboardCopyItemFlavorData(pasteboard, item_id, kUTTypeUTF8PlainText, &data);
|
err = PasteboardCopyItemFlavorData(pasteboard, item_id, kUTTypeUTF8PlainText, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flavors != NULL)
|
if(flavors != NULL)
|
||||||
{
|
{
|
||||||
CFRelease(flavors);
|
CFRelease(flavors);
|
||||||
@@ -3624,12 +3628,12 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
|
|||||||
std::string url;
|
std::string url;
|
||||||
url.assign((char*)CFDataGetBytePtr(data), CFDataGetLength(data));
|
url.assign((char*)CFDataGetBytePtr(data), CFDataGetLength(data));
|
||||||
CFRelease(data);
|
CFRelease(data);
|
||||||
|
|
||||||
if(!url.empty())
|
if(!url.empty())
|
||||||
{
|
{
|
||||||
LLWindowCallbacks::DragNDropResult res =
|
LLWindowCallbacks::DragNDropResult res =
|
||||||
mCallbacks->handleDragNDrop(this, gl_pos, mask, action, url);
|
mCallbacks->handleDragNDrop(this, gl_pos, mask, action, url);
|
||||||
|
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case LLWindowCallbacks::DND_NONE: // No drop allowed
|
case LLWindowCallbacks::DND_NONE: // No drop allowed
|
||||||
if (action == LLWindowCallbacks::DNDA_TRACK)
|
if (action == LLWindowCallbacks::DNDA_TRACK)
|
||||||
@@ -3664,7 +3668,7 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
|
|||||||
// Restore the cursor
|
// Restore the cursor
|
||||||
ECursorType temp_cursor = mCurrentCursor;
|
ECursorType temp_cursor = mCurrentCursor;
|
||||||
// get around the "setting the same cursor" code in setCursor()
|
// get around the "setting the same cursor" code in setCursor()
|
||||||
mCurrentCursor = UI_CURSOR_COUNT;
|
mCurrentCursor = UI_CURSOR_COUNT;
|
||||||
setCursor(temp_cursor);
|
setCursor(temp_cursor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -3676,7 +3680,7 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
/*virtual*/ void showCursorFromMouseMove();
|
/*virtual*/ void showCursorFromMouseMove();
|
||||||
/*virtual*/ void hideCursorUntilMouseMove();
|
/*virtual*/ void hideCursorUntilMouseMove();
|
||||||
/*virtual*/ BOOL isCursorHidden();
|
/*virtual*/ BOOL isCursorHidden();
|
||||||
/*virtual*/ void setCursor(ECursorType cursor);
|
/*virtual*/ void updateCursor();
|
||||||
/*virtual*/ ECursorType getCursor() const;
|
/*virtual*/ ECursorType getCursor() const;
|
||||||
/*virtual*/ void captureMouse();
|
/*virtual*/ void captureMouse();
|
||||||
/*virtual*/ void releaseMouse();
|
/*virtual*/ void releaseMouse();
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
/*virtual*/ void showCursorFromMouseMove() {};
|
/*virtual*/ void showCursorFromMouseMove() {};
|
||||||
/*virtual*/ void hideCursorUntilMouseMove() {};
|
/*virtual*/ void hideCursorUntilMouseMove() {};
|
||||||
/*virtual*/ BOOL isCursorHidden() {return FALSE;};
|
/*virtual*/ BOOL isCursorHidden() {return FALSE;};
|
||||||
/*virtual*/ void setCursor(ECursorType cursor) {};
|
/*virtual*/ void updateCursor() {};
|
||||||
//virtual ECursorType getCursor() { return mCurrentCursor; };
|
//virtual ECursorType getCursor() { return mCurrentCursor; };
|
||||||
/*virtual*/ void captureMouse() {};
|
/*virtual*/ void captureMouse() {};
|
||||||
/*virtual*/ void releaseMouse() {};
|
/*virtual*/ void releaseMouse() {};
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include "llwindowcallbacks.h"
|
#include "llwindowcallbacks.h"
|
||||||
#include "llkeyboardsdl.h"
|
#include "llkeyboardsdl.h"
|
||||||
|
|
||||||
#include "llerror.h"
|
#include "llerror.h"
|
||||||
#include "llgl.h"
|
#include "llgl.h"
|
||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
@@ -221,15 +222,14 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
|
|||||||
#endif // LL_X11
|
#endif // LL_X11
|
||||||
|
|
||||||
#if LL_GTK
|
#if LL_GTK
|
||||||
// We MUST be the first to initialize GTK, i.e. we have to beat
|
// We MUST be the first to initialize GTK so that GTK doesn't get badly
|
||||||
// our embedded Mozilla to the punch so that GTK doesn't get badly
|
|
||||||
// initialized with a non-C locale and cause lots of serious random
|
// initialized with a non-C locale and cause lots of serious random
|
||||||
// weirdness.
|
// weirdness.
|
||||||
ll_try_gtk_init();
|
ll_try_gtk_init();
|
||||||
#endif // LL_GTK
|
#endif // LL_GTK
|
||||||
|
|
||||||
// Get the original aspect ratio of the main device.
|
// Assume 4:3 aspect ratio until we know better
|
||||||
mOriginalAspectRatio = 1024.0 / 768.0; // !!! *FIX: ? //(double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay);
|
mOriginalAspectRatio = 1024.0 / 768.0;
|
||||||
|
|
||||||
if (title.empty())
|
if (title.empty())
|
||||||
mWindowTitle = "SDL Window"; // *FIX: (???)
|
mWindowTitle = "SDL Window"; // *FIX: (???)
|
||||||
@@ -425,7 +425,6 @@ static int x11_detect_VRAM_kb()
|
|||||||
BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync)
|
BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync)
|
||||||
{
|
{
|
||||||
//bool glneedsinit = false;
|
//bool glneedsinit = false;
|
||||||
// const char *gllibname = null;
|
|
||||||
|
|
||||||
llinfos << "createContext, fullscreen=" << fullscreen <<
|
llinfos << "createContext, fullscreen=" << fullscreen <<
|
||||||
" size=" << width << "x" << height << llendl;
|
" size=" << width << "x" << height << llendl;
|
||||||
@@ -856,11 +855,13 @@ void LLWindowSDL::hide()
|
|||||||
// *FIX: What to do with SDL?
|
// *FIX: What to do with SDL?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//virtual
|
||||||
void LLWindowSDL::minimize()
|
void LLWindowSDL::minimize()
|
||||||
{
|
{
|
||||||
// *FIX: What to do with SDL?
|
// *FIX: What to do with SDL?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//virtual
|
||||||
void LLWindowSDL::restore()
|
void LLWindowSDL::restore()
|
||||||
{
|
{
|
||||||
// *FIX: What to do with SDL?
|
// *FIX: What to do with SDL?
|
||||||
@@ -1680,12 +1681,13 @@ void check_vm_bloat()
|
|||||||
}
|
}
|
||||||
#endif // LL_LINUX
|
#endif // LL_LINUX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
void LLWindowSDL::processMiscNativeEvents()
|
void LLWindowSDL::processMiscNativeEvents()
|
||||||
{
|
{
|
||||||
#if LL_GTK
|
#if LL_GTK
|
||||||
// Pump GTK events to avoid starvation for:
|
// Pump GTK events to avoid starvation for:
|
||||||
// * Embedded Gecko
|
|
||||||
// * DBUS servicing
|
// * DBUS servicing
|
||||||
// * Anything else which quietly hooks into the default glib/GTK loop
|
// * Anything else which quietly hooks into the default glib/GTK loop
|
||||||
if (ll_try_gtk_init())
|
if (ll_try_gtk_init())
|
||||||
@@ -1721,7 +1723,7 @@ void LLWindowSDL::processMiscNativeEvents()
|
|||||||
|
|
||||||
void LLWindowSDL::gatherInput()
|
void LLWindowSDL::gatherInput()
|
||||||
{
|
{
|
||||||
const Uint32 CLICK_THRESHOLD = 500; // milliseconds
|
const Uint32 CLICK_THRESHOLD = 500; // milliseconds
|
||||||
static int leftClick = 0;
|
static int leftClick = 0;
|
||||||
static int rightClick = 0;
|
static int rightClick = 0;
|
||||||
static Uint32 lastLeftDown = 0;
|
static Uint32 lastLeftDown = 0;
|
||||||
@@ -1747,16 +1749,17 @@ void LLWindowSDL::gatherInput()
|
|||||||
mKeyScanCode = event.key.keysym.scancode;
|
mKeyScanCode = event.key.keysym.scancode;
|
||||||
mKeyVirtualKey = event.key.keysym.unicode;
|
mKeyVirtualKey = event.key.keysym.unicode;
|
||||||
mKeyModifiers = event.key.keysym.mod;
|
mKeyModifiers = event.key.keysym.mod;
|
||||||
gKeyboard->handleKeyDown(event.key.keysym.sym, event.key.keysym.mod);
|
|
||||||
// part of the fix for SL-13243
|
|
||||||
if (SDLCheckGrabbyKeys(event.key.keysym.sym, TRUE) != 0)
|
|
||||||
SDLReallyCaptureInput(TRUE);
|
|
||||||
|
|
||||||
if (event.key.keysym.unicode)
|
gKeyboard->handleKeyDown(event.key.keysym.sym, event.key.keysym.mod);
|
||||||
{
|
// part of the fix for SL-13243
|
||||||
handleUnicodeUTF16(event.key.keysym.unicode,
|
if (SDLCheckGrabbyKeys(event.key.keysym.sym, TRUE) != 0)
|
||||||
gKeyboard->currentMask(FALSE));
|
SDLReallyCaptureInput(TRUE);
|
||||||
}
|
|
||||||
|
if (event.key.keysym.unicode)
|
||||||
|
{
|
||||||
|
handleUnicodeUTF16(event.key.keysym.unicode,
|
||||||
|
gKeyboard->currentMask(FALSE));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
@@ -1767,8 +1770,8 @@ void LLWindowSDL::gatherInput()
|
|||||||
if (SDLCheckGrabbyKeys(event.key.keysym.sym, FALSE) == 0)
|
if (SDLCheckGrabbyKeys(event.key.keysym.sym, FALSE) == 0)
|
||||||
SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243
|
SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243
|
||||||
|
|
||||||
gKeyboard->handleKeyUp(event.key.keysym.sym, event.key.keysym.mod);
|
gKeyboard->handleKeyUp(event.key.keysym.sym, event.key.keysym.mod);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
{
|
{
|
||||||
@@ -1878,7 +1881,7 @@ void LLWindowSDL::gatherInput()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mCallbacks->handleResize(this, width, height);
|
mCallbacks->handleResize(this, width, height);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1932,6 +1935,8 @@ void LLWindowSDL::gatherInput()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateCursor();
|
||||||
|
|
||||||
#if LL_X11
|
#if LL_X11
|
||||||
// This is a good time to stop flashing the icon if our mFlashTimer has
|
// This is a good time to stop flashing the icon if our mFlashTimer has
|
||||||
@@ -2018,7 +2023,7 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty
|
|||||||
return sdlcursor;
|
return sdlcursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLWindowSDL::setCursor(ECursorType cursor)
|
void LLWindowSDL::updateCursor()
|
||||||
{
|
{
|
||||||
if (ATIbug) {
|
if (ATIbug) {
|
||||||
// cursor-updating is very flaky when this bug is
|
// cursor-updating is very flaky when this bug is
|
||||||
@@ -2026,11 +2031,11 @@ void LLWindowSDL::setCursor(ECursorType cursor)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCurrentCursor != cursor)
|
if (mCurrentCursor != mNextCursor)
|
||||||
{
|
{
|
||||||
if (cursor < UI_CURSOR_COUNT)
|
if (mNextCursor < UI_CURSOR_COUNT)
|
||||||
{
|
{
|
||||||
SDL_Cursor *sdlcursor = mSDLCursors[cursor];
|
SDL_Cursor *sdlcursor = mSDLCursors[mNextCursor];
|
||||||
// Try to default to the arrow for any cursors that
|
// Try to default to the arrow for any cursors that
|
||||||
// did not load correctly.
|
// did not load correctly.
|
||||||
if (!sdlcursor && mSDLCursors[UI_CURSOR_ARROW])
|
if (!sdlcursor && mSDLCursors[UI_CURSOR_ARROW])
|
||||||
@@ -2038,9 +2043,9 @@ void LLWindowSDL::setCursor(ECursorType cursor)
|
|||||||
if (sdlcursor)
|
if (sdlcursor)
|
||||||
SDL_SetCursor(sdlcursor);
|
SDL_SetCursor(sdlcursor);
|
||||||
} else {
|
} else {
|
||||||
llwarns << "Tried to set invalid cursor number " << cursor << llendl;
|
llwarns << "Tried to set invalid cursor number " << mNextCursor << llendl;
|
||||||
}
|
}
|
||||||
mCurrentCursor = cursor;
|
mCurrentCursor = mNextCursor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
/*virtual*/ void showCursorFromMouseMove();
|
/*virtual*/ void showCursorFromMouseMove();
|
||||||
/*virtual*/ void hideCursorUntilMouseMove();
|
/*virtual*/ void hideCursorUntilMouseMove();
|
||||||
/*virtual*/ BOOL isCursorHidden();
|
/*virtual*/ BOOL isCursorHidden();
|
||||||
/*virtual*/ void setCursor(ECursorType cursor);
|
/*virtual*/ void updateCursor();
|
||||||
/*virtual*/ void captureMouse();
|
/*virtual*/ void captureMouse();
|
||||||
/*virtual*/ void releaseMouse();
|
/*virtual*/ void releaseMouse();
|
||||||
/*virtual*/ void setMouseClipping( BOOL b );
|
/*virtual*/ void setMouseClipping( BOOL b );
|
||||||
@@ -102,7 +102,7 @@ public:
|
|||||||
/*virtual*/ void gatherInput();
|
/*virtual*/ void gatherInput();
|
||||||
/*virtual*/ void swapBuffers();
|
/*virtual*/ void swapBuffers();
|
||||||
|
|
||||||
/*virtual*/ void delayInputProcessing() { };
|
/*virtual*/ void delayInputProcessing() { };
|
||||||
|
|
||||||
// handy coordinate space conversion routines
|
// handy coordinate space conversion routines
|
||||||
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
|
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
|
||||||
|
|||||||
@@ -677,6 +677,7 @@ void LLWindowWin32::hide()
|
|||||||
ShowWindow(mWindowHandle, SW_HIDE);
|
ShowWindow(mWindowHandle, SW_HIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//virtual
|
||||||
void LLWindowWin32::minimize()
|
void LLWindowWin32::minimize()
|
||||||
{
|
{
|
||||||
setMouseClipping(FALSE);
|
setMouseClipping(FALSE);
|
||||||
@@ -684,7 +685,7 @@ void LLWindowWin32::minimize()
|
|||||||
ShowWindow(mWindowHandle, SW_MINIMIZE);
|
ShowWindow(mWindowHandle, SW_MINIMIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//virtual
|
||||||
void LLWindowWin32::restore()
|
void LLWindowWin32::restore()
|
||||||
{
|
{
|
||||||
ShowWindow(mWindowHandle, SW_RESTORE);
|
ShowWindow(mWindowHandle, SW_RESTORE);
|
||||||
@@ -1019,6 +1020,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||||||
dw_style = WS_OVERLAPPEDWINDOW;
|
dw_style = WS_OVERLAPPEDWINDOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// don't post quit messages when destroying old windows
|
// don't post quit messages when destroying old windows
|
||||||
mPostQuit = FALSE;
|
mPostQuit = FALSE;
|
||||||
|
|
||||||
@@ -1070,6 +1072,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LL_INFOS("Window") << "Device context retrieved." << llendl ;
|
||||||
|
|
||||||
if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd)))
|
if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd)))
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
@@ -1078,6 +1082,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LL_INFOS("Window") << "Pixel format chosen." << llendl ;
|
||||||
|
|
||||||
// Verify what pixel format we actually received.
|
// Verify what pixel format we actually received.
|
||||||
if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
|
if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
|
||||||
&pfd))
|
&pfd))
|
||||||
@@ -1653,13 +1659,13 @@ void LLWindowWin32::initCursors()
|
|||||||
mCursor[ UI_CURSOR_PIPETTE ] = LoadCursor(module, TEXT("TOOLPIPETTE"));
|
mCursor[ UI_CURSOR_PIPETTE ] = LoadCursor(module, TEXT("TOOLPIPETTE"));
|
||||||
|
|
||||||
// Color cursors
|
// Color cursors
|
||||||
mCursor[UI_CURSOR_TOOLSIT] = loadColorCursor(TEXT("TOOLSIT"));
|
mCursor[ UI_CURSOR_TOOLSIT ] = loadColorCursor(TEXT("TOOLSIT"));
|
||||||
mCursor[UI_CURSOR_TOOLBUY] = loadColorCursor(TEXT("TOOLBUY"));
|
mCursor[ UI_CURSOR_TOOLBUY ] = loadColorCursor(TEXT("TOOLBUY"));
|
||||||
mCursor[UI_CURSOR_TOOLPAY] = loadColorCursor(TEXT("TOOLPAY"));
|
mCursor[ UI_CURSOR_TOOLPAY ] = loadColorCursor(TEXT("TOOLPAY"));
|
||||||
mCursor[UI_CURSOR_TOOLOPEN] = loadColorCursor(TEXT("TOOLOPEN"));
|
mCursor[ UI_CURSOR_TOOLOPEN ] = loadColorCursor(TEXT("TOOLOPEN"));
|
||||||
mCursor[UI_CURSOR_TOOLPLAY] = loadColorCursor(TEXT("TOOLPLAY"));
|
mCursor[ UI_CURSOR_TOOLPLAY ] = loadColorCursor(TEXT("TOOLPLAY"));
|
||||||
mCursor[UI_CURSOR_TOOLPAUSE] = loadColorCursor(TEXT("TOOLPAUSE"));
|
mCursor[ UI_CURSOR_TOOLPAUSE ] = loadColorCursor(TEXT("TOOLPAUSE"));
|
||||||
mCursor[UI_CURSOR_TOOLMEDIAOPEN] = loadColorCursor(TEXT("TOOLMEDIAOPEN"));
|
mCursor[ UI_CURSOR_TOOLMEDIAOPEN ] = loadColorCursor(TEXT("TOOLMEDIAOPEN"));
|
||||||
|
|
||||||
// Note: custom cursors that are not found make LoadCursor() return NULL.
|
// Note: custom cursors that are not found make LoadCursor() return NULL.
|
||||||
for( S32 i = 0; i < UI_CURSOR_COUNT; i++ )
|
for( S32 i = 0; i < UI_CURSOR_COUNT; i++ )
|
||||||
@@ -1673,18 +1679,18 @@ void LLWindowWin32::initCursors()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void LLWindowWin32::setCursor(ECursorType cursor)
|
void LLWindowWin32::updateCursor()
|
||||||
{
|
{
|
||||||
if (cursor == UI_CURSOR_ARROW
|
if (mNextCursor == UI_CURSOR_ARROW
|
||||||
&& mBusyCount > 0)
|
&& mBusyCount > 0)
|
||||||
{
|
{
|
||||||
cursor = UI_CURSOR_WORKING;
|
mNextCursor = UI_CURSOR_WORKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mCurrentCursor != cursor )
|
if( mCurrentCursor != mNextCursor )
|
||||||
{
|
{
|
||||||
mCurrentCursor = cursor;
|
mCurrentCursor = mNextCursor;
|
||||||
SetCursor( mCursor[cursor] );
|
SetCursor( mCursor[mNextCursor] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1764,6 +1770,8 @@ void LLWindowWin32::gatherInput()
|
|||||||
|
|
||||||
mInputProcessingPaused = FALSE;
|
mInputProcessingPaused = FALSE;
|
||||||
|
|
||||||
|
updateCursor();
|
||||||
|
|
||||||
// clear this once we've processed all mouse messages that might have occurred after
|
// clear this once we've processed all mouse messages that might have occurred after
|
||||||
// we slammed the mouse position
|
// we slammed the mouse position
|
||||||
mMousePositionModified = FALSE;
|
mMousePositionModified = FALSE;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
/*virtual*/ void showCursorFromMouseMove();
|
/*virtual*/ void showCursorFromMouseMove();
|
||||||
/*virtual*/ void hideCursorUntilMouseMove();
|
/*virtual*/ void hideCursorUntilMouseMove();
|
||||||
/*virtual*/ BOOL isCursorHidden();
|
/*virtual*/ BOOL isCursorHidden();
|
||||||
/*virtual*/ void setCursor(ECursorType cursor);
|
/*virtual*/ void updateCursor();
|
||||||
/*virtual*/ ECursorType getCursor() const;
|
/*virtual*/ ECursorType getCursor() const;
|
||||||
/*virtual*/ void captureMouse();
|
/*virtual*/ void captureMouse();
|
||||||
/*virtual*/ void releaseMouse();
|
/*virtual*/ void releaseMouse();
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
# -*- cmake -*-
|
|
||||||
|
|
||||||
project(llxuixml)
|
|
||||||
|
|
||||||
include(00-Common)
|
|
||||||
include(LLCommon)
|
|
||||||
include(LLMath)
|
|
||||||
include(LLXML)
|
|
||||||
|
|
||||||
include_directories(
|
|
||||||
${LLCOMMON_INCLUDE_DIRS}
|
|
||||||
${LLMATH_INCLUDE_DIRS}
|
|
||||||
${LLXML_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(llxuixml_SOURCE_FILES
|
|
||||||
llinitparam.cpp
|
|
||||||
lluicolor.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
set(llxuixml_HEADER_FILES
|
|
||||||
CMakeLists.txt
|
|
||||||
|
|
||||||
llinitparam.h
|
|
||||||
lluicolor.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set_source_files_properties(${llxuixml_HEADER_FILES}
|
|
||||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
|
||||||
|
|
||||||
list(APPEND llxuixml_SOURCE_FILES ${llxuixml_HEADER_FILES})
|
|
||||||
|
|
||||||
add_library (llxuixml ${llxuixml_SOURCE_FILES})
|
|
||||||
# Libraries on which this library depends, needed for Linux builds
|
|
||||||
# Sort by high-level to low-level
|
|
||||||
target_link_libraries(llxuixml
|
|
||||||
llxml
|
|
||||||
llcommon
|
|
||||||
llmath
|
|
||||||
)
|
|
||||||
@@ -37,7 +37,6 @@ include(LLUI)
|
|||||||
include(LLVFS)
|
include(LLVFS)
|
||||||
include(LLWindow)
|
include(LLWindow)
|
||||||
include(LLXML)
|
include(LLXML)
|
||||||
include(LLXUIXML)
|
|
||||||
include(LScript)
|
include(LScript)
|
||||||
include(Linking)
|
include(Linking)
|
||||||
include(NDOF)
|
include(NDOF)
|
||||||
@@ -72,7 +71,6 @@ include_directories(
|
|||||||
${LLVFS_INCLUDE_DIRS}
|
${LLVFS_INCLUDE_DIRS}
|
||||||
${LLWINDOW_INCLUDE_DIRS}
|
${LLWINDOW_INCLUDE_DIRS}
|
||||||
${LLXML_INCLUDE_DIRS}
|
${LLXML_INCLUDE_DIRS}
|
||||||
${LLXUIXML_INCLUDE_DIRS}
|
|
||||||
${LSCRIPT_INCLUDE_DIRS}
|
${LSCRIPT_INCLUDE_DIRS}
|
||||||
${LSCRIPT_INCLUDE_DIRS}/lscript_compile
|
${LSCRIPT_INCLUDE_DIRS}/lscript_compile
|
||||||
)
|
)
|
||||||
@@ -98,11 +96,7 @@ set(viewer_SOURCE_FILES
|
|||||||
ascentprefschat.cpp
|
ascentprefschat.cpp
|
||||||
ascentprefssys.cpp
|
ascentprefssys.cpp
|
||||||
ascentprefsvan.cpp
|
ascentprefsvan.cpp
|
||||||
#dhparam.cpp
|
|
||||||
#dsaparam.cpp
|
|
||||||
emeraldboobutils.cpp
|
emeraldboobutils.cpp
|
||||||
dofloaterhex.cpp
|
|
||||||
dohexeditor.cpp
|
|
||||||
floatersculptpreview.cpp
|
floatersculptpreview.cpp
|
||||||
hbfloatergrouptitles.cpp
|
hbfloatergrouptitles.cpp
|
||||||
hgfloatertexteditor.cpp
|
hgfloatertexteditor.cpp
|
||||||
@@ -115,6 +109,7 @@ set(viewer_SOURCE_FILES
|
|||||||
jcfloaterareasearch.cpp
|
jcfloaterareasearch.cpp
|
||||||
chatbar_as_cmdline.cpp
|
chatbar_as_cmdline.cpp
|
||||||
qtoolalign.cpp
|
qtoolalign.cpp
|
||||||
|
NACLantispam.cpp
|
||||||
llaccountingcostmanager.cpp
|
llaccountingcostmanager.cpp
|
||||||
llagent.cpp
|
llagent.cpp
|
||||||
llagentaccess.cpp
|
llagentaccess.cpp
|
||||||
@@ -474,8 +469,6 @@ set(viewer_SOURCE_FILES
|
|||||||
llviewerfoldertype.cpp
|
llviewerfoldertype.cpp
|
||||||
llviewergenericmessage.cpp
|
llviewergenericmessage.cpp
|
||||||
llviewergesture.cpp
|
llviewergesture.cpp
|
||||||
#llviewerimage.cpp
|
|
||||||
#llviewerimagelist.cpp
|
|
||||||
llviewerinventory.cpp
|
llviewerinventory.cpp
|
||||||
llviewerjoint.cpp
|
llviewerjoint.cpp
|
||||||
llviewerjointattachment.cpp
|
llviewerjointattachment.cpp
|
||||||
@@ -528,7 +521,6 @@ set(viewer_SOURCE_FILES
|
|||||||
llvopartgroup.cpp
|
llvopartgroup.cpp
|
||||||
llvosky.cpp
|
llvosky.cpp
|
||||||
llvosurfacepatch.cpp
|
llvosurfacepatch.cpp
|
||||||
llvotextbubble.cpp
|
|
||||||
llvotree.cpp
|
llvotree.cpp
|
||||||
llvovolume.cpp
|
llvovolume.cpp
|
||||||
llvowater.cpp
|
llvowater.cpp
|
||||||
@@ -576,6 +568,7 @@ set(viewer_HEADER_FILES
|
|||||||
CMakeLists.txt
|
CMakeLists.txt
|
||||||
ViewerInstall.cmake
|
ViewerInstall.cmake
|
||||||
|
|
||||||
|
NACLantispam.h
|
||||||
sgmemstat.h
|
sgmemstat.h
|
||||||
sgversion.h
|
sgversion.h
|
||||||
llviewerobjectbackup.h
|
llviewerobjectbackup.h
|
||||||
@@ -595,8 +588,6 @@ set(viewer_HEADER_FILES
|
|||||||
ascentprefssys.h
|
ascentprefssys.h
|
||||||
ascentprefsvan.h
|
ascentprefsvan.h
|
||||||
emeraldboobutils.h
|
emeraldboobutils.h
|
||||||
dofloaterhex.h
|
|
||||||
dohexeditor.h
|
|
||||||
floatersculptpreview.h
|
floatersculptpreview.h
|
||||||
hbfloatergrouptitles.h
|
hbfloatergrouptitles.h
|
||||||
hgfloatertexteditor.h
|
hgfloatertexteditor.h
|
||||||
@@ -976,8 +967,6 @@ set(viewer_HEADER_FILES
|
|||||||
llviewerfoldertype.h
|
llviewerfoldertype.h
|
||||||
llviewergenericmessage.h
|
llviewergenericmessage.h
|
||||||
llviewergesture.h
|
llviewergesture.h
|
||||||
#llviewerimage.h
|
|
||||||
#llviewerimagelist.h
|
|
||||||
llviewerinventory.h
|
llviewerinventory.h
|
||||||
llviewerjoint.h
|
llviewerjoint.h
|
||||||
llviewerjointattachment.h
|
llviewerjointattachment.h
|
||||||
@@ -1030,7 +1019,6 @@ set(viewer_HEADER_FILES
|
|||||||
llvopartgroup.h
|
llvopartgroup.h
|
||||||
llvosky.h
|
llvosky.h
|
||||||
llvosurfacepatch.h
|
llvosurfacepatch.h
|
||||||
llvotextbubble.h
|
|
||||||
llvotree.h
|
llvotree.h
|
||||||
llvotreenew.h
|
llvotreenew.h
|
||||||
llvovolume.h
|
llvovolume.h
|
||||||
@@ -1372,23 +1360,28 @@ if (FMOD OR FMODEX)
|
|||||||
endif (FMOD)
|
endif (FMOD)
|
||||||
|
|
||||||
if (DARWIN)
|
if (DARWIN)
|
||||||
set(fmodwrapper_SOURCE_FILES fmodwrapper.cpp)
|
if(FMOD)
|
||||||
add_library(fmodwrapper SHARED ${fmodwrapper_SOURCE_FILES})
|
set(fmodwrapper_SOURCE_FILES fmodwrapper.cpp)
|
||||||
if (FMODEX)
|
add_library(fmodwrapper SHARED ${fmodwrapper_SOURCE_FILES})
|
||||||
set(fmodwrapper_needed_LIBRARIES ${FMODEX_LIBRARY} ${CARBON_LIBRARY})
|
if (FMODEX)
|
||||||
endif (FMODEX)
|
set(fmodwrapper_needed_LIBRARIES ${FMODEX_LIBRARY} ${CARBON_LIBRARY})
|
||||||
if (FMOD)
|
endif (FMODEX)
|
||||||
set(fmodwrapper_needed_LIBRARIES ${FMOD_LIBRARY} ${CARBON_LIBRARY})
|
if (FMOD)
|
||||||
endif (FMOD)
|
set(fmodwrapper_needed_LIBRARIES ${FMOD_LIBRARY} ${CARBON_LIBRARY})
|
||||||
set_target_properties(
|
endif (FMOD)
|
||||||
fmodwrapper
|
set_target_properties(
|
||||||
PROPERTIES
|
fmodwrapper
|
||||||
BUILD_WITH_INSTALL_RPATH 1
|
PROPERTIES
|
||||||
INSTALL_NAME_DIR "@executable_path/../Resources"
|
BUILD_WITH_INSTALL_RPATH 1
|
||||||
LINK_FLAGS "-unexported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/fmod_hidden_symbols.exp"
|
INSTALL_NAME_DIR "@executable_path/../Resources"
|
||||||
)
|
LINK_FLAGS "-unexported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/fmod_hidden_symbols.exp"
|
||||||
set(FMODWRAPPER_LIBRARY fmodwrapper)
|
)
|
||||||
target_link_libraries(fmodwrapper ${fmodwrapper_needed_LIBRARIES})
|
set(FMODWRAPPER_LIBRARY fmodwrapper)
|
||||||
|
target_link_libraries(fmodwrapper ${fmodwrapper_needed_LIBRARIES})
|
||||||
|
endif(FMOD)
|
||||||
|
if(FMODEX)
|
||||||
|
set(FMODWRAPPER_LIBRARY ${FMODEX_LIBRARY})
|
||||||
|
endif(FMODEX)
|
||||||
else (DARWIN)
|
else (DARWIN)
|
||||||
# fmodwrapper unnecessary on linux or windows, for fmod and fmodex
|
# fmodwrapper unnecessary on linux or windows, for fmod and fmodex
|
||||||
if (FMODEX)
|
if (FMODEX)
|
||||||
@@ -1547,7 +1540,6 @@ target_link_libraries(${VIEWER_BINARY_NAME}
|
|||||||
${LLVFS_LIBRARIES}
|
${LLVFS_LIBRARIES}
|
||||||
${LLWINDOW_LIBRARIES}
|
${LLWINDOW_LIBRARIES}
|
||||||
${LLXML_LIBRARIES}
|
${LLXML_LIBRARIES}
|
||||||
${LLXUIXML_LIBRARIES}
|
|
||||||
${LSCRIPT_LIBRARIES}
|
${LSCRIPT_LIBRARIES}
|
||||||
${LLMATH_LIBRARIES}
|
${LLMATH_LIBRARIES}
|
||||||
${LLCOMMON_LIBRARIES}
|
${LLCOMMON_LIBRARIES}
|
||||||
@@ -1798,7 +1790,7 @@ endif (WINDOWS)
|
|||||||
if (DARWIN)
|
if (DARWIN)
|
||||||
# Don't do this here -- it's taken care of by viewer_manifest.py
|
# Don't do this here -- it's taken care of by viewer_manifest.py
|
||||||
# add_custom_command(TARGET ${VIEWER_BINARY_NAME} POST_BUILD
|
# add_custom_command(TARGET ${VIEWER_BINARY_NAME} POST_BUILD
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libllqtwebkit.dylib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin/
|
# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib/release/libllqtwebkit.dylib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin/
|
||||||
# DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libllqtwebkit.dylib
|
# DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib/release/libllqtwebkit.dylib
|
||||||
# )
|
# )
|
||||||
endif (DARWIN)
|
endif (DARWIN)
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
CFBundleName = "Singularity";
|
CFBundleName = "Singularity";
|
||||||
|
|
||||||
CFBundleShortVersionString = "Singularity Viewer 1.5.0.0";
|
CFBundleShortVersionString = "Singularity Viewer 1.7.0.0";
|
||||||
CFBundleGetInfoString = "Singularity Viewer 1.5.0.0, Copyright 2010 Siana Gearz";
|
CFBundleGetInfoString = "Singularity Viewer 1.7.0.0, Copyright 2012 Siana Gearz";
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user