From 6e73b33b916934a9a7c86f8e9e7ab767eee6787d Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Sun, 17 Jan 2016 08:11:24 -0500 Subject: [PATCH 1/9] Add missing header files for basic_plugin_base and media_plugin_base to cmake --- indra/plugins/base_basic/CMakeLists.txt | 5 +++++ indra/plugins/base_media/CMakeLists.txt | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/indra/plugins/base_basic/CMakeLists.txt b/indra/plugins/base_basic/CMakeLists.txt index 404ef3fee..7c941af4f 100644 --- a/indra/plugins/base_basic/CMakeLists.txt +++ b/indra/plugins/base_basic/CMakeLists.txt @@ -33,6 +33,11 @@ set(basic_plugin_base_HEADER_FILES basic_plugin_base.h ) +set_source_files_properties(${basic_plugin_base_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND basic_plugin_base_SOURCE_FILES ${basic_plugin_base_HEADER_FILES}) + add_library(basic_plugin_base ${basic_plugin_base_SOURCE_FILES} ) diff --git a/indra/plugins/base_media/CMakeLists.txt b/indra/plugins/base_media/CMakeLists.txt index acd8d201c..504b6c932 100644 --- a/indra/plugins/base_media/CMakeLists.txt +++ b/indra/plugins/base_media/CMakeLists.txt @@ -47,6 +47,11 @@ set(media_plugin_base_HEADER_FILES media_plugin_base.h ) +set_source_files_properties(${media_plugin_base_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND media_plugin_base_SOURCE_FILES ${media_plugin_base_HEADER_FILES}) + add_library(media_plugin_base ${media_plugin_base_SOURCE_FILES} ) @@ -54,8 +59,3 @@ add_library(media_plugin_base target_link_libraries(media_plugin_base ${BASIC_PLUGIN_BASE_LIBRARIES} ) - -add_dependencies(media_plugin_base - ${BASIC_PLUGIN_BASE_LIBRARIES} -) - From 0fe3a2623affaaeb6217fcc78fb9b6bc033bbd98 Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Sun, 17 Jan 2016 08:11:54 -0500 Subject: [PATCH 2/9] Fix double std::endl --- indra/newview/llfloaterreporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 9088a7374..be5ff68b1 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -624,7 +624,7 @@ LLSD LLFloaterReporter::gatherReport() std::ostringstream details; - details << "V" << LLVersionInfo::getVersion() << std::endl << std::endl; // client version moved to body of email for abuse reports + details << "V" << LLVersionInfo::getVersion() << std::endl; // client version moved to body of email for abuse reports std::string object_name = getChild("object_name")->getValue().asString(); if (!object_name.empty() && !mOwnerName.empty()) From 8a6bb4c00ae292a877aee872687452457e8d7ab5 Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Sun, 17 Jan 2016 08:19:17 -0500 Subject: [PATCH 3/9] Add options for LTO and Incremental Linking for windows --- indra/cmake/00-Common.cmake | 33 ++++++++++++++++++++++++-- indra/cmake/Variables.cmake | 2 ++ indra/llplugin/slplugin/CMakeLists.txt | 2 +- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index f6d570c3f..ba900d1d5 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -49,7 +49,7 @@ if (WINDOWS) "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP" CACHE STRING "C++ compiler release-with-debug options" FORCE) set(CMAKE_CXX_FLAGS_RELEASE - "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /fp:fast -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0" + "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /Zo /MD /MP /Ob2 /Zc:inline /fp:fast -D_ITERATOR_DEBUG_LEVEL=0" CACHE STRING "C++ compiler release options" FORCE) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${LL_C_FLAGS} /O2 /Zi /MD /MP /fp:fast" @@ -59,6 +59,27 @@ if (WINDOWS) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") endif (WORD_SIZE EQUAL 32) + if (USE_LTO) + if(INCREMENTAL_LINK) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG:INCREMENTAL") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG:INCREMENTAL") + set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG:INCREMENTAL") + else(INCREMENTAL_LINK) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG") + set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG") + endif(INCREMENTAL_LINK) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /OPT:ICF /LTCG") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /OPT:ICF /LTCG") + set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG") + elseif (INCREMENTAL_LINK) + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL /VERBOSE:INCR") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL /VERBOSE:INCR") + else () + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /INCREMENTAL:NO") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /INCREMENTAL:NO") + endif () + set(CMAKE_CXX_STANDARD_LIBRARIES "") set(CMAKE_C_STANDARD_LIBRARIES "") @@ -78,9 +99,17 @@ if (WINDOWS) /Oy- /Zm140 /wd4267 - /wd4244 + /wd4244 ) + if (USE_LTO) + add_compile_options( + /GL + /Gy + /Gw + ) + endif (USE_LTO) + if (WORD_SIZE EQUAL 32) add_compile_options(/arch:SSE2) endif (WORD_SIZE EQUAL 32) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index 015dfb162..016fdd10f 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -29,6 +29,8 @@ set(LL_TESTS OFF CACHE BOOL "Build and run unit and integration tests (disable f # Compiler and toolchain options set(DISABLE_TCMALLOC OFF CACHE BOOL "Disable linkage of TCMalloc. (64bit builds automatically disable TCMalloc)") set(DISABLE_FATAL_WARNINGS TRUE CACHE BOOL "Set this to FALSE to enable fatal warnings.") +option(INCREMENTAL_LINK "Use incremental linking or incremental LTCG for LTO on win32 builds (enable for faster links on some machines)" OFF) +option(USE_LTO "Enable Whole Program Optimization and related folding and binary reduction routines" OFF) if(LIBS_CLOSED_DIR) file(TO_CMAKE_PATH "${LIBS_CLOSED_DIR}" LIBS_CLOSED_DIR) diff --git a/indra/llplugin/slplugin/CMakeLists.txt b/indra/llplugin/slplugin/CMakeLists.txt index 9020b85ca..f2596a1a6 100644 --- a/indra/llplugin/slplugin/CMakeLists.txt +++ b/indra/llplugin/slplugin/CMakeLists.txt @@ -57,7 +57,7 @@ set_target_properties(SLPlugin if (WINDOWS) set_target_properties(SLPlugin PROPERTIES - LINK_FLAGS "/OPT:NOREF" + LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMTD\"" ) EMBED_MANIFEST(SLPlugin 1) endif() From 0824055b29314677bada481cd65e1f59c960bd61 Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Sun, 17 Jan 2016 11:45:35 -0500 Subject: [PATCH 4/9] Remove ELFIO --- indra/cmake/00-Common.cmake | 1 - indra/cmake/CMakeLists.txt | 2 -- indra/cmake/ELFIO.cmake | 22 --------------- indra/cmake/FindELFIO.cmake | 48 -------------------------------- indra/newview/CMakeLists.txt | 3 -- indra/newview/viewer_manifest.py | 2 -- 6 files changed, 78 deletions(-) delete mode 100644 indra/cmake/ELFIO.cmake delete mode 100644 indra/cmake/FindELFIO.cmake diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index ba900d1d5..c938df16e 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -317,7 +317,6 @@ if (STANDALONE) add_definitions(-DLL_STANDALONE=1) else (STANDALONE) set(${ARCH}_linux_INCLUDES - ELFIO atk-1.0 glib-2.0 gstreamer-0.10 diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 708db7571..800e68ed2 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -25,7 +25,6 @@ set(cmake_SOURCE_FILES Cwdebug.cmake DBusGlib.cmake DeploySharedLibs.cmake - ELFIO.cmake EXPAT.cmake ExamplePlugin.cmake FMODSTUDIO.cmake @@ -34,7 +33,6 @@ set(cmake_SOURCE_FILES FindBerkeleyDB.cmake FindCARes.cmake FindColladadom.cmake - FindELFIO.cmake FindGLOD.cmake FindGoogleBreakpad.cmake FindGooglePerfTools.cmake diff --git a/indra/cmake/ELFIO.cmake b/indra/cmake/ELFIO.cmake deleted file mode 100644 index 8de2c36d4..000000000 --- a/indra/cmake/ELFIO.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -set(ELFIO_FIND_QUIETLY ON) - -if (STANDALONE) - include(FindELFIO) -elseif (LINUX) - use_prebuilt_binary(elfio) - set(ELFIO_LIBRARIES ELFIO) - set(ELFIO_INCLUDE_DIR - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) - set(ELFIO_FOUND "YES") -endif (STANDALONE) - -if (ELFIO_FOUND) - add_definitions(-DLL_ELFBIN=1) -else (ELFIO_FOUND) - set(ELFIO_INCLUDE_DIR "") -endif (ELFIO_FOUND) diff --git a/indra/cmake/FindELFIO.cmake b/indra/cmake/FindELFIO.cmake deleted file mode 100644 index 8a5421ab9..000000000 --- a/indra/cmake/FindELFIO.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# -*- cmake -*- - -# - Find ELFIO -# Find the ELFIO includes and library -# This module defines -# ELFIO_INCLUDE_DIR, where to find elfio.h, etc. -# ELFIO_LIBRARIES, the libraries needed to use ELFIO. -# ELFIO_FOUND, If false, do not try to use ELFIO. -# also defined, but not for general use are -# ELFIO_LIBRARY, where to find the ELFIO library. - -FIND_PATH(ELFIO_INCLUDE_DIR ELFIO/ELFIO.h -/usr/local/include -/usr/include -) - -SET(ELFIO_NAMES ${ELFIO_NAMES} ELFIO) -FIND_LIBRARY(ELFIO_LIBRARY - NAMES ${ELFIO_NAMES} - PATHS /usr/lib /usr/local/lib - ) - -IF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) - SET(ELFIO_LIBRARIES ${ELFIO_LIBRARY}) - SET(ELFIO_FOUND "YES") -ELSE (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) - SET(ELFIO_FOUND "NO") -ENDIF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) - - -IF (ELFIO_FOUND) - IF (NOT ELFIO_FIND_QUIETLY) - MESSAGE(STATUS "Found ELFIO: ${ELFIO_LIBRARIES}") - ENDIF (NOT ELFIO_FIND_QUIETLY) -ELSE (ELFIO_FOUND) - IF (ELFIO_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find ELFIO library") - ENDIF (ELFIO_FIND_REQUIRED) -ENDIF (ELFIO_FOUND) - -# Deprecated declarations. -SET (NATIVE_ELFIO_INCLUDE_PATH ${ELFIO_INCLUDE_DIR} ) -GET_FILENAME_COMPONENT (NATIVE_ELFIO_LIB_PATH ${ELFIO_LIBRARY} PATH) - -MARK_AS_ADVANCED( - ELFIO_LIBRARY - ELFIO_INCLUDE_DIR - ) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 2c89f64da..26f45a6cb 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -8,7 +8,6 @@ include(BuildPackagesInfo) include(BuildVersion) include(CMakeCopyIfDifferent) include(DBusGlib) -include(ELFIO) include(FMODSTUDIO) include(GLOD) include(FindOpenGL) @@ -53,7 +52,6 @@ include_directories( ${STATEMACHINE_INCLUDE_DIRS} ${DBUSGLIB_INCLUDE_DIRS} ${HUNSPELL_INCLUDE_DIR} - ${ELFIO_INCLUDE_DIR} ${JSONCPP_INCLUDE_DIR} ${GLOD_INCLUDE_DIRS} ${LLAUDIO_INCLUDE_DIRS} @@ -1656,7 +1654,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${UI_LIBRARIES} ${WINDOWS_LIBRARIES} ${XMLRPCEPI_LIBRARIES} - ${ELFIO_LIBRARIES} ${HUNSPELL_LIBRARY} ${LLPHYSICSEXTENSIONS_LIBRARIES} ${LLAPPEARANCE_LIBRARIES} diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 9523df020..19b1046ee 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1002,7 +1002,6 @@ class Linux_i686_Manifest(LinuxManifest): self.path("libcollada14dom.so.2.2", "libcollada14dom.so") self.path("libcrypto.so*") - self.path("libELFIO.so") self.path("libssl.so*") self.path("libtcmalloc_minimal.so.0") self.path("libtcmalloc_minimal.so.0.2.2") @@ -1058,7 +1057,6 @@ class Linux_x86_64_Manifest(LinuxManifest): self.path("libcollada14dom.so.2.2", "libcollada14dom.so") self.path("libcrypto.so.*") - self.path("libELFIO.so") self.path("libjpeg.so*") self.path("libpng*.so*") self.path("libz.so*") From 83338c1ee15357592198ee4016d29390dbbae692 Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Sun, 17 Jan 2016 12:56:17 -0500 Subject: [PATCH 5/9] start to get linux64 working --- autobuild.xml | 790 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 505 insertions(+), 285 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index fbdca77b8..0096381f4 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -6,7 +6,7 @@ SDL copyright - Copyright (C) 1997-2012 Sam Lantinga + Copyright (c) 2004, 2006-2013 Sam Lantinga description Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. license @@ -29,6 +29,20 @@ name linux + linux64 + + archive + + hash + 0af4eae4fd3a969ff3af542e1b3e4381 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/SDL-1.2.15-linux64-201504222326.tar.bz2 + + name + linux64 + version 1.2.15 @@ -71,6 +85,20 @@ name linux + linux64 + + archive + + hash + e66a2e7fb424f37aa4a02e854c240b3c + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/apr_suite-1.5.2-linux64-201506231118.tar.bz2 + + name + linux64 + windows archive @@ -141,6 +169,20 @@ name linux + linux64 + + archive + + hash + 1539cf5db47189e670401ba587e14e3c + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/ares-1.10.0-linux64-201504222057.tar.bz2 + + name + linux64 + windows archive @@ -211,6 +253,20 @@ name linux + linux64 + + archive + + hash + 543643b22f086af333a3dcfbf75742e2 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/boost-1.59.0-linux64-201509201640.tar.bz2 + + name + linux64 + windows archive @@ -279,6 +335,20 @@ name linux + linux64 + + archive + + hash + f5f4552817b4d0533c21cb20369fac6d + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/colladadom-2.3-linux64-201509211635.tar.bz2 + + name + linux + windows archive @@ -349,6 +419,20 @@ name linux + linux64 + + archive + + hash + 7c9d714545fcdc9de26da1ce673fe000 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/curl-7.45.0-linux64-201510120428.tar.bz2 + + name + linux64 + windows archive @@ -381,37 +465,7 @@ version 7.46.0 - db - - copyright - Copyright (c) 1990, 2010 Oracle and/or its affiliates. All rights reserved. - description - Berkeley DB (libdb) is a programmatic toolkit that provides embedded database support for both traditional and client/server applications. - license - bsd - license_file - LICENSES/db.txt - name - db - platforms - - linux - - archive - - hash - 1cc7940e500858a9754e9a3cc3ba2237 - url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/db_3p-update-db/rev/295315/arch/Linux/installer/db-5.1.25-linux-295315.tar.bz2 - - name - linux - - - version - 5.1.25 - - dbus_glib + dbus-glib copyright Copyright (C) Red Hat Inc. @@ -422,7 +476,7 @@ license_file LICENSES/dbus-glib.txt name - dbus_glib + dbus-glib platforms linux @@ -437,6 +491,20 @@ name linux + linux64 + + archive + + hash + 84e51f2e14db023be5419e74ab3b51d3 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/dbus_glib-0.76-linux64-201501030130.tar.bz2 + + name + linux64 + version 0.76 @@ -473,30 +541,6 @@ version 1 - elfio - - license - lgpl - license_file - LICENSES/elfio.txt - name - elfio - platforms - - linux - - archive - - hash - 031e6315a5c0829c9b9a2ec18aeb7ae3 - url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-elfio/rev/222074/arch/Linux/installer/elfio-1.0.3-linux-20110225.tar.bz2 - - name - linux - - - expat copyright @@ -535,6 +579,20 @@ name linux + linux64 + + archive + + hash + b863aeee79defcd7f10860f19b97e254 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/expat-2.1.0-linux64-201504222216.tar.bz2 + + name + linux64 + windows archive @@ -681,6 +739,20 @@ name linux + linux64 + + archive + + hash + 333c37f6ec2c1db04b2d73493b3a4c09 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/fontconfig-2.11.0-linux64-201507231614.tar.bz2 + + name + linux64 + version 2.11.0 @@ -769,6 +841,20 @@ name linux + linux64 + + archive + + hash + f0588eb6aba810febd3ad48e6a259436 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/freetype-2.6.0-linux64-201507231602.tar.bz2 + + name + linux64 + windows archive @@ -907,6 +993,20 @@ name linux + linux64 + + archive + + hash + 677a0141c4d9fd8778cd497c293b1704 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/glod-1.0pre4-linux64-201504222107.tar.bz2 + + name + linux64 + windows archive @@ -977,6 +1077,20 @@ name linux + linux64 + + archive + + hash + 97d74247b36e67d88f4a8ba8c7ee96a4 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/google_breakpad-1474-linux64-201507231539.tar.bz2 + + name + linux64 + windows archive @@ -1075,26 +1189,30 @@ gstreamer platforms - linux + common archive hash - fb1479533a7699b44d34e3a550037eb7 + df57a59e832f9e3ca8ba31e37e383dfb + hash_algorithm + md5 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/gstreamer_3p-update-gstreamer/rev/294903/arch/Linux/installer/gstreamer-0.10.6.294903-linux-294903.tar.bz2 + http://depot.alchemyviewer.org/pub/common/lib/gstreamer-0.10.6.201501032013-common-201501032013.tar.bz2 name - linux + common version - 0.10.6.294903 + 0.10.6.201501032013 gtk-atk-pango-glib copyright - Copyright (various, see sources) + Copyright various(See license file) + description + gtk-atk-pango-glib license lgpl license_file @@ -1115,64 +1233,24 @@ name linux + linux64 + + archive + + hash + 5d820cbb71bac0ccc142622bc3a7d56f + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/gtk_atk_pango_glib-0.0.2-linux64-201507231955.tar.bz2 + + name + linux64 + version 0.0 - havok-source - - copyright - Uses Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (and its Licensors). All Rights Reserved. See www.havok.com for details. - description - Havok source code for libs and demos - license - havok - license_file - LICENSES/havok.txt - name - havok-source - platforms - - darwin - - archive - - hash - 5c5b4820999ae9e398801d6a46f45897 - url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/havok-source_3p-update-havok-source/rev/297312/arch/Darwin/installer/havok_source-2012.1-darwin-297312.tar.bz2 - - name - darwin - - linux - - archive - - hash - 6b0f41ddddfa60d8424d8a2e0bc2077d - url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/havok-source_3p-update-havok-source/rev/296959/arch/Linux/installer/havok_source-2012.1-linux-296959.tar.bz2 - - name - linux - - windows - - archive - - hash - ab30ae74a665950d73ea559f019ff358 - url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/havok-source_3p-update-havok-source/rev/297566/arch/CYGWIN/installer/havok_source-2012.1-windows-297566.tar.bz2 - - name - windows - - - version - 2012.1 - jpeglib copyright @@ -1211,6 +1289,20 @@ name linux + linux64 + + archive + + hash + bb3cfffb1e0079c0a4e1a731ca404e99 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/jpeglib-1.4.1-linux64-201507231342.tar.bz2 + + name + linux64 + windows archive @@ -1281,6 +1373,20 @@ name linux + linux64 + + archive + + hash + 07f1fc5de319f5ab4e73eaeaab11655f + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/jsoncpp-1.6.5-linux64-201508261319.tar.bz2 + + name + linux64 + windows archive @@ -1313,60 +1419,6 @@ version 1.6.5 - kdu - - copyright - Kakadu software - description - JPEG2000 library by Kakadu - license - Kakadu - license_file - LICENSES/kdu.txt - name - kdu - platforms - - darwin - - archive - - hash - e62f2fc1ee9ab791d603c5b717b46119 - url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/kdu_3p-update-kdu/rev/296932/arch/Darwin/installer/kdu-7.2.296932-darwin-296932.tar.bz2 - - name - darwin - - linux - - archive - - hash - ed952c0cb86329e63a8db190953962d8 - url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/kdu_3p-update-kdu/rev/296932/arch/Linux/installer/kdu-7.2.296932-linux-296932.tar.bz2 - - name - linux - - windows - - archive - - hash - a0e5c050a4975c81611d9f1862ac57fb - url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/kdu_3p-update-kdu/rev/296932/arch/CYGWIN/installer/kdu-7.2.296932-windows-296932.tar.bz2 - - name - windows - - - version - 7.2.296932 - libhunspell copyright @@ -1405,6 +1457,20 @@ name linux + linux64 + + archive + + hash + f9c2a23d112f4401366e4cf61f12919f + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/libhunspell-1.3.3-linux64-201504222121.tar.bz2 + + name + linux64 + windows archive @@ -1437,6 +1503,52 @@ version 1.3.3 + libidn + + copyright + Copyright (C) 2002-2013 Simon Josefsson + description + Libidn's purpose is to encode and decode internationalized domain names. + license + LGPL + license_file + LICENSES/libidn.txt + name + libidn + platforms + + darwin + + archive + + hash + 4c1f76a59c9abd7590b60b1507c16540 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/libidn-1.32-darwin-201511222141.tar.bz2 + + name + darwin + + linux64 + + archive + + hash + 25cc66cae22fdeacec871477c6c0ff9e + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/libidn-1.31-linux64-201507111804.tar.bz2 + + name + linux64 + + + version + 1.32 + libndofdev copyright @@ -1495,6 +1607,38 @@ version 0.1 + libndofdev-open + + copyright + Copyright (c) 2008, Jan Ciger (jan.ciger (at) gmail.com) + description + 3DConnection SDK + license + BSD + license_file + LICENSES/libndofdev.txt + name + libndofdev-open + platforms + + linux64 + + archive + + hash + 79ab48e71adda5759685d17d2497cdc7 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/libndofdev_open-0.6-linux64-201504222332.tar.bz2 + + name + linux64 + + + version + 0.6 + libpng copyright @@ -1533,6 +1677,20 @@ name linux + linux64 + + archive + + hash + e12673f5a2806cb5f7c22b432e4c18e2 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/libpng-1.6.17-linux64-201504222318.tar.bz2 + + name + linux64 + windows archive @@ -1565,36 +1723,6 @@ version 1.6.19 - libuuid - - copyright - Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/> - description - OSSP uuid is a ISO-C:1999 application programming interface (API) and corresponding command line interface (CLI) for the generation of DCE 1.1, ISO/IEC 11578:1996 and RFC 4122 compliant Universally Unique Identifier (UUID). - license - UUID - license_file - LICENSES/uuid.txt - name - libuuid - platforms - - linux - - archive - - hash - f231b6ec8bc2f050cfb1ee20bd83190d - url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/libuuid_3p-update-libuuid/rev/295209/arch/Linux/installer/libuuid-1.6.2-linux-295209.tar.bz2 - - name - linux - - - version - 1.6.2 - libxml2 copyright @@ -1633,6 +1761,20 @@ name linux + linux64 + + archive + + hash + bcfb3196df9b18aaf4f25ae40c8eda69 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/libxml2-2.9.2-linux64-201507231608.tar.bz2 + + name + linux64 + windows archive @@ -1665,36 +1807,6 @@ version 2.9.3 - llappearance_utility - - copyright - Copyright (c) 2000-2012, Linden Research, Inc. - description - Linden Lab appearance utility for server-side avatar baking services. - license - Proprietary - license_file - LICENSES/llappearanceutility.txt - name - llappearance_utility - platforms - - linux - - archive - - hash - ce1261a54d877ab5530ae6a9134a77a3 - url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearance_viewer-update-llappearance-utility/rev/294906/arch/Linux/installer/llappearance_utility-0.0.1-linux-294906.tar.bz2 - - name - linux - - - version - 0.0.1 - llceflib copyright @@ -1755,60 +1867,6 @@ version 3.2526.1364.gf6bf57b - llphysicsextensions_source - - copyright - Copyright (c) 2010, Linden Research, Inc. - license - internal - license_file - LICENSES/llphysicsextensions.txt - name - llphysicsextensions_source - platforms - - darwin - - archive - - hash - 468e88a527e610804c3eecf07f4ed70b - hash_algorithm - md5 - url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source_llphysicsextensions-update/rev/298369/arch/Darwin/installer/llphysicsextensions_source-1.0.298369-darwin-298369.tar.bz2 - - name - darwin - - linux - - archive - - hash - 793964e49c935b414c4bdbb8a0d14ad1 - url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source_llphysicsextensions-update/rev/298369/arch/Linux/installer/llphysicsextensions_source-1.0.298369-linux-298369.tar.bz2 - - name - linux - - windows - - archive - - hash - 922aad5261aac150e5ce3c094e57f373 - url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source_llphysicsextensions-update/rev/298369/arch/CYGWIN/installer/llphysicsextensions_source-1.0.298369-windows-298369.tar.bz2 - - name - windows - - - version - 1.0.298369 - llphysicsextensions_stub copyright @@ -1997,6 +2055,20 @@ name linux + linux64 + + archive + + hash + f177439b76c57a9950949a239032e4e8 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/ogg_vorbis-1.3.2-1.3.5-linux64-201504222220.tar.bz2 + + name + linux64 + windows archive @@ -2087,6 +2159,20 @@ name linux + linux64 + + archive + + hash + b74ae4a2f23f69c19f2860d9b5290a75 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/openal-1.16.0-1.1.0-linux64-201504222210.tar.bz2 + + name + linux64 + windows archive @@ -2157,6 +2243,20 @@ name linux + linux64 + + archive + + hash + 92570921c5de44dd4b554cabb386bdc6 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/openssl-1.0.2d-linux64-201507111825.tar.bz2 + + name + linux64 + windows archive @@ -2261,6 +2361,20 @@ name linux + linux64 + + archive + + hash + df43d3df49296bfe93996ec537b9eddf + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/slvoice-4.6.0009.20030-linux64-201501031918.tar.bz2 + + name + linux64 + windows archive @@ -2363,6 +2477,20 @@ name linux + linux64 + + archive + + hash + 185066409eccc8f4fbb8a8ba00cace8a + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/uriparser-0.8.2-linux64-201507231504.tar.bz2 + + name + linux64 + windows archive @@ -2433,6 +2561,20 @@ name linux + linux64 + + archive + + hash + 7ea8eebdfb17f57a5327bf50f23dd99e + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/xmlrpc_epi-0.54.2-linux64-201504222313.tar.bz2 + + name + linux64 + windows archive @@ -2505,6 +2647,20 @@ name linux + linux64 + + archive + + hash + 461a0af0346a9140e7bb598eb8e78905 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/zlib-1.2.8-linux64-201504222303.tar.bz2 + + name + linux64 + windows archive @@ -2726,6 +2882,70 @@ name linux + linux64 + + build_directory + build-linux-i686 + configurations + + RelWithDebInfo + + build + + command + make + options + + -j 7 + + + configure + + options + + -G + 'Unix Makefiles' + + + default + True + name + RelWithDebInfo + + Release + + build + + command + make + options + + -j 7 + + + configure + + options + + -G + 'Unix Makefiles' + + + name + Release + + default + + build + + + name + default + + + name + linux64 + windows build_directory From 681c85b12282ce9436754c7561a38edf24f70bd9 Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Sun, 17 Jan 2016 23:31:38 -0500 Subject: [PATCH 6/9] Revert to older calc parser code for now --- indra/llmath/CMakeLists.txt | 1 + indra/llmath/llcalc.cpp | 148 ++++++++------- indra/llmath/llcalc.h | 1 + indra/llmath/llcalcparser.cpp | 63 +++++++ indra/llmath/llcalcparser.h | 342 ++++++++++++++-------------------- 5 files changed, 287 insertions(+), 268 deletions(-) create mode 100644 indra/llmath/llcalcparser.cpp diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt index 96986b79f..ff174112a 100644 --- a/indra/llmath/CMakeLists.txt +++ b/indra/llmath/CMakeLists.txt @@ -13,6 +13,7 @@ set(llmath_SOURCE_FILES llbbox.cpp llbboxlocal.cpp llcalc.cpp + llcalcparser.cpp llcamera.cpp llcoordframe.cpp llline.cpp diff --git a/indra/llmath/llcalc.cpp b/indra/llmath/llcalc.cpp index 46330a767..edc6986cc 100644 --- a/indra/llmath/llcalc.cpp +++ b/indra/llmath/llcalc.cpp @@ -28,61 +28,59 @@ #include "llcalc.h" +#include "llcalcparser.h" #include "llmath.h" -#include "llcalcparser.h" // Variable names for use in the build floater -// must be lower case for parser definition -// case-insensitive for actual parsing -const char* LLCalc::X_POS = "px"; -const char* LLCalc::Y_POS = "py"; -const char* LLCalc::Z_POS = "pz"; -const char* LLCalc::X_SCALE = "sx"; -const char* LLCalc::Y_SCALE = "sy"; -const char* LLCalc::Z_SCALE = "sz"; -const char* LLCalc::X_ROT = "rx"; -const char* LLCalc::Y_ROT = "ry"; -const char* LLCalc::Z_ROT = "rz"; -const char* LLCalc::HOLLOW = "hlw"; -const char* LLCalc::CUT_BEGIN = "cb"; -const char* LLCalc::CUT_END = "ce"; -const char* LLCalc::PATH_BEGIN = "pb"; -const char* LLCalc::PATH_END = "pe"; -const char* LLCalc::TWIST_BEGIN = "tb"; -const char* LLCalc::TWIST_END = "te"; -const char* LLCalc::X_SHEAR = "shx"; -const char* LLCalc::Y_SHEAR = "shy"; -const char* LLCalc::X_TAPER = "tpx"; -const char* LLCalc::Y_TAPER = "tpy"; -const char* LLCalc::RADIUS_OFFSET = "rof"; -const char* LLCalc::REVOLUTIONS = "rev"; -const char* LLCalc::SKEW = "skw"; -const char* LLCalc::X_HOLE = "hlx"; -const char* LLCalc::Y_HOLE = "hly"; -const char* LLCalc::TEX_U_SCALE = "tsu"; -const char* LLCalc::TEX_V_SCALE = "tsv"; -const char* LLCalc::TEX_U_OFFSET = "tou"; -const char* LLCalc::TEX_V_OFFSET = "tov"; -const char* LLCalc::TEX_ROTATION = "trot"; -const char* LLCalc::TEX_TRANSPARENCY = "trns"; -const char* LLCalc::TEX_GLOW = "glow"; +const char* LLCalc::X_POS = "PX"; +const char* LLCalc::Y_POS = "PY"; +const char* LLCalc::Z_POS = "PZ"; +const char* LLCalc::X_SCALE = "SX"; +const char* LLCalc::Y_SCALE = "SY"; +const char* LLCalc::Z_SCALE = "SZ"; +const char* LLCalc::X_ROT = "RX"; +const char* LLCalc::Y_ROT = "RY"; +const char* LLCalc::Z_ROT = "RZ"; +const char* LLCalc::HOLLOW = "HLW"; +const char* LLCalc::CUT_BEGIN = "CB"; +const char* LLCalc::CUT_END = "CE"; +const char* LLCalc::PATH_BEGIN = "PB"; +const char* LLCalc::PATH_END = "PE"; +const char* LLCalc::TWIST_BEGIN = "TB"; +const char* LLCalc::TWIST_END = "TE"; +const char* LLCalc::X_SHEAR = "SHX"; +const char* LLCalc::Y_SHEAR = "SHY"; +const char* LLCalc::X_TAPER = "TPX"; +const char* LLCalc::Y_TAPER = "TPY"; +const char* LLCalc::RADIUS_OFFSET = "ROF"; +const char* LLCalc::REVOLUTIONS = "REV"; +const char* LLCalc::SKEW = "SKW"; +const char* LLCalc::X_HOLE = "HLX"; +const char* LLCalc::Y_HOLE = "HLY"; +const char* LLCalc::TEX_U_SCALE = "TSU"; +const char* LLCalc::TEX_V_SCALE = "TSV"; +const char* LLCalc::TEX_U_OFFSET = "TOU"; +const char* LLCalc::TEX_V_OFFSET = "TOV"; +const char* LLCalc::TEX_ROTATION = "TROT"; +const char* LLCalc::TEX_TRANSPARENCY = "TRNS"; +const char* LLCalc::TEX_GLOW = "GLOW"; + LLCalc* LLCalc::sInstance = NULL; -//TODO: Make this a static global class LLCalc::LLCalc() : mLastErrorPos(0) { // Init table of constants - /*setVar("PI", F_PI); - setVar("TWO_PI", F_TWO_PI); - setVar("PI_BY_TWO", F_PI_BY_TWO); - setVar("SQRT_TWO_PI", F_SQRT_TWO_PI); - setVar("SQRT2", F_SQRT2); - setVar("SQRT3", F_SQRT3); - setVar("DEG_TO_RAD", DEG_TO_RAD); - setVar("RAD_TO_DEG", RAD_TO_DEG); - setVar("GRAVITY", GRAVITY);*/ + mConstants["PI"] = F_PI; + mConstants["TWO_PI"] = F_TWO_PI; + mConstants["PI_BY_TWO"] = F_PI_BY_TWO; + mConstants["SQRT_TWO_PI"] = F_SQRT_TWO_PI; + mConstants["SQRT2"] = F_SQRT2; + mConstants["SQRT3"] = F_SQRT3; + mConstants["DEG_TO_RAD"] = DEG_TO_RAD; + mConstants["RAD_TO_DEG"] = RAD_TO_DEG; + mConstants["GRAVITY"] = GRAVITY; } LLCalc::~LLCalc() @@ -99,7 +97,7 @@ void LLCalc::cleanUp() //static LLCalc* LLCalc::getInstance() { - if (!sInstance) sInstance = new LLCalc(); + if (!sInstance) sInstance = new LLCalc(); return sInstance; } @@ -118,35 +116,47 @@ void LLCalc::clearAllVariables() mVariables.clear(); } +/* +void LLCalc::updateVariables(LLSD& vars) +{ + LLSD::map_iterator cIt = vars.beginMap(); + for(; cIt != vars.endMap(); cIt++) + { + setVar(cIt->first, (F32)(LLSD::Real)cIt->second); + } +} +*/ + bool LLCalc::evalString(const std::string& expression, F32& result) { - mLastErrorPos = 0; - std::string::const_iterator itr = expression.begin(); - expression::grammar calc; - calc.constant.add - ("pi", F_PI) - ("two_pi", F_TWO_PI) - ("pi_by_two", F_PI_BY_TWO) - ("sqrt_two_pi", F_SQRT_TWO_PI) - ("sqrt2", F_SQRT2) - ("sqrt3", F_SQRT3) - ("deg_to_rad", DEG_TO_RAD) - ("rad_to_deg", RAD_TO_DEG) - ("gravity", GRAVITY) - ; - for(calc_map_t::const_iterator iter = mVariables.begin(); - iter != mVariables.end(); - ++iter) - { - calc.constant.add(iter->first, iter->second); - } + std::string expr_upper = expression; + LLStringUtil::toUpper(expr_upper); + + LLCalcParser calc(result, &mConstants, &mVariables); - if (!expression::parse(itr, expression.end(), calc, result) || itr != expression.end()) + mLastErrorPos = 0; + std::string::iterator start = expr_upper.begin(); + parse_info info; + + try { - mLastErrorPos = itr - expression.begin(); + info = parse(start, expr_upper.end(), calc, space_p); + LL_DEBUGS() << "Math expression: " << expression << " = " << result << LL_ENDL; + } + catch(parser_error &e) + { + mLastErrorPos = e.where - expr_upper.begin(); + + LL_INFOS() << "Calc parser exception: " << e.descriptor << " at " << mLastErrorPos << " in expression: " << expression << LL_ENDL; + return false; + } + + if (!info.full) + { + mLastErrorPos = info.stop - expr_upper.begin(); LL_INFOS() << "Unhandled syntax error at " << mLastErrorPos << " in expression: " << expression << LL_ENDL; return false; } - LL_DEBUGS() << "Math expression: " << expression << " = " << result << LL_ENDL; + return true; } diff --git a/indra/llmath/llcalc.h b/indra/llmath/llcalc.h index 8c71569f4..7f4c6e317 100644 --- a/indra/llmath/llcalc.h +++ b/indra/llmath/llcalc.h @@ -86,6 +86,7 @@ public: private: std::string::size_type mLastErrorPos; + calc_map_t mConstants; calc_map_t mVariables; // "There shall be only one" diff --git a/indra/llmath/llcalcparser.cpp b/indra/llmath/llcalcparser.cpp new file mode 100644 index 000000000..b4ca32065 --- /dev/null +++ b/indra/llmath/llcalcparser.cpp @@ -0,0 +1,63 @@ +/* + * LLCalcParser.cpp + * Copyright 2008 Aimee Walton. + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2008, 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 "llcalcparser.h" +using namespace boost::spirit::classic; + +F32 LLCalcParser::lookup(const std::string::iterator& start, const std::string::iterator& end) const +{ + LLCalc::calc_map_t::iterator iter; + + std::string name(start, end); + + if (mConstants) + { + iter = mConstants->find(name); + if (iter != mConstants->end()) + { + return (*iter).second; + } + } + else + { + // This should never happen! + throw_(end, std::string("Missing constants table")); + } + + if (mVariables) + { + iter = mVariables->find(name); + if (iter != mVariables->end()) + { + return (*iter).second; + } + } + + throw_(end, std::string("Unknown symbol " + name)); + return 0.f; +} diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h index 0fbf358a1..faa699ff7 100644 --- a/indra/llmath/llcalcparser.h +++ b/indra/llmath/llcalcparser.h @@ -27,218 +27,162 @@ #ifndef LL_CALCPARSER_H #define LL_CALCPARSER_H -#include -#if !defined(SPIRIT_VERSION) || SPIRIT_VERSION < 0x2010 -#error "At least Spirit version 2.1 required" -#endif +#include +#include +#include +#include +#include +#include +using namespace boost::spirit::classic; -// Add this in if we want boost math constants. -#include +#include "llcalc.h" +#include "llmath.h" -#if defined(LL_WINDOWS) -#pragma warning(push) -// warning C4348: 'boost::spirit::terminal<...>::result_helper': redefinition of default parameter: parameter 3, 4 -#pragma warning(disable: 4348) -#endif - -//#include -#include -#include - -#if defined(LL_WINDOWS) -#pragma warning(pop) -#endif -namespace expression { - - -//TODO: If we can find a better way to do this with boost::pheonix::bind lets do it -//namespace { // anonymous - -template -T min_glue(T a, T b) +struct LLCalcParser : grammar { - return std::min(a, b); -} - -template -T max_glue(T a, T b) -{ - return std::max(a, b); -} - -struct lazy_pow_ -{ - template - struct result { typedef X type; }; - - template - X operator()(X x, Y y) const + LLCalcParser(F32& result, LLCalc::calc_map_t* constants, LLCalc::calc_map_t* vars) : + mResult(result), mConstants(constants), mVariables(vars) {}; + + struct value_closure : closure { - return std::pow(x, y); - } -}; - -struct lazy_ufunc_ -{ - template - struct result { typedef A1 type; }; - - template - A1 operator()(F f, A1 a1) const + member1 value; + }; + + template + struct definition { - return f(a1); - } -}; - -struct lazy_bfunc_ -{ - template - struct result { typedef A1 type; }; - - template - A1 operator()(F f, A1 a1, A2 a2) const - { - return f(a1, a2); - } -}; - -//} // end namespace anonymous - -template -struct grammar - : boost::spirit::qi::grammar< - Iterator, FPT(), boost::spirit::ascii::space_type - > -{ - - // symbol table for constants - // to be added by the actual calculator - struct constant_ - : boost::spirit::qi::symbols< - typename std::iterator_traits::value_type, - FPT - > - { - constant_() + // Rule declarations + rule statement, identifier; + rule expression, term, + power, + unary_expr, + factor, + unary_func, + binary_func, + group; + + // start() should return the starting symbol + rule const& start() const { return statement; } + + definition(LLCalcParser const& self) { - } - } constant; - - // symbol table for unary functions like "abs" - struct ufunc_ - : boost::spirit::qi::symbols< - typename std::iterator_traits::value_type, - FPT (*)(FPT) - > - { - ufunc_() - { - this->add - ("abs" , (FPT (*)(FPT)) std::abs ) - ("acos" , (FPT (*)(FPT)) std::acos ) - ("asin" , (FPT (*)(FPT)) std::asin ) - ("atan" , (FPT (*)(FPT)) std::atan ) - ("ceil" , (FPT (*)(FPT)) std::ceil ) - ("cos" , (FPT (*)(FPT)) std::cos ) - ("cosh" , (FPT (*)(FPT)) std::cosh ) - ("exp" , (FPT (*)(FPT)) std::exp ) - ("floor" , (FPT (*)(FPT)) std::floor) - ("log" , (FPT (*)(FPT)) std::log ) - ("log10" , (FPT (*)(FPT)) std::log10) - ("sin" , (FPT (*)(FPT)) std::sin ) - ("sinh" , (FPT (*)(FPT)) std::sinh ) - ("sqrt" , (FPT (*)(FPT)) std::sqrt ) - ("tan" , (FPT (*)(FPT)) std::tan ) - ("tanh" , (FPT (*)(FPT)) std::tanh ) + using namespace phoenix; + + assertion assert_domain("Domain error"); +// assertion assert_symbol("Unknown symbol"); + assertion assert_syntax("Syntax error"); + + identifier = + lexeme_d[(alpha_p | '_') >> *(alnum_p | '_')] ; - } - } ufunc; - - // symbol table for binary functions like "pow" - struct bfunc_ - : boost::spirit::qi::symbols< - typename std::iterator_traits::value_type, - FPT (*)(FPT, FPT) - > - { - bfunc_() - { - using boost::bind; - this->add - ("pow" , (FPT (*)(FPT, FPT)) std::pow ) - ("atan2", (FPT (*)(FPT, FPT)) std::atan2) - ("min" , (FPT (*)(FPT, FPT)) min_glue) - ("max" , (FPT (*)(FPT, FPT)) max_glue) + + group = + '(' >> expression[group.value = arg1] >> assert_syntax(ch_p(')')) ; - } - } bfunc; - - boost::spirit::qi::rule< - Iterator, FPT(), boost::spirit::ascii::space_type - > expression, term, factor, primary; - - grammar() : grammar::base_type(expression) - { - using boost::spirit::qi::real_parser; - using boost::spirit::qi::real_policies; - real_parser > real; - - using boost::spirit::qi::_1; - using boost::spirit::qi::_2; - using boost::spirit::qi::_3; - using boost::spirit::qi::no_case; - using boost::spirit::qi::_val; - - boost::phoenix::function lazy_pow; - boost::phoenix::function lazy_ufunc; - boost::phoenix::function lazy_bfunc; - - expression = - term [_val = _1] - >> *( ('+' >> term [_val += _1]) - | ('-' >> term [_val -= _1]) + + unary_func = + ((str_p("SIN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_sin)(self,arg1)]) | + (str_p("COS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_cos)(self,arg1)]) | + (str_p("TAN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_tan)(self,arg1)]) | + (str_p("ASIN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_asin)(self,arg1)]) | + (str_p("ACOS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_acos)(self,arg1)]) | + (str_p("ATAN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_atan)(self,arg1)]) | + (str_p("SQRT") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_sqrt)(self,arg1)]) | + (str_p("LOG") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_log)(self,arg1)]) | + (str_p("EXP") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_exp)(self,arg1)]) | + (str_p("ABS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_fabs)(self,arg1)]) | + (str_p("FLR") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_floor)(self,arg1)]) | + (str_p("CEIL") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_ceil)(self,arg1)]) + ) >> assert_syntax(ch_p(')')) + ; + + binary_func = + ((str_p("ATAN2") >> '(' >> expression[binary_func.value = arg1] >> ',' >> + expression[binary_func.value = bind(&LLCalcParser::_atan2)(self, binary_func.value, arg1)]) | + (str_p("MIN") >> '(' >> expression[binary_func.value = arg1] >> ',' >> + expression[binary_func.value = bind(&LLCalcParser::_min)(self, binary_func.value, arg1)]) | + (str_p("MAX") >> '(' >> expression[binary_func.value = arg1] >> ',' >> + expression[binary_func.value = bind(&LLCalcParser::_max)(self, binary_func.value, arg1)]) + ) >> assert_syntax(ch_p(')')) + ; + + // *TODO: Localisation of the decimal point? + // Problem, LLLineEditor::postvalidateFloat accepts a comma when appropriate + // for the current locale. However to do that here could clash with using + // the comma as a separator when passing arguments to functions. + factor = + (ureal_p[factor.value = arg1] | + group[factor.value = arg1] | + unary_func[factor.value = arg1] | + binary_func[factor.value = arg1] | + // Lookup throws an Unknown Symbol error if it is unknown, while this works fine, + // would be "neater" to handle symbol lookup from here with an assertive parser. +// constants_p[factor.value = arg1]| + identifier[factor.value = bind(&LLCalcParser::lookup)(self, arg1, arg2)] + ) >> + // Detect and throw math errors. + assert_domain(eps_p(bind(&LLCalcParser::checkNaN)(self, factor.value))) + ; + + unary_expr = + !ch_p('+') >> factor[unary_expr.value = arg1] | + '-' >> factor[unary_expr.value = -arg1] + ; + + power = + unary_expr[power.value = arg1] >> + *('^' >> assert_syntax(unary_expr[power.value = bind(&powf)(power.value, arg1)])) + ; + + term = + power[term.value = arg1] >> + *(('*' >> assert_syntax(power[term.value *= arg1])) | + ('/' >> assert_syntax(power[term.value /= arg1])) | + ('%' >> assert_syntax(power[term.value = bind(&fmodf)(term.value, arg1)])) ) ; - - term = - factor [_val = _1] - >> *( ('*' >> factor [_val *= _1]) - | ('/' >> factor [_val /= _1]) + + expression = + assert_syntax(term[expression.value = arg1]) >> + *(('+' >> assert_syntax(term[expression.value += arg1])) | + ('-' >> assert_syntax(term[expression.value -= arg1])) ) ; - - factor = - primary [_val = _1] - >> *( ("**" >> factor [_val = lazy_pow(_val, _1)]) - ) + + statement = + !ch_p('=') >> ( expression )[var(self.mResult) = arg1] >> (end_p) ; - - primary = - real [_val = _1] - | '(' >> expression [_val = _1] >> ')' - | ('-' >> primary [_val = -_1]) - | ('+' >> primary [_val = _1]) - | (no_case[ufunc] >> '(' >> expression >> ')') - [_val = lazy_ufunc(_1, _2)] - | (no_case[bfunc] >> '(' >> expression >> ',' - >> expression >> ')') - [_val = lazy_bfunc(_1, _2, _3)] - | no_case[constant] [_val = _1] - ; - - } + } + }; + +private: + // Member functions for semantic actions + F32 lookup(const std::string::iterator&, const std::string::iterator&) const; + F32 _min(const F32& a, const F32& b) const { return llmin(a, b); } + F32 _max(const F32& a, const F32& b) const { return llmax(a, b); } + + bool checkNaN(const F32& a) const { return !llisnan(a); } + + //FIX* non ambiguous function fix making SIN() work for calc -Cryogenic Blitz + F32 _sin(const F32& a) const { return sin(DEG_TO_RAD * a); } + F32 _cos(const F32& a) const { return cos(DEG_TO_RAD * a); } + F32 _tan(const F32& a) const { return tan(DEG_TO_RAD * a); } + F32 _asin(const F32& a) const { return asin(a * RAD_TO_DEG); } + F32 _acos(const F32& a) const { return acos(a * RAD_TO_DEG); } + F32 _atan(const F32& a) const { return atan(a * RAD_TO_DEG); } + F32 _sqrt(const F32& a) const { return sqrt(a); } + F32 _log(const F32& a) const { return log(a); } + F32 _exp(const F32& a) const { return exp(a); } + F32 _fabs(const F32& a) const { return fabs(a); } + F32 _floor(const F32& a) const { return (F32)llfloor(a); } + F32 _ceil(const F32& a) const { return llceil(a); } + F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); } + + LLCalc::calc_map_t* mConstants; + LLCalc::calc_map_t* mVariables; +// LLCalc::calc_map_t* mUserVariables; + + F32& mResult; }; - -template -bool parse(Iterator &iter, - Iterator end, - const grammar &g, - FPT &result) -{ - return boost::spirit::qi::phrase_parse( - iter, end, g, boost::spirit::ascii::space, result); -} - -} // end namespace expression #endif // LL_CALCPARSER_H From 78561d7ac78c32d6e2ed1d242966ad1409901f17 Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Sun, 17 Jan 2016 23:32:02 -0500 Subject: [PATCH 7/9] Link LLCommon as static --- indra/cmake/LLCommon.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake index b1bb1b6a9..6cc325495 100644 --- a/indra/cmake/LLCommon.cmake +++ b/indra/cmake/LLCommon.cmake @@ -28,7 +28,7 @@ else (LINUX) set(LLCOMMON_LIBRARIES llcommon) endif (LINUX) -set(LLCOMMON_LINK_SHARED ON CACHE BOOL "Build the llcommon target as a shared library.") +set(LLCOMMON_LINK_SHARED OFF CACHE BOOL "Build the llcommon target as a shared library.") if(LLCOMMON_LINK_SHARED) add_definitions(-DLL_COMMON_LINK_SHARED=1) endif(LLCOMMON_LINK_SHARED) From e545281387d82f33e1e9d75d5d841511bdd79902 Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Sun, 17 Jan 2016 23:32:58 -0500 Subject: [PATCH 8/9] Disable aixml* and comment out related classes for later fixing --- indra/llxml/CMakeLists.txt | 4 +-- indra/newview/CMakeLists.txt | 50 ++++++++++++++-------------- indra/newview/llfloatercustomize.cpp | 6 +++- indra/newview/llvoavatar.cpp | 4 ++- 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt index 2245255cd..d65bf3146 100644 --- a/indra/llxml/CMakeLists.txt +++ b/indra/llxml/CMakeLists.txt @@ -13,7 +13,7 @@ include_directories( ) set(llxml_SOURCE_FILES - aixml.cpp + #aixml.cpp llcontrol.cpp llxmlnode.cpp llxmlparser.cpp @@ -23,7 +23,7 @@ set(llxml_SOURCE_FILES set(llxml_HEADER_FILES CMakeLists.txt - aixml.h + #aixml.h llcontrol.h llcontrolgroupreader.h llxmlnode.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 26f45a6cb..0b7ce2453 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -76,7 +76,7 @@ include_directories( set(viewer_SOURCE_FILES NACLantispam.cpp aihttpview.cpp - aixmllindengenepool.cpp + #aixmllindengenepool.cpp alfloaterregiontracker.cpp aoremotectrl.cpp ascentfloatercontactgroups.cpp @@ -607,7 +607,7 @@ set(viewer_HEADER_FILES NACLantispam.h aihttpview.h - aixmllindengenepool.h + #aixmllindengenepool.h alfloaterregiontracker.h aoremotectrl.h ascentfloatercontactgroups.h @@ -1660,17 +1660,19 @@ target_link_libraries(${VIEWER_BINARY_NAME} ) if (LINUX) - add_custom_command( - OUTPUT secondlife-stripped - COMMAND strip - ARGS --strip-debug -o secondlife-stripped ${VIEWER_BINARY_NAME} - DEPENDS ${VIEWER_BINARY_NAME} - ) + set(product Singularity-${ARCH}-${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}) + + # These are the generated targets that are copied to package/ + set(COPY_INPUT_DEPENDENCIES + ${VIEWER_BINARY_NAME} + linux-crash-logger + AlchemyPlugin + media_plugin_gstreamer010 + llcommon + ) add_dependencies(${VIEWER_BINARY_NAME} generate_viewer_version) - set(product ${VIEWER_BRANDING_NAME_CAMELCASE}-${ARCH}-${${ROOT_PROJECT_NAME}_VERSION}) - add_custom_command( OUTPUT ${product}.tar.bz2 COMMAND ${PYTHON_EXECUTABLE} @@ -1678,21 +1680,20 @@ if (LINUX) ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --arch=${ARCH} --artwork=${ARTWORK_DIR} - --branding_id=${VIEWER_BRANDING_ID} --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt + --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --grid=${GRID} - --installer_name=${product} - --login_channel=${VIEWER_LOGIN_CHANNEL} --source=${CMAKE_CURRENT_SOURCE_DIR} --standalone=${STANDALONE} --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched - --extra_libraries="${MANIFEST_LIBRARIES}" DEPENDS secondlife-stripped ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${COPY_INPUT_DEPENDENCIES} ) add_custom_command( @@ -1703,28 +1704,27 @@ if (LINUX) --arch=${ARCH} --actions=copy --artwork=${ARTWORK_DIR} - --branding_id=${VIEWER_BRANDING_ID} --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} - --channel=${VIEWER_CHANNEL} + --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --grid=${GRID} - --installer_name=${product} - --login_channel=${VIEWER_LOGIN_CHANNEL} + --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --source=${CMAKE_CURRENT_SOURCE_DIR} - --standalone=${STANDALONE} - --extra_libraries="${MANIFEST_LIBRARIES}" DEPENDS - secondlife-stripped ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${COPY_INPUT_DEPENDENCIES} + COMMENT "Performing viewer_manifest copy" ) - add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_gstreamer010 media_plugin_webkit basic_plugin_filepicker) + add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_gstreamer010 basic_plugin_filepicker) add_custom_target(copy_l_viewer_manifest ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched) if (PACKAGE) add_custom_target(llpackage ALL DEPENDS ${product}.tar.bz2) add_dependencies(llpackage copy_l_viewer_manifest) + check_message_template(llpackage) endif (PACKAGE) endif (LINUX) @@ -1785,17 +1785,17 @@ if (DARWIN) COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --arch=${ARCH} --artwork=${ARTWORK_DIR} - --branding_id=${VIEWER_BRANDING_ID} --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} --channel=${VIEWER_CHANNEL} --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app --grid=${GRID} - --login_channel=${VIEWER_LOGIN_CHANNEL} + --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --source=${CMAKE_CURRENT_SOURCE_DIR} - --extra_libraries="${MANIFEST_LIBRARIES}" --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched DEPENDS ${VIEWER_BINARY_NAME} diff --git a/indra/newview/llfloatercustomize.cpp b/indra/newview/llfloatercustomize.cpp index c03c8f1a5..657920701 100644 --- a/indra/newview/llfloatercustomize.cpp +++ b/indra/newview/llfloatercustomize.cpp @@ -55,7 +55,7 @@ #include "statemachine/aifilepicker.h" #include "hippogridmanager.h" -#include "aixmllindengenepool.h" +//#include "aixmllindengenepool.h" #include "aifile.h" using namespace LLAvatarAppearanceDefines; @@ -314,6 +314,7 @@ void LLFloaterCustomize::onBtnImport() void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker) { +#if 0 if (!filepicker->hasFilename()) { // User canceled import. @@ -456,6 +457,7 @@ void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker) { AIAlert::add("AIXMLImportWearableTypeMismatch", args("[TYPE]", label)("[ARCHETYPENAME]", wearable_types)); } +#endif } // reX: new function @@ -500,6 +502,7 @@ void LLFloaterCustomize::onBtnExport() //static void LLFloaterCustomize::onBtnExport_continued(LLViewerWearable* edit_wearable, AIFilePicker* filepicker) { +#if 0 if (!filepicker->hasFilename()) { // User canceled export. @@ -527,6 +530,7 @@ void LLFloaterCustomize::onBtnExport_continued(LLViewerWearable* edit_wearable, { AIAlert::add_modal("AIXMLExportSuccess", AIArgs("[FILE]", filename)); } +#endif } void LLFloaterCustomize::onBtnOk() diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 56cf792fd..61c6f3fdf 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -111,7 +111,7 @@ #include "llsdutil.h" #include "llfloaterexploreanimations.h" -#include "aixmllindengenepool.h" +//#include "aixmllindengenepool.h" #include "aifile.h" #include "llavatarname.h" @@ -8670,6 +8670,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara void LLVOAvatar::dumpArchetypeXML_cont(std::string const& fullpath, bool group_by_wearables) { +#if 0 try { AIFile outfile(fullpath, "wb"); @@ -8745,6 +8746,7 @@ void LLVOAvatar::dumpArchetypeXML_cont(std::string const& fullpath, bool group_b { AIAlert::add_modal("AIXMLdumpArchetypeXMLError", AIArgs("[FILE]", fullpath), error); } +#endif } From 949a9ab5dc567788b45b1af78d5330d046ce1472 Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Sun, 17 Jan 2016 23:33:21 -0500 Subject: [PATCH 9/9] Largely rework llfile* --- indra/llappearance/llwearable.cpp | 23 +- indra/llappearance/llwearable.h | 4 +- indra/llcommon/llfile.cpp | 659 ++-------------------------- indra/llcommon/llfile.h | 281 +----------- indra/llinventory/llinventory.cpp | 8 +- indra/llinventory/llpermissions.cpp | 206 ++++++--- indra/llinventory/llpermissions.h | 10 +- indra/llinventory/llsaleinfo.cpp | 99 +++-- indra/llinventory/llsaleinfo.h | 4 +- indra/newview/llviewerwearable.cpp | 18 +- indra/newview/llviewerwearable.h | 3 +- 11 files changed, 303 insertions(+), 1012 deletions(-) diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index 45962d898..0dbd6f3de 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -86,10 +86,10 @@ LLAssetType::EType LLWearable::getAssetType() const return LLWearableType::getAssetType(mType); } -BOOL LLWearable::exportFile(LLFILE* fp) const +BOOL LLWearable::exportFile(const std::string& filename) const { - llofstream ofs(fp); - return exportStream(ofs); + llofstream ofs(filename.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); + return ofs.is_open() && exportStream(ofs); } // virtual @@ -105,13 +105,13 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const output_stream << mDescription << "\n"; // permissions - if( !mPermissions.exportStream( output_stream ) ) + if( !mPermissions.exportLegacyStream( output_stream ) ) { return FALSE; } // sale info - if( !mSaleInfo.exportStream( output_stream ) ) + if( !mSaleInfo.exportLegacyStream( output_stream ) ) { return FALSE; } @@ -193,7 +193,7 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp) if (layer_set) { - layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); + layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); } else { @@ -201,10 +201,11 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp) } } -LLWearable::EImportResult LLWearable::importFile(LLFILE* fp, LLAvatarAppearance* avatarp ) +LLWearable::EImportResult LLWearable::importFile(const std::string& filename, + LLAvatarAppearance* avatarp ) { - llifstream ifs(fp); - return importStream(ifs, avatarp); + llifstream ifs(filename.c_str(), std::ios_base::in | std::ios_base::binary); + return (! ifs.is_open())? FAILURE : importStream(ifs, avatarp); } // virtual @@ -287,7 +288,7 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, LL_WARNS() << "Bad Wearable asset: missing valid permissions" << LL_ENDL; return LLWearable::FAILURE; } - if( !mPermissions.importStream( input_stream ) ) + if( !mPermissions.importLegacyStream( input_stream ) ) { return LLWearable::FAILURE; } @@ -312,7 +313,7 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // up the vast majority of the tasks. BOOL has_perm_mask = FALSE; U32 perm_mask = 0; - if( !mSaleInfo.importStream(input_stream, has_perm_mask, perm_mask) ) + if( !mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask) ) { return LLWearable::FAILURE; } diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h index 3ffcc7516..d9527b9e9 100644 --- a/indra/llappearance/llwearable.h +++ b/indra/llappearance/llwearable.h @@ -82,8 +82,8 @@ public: SUCCESS, BAD_HEADER }; - BOOL exportFile(LLFILE* file) const; - EImportResult importFile(LLFILE* file, LLAvatarAppearance* avatarp ); + BOOL exportFile(const std::string& filename) const; + EImportResult importFile(const std::string& filename, LLAvatarAppearance* avatarp ); virtual BOOL exportStream( std::ostream& output_stream ) const; virtual EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp ); diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 686a516b9..7660baa90 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -416,679 +416,76 @@ LLFILE * LLFile::_Fiopen(const std::string& filename, #endif /* LL_WINDOWS */ -/************** llstdio file buffer ********************************/ - - -//llstdio_filebuf* llstdio_filebuf::open(const char *_Filename, -// ios_base::openmode _Mode) -//{ -//#if LL_WINDOWS -// _Filet *_File; -// if (is_open() || (_File = LLFILE::_Fiopen(_Filename, _Mode)) == 0) -// return (0); // open failed -// -// _Init(_File, _Openfl); -// _Initcvt(&_USE(_Mysb::getloc(), _Cvt)); -// return (this); // open succeeded -//#else -// std::filebuf* _file = std::filebuf::open(_Filename, _Mode); -// if (NULL == _file) return NULL; -// return this; -//#endif -//} - - -// *TODO: Seek the underlying c stream for better cross-platform compatibility? -#if !LL_WINDOWS -llstdio_filebuf::int_type llstdio_filebuf::overflow(llstdio_filebuf::int_type __c) -{ - int_type __ret = traits_type::eof(); - const bool __testeof = traits_type::eq_int_type(__c, __ret); - const bool __testout = _M_mode & ios_base::out; - if (__testout && !_M_reading) - { - if (this->pbase() < this->pptr()) - { - // If appropriate, append the overflow char. - if (!__testeof) - { - *this->pptr() = traits_type::to_char_type(__c); - this->pbump(1); - } - - // Convert pending sequence to external representation, - // and output. - if (_convert_to_external(this->pbase(), - this->pptr() - this->pbase())) - { - _M_set_buffer(0); - __ret = traits_type::not_eof(__c); - } - } - else if (_M_buf_size > 1) - { - // Overflow in 'uncommitted' mode: set _M_writing, set - // the buffer to the initial 'write' mode, and put __c - // into the buffer. - _M_set_buffer(0); - _M_writing = true; - if (!__testeof) - { - *this->pptr() = traits_type::to_char_type(__c); - this->pbump(1); - } - __ret = traits_type::not_eof(__c); - } - else - { - // Unbuffered. - char_type __conv = traits_type::to_char_type(__c); - if (__testeof || _convert_to_external(&__conv, 1)) - { - _M_writing = true; - __ret = traits_type::not_eof(__c); - } - } - } - return __ret; -} - -bool llstdio_filebuf::_convert_to_external(char_type* __ibuf, - std::streamsize __ilen) -{ - // Sizes of external and pending output. - streamsize __elen; - streamsize __plen; - if (__check_facet(_M_codecvt).always_noconv()) - { - //__elen = _M_file.xsputn(reinterpret_cast(__ibuf), __ilen); - __elen = fwrite(reinterpret_cast(__ibuf), 1, - __ilen, _M_file.file()); - __plen = __ilen; - } - else - { - // Worst-case number of external bytes needed. - // XXX Not done encoding() == -1. - streamsize __blen = __ilen * _M_codecvt->max_length(); - char* __buf = static_cast(__builtin_alloca(__blen)); - - char* __bend; - const char_type* __iend; - codecvt_base::result __r; - __r = _M_codecvt->out(_M_state_cur, __ibuf, __ibuf + __ilen, - __iend, __buf, __buf + __blen, __bend); - - if (__r == codecvt_base::ok || __r == codecvt_base::partial) - __blen = __bend - __buf; - else if (__r == codecvt_base::noconv) - { - // Same as the always_noconv case above. - __buf = reinterpret_cast(__ibuf); - __blen = __ilen; - } - else - __throw_ios_failure(__N("llstdio_filebuf::_convert_to_external " - "conversion error")); - - //__elen = _M_file.xsputn(__buf, __blen); - __elen = fwrite(__buf, 1, __blen, _M_file.file()); - __plen = __blen; - - // Try once more for partial conversions. - if (__r == codecvt_base::partial && __elen == __plen) - { - const char_type* __iresume = __iend; - streamsize __rlen = this->pptr() - __iend; - __r = _M_codecvt->out(_M_state_cur, __iresume, - __iresume + __rlen, __iend, __buf, - __buf + __blen, __bend); - if (__r != codecvt_base::error) - { - __rlen = __bend - __buf; - //__elen = _M_file.xsputn(__buf, __rlen); - __elen = fwrite(__buf, 1, __rlen, _M_file.file()); - __plen = __rlen; - } - else - { - __throw_ios_failure(__N("llstdio_filebuf::_convert_to_external " - "conversion error")); - } - } - } - return __elen == __plen; -} - -llstdio_filebuf::int_type llstdio_filebuf::underflow() -{ - int_type __ret = traits_type::eof(); - const bool __testin = _M_mode & ios_base::in; - if (__testin) - { - if (_M_writing) - { - if (overflow() == traits_type::eof()) - return __ret; - //_M_set_buffer(-1); - //_M_writing = false; - } - // Check for pback madness, and if so switch back to the - // normal buffers and jet outta here before expensive - // fileops happen... - _M_destroy_pback(); - - if (this->gptr() < this->egptr()) - return traits_type::to_int_type(*this->gptr()); - - // Get and convert input sequence. - const size_t __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1; - - // Will be set to true if ::fread() returns 0 indicating EOF. - bool __got_eof = false; - // Number of internal characters produced. - streamsize __ilen = 0; - codecvt_base::result __r = codecvt_base::ok; - if (__check_facet(_M_codecvt).always_noconv()) - { - //__ilen = _M_file.xsgetn(reinterpret_cast(this->eback()), - // __buflen); - __ilen = fread(reinterpret_cast(this->eback()), 1, - __buflen, _M_file.file()); - if (__ilen == 0) - __got_eof = true; - } - else - { - // Worst-case number of external bytes. - // XXX Not done encoding() == -1. - const int __enc = _M_codecvt->encoding(); - streamsize __blen; // Minimum buffer size. - streamsize __rlen; // Number of chars to read. - if (__enc > 0) - __blen = __rlen = __buflen * __enc; - else - { - __blen = __buflen + _M_codecvt->max_length() - 1; - __rlen = __buflen; - } - const streamsize __remainder = _M_ext_end - _M_ext_next; - __rlen = __rlen > __remainder ? __rlen - __remainder : 0; - - // An imbue in 'read' mode implies first converting the external - // chars already present. - if (_M_reading && this->egptr() == this->eback() && __remainder) - __rlen = 0; - - // Allocate buffer if necessary and move unconverted - // bytes to front. - if (_M_ext_buf_size < __blen) - { - char* __buf = new char[__blen]; - if (__remainder) - __builtin_memcpy(__buf, _M_ext_next, __remainder); - - delete [] _M_ext_buf; - _M_ext_buf = __buf; - _M_ext_buf_size = __blen; - } - else if (__remainder) - __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder); - - _M_ext_next = _M_ext_buf; - _M_ext_end = _M_ext_buf + __remainder; - _M_state_last = _M_state_cur; - - do - { - if (__rlen > 0) - { - // Sanity check! - // This may fail if the return value of - // codecvt::max_length() is bogus. - if (_M_ext_end - _M_ext_buf + __rlen > _M_ext_buf_size) - { - __throw_ios_failure(__N("llstdio_filebuf::underflow " - "codecvt::max_length() " - "is not valid")); - } - //streamsize __elen = _M_file.xsgetn(_M_ext_end, __rlen); - streamsize __elen = fread(_M_ext_end, 1, - __rlen, _M_file.file()); - if (__elen == 0) - __got_eof = true; - else if (__elen == -1) - break; - //_M_ext_end += __elen; - } - - char_type* __iend = this->eback(); - if (_M_ext_next < _M_ext_end) - { - __r = _M_codecvt->in(_M_state_cur, _M_ext_next, - _M_ext_end, _M_ext_next, - this->eback(), - this->eback() + __buflen, __iend); - } - if (__r == codecvt_base::noconv) - { - size_t __avail = _M_ext_end - _M_ext_buf; - __ilen = std::min(__avail, __buflen); - traits_type::copy(this->eback(), - reinterpret_cast - (_M_ext_buf), __ilen); - _M_ext_next = _M_ext_buf + __ilen; - } - else - __ilen = __iend - this->eback(); - - // _M_codecvt->in may return error while __ilen > 0: this is - // ok, and actually occurs in case of mixed encodings (e.g., - // XML files). - if (__r == codecvt_base::error) - break; - - __rlen = 1; - } while (__ilen == 0 && !__got_eof); - } - - if (__ilen > 0) - { - _M_set_buffer(__ilen); - _M_reading = true; - __ret = traits_type::to_int_type(*this->gptr()); - } - else if (__got_eof) - { - // If the actual end of file is reached, set 'uncommitted' - // mode, thus allowing an immediate write without an - // intervening seek. - _M_set_buffer(-1); - _M_reading = false; - // However, reaching it while looping on partial means that - // the file has got an incomplete character. - if (__r == codecvt_base::partial) - __throw_ios_failure(__N("llstdio_filebuf::underflow " - "incomplete character in file")); - } - else if (__r == codecvt_base::error) - __throw_ios_failure(__N("llstdio_filebuf::underflow " - "invalid byte sequence in file")); - else - __throw_ios_failure(__N("llstdio_filebuf::underflow " - "error reading the file")); - } - return __ret; -} - -std::streamsize llstdio_filebuf::xsgetn(char_type* __s, std::streamsize __n) -{ - // Clear out pback buffer before going on to the real deal... - streamsize __ret = 0; - if (_M_pback_init) - { - if (__n > 0 && this->gptr() == this->eback()) - { - *__s++ = *this->gptr(); - this->gbump(1); - __ret = 1; - --__n; - } - _M_destroy_pback(); - } - - // Optimization in the always_noconv() case, to be generalized in the - // future: when __n > __buflen we read directly instead of using the - // buffer repeatedly. - const bool __testin = _M_mode & ios_base::in; - const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1; - - if (__n > __buflen && __check_facet(_M_codecvt).always_noconv() - && __testin && !_M_writing) - { - // First, copy the chars already present in the buffer. - const streamsize __avail = this->egptr() - this->gptr(); - if (__avail != 0) - { - if (__avail == 1) - *__s = *this->gptr(); - else - traits_type::copy(__s, this->gptr(), __avail); - __s += __avail; - this->gbump(__avail); - __ret += __avail; - __n -= __avail; - } - - // Need to loop in case of short reads (relatively common - // with pipes). - streamsize __len; - for (;;) - { - //__len = _M_file.xsgetn(reinterpret_cast(__s), __n); - __len = fread(reinterpret_cast(__s), 1, - __n, _M_file.file()); - if (__len == -1) - __throw_ios_failure(__N("llstdio_filebuf::xsgetn " - "error reading the file")); - if (__len == 0) - break; - - __n -= __len; - __ret += __len; - if (__n == 0) - break; - - __s += __len; - } - - if (__n == 0) - { - _M_set_buffer(0); - _M_reading = true; - } - else if (__len == 0) - { - // If end of file is reached, set 'uncommitted' - // mode, thus allowing an immediate write without - // an intervening seek. - _M_set_buffer(-1); - _M_reading = false; - } - } - else - __ret += __streambuf_type::xsgetn(__s, __n); - - return __ret; -} - -std::streamsize llstdio_filebuf::xsputn(char_type const* __s, std::streamsize __n) -{ - // Optimization in the always_noconv() case, to be generalized in the - // future: when __n is sufficiently large we write directly instead of - // using the buffer. - streamsize __ret = 0; - const bool __testout = _M_mode & ios_base::out; - if (__check_facet(_M_codecvt).always_noconv() - && __testout && !_M_reading) - { - // Measurement would reveal the best choice. - const streamsize __chunk = 1ul << 10; - streamsize __bufavail = this->epptr() - this->pptr(); - - // Don't mistake 'uncommitted' mode buffered with unbuffered. - if (!_M_writing && _M_buf_size > 1) - __bufavail = _M_buf_size - 1; - - const streamsize __limit = std::min(__chunk, __bufavail); - if (__n >= __limit) - { - const streamsize __buffill = this->pptr() - this->pbase(); - const char* __buf = reinterpret_cast(this->pbase()); - //__ret = _M_file.xsputn_2(__buf, __buffill, - // reinterpret_cast(__s), __n); - if (__buffill) - { - __ret = fwrite(__buf, 1, __buffill, _M_file.file()); - } - if (__ret == __buffill) - { - __ret += fwrite(reinterpret_cast(__s), 1, - __n, _M_file.file()); - } - if (__ret == __buffill + __n) - { - _M_set_buffer(0); - _M_writing = true; - } - if (__ret > __buffill) - __ret -= __buffill; - else - __ret = 0; - } - else - __ret = __streambuf_type::xsputn(__s, __n); - } - else - __ret = __streambuf_type::xsputn(__s, __n); - return __ret; -} - -int llstdio_filebuf::sync() -{ - return (_M_file.sync() == 0 ? 0 : -1); -} -#endif +#if LL_WINDOWS /************** input file stream ********************************/ - -llifstream::llifstream() : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) {} -#else - std::istream() +llifstream::llifstream() : std::ifstream() { - this->init(&_M_filebuf); } -#endif // explicit -llifstream::llifstream(const std::string& _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) +llifstream::llifstream(const std::string& _Filename, ios_base::openmode _Mode) : + std::ifstream(utf8str_to_utf16str(_Filename), + _Mode | ios_base::in) { - if (_M_filebuf.open(_Filename.c_str(), _Mode | ios_base::in) == 0) - { - _Myios::setstate(ios_base::failbit); - } } -#else - std::istream() -{ - this->init(&_M_filebuf); - this->open(_Filename.c_str(), _Mode | ios_base::in); -} -#endif // explicit -llifstream::llifstream(const char* _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) -{ - if (_M_filebuf.open(_Filename, _Mode | ios_base::in) == 0) - { - _Myios::setstate(ios_base::failbit); - } -} -#else - std::istream() -{ - this->init(&_M_filebuf); - this->open(_Filename, _Mode | ios_base::in); -} -#endif +llifstream::llifstream(const char* _Filename, ios_base::openmode _Mode) : + std::ifstream(utf8str_to_utf16str(_Filename).c_str(), + _Mode | ios_base::in) - -// explicit -llifstream::llifstream(_Filet *_File, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(_File, _Mode, _Size), -#if LL_WINDOWS - std::istream(&_M_filebuf) {} -#else - std::istream() { - this->init(&_M_filebuf); } -#endif -#if !LL_WINDOWS -// explicit -llifstream::llifstream(int __fd, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(__fd, _Mode, _Size), - std::istream() +void llifstream::open(const std::string& _Filename, ios_base::openmode _Mode) { - this->init(&_M_filebuf); -} -#endif - -bool llifstream::is_open() const -{ // test if C stream has been opened - return _M_filebuf.is_open(); + std::ifstream::open(utf8str_to_utf16str(_Filename), + _Mode | ios_base::in); } void llifstream::open(const char* _Filename, ios_base::openmode _Mode) -{ // open a C stream with specified mode - if (_M_filebuf.open(_Filename, _Mode | ios_base::in) == 0) -#if LL_WINDOWS - { - _Myios::setstate(ios_base::failbit); - } - else - { - _Myios::clear(); - } -#else - { - this->setstate(ios_base::failbit); - } - else - { - this->clear(); - } -#endif -} - -void llifstream::close() -{ // close the C stream - if (_M_filebuf.close() == 0) - { -#if LL_WINDOWS - _Myios::setstate(ios_base::failbit); -#else - this->setstate(ios_base::failbit); -#endif - } +{ + std::ifstream::open(utf8str_to_utf16str(_Filename).c_str(), + _Mode | ios_base::in); } /************** output file stream ********************************/ -llofstream::llofstream() : _M_filebuf(), -#if LL_WINDOWS - std::ostream(&_M_filebuf) {} -#else - std::ostream() +llofstream::llofstream() : std::ofstream() { - this->init(&_M_filebuf); } -#endif // explicit -llofstream::llofstream(const std::string& _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::ostream(&_M_filebuf) +llofstream::llofstream(const std::string& _Filename, ios_base::openmode _Mode) : + std::ofstream(utf8str_to_utf16str(_Filename), + _Mode | ios_base::out) { - if (_M_filebuf.open(_Filename.c_str(), _Mode | ios_base::out) == 0) - { - _Myios::setstate(ios_base::failbit); - } } -#else - std::ostream() -{ - this->init(&_M_filebuf); - this->open(_Filename.c_str(), _Mode | ios_base::out); -} -#endif // explicit -llofstream::llofstream(const char* _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::ostream(&_M_filebuf) +llofstream::llofstream(const char* _Filename, ios_base::openmode _Mode) : + std::ofstream(utf8str_to_utf16str(_Filename).c_str(), + _Mode | ios_base::out) { - if (_M_filebuf.open(_Filename, _Mode | ios_base::out) == 0) - { - _Myios::setstate(ios_base::failbit); - } } -#else - std::ostream() -{ - this->init(&_M_filebuf); - this->open(_Filename, _Mode | ios_base::out); -} -#endif -// explicit -llofstream::llofstream(_Filet *_File, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(_File, _Mode, _Size), -#if LL_WINDOWS - std::ostream(&_M_filebuf) {} -#else - std::ostream() +void llofstream::open(const std::string& _Filename, ios_base::openmode _Mode) { - this->init(&_M_filebuf); -} -#endif - -#if !LL_WINDOWS -// explicit -llofstream::llofstream(int __fd, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(__fd, _Mode, _Size), - std::ostream() -{ - this->init(&_M_filebuf); -} -#endif - -bool llofstream::is_open() const -{ // test if C stream has been opened - return _M_filebuf.is_open(); + std::ofstream::open(utf8str_to_utf16str(_Filename), + _Mode | ios_base::out); } void llofstream::open(const char* _Filename, ios_base::openmode _Mode) -{ // open a C stream with specified mode - if (_M_filebuf.open(_Filename, _Mode | ios_base::out) == 0) -#if LL_WINDOWS - { - _Myios::setstate(ios_base::failbit); - } - else - { - _Myios::clear(); - } -#else - { - this->setstate(ios_base::failbit); - } - else - { - this->clear(); - } -#endif +{ + std::ofstream::open(utf8str_to_utf16str(_Filename).c_str(), + _Mode | ios_base::out); } -void llofstream::close() -{ // close the C stream - if (_M_filebuf.close() == 0) - { -#if LL_WINDOWS - _Myios::setstate(ios_base::failbit); -#else - this->setstate(ios_base::failbit); -#endif - } -} +#endif // LL_WINDOWS /************** helper functions ********************************/ diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index cc990f6ab..eacbacca1 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -38,15 +38,13 @@ * Attempts to mostly mirror the POSIX style IO functions. */ -typedef FILE LLFILE; +typedef FILE LLFILE; #if LL_WINDOWS // windows version of stat function and stat data structure are called _stat typedef struct _stat llstat; #else typedef struct stat llstat; -#include -#include #endif #ifndef S_ISREG @@ -93,135 +91,20 @@ public: static std::string strerr(); }; -/** - * @brief Provides a layer of compatibility for C/POSIX. - * - * This is taken from both the GNU __gnu_cxx::stdio_filebuf extension and - * VC's basic_filebuf implementation. - * This file buffer provides extensions for working with standard C FILE*'s - * and POSIX file descriptors for platforms that support this. -*/ -namespace -{ -#if LL_WINDOWS -//typedef std::filebuf _Myfb; -//Singu note: Wrap around std::filebuf to override the open procedure. -// The client encodes filepaths in UTF-8, however Windows uses UTF-16 encoding natively. -// Need to convert paths to UTF-16 before calling std::filebuf::open. -struct _Myfb : public std::filebuf -{ - _Myfb() : std::filebuf() {} - _Myfb(_Filet* file) : std::filebuf(file) {} - _Myt *open(const char *filename, std::ios_base::openmode mode, int prot = (int)std::ios_base::_Openprot) - { - return std::filebuf::open(utf8str_to_utf16str(filename).c_str(),mode,prot); - } -}; +#if !defined(LL_WINDOWS) +typedef std::ifstream llifstream; +typedef std::ofstream llofstream; #else -typedef __gnu_cxx::stdio_filebuf< char > _Myfb; -typedef std::__c_file _Filet; -#endif /* LL_WINDOWS */ -} - -class LL_COMMON_API llstdio_filebuf : public _Myfb -{ -public: - /** - * deferred initialization / destruction - */ - llstdio_filebuf() : _Myfb() {} - virtual ~llstdio_filebuf() {} - - /** - * @param f An open @c FILE*. - * @param mode Same meaning as in a standard filebuf. - * @param size Optimal or preferred size of internal buffer, in chars. - * Defaults to system's @c BUFSIZ. - * - * This constructor associates a file stream buffer with an open - * C @c FILE*. The @c FILE* will not be automatically closed when the - * stdio_filebuf is closed/destroyed. - */ - llstdio_filebuf(_Filet* __f, std::ios_base::openmode __mode, - //size_t __size = static_cast(BUFSIZ)) : - size_t __size = static_cast(1)) : -#if LL_WINDOWS - _Myfb(__f) {} -#else - _Myfb(__f, __mode, __size) {} -#endif - - /** - * @brief Opens an external file. - * @param s The name of the file. - * @param mode The open mode flags. - * @return @c this on success, NULL on failure - * - * If a file is already open, this function immediately fails. - * Otherwise it tries to open the file named @a s using the flags - * given in @a mode. - */ - //llstdio_filebuf* open(const char *_Filename, - // std::ios_base::openmode _Mode); - - /** - * @param fd An open file descriptor. - * @param mode Same meaning as in a standard filebuf. - * @param size Optimal or preferred size of internal buffer, in chars. - * - * This constructor associates a file stream buffer with an open - * POSIX file descriptor. The file descriptor will be automatically - * closed when the stdio_filebuf is closed/destroyed. - */ -#if !LL_WINDOWS - llstdio_filebuf(int __fd, std::ios_base::openmode __mode, - //size_t __size = static_cast(BUFSIZ)) : - size_t __size = static_cast(1)) : - _Myfb(__fd, __mode, __size) {} -#endif - -// *TODO: Seek the underlying c stream for better cross-platform compatibility? -#if !LL_WINDOWS -protected: - /** underflow() and uflow() functions are called to get the next - * character from the real input source when the buffer is empty. - * Buffered input uses underflow() - */ - /*virtual*/ int_type underflow(); - - /* Convert internal byte sequence to external, char-based - * sequence via codecvt. - */ - bool _convert_to_external(char_type*, std::streamsize); - - /** The overflow() function is called to transfer characters to the - * real output destination when the buffer is full. A call to - * overflow(c) outputs the contents of the buffer plus the - * character c. - * Consume some sequence of the characters in the pending sequence. - */ - /*virtual*/ int_type overflow(int_type __c = traits_type::eof()); - - /** sync() flushes the underlying @c FILE* stream. - */ - /*virtual*/ int sync(); - - std::streamsize xsgetn(char_type*, std::streamsize); - std::streamsize xsputn(char_type const*, std::streamsize); -#endif -}; - /** * @brief Controlling input for files. * * This class supports reading from named files, using the inherited - * functions from std::basic_istream. To control the associated - * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) - * which allows construction using a pre-exisintg file stream buffer. - * We refer to this std::basic_filebuf (or derivative) as @c sb. -*/ -class LL_COMMON_API llifstream : public std::istream + * functions from std::ifstream. The only added value is that our constructor + * Does The Right Thing when passed a non-ASCII pathname. Sadly, that isn't + * true of Microsoft's std::ifstream. + */ +class LL_COMMON_API llifstream : public std::ifstream { // input stream associated with a C stream public: @@ -247,56 +130,6 @@ public: explicit llifstream(const char* _Filename, ios_base::openmode _Mode = ios_base::in); - /** - * @brief Create a stream using an open c file stream. - * @param File An open @c FILE*. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ - explicit llifstream(_Filet *_File, - ios_base::openmode _Mode = ios_base::in, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); - - /** - * @brief Create a stream using an open file descriptor. - * @param fd An open file descriptor. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ -#if !LL_WINDOWS - explicit llifstream(int __fd, - ios_base::openmode _Mode = ios_base::in, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); -#endif - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - virtual ~llifstream() {} - - // Members: - /** - * @brief Accessing the underlying buffer. - * @return The current basic_filebuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - llstdio_filebuf* rdbuf() const - { return const_cast(&_M_filebuf); } - - /** - * @brief Wrapper to test for an open file. - * @return @c rdbuf()->is_open() - */ - bool is_open() const; - /** * @brief Opens an external file. * @param Filename The name of the file. @@ -306,34 +139,21 @@ public: * fails, @c failbit is set in the stream's error state. */ void open(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::in) - { open(_Filename.c_str(), _Mode); } + ios_base::openmode _Mode = ios_base::in); void open(const char* _Filename, ios_base::openmode _Mode = ios_base::in); - - /** - * @brief Close the file. - * - * Calls @c llstdio_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void close(); - -private: - llstdio_filebuf _M_filebuf; }; /** * @brief Controlling output for files. * - * This class supports writing to named files, using the inherited - * functions from std::basic_ostream. To control the associated - * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) - * which allows construction using a pre-exisintg file stream buffer. - * We refer to this std::basic_filebuf (or derivative) as @c sb. -*/ -class LL_COMMON_API llofstream : public std::ostream + * This class supports writing to named files, using the inherited functions + * from std::ofstream. The only added value is that our constructor Does The + * Right Thing when passed a non-ASCII pathname. Sadly, that isn't true of + * Microsoft's std::ofstream. + */ +class LL_COMMON_API llofstream : public std::ofstream { public: // Constructors: @@ -351,64 +171,13 @@ public: * @param Filename String specifying the filename. * @param Mode Open file in specified mode (see std::ios_base). * - * @c ios_base::out|ios_base::trunc is automatically included in - * @a mode. + * @c ios_base::out is automatically included in @a mode. */ explicit llofstream(const std::string& _Filename, ios_base::openmode _Mode = ios_base::out|ios_base::trunc); explicit llofstream(const char* _Filename, ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - /** - * @brief Create a stream using an open c file stream. - * @param File An open @c FILE*. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ - explicit llofstream(_Filet *_File, - ios_base::openmode _Mode = ios_base::out, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); - - /** - * @brief Create a stream using an open file descriptor. - * @param fd An open file descriptor. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ -#if !LL_WINDOWS - explicit llofstream(int __fd, - ios_base::openmode _Mode = ios_base::out, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); -#endif - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - virtual ~llofstream() {} - - // Members: - /** - * @brief Accessing the underlying buffer. - * @return The current basic_filebuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - llstdio_filebuf* rdbuf() const - { return const_cast(&_M_filebuf); } - - /** - * @brief Wrapper to test for an open file. - * @return @c rdbuf()->is_open() - */ - bool is_open() const; - /** * @brief Opens an external file. * @param Filename The name of the file. @@ -418,23 +187,11 @@ public: * fails, @c failbit is set in the stream's error state. */ void open(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc) - { open(_Filename.c_str(), _Mode); } + ios_base::openmode _Mode = ios_base::out | ios_base::trunc); void open(const char* _Filename, ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - - /** - * @brief Close the file. - * - * Calls @c llstdio_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void close(); - -private: - llstdio_filebuf _M_filebuf; }; - +#endif /** * @breif filesize helpers. diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 4a21ea334..6bce8f62e 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -831,7 +831,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } else if(0 == strcmp("permissions", keyword)) { - success = mPermissions.importStream(input_stream); + success = mPermissions.importLegacyStream(input_stream); } else if(0 == strcmp("sale_info", keyword)) { @@ -841,7 +841,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) // should pick up the vast majority of the tasks. BOOL has_perm_mask = FALSE; U32 perm_mask = 0; - success = mSaleInfo.importStream(input_stream, has_perm_mask, perm_mask); + success = mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask); if(has_perm_mask) { if(perm_mask == PERM_NONE) @@ -957,7 +957,7 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu output_stream << "\t\titem_id\t" << uuid_str << "\n"; mParentUUID.toString(uuid_str); output_stream << "\t\tparent_id\t" << uuid_str << "\n"; - mPermissions.exportStream(output_stream); + mPermissions.exportLegacyStream(output_stream); // Check for permissions to see the asset id, and if so write it // out as an asset id. Otherwise, apply our cheesy encryption. @@ -991,7 +991,7 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu std::string buffer; buffer = llformat( "\t\tflags\t%08x\n", mFlags); output_stream << buffer; - mSaleInfo.exportStream(output_stream); + mSaleInfo.exportLegacyStream(output_stream); output_stream << "\t\tname\t" << mName.c_str() << "|\n"; output_stream << "\t\tdesc\t" << mDescription.c_str() << "|\n"; output_stream << "\t\tcreation_date\t" << mCreationDate << "\n"; diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index b0deafdfe..2316c635d 100644 --- a/indra/llinventory/llpermissions.cpp +++ b/indra/llinventory/llpermissions.cpp @@ -31,7 +31,6 @@ // library includes #include "message.h" -#include "metapropertyt.h" #include "llsd.h" ///---------------------------------------------------------------------------- @@ -572,17 +571,143 @@ void LLPermissions::unpackMessage(LLMessageSystem* msg, const char* block, S32 b BOOL LLPermissions::importFile(LLFILE* fp) { - llifstream ifs(fp); - return importStream(ifs); + init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); + const S32 BUFSIZE = 16384; + + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. + char buffer[BUFSIZE]; /* Flawfinder: ignore */ + char keyword[256]; /* Flawfinder: ignore */ + char valuestr[256]; /* Flawfinder: ignore */ + char uuid_str[256]; /* Flawfinder: ignore */ + U32 mask; + + keyword[0] = '\0'; + valuestr[0] = '\0'; + + while (!feof(fp)) + { + if (fgets(buffer, BUFSIZE, fp) == NULL) + { + buffer[0] = '\0'; + } + + sscanf( /* Flawfinder: ignore */ + buffer, + " %255s %255s", + keyword, valuestr); + if (!strcmp("{", keyword)) + { + continue; + } + if (!strcmp("}",keyword)) + { + break; + } + else if (!strcmp("creator_mask", keyword)) + { + // legacy support for "creator" masks + sscanf(valuestr, "%x", &mask); + mMaskBase = mask; + fixFairUse(); + } + else if (!strcmp("base_mask", keyword)) + { + sscanf(valuestr, "%x", &mask); + mMaskBase = mask; + //fixFairUse(); + } + else if (!strcmp("owner_mask", keyword)) + { + sscanf(valuestr, "%x", &mask); + mMaskOwner = mask; + } + else if (!strcmp("group_mask", keyword)) + { + sscanf(valuestr, "%x", &mask); + mMaskGroup = mask; + } + else if (!strcmp("everyone_mask", keyword)) + { + sscanf(valuestr, "%x", &mask); + mMaskEveryone = mask; + } + else if (!strcmp("next_owner_mask", keyword)) + { + sscanf(valuestr, "%x", &mask); + mMaskNextOwner = mask; + } + else if (!strcmp("creator_id", keyword)) + { + sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */ + mCreator.set(uuid_str); + } + else if (!strcmp("owner_id", keyword)) + { + sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */ + mOwner.set(uuid_str); + } + else if (!strcmp("last_owner_id", keyword)) + { + sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */ + mLastOwner.set(uuid_str); + } + else if (!strcmp("group_id", keyword)) + { + sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */ + mGroup.set(uuid_str); + } + else if (!strcmp("group_owned", keyword)) + { + sscanf(valuestr, "%d", &mask); + if(mask) mIsGroupOwned = true; + else mIsGroupOwned = false; + } + else + { + LL_INFOS() << "unknown keyword " << keyword << " in permissions import" << LL_ENDL; + } + } + fix(); + return TRUE; } + BOOL LLPermissions::exportFile(LLFILE* fp) const { - llofstream ofs(fp); - return exportStream(ofs); + std::string uuid_str; + + fprintf(fp, "\tpermissions 0\n"); + fprintf(fp, "\t{\n"); + + fprintf(fp, "\t\tbase_mask\t%08x\n", mMaskBase); + fprintf(fp, "\t\towner_mask\t%08x\n", mMaskOwner); + fprintf(fp, "\t\tgroup_mask\t%08x\n", mMaskGroup); + fprintf(fp, "\t\teveryone_mask\t%08x\n", mMaskEveryone); + fprintf(fp, "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); + + mCreator.toString(uuid_str); + fprintf(fp, "\t\tcreator_id\t%s\n", uuid_str.c_str()); + + mOwner.toString(uuid_str); + fprintf(fp, "\t\towner_id\t%s\n", uuid_str.c_str()); + + mLastOwner.toString(uuid_str); + fprintf(fp, "\t\tlast_owner_id\t%s\n", uuid_str.c_str()); + + mGroup.toString(uuid_str); + fprintf(fp, "\t\tgroup_id\t%s\n", uuid_str.c_str()); + + if(mIsGroupOwned) + { + fprintf(fp, "\t\tgroup_owned\t1\n"); + } + fprintf(fp,"\t}\n"); + return TRUE; } -BOOL LLPermissions::importStream(std::istream& input_stream) + +BOOL LLPermissions::importLegacyStream(std::istream& input_stream) { init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); const S32 BUFSIZE = 16384; @@ -601,18 +726,6 @@ BOOL LLPermissions::importStream(std::istream& input_stream) while (input_stream.good()) { input_stream.getline(buffer, BUFSIZE); - if (input_stream.eof()) - { - LL_WARNS() << "Bad permissions: early end of input stream" - << LL_ENDL; - return FALSE; - } - if (input_stream.fail()) - { - LL_WARNS() << "Bad permissions: failed to read from input stream" - << LL_ENDL; - return FALSE; - } sscanf( /* Flawfinder: ignore */ buffer, " %255s %255s", @@ -695,26 +808,36 @@ BOOL LLPermissions::importStream(std::istream& input_stream) } -BOOL LLPermissions::exportStream(std::ostream& output_stream) const +BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const { - if (!output_stream.good()) return FALSE; + std::string uuid_str; + output_stream << "\tpermissions 0\n"; output_stream << "\t{\n"; - char prev_fill = output_stream.fill('0'); - output_stream << std::hex; - output_stream << "\t\tbase_mask\t" << std::setw(8) << mMaskBase << "\n"; - output_stream << "\t\towner_mask\t" << std::setw(8) << mMaskOwner << "\n"; - output_stream << "\t\tgroup_mask\t" << std::setw(8) << mMaskGroup << "\n"; - output_stream << "\t\teveryone_mask\t" << std::setw(8) << mMaskEveryone << "\n"; - output_stream << "\t\tnext_owner_mask\t" << std::setw(8) << mMaskNextOwner << "\n"; - output_stream << std::dec; - output_stream.fill(prev_fill); + std::string buffer; + buffer = llformat( "\t\tbase_mask\t%08x\n", mMaskBase); + output_stream << buffer; + buffer = llformat( "\t\towner_mask\t%08x\n", mMaskOwner); + output_stream << buffer; + buffer = llformat( "\t\tgroup_mask\t%08x\n", mMaskGroup); + output_stream << buffer; + buffer = llformat( "\t\teveryone_mask\t%08x\n", mMaskEveryone); + output_stream << buffer; + buffer = llformat( "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); + output_stream << buffer; - output_stream << "\t\tcreator_id\t" << mCreator << "\n"; - output_stream << "\t\towner_id\t" << mOwner << "\n"; - output_stream << "\t\tlast_owner_id\t" << mLastOwner << "\n"; - output_stream << "\t\tgroup_id\t" << mGroup << "\n"; + mCreator.toString(uuid_str); + output_stream << "\t\tcreator_id\t" << uuid_str << "\n"; + + mOwner.toString(uuid_str); + output_stream << "\t\towner_id\t" << uuid_str << "\n"; + + mLastOwner.toString(uuid_str); + output_stream << "\t\tlast_owner_id\t" << uuid_str << "\n"; + + mGroup.toString(uuid_str); + output_stream << "\t\tgroup_id\t" << uuid_str << "\n"; if(mIsGroupOwned) { @@ -772,21 +895,6 @@ std::ostream& operator<<(std::ostream &s, const LLPermissions &perm) return s; } -template <> -void LLMetaClassT::reflectProperties(LLMetaClass& meta_class) -{ - reflectProperty(meta_class, "mCreator", &LLPermissions::mCreator); - reflectProperty(meta_class, "mOwner", &LLPermissions::mOwner); - reflectProperty(meta_class, "mGroup", &LLPermissions::mGroup); - reflectProperty(meta_class, "mIsGroupOwned", &LLPermissions::mIsGroupOwned); -} - -// virtual -const LLMetaClass& LLPermissions::getMetaClass() const -{ - return LLMetaClassT::instance(); -} - ///---------------------------------------------------------------------------- /// Class LLAggregatePermissions ///---------------------------------------------------------------------------- @@ -1021,7 +1129,7 @@ void mask_to_string(U32 mask, char* str) else { *str = ' '; - } + } str++; if (mask & PERM_EXPORT) diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h index d3a65a5a6..a69f6033d 100644 --- a/indra/llinventory/llpermissions.h +++ b/indra/llinventory/llpermissions.h @@ -31,7 +31,6 @@ #include "llsd.h" #include "lluuid.h" #include "llxmlnode.h" -#include "reflective.h" #include "llinventorytype.h" // prototypes @@ -89,7 +88,7 @@ enum ExportPolicy { // logical consistency. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLPermissions : public LLReflective +class LLPermissions { private: LLUUID mCreator; // null if object created by system @@ -329,17 +328,14 @@ public: BOOL importFile(LLFILE* fp); BOOL exportFile(LLFILE* fp) const; - BOOL importStream(std::istream& input_stream); - BOOL exportStream(std::ostream& output_stream) const; + BOOL importLegacyStream(std::istream& input_stream); + BOOL exportLegacyStream(std::ostream& output_stream) const; bool operator==(const LLPermissions &rhs) const; bool operator!=(const LLPermissions &rhs) const; friend std::ostream& operator<<(std::ostream &s, const LLPermissions &perm); - // Reflection. - friend class LLMetaClassT; - virtual const LLMetaClass& getMetaClass() const; }; // Inlines diff --git a/indra/llinventory/llsaleinfo.cpp b/indra/llinventory/llsaleinfo.cpp index 2c5d163e3..021c1d9d3 100644 --- a/indra/llinventory/llsaleinfo.cpp +++ b/indra/llinventory/llsaleinfo.cpp @@ -87,13 +87,15 @@ U32 LLSaleInfo::getCRC32() const BOOL LLSaleInfo::exportFile(LLFILE* fp) const { - llofstream ofs(fp); - return exportStream(ofs); + fprintf(fp, "\tsale_info\t0\n\t{\n"); + fprintf(fp, "\t\tsale_type\t%s\n", lookup(mSaleType)); + fprintf(fp, "\t\tsale_price\t%d\n", mSalePrice); + fprintf(fp,"\t}\n"); + return TRUE; } -BOOL LLSaleInfo::exportStream(std::ostream& output_stream) const +BOOL LLSaleInfo::exportLegacyStream(std::ostream& output_stream) const { - if (!output_stream.good()) return FALSE; output_stream << "\tsale_info\t0\n\t{\n"; output_stream << "\t\tsale_type\t" << lookup(mSaleType) << "\n"; output_stream << "\t\tsale_price\t" << mSalePrice << "\n"; @@ -137,40 +139,25 @@ bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask) // because I can't find any non-test code references to it. 2009-05-04 JC BOOL LLSaleInfo::importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask) -{ - llifstream ifs(fp); - return importStream(ifs, has_perm_mask, perm_mask); -} - -BOOL LLSaleInfo::importStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask) { has_perm_mask = FALSE; - const S32 BUFSIZE = 16384; - // *NOTE: Changing the buffer size will require changing the scanf // calls below. - char buffer[BUFSIZE]; /* Flawfinder: ignore */ - char keyword[255]; /* Flawfinder: ignore */ - char valuestr[255]; /* Flawfinder: ignore */ + char buffer[MAX_STRING]; /* Flawfinder: ignore */ + char keyword[MAX_STRING]; /* Flawfinder: ignore */ + char valuestr[MAX_STRING]; /* Flawfinder: ignore */ + BOOL success = TRUE; keyword[0] = '\0'; valuestr[0] = '\0'; - while(input_stream.good()) + while(success && (!feof(fp))) { - input_stream.getline(buffer, MAX_STRING); - if (input_stream.eof()) + if (fgets(buffer, MAX_STRING, fp) == NULL) { - LL_WARNS() << "Bad sale info: early end of input stream" - << LL_ENDL; - return FALSE; - } - if (input_stream.fail()) - { - LL_WARNS() << "Bad sale info: failed to read from input stream" - << LL_ENDL; - return FALSE; + buffer[0] = '\0'; } + sscanf( /* Flawfinder: ignore */ buffer, " %254s %254s", @@ -208,7 +195,63 @@ BOOL LLSaleInfo::importStream(std::istream& input_stream, BOOL& has_perm_mask, U << "' in sale info import" << LL_ENDL; } } - return TRUE; + return success; +} + +BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask) +{ + has_perm_mask = FALSE; + + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. + char buffer[MAX_STRING]; /* Flawfinder: ignore */ + char keyword[MAX_STRING]; /* Flawfinder: ignore */ + char valuestr[MAX_STRING]; /* Flawfinder: ignore */ + BOOL success = TRUE; + + keyword[0] = '\0'; + valuestr[0] = '\0'; + while(success && input_stream.good()) + { + input_stream.getline(buffer, MAX_STRING); + sscanf( /* Flawfinder: ignore */ + buffer, + " %254s %254s", + keyword, valuestr); + if(!keyword[0]) + { + continue; + } + if(0 == strcmp("{",keyword)) + { + continue; + } + if(0 == strcmp("}", keyword)) + { + break; + } + else if(0 == strcmp("sale_type", keyword)) + { + mSaleType = lookup(valuestr); + } + else if(0 == strcmp("sale_price", keyword)) + { + sscanf(valuestr, "%d", &mSalePrice); + mSalePrice = llclamp(mSalePrice, 0, S32_MAX); + } + else if (!strcmp("perm_mask", keyword)) + { + //LL_INFOS() << "found deprecated keyword perm_mask" << LL_ENDL; + has_perm_mask = TRUE; + sscanf(valuestr, "%x", &perm_mask); + } + else + { + LL_WARNS() << "unknown keyword '" << keyword + << "' in sale info import" << LL_ENDL; + } + } + return success; } void LLSaleInfo::setSalePrice(S32 price) diff --git a/indra/llinventory/llsaleinfo.h b/indra/llinventory/llsaleinfo.h index 8a01653a6..262aeb3dd 100644 --- a/indra/llinventory/llsaleinfo.h +++ b/indra/llinventory/llsaleinfo.h @@ -95,11 +95,11 @@ public: BOOL exportFile(LLFILE* fp) const; BOOL importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask); - BOOL exportStream(std::ostream& output_stream) const; + BOOL exportLegacyStream(std::ostream& output_stream) const; LLSD asLLSD() const; operator LLSD() const { return asLLSD(); } bool fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask); - BOOL importStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask); + BOOL importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask); LLSD packMessage() const; void unpackMessage(const LLSD& sales); diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 1f8add5c2..71bf61541 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -42,7 +42,6 @@ #include "llinventoryfunctions.h" #include "lllocaltextureobject.h" #include "llpaneleditwearable.h" -#include "aixmllindengenepool.h" using namespace LLAvatarAppearanceDefines; @@ -136,7 +135,7 @@ LLWearable::EImportResult LLViewerWearable::importStream( std::istream& input_st return result; } - +#if 0 AIArchetype LLViewerWearable::getArchetype(void) const { AIArchetype archetype(this); @@ -150,7 +149,7 @@ AIArchetype LLViewerWearable::getArchetype(void) const } return archetype; } - +#endif // Avatar parameter and texture definitions can change over time. // This function returns true if parameters or textures have been added or removed // since this wearable was created. @@ -600,18 +599,7 @@ void LLViewerWearable::saveNewAsset() const //LL_INFOS() << *this << LL_ENDL; const std::string filename = asset_id_to_filename(mAssetID); - LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ - BOOL successful_save = FALSE; - if(fp && exportFile(fp)) - { - successful_save = TRUE; - } - if(fp) - { - fclose(fp); - fp = NULL; - } - if(!successful_save) + if(! exportFile(filename)) { std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str()); LL_WARNS() << buffer << LL_ENDL; diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h index 3f5d8ec17..245753865 100644 --- a/indra/newview/llviewerwearable.h +++ b/indra/newview/llviewerwearable.h @@ -29,7 +29,6 @@ #include "llwearable.h" #include "llavatarappearancedefines.h" -#include "aixmllindengenepool.h" class LLVOAvatar; class LLAPRFile; @@ -69,7 +68,9 @@ public: /*virtual*/ EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp ); // Singu extension. +#if 0 AIArchetype getArchetype(void) const; +#endif void setParamsToDefaults(); void setTexturesToDefaults();