Merge branch 'release/2026.01' into maxim/2025.07-Flat-UI

This commit is contained in:
Mnikolenko Productengine
2025-12-04 14:19:22 +02:00
738 changed files with 15081 additions and 6575 deletions
+1
View File
@@ -1,6 +1,7 @@
# Replace tabs with spaces
1b68f71348ecf3983b76b40d7940da8377f049b7
33418a77b716e122da9778869cdbabe97c83ff37
6b974724826a038b0db794460b322eb4921da735
# Trim trailing whitespace
a0b3021bdcf76859054fda8e30abb3ed47749e83
8444cd9562a6a7b755fcb075864e205122354192
+7
View File
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
+63 -35
View File
@@ -1,81 +1,109 @@
llappearance:
- indra/llappearance/**/*
- changed-files:
- any-glob-to-any-file: indra/llappearance/**
llaudio:
- indra/llaudio/**/*
- changed-files:
- any-glob-to-any-file: indra/llaudio/**
llcharacter:
- indra/llcharacter/**/*
- changed-files:
- any-glob-to-any-file: indra/llcharacter/**
llcommon:
- indra/llcommon/**/*
- changed-files:
- any-glob-to-any-file: indra/llcommon/**
llcorehttp:
- indra/llcorehttp/**/*
- changed-files:
- any-glob-to-any-file: indra/llcorehttp/**
llcrashlogger:
- indra/llcrashlogger/**/*
- changed-files:
- any-glob-to-any-file: indra/llcrashlogger/**
llfilesystem:
- indra/llfilesystem/**/*
- changed-files:
- any-glob-to-any-file: indra/llfilesystem/**
llimage:
- indra/llimage/**/*
- changed-files:
- any-glob-to-any-file: indra/llimage/**
llimagej2coj:
- indra/llimagej2coj/**/*
- changed-files:
- any-glob-to-any-file: indra/llimagej2coj/**
llinventory:
- indra/llinventory/**/*
- changed-files:
- any-glob-to-any-file: indra/llinventory/**
llkdu:
- indra/llkdu/**/*
- changed-files:
- any-glob-to-any-file: indra/llkdu/**
llmath:
- indra/llmath/**/*
- changed-files:
- any-glob-to-any-file: indra/llmath/**
llmeshoptimizer:
- indra/llmeshoptimizer/**/*
- changed-files:
- any-glob-to-any-file: indra/llmeshoptimizer/**
llmessage:
- indra/llmessage/**/*
- changed-files:
- any-glob-to-any-file: indra/llmessage/**
llplugin:
- indra/llplugin/**/*
- changed-files:
- any-glob-to-any-file: indra/llplugin/**
llprimitive:
- indra/llprimitive/**/*
- changed-files:
- any-glob-to-any-file: indra/llprimitive/**
llrender:
- indra/llrender/**/*
- changed-files:
- any-glob-to-any-file: indra/llrender/**
llui:
- indra/llui/**/*
- changed-files:
- any-glob-to-any-file: indra/llui/**
llwindow:
- indra/llwindow/**/*
- changed-files:
- any-glob-to-any-file: indra/llwindow/**
llxml:
- indra/llxml/**/*
- changed-files:
- any-glob-to-any-file: indra/llxml/**
cmake:
- '**/*.cmake'
- '**/*/cmake/*'
- '**/CMakeLists.txt'
- changed-files:
- any-glob-to-any-file:
- '**/*.cmake'
- '**/*/cmake/*'
- '**/CMakeLists.txt'
python:
- '**/*.py'
- changed-files:
- any-glob-to-any-file: '**/*.py'
c/cpp:
- '**/*.c'
- '**/*.cpp'
- '**/*.cxx'
- '**/*.h'
- '**/*.hpp'
- '**/*.hxx'
- '**/*.i'
- '**/*.inl'
- '**/*.y'
- changed-files:
- any-glob-to-any-file:
- '**/*.c'
- '**/*.cpp'
- '**/*.cxx'
- '**/*.h'
- '**/*.hpp'
- '**/*.hxx'
- '**/*.i'
- '**/*.inl'
- '**/*.y'
'team:viewer':
- '*'
objc:
- changed-files:
- any-glob-to-any-file:
- '**/*.m'
- '**/*.mm'
+30 -23
View File
@@ -1,6 +1,7 @@
name: Build
on:
workflow_dispatch:
pull_request:
push:
branches: ["main", "release/*", "project/*"]
@@ -85,23 +86,23 @@ jobs:
variants: ${{ matrix.configuration }}
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Setup python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Checkout build variables
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: secondlife/build-variables
ref: universal
ref: master
path: .build-variables
- name: Checkout master-message-template
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: secondlife/master-message-template
path: .master-message-template
@@ -309,7 +310,7 @@ jobs:
steps:
- name: Sign and package Windows viewer
if: env.AZURE_KEY_VAULT_URI && env.AZURE_CERT_NAME && env.AZURE_CLIENT_ID && env.AZURE_CLIENT_SECRET && env.AZURE_TENANT_ID
uses: secondlife/viewer-build-util/sign-pkg-windows@v2
uses: secondlife/viewer-build-util/sign-pkg-windows@v2.0.4
with:
vault_uri: "${{ env.AZURE_KEY_VAULT_URI }}"
cert_name: "${{ env.AZURE_CERT_NAME }}"
@@ -361,8 +362,9 @@ jobs:
post-windows-symbols:
env:
BUGSPLAT_USER: ${{ secrets.BUGSPLAT_USER }}
BUGSPLAT_PASS: ${{ secrets.BUGSPLAT_PASS }}
BUGSPLAT_DATABASE: "${{ secrets.BUGSPLAT_DATABASE }}"
SYMBOL_UPLOAD_CLIENT_ID: "${{ secrets.BUGSPLAT_SYMBOL_UPLOAD_CLIENT_ID }}"
SYMBOL_UPLOAD_CLIENT_SECRET: "${{ secrets.BUGSPLAT_SYMBOL_UPLOAD_CLIENT_SECRET }}"
needs: build
if: needs.build.outputs.configuration == 'Release'
runs-on: ubuntu-latest
@@ -373,51 +375,56 @@ jobs:
name: Windows-app
path: _artifacts
- name: Download Windows Symbols
if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS
if: env.BUGSPLAT_DATABASE && env.SYMBOL_UPLOAD_CLIENT_ID
uses: actions/download-artifact@v4
with:
name: Windows-symbols
- name: Extract viewer pdb
if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS
if: env.BUGSPLAT_DATABASE && env.SYMBOL_UPLOAD_CLIENT_ID
shell: bash
run: |
tar -xJf "${{ needs.build.outputs.viewer_channel }}.sym.tar.xz" -C _artifacts
- name: Post Windows symbols
if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS
uses: secondlife-3p/symbol-upload@v10
if: env.BUGSPLAT_DATABASE && env.SYMBOL_UPLOAD_CLIENT_ID
uses: BugSplat-Git/symbol-upload@095d163ae9ceb006d286a731dcd35cf6a1b458c8
with:
username: ${{ env.BUGSPLAT_USER }}
password: ${{ env.BUGSPLAT_PASS }}
database: "SecondLife_Viewer_2018"
clientId: "${{ env.SYMBOL_UPLOAD_CLIENT_ID }}"
clientSecret: "${{ env.SYMBOL_UPLOAD_CLIENT_SECRET }}"
database: "${{ env.BUGSPLAT_DATABASE }}"
application: ${{ needs.build.outputs.viewer_channel }}
version: ${{ needs.build.outputs.viewer_version }}
directory: _artifacts
files: "**/{SecondLifeViewer.exe,llwebrtc.dll,*.pdb}"
node-version: "22"
dumpSyms: false
post-mac-symbols:
env:
BUGSPLAT_USER: ${{ secrets.BUGSPLAT_USER }}
BUGSPLAT_PASS: ${{ secrets.BUGSPLAT_PASS }}
BUGSPLAT_DATABASE: "${{ secrets.BUGSPLAT_DATABASE }}"
SYMBOL_UPLOAD_CLIENT_ID: "${{ secrets.BUGSPLAT_SYMBOL_UPLOAD_CLIENT_ID }}"
SYMBOL_UPLOAD_CLIENT_SECRET: "${{ secrets.BUGSPLAT_SYMBOL_UPLOAD_CLIENT_SECRET }}"
needs: build
if: needs.build.outputs.configuration == 'Release'
runs-on: ubuntu-latest
steps:
- name: Download Mac Symbols
if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS
if: env.BUGSPLAT_DATABASE && env.SYMBOL_UPLOAD_CLIENT_ID
uses: actions/download-artifact@v4
with:
name: macOS-symbols
- name: Post Mac symbols
if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS
uses: secondlife-3p/symbol-upload@v10
if: env.BUGSPLAT_DATABASE && env.SYMBOL_UPLOAD_CLIENT_ID
uses: BugSplat-Git/symbol-upload@095d163ae9ceb006d286a731dcd35cf6a1b458c8
with:
username: ${{ env.BUGSPLAT_USER }}
password: ${{ env.BUGSPLAT_PASS }}
database: "SecondLife_Viewer_2018"
clientId: "${{ env.SYMBOL_UPLOAD_CLIENT_ID }}"
clientSecret: "${{ env.SYMBOL_UPLOAD_CLIENT_SECRET }}"
database: "${{ env.BUGSPLAT_DATABASE }}"
application: ${{ needs.build.outputs.viewer_channel }}
version: ${{ needs.build.outputs.viewer_version }} (${{ needs.build.outputs.viewer_version }})
directory: .
files: "**/*.xcarchive.zip"
node-version: "22"
dumpSyms: false
release:
needs: [setup, build, sign-and-package-windows, sign-and-package-mac]
+1 -1
View File
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check PR description
uses: actions/github-script@v7
uses: actions/github-script@v8
with:
script: |
const description = context.payload.pull_request.body || '';
+1 -1
View File
@@ -23,4 +23,4 @@ jobs:
path-to-signatures: signatures.json
remote-organization-name: secondlife
remote-repository-name: cla-signatures
allowlist: callum@mbp.localdomain,rye@lindenlab.com,rye
allowlist: callum@mbp.localdomain,rye@lindenlab.com,rye,bot*
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@v6
with:
configuration-path: .github/labeler.yaml
repo-token: "${{ secrets.GITHUB_TOKEN }}"
+3 -3
View File
@@ -11,8 +11,8 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.0
- uses: pre-commit/action@v3.0.1
+1 -1
View File
@@ -12,7 +12,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v6
- uses: actions/stale@v10
id: stale
with:
stale-pr-message: This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or it will be closed in 7 days
+1 -1
View File
@@ -35,7 +35,7 @@ jobs:
echo NIGHTLY_DATE=${NIGHTLY_DATE} >> ${GITHUB_ENV}
echo TAG_ID="$(echo ${{ github.sha }} | cut -c1-8)-${{ inputs.project || '${NIGHTLY_DATE}' }}" >> ${GITHUB_ENV}
- name: Update Tag
uses: actions/github-script@v7.0.1
uses: actions/github-script@v8
with:
# use a real access token instead of GITHUB_TOKEN default.
# required so that the results of this tag creation can trigger the build workflow
+4 -4
View File
@@ -7,14 +7,14 @@ repos:
- id: no-trigraphs
- id: copyright
- id: end-of-file
files: \.(cpp|c|h|py|glsl|cmake|txt)$
files: \.(cpp|c|m|mm|h|py|glsl|cmake|txt)$
exclude: language.txt
- id: indent-with-spaces
files: \.(cpp|c|h|inl|py|glsl|cmake)$
files: \.(cpp|c|m|mm|h|inl|py|glsl|cmake)$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-xml
- id: mixed-line-ending
- id: trailing-whitespace
files: \.(cpp|c|h|inl|py|glsl|cmake|yaml|sh)$
files: \.(cpp|c|m|mm|h|inl|py|glsl|cmake|yaml|sh)$
+52 -104
View File
@@ -46,11 +46,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>a21487f4e3a68721fd97edef117795a1b7212a77</string>
<string>3f8e58fe74e144b771858e89a5514bf354964c76</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r1/apr_suite-1.7.5-12259255574-darwin64-12259255574.tar.zst</string>
<string>https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r2/apr_suite-1.7.5-18696779749-darwin64-18696779749.tar.zst</string>
</map>
<key>name</key>
<string>darwin64</string>
@@ -60,11 +60,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>45baf82d3366734e542a2a3749f495b64f5513b4</string>
<string>df36114eb8fb66fdcbb190011222a7d336791d98</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r1/apr_suite-1.7.5-12259255574-linux64-12259255574.tar.zst</string>
<string>https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r2/apr_suite-1.7.5-18696779749-linux64-18696779749.tar.zst</string>
</map>
<key>name</key>
<string>linux64</string>
@@ -74,11 +74,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>bdd35d3b9580d3cdcb98afae639936aaa40e24c4</string>
<string>164705831819d247753c9fd608c2c1ac8dca1883</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r1/apr_suite-1.7.5-12259255574-windows64-12259255574.tar.zst</string>
<string>https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r2/apr_suite-1.7.5-18696779749-windows64-18696779749.tar.zst</string>
</map>
<key>name</key>
<string>windows64</string>
@@ -91,7 +91,7 @@
<key>copyright</key>
<string>Copyright © 2012 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.</string>
<key>version</key>
<string>1.7.5-12259255574</string>
<string>1.7.5-18696779749</string>
<key>name</key>
<string>apr_suite</string>
<key>description</key>
@@ -166,11 +166,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>cd1f1d55a2488657ec2253774b3a414621f81b24</string>
<string>9bcafdd7e1df6b92096fa850627d4f3437630d4a</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-bugsplat/releases/download/v1.1.5-71fc41e/bugsplat-1.1.1-9599607655-darwin64-9599607655.tar.zst</string>
<string>https://github.com/secondlife/3p-bugsplat/releases/download/v1.2.6-a475cbb/bugsplat-1.2.6-19430122611-darwin64-19430122611.tar.zst</string>
</map>
<key>name</key>
<string>darwin64</string>
@@ -180,11 +180,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>9fb0615d17988bd89a2e5ae6d4d19e150afb54a9</string>
<string>4e9f0c1cdbc1cebf6185ecc45228ced7f9af1532</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-bugsplat/releases/download/v1.1.5-71fc41e/bugsplat-5.0.1.0-9599607655-windows64-9599607655.tar.zst</string>
<string>https://github.com/secondlife/3p-bugsplat/releases/download/v1.2.6-a475cbb/bugsplat-6.1.1.0-19430122611-windows64-19430122611.tar.zst</string>
</map>
<key>name</key>
<string>windows64</string>
@@ -450,11 +450,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>d44256458ff0ef4db4c91e8e8cc83e8f98b4f1b8</string>
<string>126e0fa4c16dfd433c9fb7d1d242da98f213d933</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/dullahan/releases/download/v1.21.0-CEF_139.0.28/dullahan-1.21.0.202508272158_139.0.28_g55ab8a8_chromium-139.0.7258.139-darwin64-17279703032.tar.zst</string>
<string>https://github.com/secondlife/dullahan/releases/download/v1.24.0-CEF_139.0.40/dullahan-1.24.0.202510081737_139.0.40_g465474a_chromium-139.0.7258.139-darwin64-18353103947.tar.zst</string>
</map>
<key>name</key>
<string>darwin64</string>
@@ -478,11 +478,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>9d5af766a87052808e4062978504e9af124fb558</string>
<string>20de62c9e57d9e6539c1e2437ec4b46c3ca237bc</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/dullahan/releases/download/v1.21.0-CEF_139.0.28/dullahan-1.21.0.202508272159_139.0.28_g55ab8a8_chromium-139.0.7258.139-windows64-17279703032.tar.zst</string>
<string>https://github.com/secondlife/dullahan/releases/download/v1.24.0-CEF_139.0.40/dullahan-1.24.0.202510081738_139.0.40_g465474a_chromium-139.0.7258.139-windows64-18353103947.tar.zst</string>
</map>
<key>name</key>
<string>windows64</string>
@@ -495,7 +495,7 @@
<key>copyright</key>
<string>Copyright (c) 2017, Linden Research, Inc.</string>
<key>version</key>
<string>1.21.0.202508272158_139.0.28_g55ab8a8_chromium-139.0.7258.139</string>
<string>1.24.0.202510081737_139.0.40_g465474a_chromium-139.0.7258.139</string>
<key>name</key>
<string>dullahan</string>
<key>description</key>
@@ -1432,53 +1432,21 @@
<map>
<key>platforms</key>
<map>
<key>darwin64</key>
<key>common</key>
<map>
<key>archive</key>
<map>
<key>creds</key>
<string>github</string>
<key>hash</key>
<string>7facda95e2f00c260513f3d4db42588fa8ba703c</string>
<string>fff82c79edb900c547c40dca9a0e3ebac5a8c7da</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/196289774</string>
<string>https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/299858950</string>
</map>
<key>name</key>
<string>darwin64</string>
</map>
<key>linux64</key>
<map>
<key>archive</key>
<map>
<key>creds</key>
<string>github</string>
<key>hash</key>
<string>01d08f13c7bc8d1b95b0330fa6833b7d8274e4d0</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/196289775</string>
</map>
<key>name</key>
<string>linux64</string>
</map>
<key>windows64</key>
<map>
<key>archive</key>
<map>
<key>creds</key>
<string>github</string>
<key>hash</key>
<string>6d00345c7d3471bc5f7c1218e014dd0f1a2c069b</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/196289778</string>
</map>
<key>name</key>
<string>windows64</string>
<string>common</string>
</map>
</map>
<key>license</key>
@@ -1492,58 +1460,6 @@
<key>name</key>
<string>llphysicsextensions_source</string>
</map>
<key>llphysicsextensions_stub</key>
<map>
<key>platforms</key>
<map>
<key>darwin64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>f290b000b31f9e36f2489946cbc99f5e</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/59995/563653/llphysicsextensions_stub-1.0.542456-darwin64-542456.tar.bz2</string>
</map>
<key>name</key>
<string>darwin64</string>
</map>
<key>linux64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>711f4ec769e4b5f59ba25ee43c11bcbc</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/4724/14846/llphysicsextensions_stub-1.0.504712-linux64-504712.tar.bz2</string>
</map>
<key>name</key>
<string>linux64</string>
</map>
<key>windows64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>2e5f1f7046a49d8b0bc295aa878116bc</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/60043/564063/llphysicsextensions_stub-1.0.542456-windows-542456.tar.bz2</string>
</map>
<key>name</key>
<string>windows64</string>
</map>
</map>
<key>license</key>
<string>internal</string>
<key>license_file</key>
<string>LICENSES/llphysicsextensions.txt</string>
<key>copyright</key>
<string>Copyright (c) 2010, Linden Research, Inc.</string>
<key>version</key>
<string>1.0.542456</string>
<key>name</key>
<string>llphysicsextensions_stub</string>
</map>
<key>llphysicsextensions_tpv</key>
<map>
<key>platforms</key>
@@ -2966,6 +2882,38 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>description</key>
<string>Discord Social SDK</string>
</map>
<key>vhacd</key>
<map>
<key>platforms</key>
<map>
<key>common</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>140d8fc952a10edb5f2d72ab405336019ef32cadfa64f0cfce76c9de4bc6268cbc87cc8cd89d3417fb78b531d441701afc8d016bafe4bd275df2707f7daf1387</string>
<key>hash_algorithm</key>
<string>blake2b</string>
<key>url</key>
<string>https://github.com/AlchemyViewer/3p-vhacd/releases/download/v4.1.0-r2/vhacd-4.1.0-r2-common-18166921729.tar.zst</string>
</map>
<key>name</key>
<string>common</string>
</map>
</map>
<key>license</key>
<string>BSD</string>
<key>license_file</key>
<string>LICENSES/vhacd.txt</string>
<key>copyright</key>
<string>Copyright (c) 2011, Khaled Mamou</string>
<key>version</key>
<string>4.1.0-r2</string>
<key>name</key>
<string>vhacd</string>
<key>description</key>
<string>Voxelized Hierarchical Approximate Convex Decomposition</string>
</map>
</map>
<key>package_description</key>
<map>
+3 -4
View File
@@ -70,7 +70,7 @@ installer_Darwin()
{
local package_name="$1"
local package_dir="$(build_dir_Darwin)/newview/"
local pattern=".*$(viewer_channel_suffix ${package_name})_[0-9]+_[0-9]+_[0-9]+_[0-9]+_x86_64\\.dmg\$"
local pattern=".*$(viewer_channel_suffix ${package_name})_[0-9]+_[0-9]+_[0-9]+_[0-9]+_universal\\.dmg\$"
# since the additional packages are built after the base package,
# sorting oldest first ensures that the unqualified package is returned
# even if someone makes a qualified name that duplicates the last word of the base name
@@ -158,7 +158,6 @@ pre_build()
if [[ "$arch" == "Darwin" ]]
then
HAVOK=OFF
SIGNING=("-DENABLE_SIGNING:BOOL=YES" \
"-DSIGNING_IDENTITY:STRING=Developer ID Application: Linden Research, Inc.")
fi
@@ -262,8 +261,8 @@ build()
done
fi
# *TODO: Make this a build extension.
package_llphysicsextensions_tpv || fatal "failed building llphysicsextensions packages"
# *TODO: Make this a build extension. disabled for now
# package_llphysicsextensions_tpv || fatal "failed building llphysicsextensions packages"
end_section "extensions $variant"
else
+1
View File
@@ -70,6 +70,7 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llinventory)
add_subdirectory(${LIBS_OPEN_PREFIX}llmath)
add_subdirectory(${LIBS_OPEN_PREFIX}llmeshoptimizer)
add_subdirectory(${LIBS_OPEN_PREFIX}llmessage)
add_subdirectory(${LIBS_OPEN_PREFIX}llphysicsextensionsos)
add_subdirectory(${LIBS_OPEN_PREFIX}llprimitive)
add_subdirectory(${LIBS_OPEN_PREFIX}llrender)
add_subdirectory(${LIBS_OPEN_PREFIX}llfilesystem)
+1
View File
@@ -62,6 +62,7 @@ set(cmake_SOURCE_FILES
UI.cmake
UnixInstall.cmake
Variables.cmake
VHACD.cmake
ViewerMiscLibs.cmake
VisualLeakDetector.cmake
LibVLCPlugin.cmake
+20 -9
View File
@@ -22,14 +22,25 @@ if (HAVOK)
include(Havok)
use_prebuilt_binary(llphysicsextensions_source)
set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/src)
target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensions)
if(DARWIN)
set(LLPHYSICSEXTENSIONS_STUB_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub)
# can't set these library dependencies per-arch here, need to do it using XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=*] in newview/CMakeLists.txt
#target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensions)
#target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensionsstub)
else()
target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensions)
target_compile_definitions( llphysicsextensions_impl INTERFACE LL_HAVOK=1 )
endif()
target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions)
elseif (HAVOK_TPV)
use_prebuilt_binary(llphysicsextensions_tpv)
target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensions_tpv)
else (HAVOK)
use_prebuilt_binary(llphysicsextensions_stub)
set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub)
target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensionsstub)
endif (HAVOK)
target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions)
if (NOT DARWIN)
if(WINDOWS)
target_link_libraries( llphysicsextensions_impl INTERFACE ${ARCH_PREBUILT_DIRS}/llphysicsextensions_tpv.lib)
elseif(LINUX)
target_link_libraries( llphysicsextensions_impl INTERFACE ${ARCH_PREBUILT_DIRS}/libllphysicsextensions_tpv.a)
endif()
target_compile_definitions( llphysicsextensions_impl INTERFACE LL_HAVOK=1 )
endif()
target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions)
endif ()
+9
View File
@@ -0,0 +1,9 @@
# -*- cmake -*-
include(Prebuilt)
add_library(ll::vhacd INTERFACE IMPORTED)
use_system_binary(vhacd)
use_prebuilt_binary(vhacd)
target_include_directories(ll::vhacd SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/vhacd/)
+6
View File
@@ -23,8 +23,14 @@ if (USE_BUGSPLAT)
elseif (DARWIN)
find_library(BUGSPLAT_LIBRARIES BugsplatMac REQUIRED
NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}")
find_library(CRASHREPORTED_LIBRARIES CrashReporter REQUIRED
NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}")
find_library(HOCKEYSDK_LIBRARIES HockeySDK REQUIRED
NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}")
target_link_libraries( ll::bugsplat INTERFACE
${BUGSPLAT_LIBRARIES}
${CRASHREPORTED_LIBRARIES}
${HOCKEYSDK_LIBRARIES}
)
else (WINDOWS)
message(FATAL_ERROR "BugSplat is not supported; add -DUSE_BUGSPLAT=OFF")
+1
View File
@@ -283,6 +283,7 @@ bool LLPolyMeshSharedData::loadMesh( const std::string& fileName )
LLFILE* fp = LLFile::fopen(fileName, "rb"); /*Flawfinder: ignore*/
if (!fp)
{
LLError::LLUserWarningMsg::showMissingFiles();
LL_ERRS() << "can't open: " << fileName << LL_ENDL;
return false;
}
+4 -1
View File
@@ -1890,7 +1890,10 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name,
image_raw->copyUnscaledAlphaMask(alpha_image_raw, LLColor4U::black);
}
tex->createGLTexture(0, image_raw, 0, true, LLGLTexture::LOCAL);
if (!tex->createGLTexture(0, image_raw, 0, true, LLGLTexture::LOCAL))
{
LL_WARNS() << "Failed to create GL texture for image: " << file_name << LL_ENDL;
}
gGL.getTexUnit(0)->bind(tex);
tex->setAddressMode(LLTexUnit::TAM_CLAMP);
+4 -1
View File
@@ -338,7 +338,10 @@ bool LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
// Create the GL texture, and then hang onto it for future use.
if (mNeedsCreateTexture)
{
mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw);
if (!mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw))
{
LL_WARNS() << "Failed to create GL texture for image: " << mCachedProcessedTexture->getID() << LL_ENDL;
}
mNeedsCreateTexture = false;
gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP);
+2 -2
View File
@@ -1229,7 +1229,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints)
{
bool old_version = false;
std::unique_ptr<LLKeyframeMotion::JointMotionList> joint_motion_list(new LLKeyframeMotion::JointMotionList);
std::unique_ptr<LLKeyframeMotion::JointMotionList> joint_motion_list = std::make_unique<LLKeyframeMotion::JointMotionList>();
//-------------------------------------------------------------------------
// get base priority
@@ -1826,7 +1826,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
for(S32 i = 0; i < num_constraints; ++i)
{
// read in constraint data
std::unique_ptr<JointConstraintSharedData> constraintp(new JointConstraintSharedData);
std::unique_ptr<JointConstraintSharedData> constraintp = std::make_unique<JointConstraintSharedData>();
U8 byte = 0;
if (!dp.unpackU8(byte, "chain_length"))
+2 -2
View File
@@ -51,8 +51,8 @@ LLMotion::LLMotion( const LLUUID &id ) :
mSendStopTimestamp(F32_MAX),
mResidualWeight(0.f),
mFadeWeight(1.f),
mDeactivateCallback(NULL),
mDeactivateCallbackUserData(NULL)
mDeactivateCallback(nullptr),
mDeactivateCallbackUserData(nullptr)
{
for (S32 i=0; i<3; ++i)
memset(&mJointSignature[i][0], 0, sizeof(U8) * LL_CHARACTER_MAX_ANIMATED_JOINTS);
+3 -4
View File
@@ -54,11 +54,10 @@ public:
void reset();
const std::string& getTrigger() const { return mTrigger; }
protected:
LLMultiGesture(const LLMultiGesture& gest);
const LLMultiGesture& operator=(const LLMultiGesture& rhs);
public:
LLMultiGesture(const LLMultiGesture& gest) = delete;
const LLMultiGesture& operator=(const LLMultiGesture& rhs) = delete;
KEY mKey { 0 };
MASK mMask { 0 };
+3 -2
View File
@@ -30,7 +30,8 @@
#include "v3math.h"
#include "llstring.h"
#include "llxmltree.h"
#include <boost/function.hpp>
#include <functional>
class LLPolyMesh;
class LLXmlTreeNode;
@@ -104,7 +105,7 @@ LL_ALIGN_PREFIX(16)
class LLVisualParam
{
public:
typedef boost::function<LLVisualParam*(S32)> visual_param_mapper;
typedef std::function<LLVisualParam*(S32)> visual_param_mapper;
LLVisualParam();
virtual ~LLVisualParam();
+1 -1
View File
@@ -154,7 +154,7 @@ LLVolatileAPRPool::LLVolatileAPRPool(bool is_local, apr_pool_t *parent, apr_size
//create mutex
if(!is_local) //not a local apr_pool, that is: shared by multiple threads.
{
mMutexp.reset(new std::mutex());
mMutexp = std::make_unique<std::mutex>();
}
}
+6 -4
View File
@@ -33,7 +33,6 @@
#include <sys/param.h> // Need PATH_MAX in APR headers...
#endif
#include <boost/noncopyable.hpp>
#include "llwin32headers.h"
#include "apr_thread_proc.h"
#include "apr_getopt.h"
@@ -145,7 +144,7 @@ private:
// 2, a global pool.
//
class LL_COMMON_API LLAPRFile : boost::noncopyable
class LL_COMMON_API LLAPRFile
{
// make this non copyable since a copy closes the file
private:
@@ -153,9 +152,12 @@ private:
LLVolatileAPRPool *mCurrentFilePoolp ; //currently in use apr_pool, could be one of them: sAPRFilePoolp, or a temp pool.
public:
LLAPRFile() ;
LLAPRFile();
LLAPRFile(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL);
~LLAPRFile() ;
~LLAPRFile();
LLAPRFile(const LLAPRFile&) = delete;
LLAPRFile& operator=(const LLAPRFile&) = delete;
apr_status_t open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL, S32* sizep = NULL);
apr_status_t open(const std::string& filename, apr_int32_t flags, bool use_global_pool); //use gAPRPoolp.
+5 -4
View File
@@ -27,8 +27,9 @@
#ifndef LL_LLCALLBACKLIST_H
#define LL_LLCALLBACKLIST_H
#include "llstl.h"
#include <boost/function.hpp>
#include "stdtypes.h"
#include <functional>
#include <list>
class LLCallbackList
@@ -59,8 +60,8 @@ protected:
callback_list_t mCallbackList;
};
typedef boost::function<void ()> nullary_func_t;
typedef boost::function<bool ()> bool_func_t;
typedef std::function<void ()> nullary_func_t;
typedef std::function<bool ()> bool_func_t;
// Call a given callable once in idle loop.
void doOnIdleOneTime(nullary_func_t callable);
+2 -2
View File
@@ -37,7 +37,7 @@
#include "mutex.h"
#include "llsingleton.h"
#include "llinstancetracker.h"
#include <boost/function.hpp>
#include <functional>
#include <string>
#include <exception>
#include <queue>
@@ -112,7 +112,7 @@ public:
/// stuck with the term "coroutine."
typedef boost::fibers::fiber coro;
/// Canonical callable type
typedef boost::function<void()> callable_t;
typedef std::function<void()> callable_t;
/**
* Create and start running a new coroutine with specified name. The name
+3 -6
View File
@@ -99,13 +99,10 @@ public:
/// during updates. If false, cpu usage data isn't
/// collected and will be zero if queried.
LLDeadmanTimer(F64 horizon, bool inc_cpu);
~LLDeadmanTimer() = default;
~LLDeadmanTimer()
{}
private:
LLDeadmanTimer(const LLDeadmanTimer &); // Not defined
void operator=(const LLDeadmanTimer &); // Not defined
LLDeadmanTimer(const LLDeadmanTimer &) = delete;
LLDeadmanTimer& operator=(const LLDeadmanTimer&) = delete;
public:
/// Get the current time. Zero-basis for this time
+7 -7
View File
@@ -30,6 +30,7 @@
#if ! defined(LL_LLDEPENDENCIES_H)
#define LL_LLDEPENDENCIES_H
#include <functional>
#include <string>
#include <vector>
#include <set>
@@ -38,7 +39,6 @@
#include <boost/iterator/transform_iterator.hpp>
#include <boost/iterator/indirect_iterator.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include "llexception.h"
@@ -217,7 +217,7 @@ class LLDependencies: public LLDependenciesBase
/// We have various ways to get the dependencies for a given DepNode.
/// Rather than having to restate each one for 'after' and 'before'
/// separately, pass a dep_selector so we can apply each to either.
typedef boost::function<const typename DepNode::dep_set&(const DepNode&)> dep_selector;
typedef std::function<const typename DepNode::dep_set&(const DepNode&)> dep_selector;
public:
LLDependencies() {}
@@ -340,7 +340,7 @@ private:
public:
/// iterator over value_type entries
typedef boost::transform_iterator<boost::function<value_type(DepNodeMapEntry&)>,
typedef boost::transform_iterator<std::function<value_type(DepNodeMapEntry&)>,
typename DepNodeMap::iterator> iterator;
/// range over value_type entries
typedef boost::iterator_range<iterator> range;
@@ -352,7 +352,7 @@ public:
}
/// iterator over const_value_type entries
typedef boost::transform_iterator<boost::function<const_value_type(const DepNodeMapEntry&)>,
typedef boost::transform_iterator<std::function<const_value_type(const DepNodeMapEntry&)>,
typename DepNodeMap::const_iterator> const_iterator;
/// range over const_value_type entries
typedef boost::iterator_range<const_iterator> const_range;
@@ -364,7 +364,7 @@ public:
}
/// iterator over stored NODEs
typedef boost::transform_iterator<boost::function<NODE&(DepNodeMapEntry&)>,
typedef boost::transform_iterator<std::function<NODE&(DepNodeMapEntry&)>,
typename DepNodeMap::iterator> node_iterator;
/// range over stored NODEs
typedef boost::iterator_range<node_iterator> node_range;
@@ -380,7 +380,7 @@ public:
}
/// const iterator over stored NODEs
typedef boost::transform_iterator<boost::function<const NODE&(const DepNodeMapEntry&)>,
typedef boost::transform_iterator<std::function<const NODE&(const DepNodeMapEntry&)>,
typename DepNodeMap::const_iterator> const_node_iterator;
/// const range over stored NODEs
typedef boost::iterator_range<const_node_iterator> const_node_range;
@@ -396,7 +396,7 @@ public:
}
/// const iterator over stored KEYs
typedef boost::transform_iterator<boost::function<const KEY&(const DepNodeMapEntry&)>,
typedef boost::transform_iterator<std::function<const KEY&(const DepNodeMapEntry&)>,
typename DepNodeMap::const_iterator> const_key_iterator;
/// const range over stored KEYs
typedef boost::iterator_range<const_key_iterator> const_key_range;
+6 -8
View File
@@ -30,9 +30,7 @@
#define LL_LLDOUBLEDISPATCH_H
#include <list>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/ref.hpp>
#include <functional>
/**
* This class supports function calls which are virtual on the dynamic type of
@@ -156,9 +154,9 @@ public:
insert(t1, t2, func);
if (symmetrical)
{
// Use boost::bind() to construct a param-swapping thunk. Don't
// Use std::bind() to construct a param-swapping thunk. Don't
// forget to reverse the parameters too.
insert(t2, t1, boost::bind(func, _2, _1));
insert(t2, t1, std::bind(func, std::placeholders::_2, std::placeholders::_1));
}
}
@@ -193,7 +191,7 @@ public:
insert(Type<Type1>(), Type<Type2>(), func, insertion);
if (symmetrical)
{
insert(Type<Type2>(), Type<Type1>(), boost::bind(func, _2, _1), insertion);
insert(Type<Type2>(), Type<Type1>(), std::bind(func, std::placeholders::_2, std::placeholders::_1), insertion);
}
}
@@ -271,8 +269,8 @@ private:
typename DispatchTable::iterator find(const ParamBaseType& param1, const ParamBaseType& param2)
{
return std::find_if(mDispatch.begin(), mDispatch.end(),
boost::bind(&EntryBase::matches, _1,
boost::ref(param1), boost::ref(param2)));
std::bind(&EntryBase::matches, std::placeholders::_1,
std::ref(param1), std::ref(param2)));
}
/// Look up the first matching entry.
+3 -3
View File
@@ -527,8 +527,8 @@ namespace
mFileLevelMap(),
mTagLevelMap(),
mUniqueLogMessages(),
mCrashFunction(NULL),
mTimeFunction(NULL),
mCrashFunction(nullptr),
mTimeFunction(nullptr),
mRecorders(),
mShouldLogCallCounter(0)
{
@@ -1231,7 +1231,7 @@ namespace
std::ostringstream message_stream;
if (r->wantsTime() && s->mTimeFunction != NULL)
if (r->wantsTime() && s->mTimeFunction != nullptr)
{
message_stream << s->mTimeFunction();
}
+2 -2
View File
@@ -31,7 +31,7 @@
#include "llerror.h"
#include "llpointer.h"
#include "llrefcount.h"
#include "boost/function.hpp"
#include <functional>
#include <string>
class LLSD;
@@ -92,7 +92,7 @@ namespace LLError
Control functions.
*/
typedef boost::function<void(const std::string&)> FatalFunction;
typedef std::function<void(const std::string&)> FatalFunction;
LL_COMMON_API void setFatalFunction(const FatalFunction&);
// The fatal function will be called after an message of LEVEL_ERROR
+6 -9
View File
@@ -33,9 +33,7 @@
#define LL_LLEVENTDISPATCHER_H
#include <boost/fiber/fss.hpp>
#include <boost/function_types/is_member_function_pointer.hpp>
#include <boost/function_types/is_nonmember_callable_builtin.hpp>
#include <boost/hof/is_invocable.hpp> // until C++17, when we get std::is_invocable
#include <boost/iterator/transform_iterator.hpp>
#include <functional> // std::function
#include <memory> // std::unique_ptr
@@ -99,7 +97,7 @@ public:
template <typename CALLABLE,
typename=typename std::enable_if<
boost::hof::is_invocable<CALLABLE, LLSD>::value
std::is_invocable<CALLABLE, LLSD>::value
>::type>
void add(const std::string& name,
const std::string& desc,
@@ -295,9 +293,8 @@ public:
* converted to the corresponding parameter type using LLSDParam.
*/
template <typename CALLABLE,
typename=typename std::enable_if<
! boost::hof::is_invocable<CALLABLE, LLSD>()
>::type>
typename=typename std::enable_if_t<
! std::is_invocable<CALLABLE, LLSD>()>>
void add(const std::string& name,
const std::string& desc,
CALLABLE&& f)
@@ -318,7 +315,7 @@ public:
*/
template<typename Method, typename InstanceGetter,
typename = typename std::enable_if<
boost::function_types::is_member_function_pointer<Method>::value &&
std::is_member_function_pointer<Method>::value &&
! std::is_convertible<InstanceGetter, LLSD>::value
>::type>
void add(const std::string& name, const std::string& desc, Method f,
@@ -338,7 +335,7 @@ public:
template<typename Function,
typename = typename std::enable_if<
boost::function_types::is_nonmember_callable_builtin<Function>::value &&
! boost::hof::is_invocable<Function, LLSD>::value
! std::is_invocable<Function, LLSD>::value
>::type>
void add(const std::string& name, const std::string& desc, Function f,
const LLSD& params, const LLSD& defaults=LLSD());
@@ -364,7 +361,7 @@ public:
*/
template<typename Method, typename InstanceGetter,
typename = typename std::enable_if<
boost::function_types::is_member_function_pointer<Method>::value &&
std::is_member_function_pointer<Method>::value &&
! std::is_convertible<InstanceGetter, LLSD>::value
>::type>
void add(const std::string& name, const std::string& desc, Method f,
+4 -3
View File
@@ -33,7 +33,8 @@
#include "stdtypes.h"
#include "lltimer.h"
#include "llsdutil.h"
#include <boost/function.hpp>
#include <functional>
class LLEventTimer;
class LLDate;
@@ -92,8 +93,8 @@ public:
/// construct and connect
LLEventTimeoutBase(LLEventPump& source);
/// Callable, can be constructed with boost::bind()
typedef boost::function<void()> Action;
/// Callable, can be constructed with std::bind()
typedef std::function<void()> Action;
/**
* Start countdown timer for the specified number of @a seconds. Forward
-1
View File
@@ -44,7 +44,6 @@
#include <cmath>
#include <cctype>
// external library headers
#include <boost/range/iterator_range.hpp>
#if LL_WINDOWS
#pragma warning (push)
#pragma warning (disable : 4701) // compiler thinks might use uninitialized var, but no
-4
View File
@@ -41,11 +41,7 @@
#include <boost/signals2.hpp>
#include <boost/bind.hpp>
#include <boost/utility.hpp> // noncopyable
#include <boost/optional/optional.hpp>
#include <boost/visit_each.hpp>
#include <boost/ref.hpp> // reference_wrapper
#include <boost/type_traits/is_pointer.hpp>
#include <boost/static_assert.hpp>
#include "llsd.h"
#include "llsingleton.h"
+263 -131
View File
@@ -35,7 +35,6 @@
#if LL_WINDOWS
#include "llwin32headers.h"
#include <stdlib.h> // Windows errno
#include <vector>
#else
#include <errno.h>
@@ -49,6 +48,86 @@ static std::string empty;
// variants of strerror() to report errors.
#if LL_WINDOWS
// For the situations where we directly call into Windows API functions we need to translate
// the Windows error codes into errno values
namespace
{
struct errentry
{
unsigned long oserr; // Windows OS error value
int errcode; // System V error code
};
}
// translation table between Windows OS error value and System V errno code
static errentry const errtable[]
{
{ ERROR_INVALID_FUNCTION, EINVAL }, // 1
{ ERROR_FILE_NOT_FOUND, ENOENT }, // 2
{ ERROR_PATH_NOT_FOUND, ENOENT }, // 3
{ ERROR_TOO_MANY_OPEN_FILES, EMFILE }, // 4
{ ERROR_ACCESS_DENIED, EACCES }, // 5
{ ERROR_INVALID_HANDLE, EBADF }, // 6
{ ERROR_ARENA_TRASHED, ENOMEM }, // 7
{ ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, // 8
{ ERROR_INVALID_BLOCK, ENOMEM }, // 9
{ ERROR_BAD_ENVIRONMENT, E2BIG }, // 10
{ ERROR_BAD_FORMAT, ENOEXEC }, // 11
{ ERROR_INVALID_ACCESS, EINVAL }, // 12
{ ERROR_INVALID_DATA, EINVAL }, // 13
{ ERROR_INVALID_DRIVE, ENOENT }, // 15
{ ERROR_CURRENT_DIRECTORY, EACCES }, // 16
{ ERROR_NOT_SAME_DEVICE, EXDEV }, // 17
{ ERROR_NO_MORE_FILES, ENOENT }, // 18
{ ERROR_LOCK_VIOLATION, EACCES }, // 33
{ ERROR_BAD_NETPATH, ENOENT }, // 53
{ ERROR_NETWORK_ACCESS_DENIED, EACCES }, // 65
{ ERROR_BAD_NET_NAME, ENOENT }, // 67
{ ERROR_FILE_EXISTS, EEXIST }, // 80
{ ERROR_CANNOT_MAKE, EACCES }, // 82
{ ERROR_FAIL_I24, EACCES }, // 83
{ ERROR_INVALID_PARAMETER, EINVAL }, // 87
{ ERROR_NO_PROC_SLOTS, EAGAIN }, // 89
{ ERROR_DRIVE_LOCKED, EACCES }, // 108
{ ERROR_BROKEN_PIPE, EPIPE }, // 109
{ ERROR_DISK_FULL, ENOSPC }, // 112
{ ERROR_INVALID_TARGET_HANDLE, EBADF }, // 114
{ ERROR_WAIT_NO_CHILDREN, ECHILD }, // 128
{ ERROR_CHILD_NOT_COMPLETE, ECHILD }, // 129
{ ERROR_DIRECT_ACCESS_HANDLE, EBADF }, // 130
{ ERROR_NEGATIVE_SEEK, EINVAL }, // 131
{ ERROR_SEEK_ON_DEVICE, EACCES }, // 132
{ ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, // 145
{ ERROR_NOT_LOCKED, EACCES }, // 158
{ ERROR_BAD_PATHNAME, ENOENT }, // 161
{ ERROR_MAX_THRDS_REACHED, EAGAIN }, // 164
{ ERROR_LOCK_FAILED, EACCES }, // 167
{ ERROR_ALREADY_EXISTS, EEXIST }, // 183
{ ERROR_FILENAME_EXCED_RANGE, ENOENT }, // 206
{ ERROR_NESTING_NOT_ALLOWED, EAGAIN }, // 215
{ ERROR_NO_UNICODE_TRANSLATION, EILSEQ }, // 1113
{ ERROR_NOT_ENOUGH_QUOTA, ENOMEM } // 1816
};
static int set_errno_from_oserror(unsigned long oserr)
{
if (!oserr)
return 0;
// Check the table for the Windows OS error code
for (const struct errentry &entry : errtable)
{
if (oserr == entry.oserr)
{
_set_errno(entry.errcode);
return -1;
}
}
_set_errno(EINVAL);
return -1;
}
// On Windows, use strerror_s().
std::string strerr(int errn)
{
@@ -57,7 +136,67 @@ std::string strerr(int errn)
return buffer;
}
typedef std::basic_ios<char,std::char_traits < char > > _Myios;
inline bool is_slash(wchar_t const c)
{
return c == L'\\' || c == L'/';
}
static std::wstring utf8path_to_wstring(const std::string& utf8path)
{
if (utf8path.size() >= MAX_PATH)
{
// By prepending "\\?\" to a path, Windows widechar file APIs will not fail on long path names
std::wstring utf16path = L"\\\\?\\" + ll_convert<std::wstring>(utf8path);
// We need to make sure that the path does not contain forward slashes as above
// prefix does bypass the path normalization that replaces slashes with backslashes
// before passing the path to kernel mode APIs
std::replace(utf16path.begin(), utf16path.end(), L'/', L'\\');
return utf16path;
}
return ll_convert<std::wstring>(utf8path);
}
static unsigned short get_fileattr(const std::wstring& utf16path, bool dontFollowSymLink = false)
{
unsigned long flags = FILE_FLAG_BACKUP_SEMANTICS;
if (dontFollowSymLink)
{
flags |= FILE_FLAG_OPEN_REPARSE_POINT;
}
HANDLE file_handle = CreateFileW(utf16path.c_str(), FILE_READ_ATTRIBUTES,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr, OPEN_EXISTING, flags, nullptr);
if (file_handle != INVALID_HANDLE_VALUE)
{
FILE_ATTRIBUTE_TAG_INFO attribute_info;
if (GetFileInformationByHandleEx(file_handle, FileAttributeTagInfo, &attribute_info, sizeof(attribute_info)))
{
// A volume path alone (only drive letter) is not recognized as directory while it technically is
bool is_directory = (attribute_info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
(iswalpha(utf16path[0]) && utf16path[1] == ':' &&
(!utf16path[2] || (is_slash(utf16path[2]) && !utf16path[3])));
unsigned short st_mode = is_directory ? S_IFDIR :
(attribute_info.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT ? S_IFLNK : S_IFREG);
st_mode |= (attribute_info.FileAttributes & FILE_ATTRIBUTE_READONLY) ? S_IREAD : S_IREAD | S_IWRITE;
// we do not try to guess executable flag
// propagate user bits to group/other fields:
st_mode |= (st_mode & 0700) >> 3;
st_mode |= (st_mode & 0700) >> 6;
CloseHandle(file_handle);
return st_mode;
}
}
// Retrieve last error and set errno before calling CloseHandle()
set_errno_from_oserror(GetLastError());
if (file_handle != INVALID_HANDLE_VALUE)
{
CloseHandle(file_handle);
}
return 0;
}
#else
// On Posix we want to call strerror_r(), but alarmingly, there are two
@@ -108,18 +247,13 @@ std::string strerr(int errn)
}
#endif // ! LL_WINDOWS
// On either system, shorthand call just infers global 'errno'.
std::string strerr()
{
return strerr(errno);
}
int warnif(const std::string& desc, const std::string& filename, int rc, int accept=0)
static int warnif(const std::string& desc, const std::string& filename, int rc, int accept = 0)
{
if (rc < 0)
{
// Capture errno before we start emitting output
int errn = errno;
// For certain operations, a particular errno value might be
// acceptable -- e.g. stat() could permit ENOENT, mkdir() could permit
// EEXIST. Don't warn if caller explicitly says this errno is okay.
@@ -176,62 +310,59 @@ int warnif(const std::string& desc, const std::string& filename, int rc, int acc
// static
int LLFile::mkdir(const std::string& dirname, int perms)
{
#if LL_WINDOWS
// permissions are ignored on Windows
std::wstring utf16dirname = ll_convert<std::wstring>(dirname);
int rc = _wmkdir(utf16dirname.c_str());
#else
int rc = ::mkdir(dirname.c_str(), (mode_t)perms);
#endif
// We often use mkdir() to ensure the existence of a directory that might
// already exist. There is no known case in which we want to call out as
// an error the requested directory already existing.
#if LL_WINDOWS
// permissions are ignored on Windows
int rc = 0;
std::wstring utf16dirname = utf8path_to_wstring(dirname);
if (!CreateDirectoryW(utf16dirname.c_str(), nullptr))
{
// Only treat other errors than an already existing file as a real error
unsigned long oserr = GetLastError();
if (oserr != ERROR_ALREADY_EXISTS)
{
rc = set_errno_from_oserror(oserr);
}
}
#else
int rc = ::mkdir(dirname.c_str(), (mode_t)perms);
if (rc < 0 && errno == EEXIST)
{
// this is not the error you want, move along
return 0;
}
#endif
// anything else might be a problem
return warnif("mkdir", dirname, rc, EEXIST);
return warnif("mkdir", dirname, rc);
}
// static
int LLFile::rmdir(const std::string& dirname)
int LLFile::rmdir(const std::string& dirname, int suppress_error)
{
#if LL_WINDOWS
// permissions are ignored on Windows
std::wstring utf16dirname = ll_convert<std::wstring>(dirname);
std::wstring utf16dirname = utf8path_to_wstring(dirname);
int rc = _wrmdir(utf16dirname.c_str());
#else
int rc = ::rmdir(dirname.c_str());
#endif
return warnif("rmdir", dirname, rc);
return warnif("rmdir", dirname, rc, suppress_error);
}
// static
LLFILE* LLFile::fopen(const std::string& filename, const char* mode) /* Flawfinder: ignore */
LLFILE* LLFile::fopen(const std::string& filename, const char* mode)
{
#if LL_WINDOWS
std::wstring utf16filename = ll_convert<std::wstring>(filename);
std::wstring utf16filename = utf8path_to_wstring(filename);
std::wstring utf16mode = ll_convert<std::wstring>(std::string(mode));
return _wfopen(utf16filename.c_str(),utf16mode.c_str());
return _wfopen(utf16filename.c_str(), utf16mode.c_str());
#else
return ::fopen(filename.c_str(),mode); /* Flawfinder: ignore */
#endif
}
LLFILE* LLFile::_fsopen(const std::string& filename, const char* mode, int sharingFlag)
{
#if LL_WINDOWS
std::wstring utf16filename = ll_convert<std::wstring>(filename);
std::wstring utf16mode = ll_convert<std::wstring>(std::string(mode));
return _wfsopen(utf16filename.c_str(),utf16mode.c_str(),sharingFlag);
#else
llassert(0);//No corresponding function on non-windows
return NULL;
return ::fopen(filename.c_str(),mode);
#endif
}
// static
int LLFile::close(LLFILE * file)
{
int ret_value = 0;
@@ -242,9 +373,10 @@ int LLFile::close(LLFILE * file)
return ret_value;
}
// static
std::string LLFile::getContents(const std::string& filename)
{
LLFILE* fp = fopen(filename, "rb"); /* Flawfinder: ignore */
LLFILE* fp = LLFile::fopen(filename, "rb");
if (fp)
{
fseek(fp, 0, SEEK_END);
@@ -261,42 +393,80 @@ std::string LLFile::getContents(const std::string& filename)
return LLStringUtil::null;
}
int LLFile::remove(const std::string& filename, int supress_error)
// static
int LLFile::remove(const std::string& filename, int suppress_error)
{
#if LL_WINDOWS
std::wstring utf16filename = ll_convert<std::wstring>(filename);
int rc = _wremove(utf16filename.c_str());
// Posix remove() works on both files and directories although on Windows
// remove() and its wide char variant _wremove() only removes files just
// as its siblings unlink() and _wunlink().
// If we really only want to support files we should instead use
// unlink() in the non-Windows part below too
int rc = -1;
std::wstring utf16filename = utf8path_to_wstring(filename);
unsigned short st_mode = get_fileattr(utf16filename);
if (S_ISDIR(st_mode))
{
rc = _wrmdir(utf16filename.c_str());
}
else if (S_ISREG(st_mode))
{
rc = _wunlink(utf16filename.c_str());
}
else if (st_mode)
{
// it is something else than a file or directory
// this should not really happen as long as we do not allow for symlink
// detection in the optional parameter to get_fileattr()
rc = set_errno_from_oserror(ERROR_INVALID_PARAMETER);
}
else
{
// get_fileattr() failed and already set errno, preserve it for correct error reporting
}
#else
int rc = ::remove(filename.c_str());
#endif
return warnif("remove", filename, rc, supress_error);
return warnif("remove", filename, rc, suppress_error);
}
int LLFile::rename(const std::string& filename, const std::string& newname, int supress_error)
// static
int LLFile::rename(const std::string& filename, const std::string& newname, int suppress_error)
{
#if LL_WINDOWS
std::wstring utf16filename = ll_convert<std::wstring>(filename);
std::wstring utf16newname = ll_convert<std::wstring>(newname);
int rc = _wrename(utf16filename.c_str(),utf16newname.c_str());
// Posix rename() will gladly overwrite a file at newname if it exists, the Windows
// rename(), respectively _wrename(), will bark on that. Instead call directly the Windows
// API MoveFileEx() and use its flags to specify that overwrite is allowed.
std::wstring utf16filename = utf8path_to_wstring(filename);
std::wstring utf16newname = utf8path_to_wstring(newname);
int rc = 0;
if (!MoveFileExW(utf16filename.c_str(), utf16newname.c_str(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED))
{
rc = set_errno_from_oserror(GetLastError());
}
#else
int rc = ::rename(filename.c_str(),newname.c_str());
#endif
return warnif(STRINGIZE("rename to '" << newname << "' from"), filename, rc, supress_error);
return warnif(STRINGIZE("rename to '" << newname << "' from"), filename, rc, suppress_error);
}
// Make this a define rather than using magic numbers multiple times in the code
#define LLFILE_COPY_BUFFER_SIZE 16384
// static
bool LLFile::copy(const std::string& from, const std::string& to)
{
bool copied = false;
LLFILE* in = LLFile::fopen(from, "rb"); /* Flawfinder: ignore */
LLFILE* in = LLFile::fopen(from, "rb");
if (in)
{
LLFILE* out = LLFile::fopen(to, "wb"); /* Flawfinder: ignore */
LLFILE* out = LLFile::fopen(to, "wb");
if (out)
{
char buf[16384]; /* Flawfinder: ignore */
char buf[LLFILE_COPY_BUFFER_SIZE];
size_t readbytes;
bool write_ok = true;
while(write_ok && (readbytes = fread(buf, 1, 16384, in))) /* Flawfinder: ignore */
while (write_ok && (readbytes = fread(buf, 1, LLFILE_COPY_BUFFER_SIZE, in)))
{
if (fwrite(buf, 1, readbytes, out) != readbytes)
{
@@ -315,33 +485,62 @@ bool LLFile::copy(const std::string& from, const std::string& to)
return copied;
}
int LLFile::stat(const std::string& filename, llstat* filestatus)
// static
int LLFile::stat(const std::string& filename, llstat* filestatus, int suppress_error)
{
#if LL_WINDOWS
std::wstring utf16filename = ll_convert<std::wstring>(filename);
int rc = _wstat(utf16filename.c_str(),filestatus);
std::wstring utf16filename = utf8path_to_wstring(filename);
int rc = _wstat64(utf16filename.c_str(), filestatus);
#else
int rc = ::stat(filename.c_str(),filestatus);
int rc = ::stat(filename.c_str(), filestatus);
#endif
// We use stat() to determine existence (see isfile(), isdir()).
// Don't spam the log if the subject pathname doesn't exist.
return warnif("stat", filename, rc, ENOENT);
return warnif("stat", filename, rc, suppress_error);
}
// static
unsigned short LLFile::getattr(const std::string& filename, bool dontFollowSymLink, int suppress_error)
{
#if LL_WINDOWS
// _wstat64() is a bit heavyweight on Windows, use a more lightweight API
// to just get the attributes
int rc = -1;
std::wstring utf16filename = utf8path_to_wstring(filename);
unsigned short st_mode = get_fileattr(utf16filename, dontFollowSymLink);
if (st_mode)
{
return st_mode;
}
#else
llstat filestatus;
int rc = dontFollowSymLink ? ::lstat(filename.c_str(), &filestatus) : ::stat(filename.c_str(), &filestatus);
if (rc == 0)
{
return filestatus.st_mode;
}
#endif
warnif("getattr", filename, rc, suppress_error);
return 0;
}
// static
bool LLFile::isdir(const std::string& filename)
{
llstat st;
return stat(filename, &st) == 0 && S_ISDIR(st.st_mode);
return S_ISDIR(getattr(filename));
}
// static
bool LLFile::isfile(const std::string& filename)
{
llstat st;
return stat(filename, &st) == 0 && S_ISREG(st.st_mode);
return S_ISREG(getattr(filename));
}
// static
bool LLFile::islink(const std::string& filename)
{
return S_ISLNK(getattr(filename, true));
}
// static
const char *LLFile::tmpdir()
{
static std::string utf8path;
@@ -368,75 +567,8 @@ const char *LLFile::tmpdir()
return utf8path.c_str();
}
/***************** Modified file stream created to overcome the incorrect behaviour of posix fopen in windows *******************/
#if LL_WINDOWS
LLFILE * LLFile::_Fiopen(const std::string& filename,
std::ios::openmode mode)
{ // open a file
static const char *mods[] =
{ // fopen mode strings corresponding to valid[i]
"r", "w", "w", "a", "rb", "wb", "wb", "ab",
"r+", "w+", "a+", "r+b", "w+b", "a+b",
0};
static const int valid[] =
{ // valid combinations of open flags
ios_base::in,
ios_base::out,
ios_base::out | ios_base::trunc,
ios_base::out | ios_base::app,
ios_base::in | ios_base::binary,
ios_base::out | ios_base::binary,
ios_base::out | ios_base::trunc | ios_base::binary,
ios_base::out | ios_base::app | ios_base::binary,
ios_base::in | ios_base::out,
ios_base::in | ios_base::out | ios_base::trunc,
ios_base::in | ios_base::out | ios_base::app,
ios_base::in | ios_base::out | ios_base::binary,
ios_base::in | ios_base::out | ios_base::trunc
| ios_base::binary,
ios_base::in | ios_base::out | ios_base::app
| ios_base::binary,
0};
LLFILE *fp = 0;
int n;
ios_base::openmode atendflag = mode & ios_base::ate;
ios_base::openmode norepflag = mode & ios_base::_Noreplace;
if (mode & ios_base::_Nocreate)
mode |= ios_base::in; // file must exist
mode &= ~(ios_base::ate | ios_base::_Nocreate | ios_base::_Noreplace);
for (n = 0; valid[n] != 0 && valid[n] != mode; ++n)
; // look for a valid mode
if (valid[n] == 0)
return (0); // no valid mode
else if (norepflag && mode & (ios_base::out | ios_base::app)
&& (fp = LLFile::fopen(filename, "r")) != 0) /* Flawfinder: ignore */
{ // file must not exist, close and fail
fclose(fp);
return (0);
}
else if (fp != 0 && fclose(fp) != 0)
return (0); // can't close after test open
// should open with protection here, if other than default
else if ((fp = LLFile::fopen(filename, mods[n])) == 0) /* Flawfinder: ignore */
return (0); // open failed
if (!atendflag || fseek(fp, 0, SEEK_END) == 0)
return (fp); // no need to seek to end, or seek succeeded
fclose(fp); // can't position at end
return (0);
}
#endif /* LL_WINDOWS */
#if LL_WINDOWS
/************** input file stream ********************************/
llifstream::llifstream() {}
+92 -16
View File
@@ -41,8 +41,9 @@ typedef FILE LLFILE;
#include <sys/stat.h>
#if LL_WINDOWS
// windows version of stat function and stat data structure are called _stat
typedef struct _stat llstat;
// The Windows version of stat function and stat data structure are called _stat64
// We use _stat64 here to support 64-bit st_size and time_t values
typedef struct _stat64 llstat;
#else
typedef struct stat llstat;
#include <sys/types.h>
@@ -56,35 +57,110 @@ typedef struct stat llstat;
# define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
#endif
// Windows C runtime library does not define this and does not support symlink detection in the
// stat functions but we do in our getattr() function
#ifndef S_IFLNK
#define S_IFLNK 0xA000 /* symlink */
#endif
#ifndef S_ISLNK
#define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK)
#endif
#include "llstring.h" // safe char* -> std::string conversion
/// LLFile is a class of static functions operating on paths
/// All the functions with a path string input take UTF8 path/filenames
class LL_COMMON_API LLFile
{
public:
// All these functions take UTF8 path/filenames.
static LLFILE* fopen(const std::string& filename,const char* accessmode); /* Flawfinder: ignore */
static LLFILE* _fsopen(const std::string& filename,const char* accessmode,int sharingFlag);
/// open a file with the specified access mode
static LLFILE* fopen(const std::string& filename, const char* accessmode); /* Flawfinder: ignore */
///< 'accessmode' follows the rules of the Posix fopen() mode parameter
/// "r" open the file for reading only and positions the stream at the beginning
/// "r+" open the file for reading and writing and positions the stream at the beginning
/// "w" open the file for reading and writing and truncate it to zero length
/// "w+" open or create the file for reading and writing and truncate to zero length if it existed
/// "a" open the file for reading and writing and position the stream at the end of the file
/// "a+" open or create the file for reading and writing and position the stream at the end of the file
///
/// in addition to these values, "b" can be appended to indicate binary stream access, but on Linux and Mac
/// this is strictly for compatibility and has no effect. On Windows this makes the file functions not
/// try to translate line endings. Windows also allows to append "t" to indicate text mode. If neither
/// "b" or "t" is defined, Windows uses the value set by _fmode which by default is _O_TEXT.
/// This means that it is always a good idea to append "b" specifically for binary file access to
/// avoid corruption of the binary consistency of the data stream when reading or writing
/// Other characters in 'accessmode' will usually cause an error as fopen will verify this parameter
/// @returns a valid LLFILE* pointer on success or NULL on failure
static int close(LLFILE * file);
/// retrieve the content of a file into a string
static std::string getContents(const std::string& filename);
///< @returns the content of the file or an empty string on failure
// perms is a permissions mask like 0777 or 0700. In most cases it will
// be overridden by the user's umask. It is ignored on Windows.
// mkdir() considers "directory already exists" to be SUCCESS.
/// create a directory
static int mkdir(const std::string& filename, int perms = 0700);
///< perms is a permissions mask like 0777 or 0700. In most cases it will be
/// overridden by the user's umask. It is ignored on Windows.
/// mkdir() considers "directory already exists" to be not an error.
/// @returns 0 on success and -1 on failure.
static int rmdir(const std::string& filename);
static int remove(const std::string& filename, int supress_error = 0);
static int rename(const std::string& filename,const std::string& newname, int supress_error = 0);
//// remove a directory
static int rmdir(const std::string& filename, int suppress_error = 0);
///< pass ENOENT in the optional 'suppress_error' parameter
/// if you don't want a warning in the log when the directory does not exist
/// @returns 0 on success and -1 on failure.
/// remove a file or directory
static int remove(const std::string& filename, int suppress_error = 0);
///< pass ENOENT in the optional 'suppress_error' parameter
/// if you don't want a warning in the log when the directory does not exist
/// @returns 0 on success and -1 on failure.
/// rename a file
static int rename(const std::string& filename, const std::string& newname, int suppress_error = 0);
///< it will silently overwrite newname if it exists without returning an error
/// Posix guarantees that if newname already exists, then there will be no moment
/// in which for other processes newname does not exist. There is no such guarantee
/// under Windows at this time. It may do it in the same way but the used Windows API
/// does not make such guarantees.
/// @returns 0 on success and -1 on failure.
/// copy the contents of file from 'from' to 'to' filename
static bool copy(const std::string& from, const std::string& to);
///< @returns true on success and false on failure.
static int stat(const std::string& filename,llstat* file_status);
static bool isdir(const std::string& filename);
static bool isfile(const std::string& filename);
static LLFILE * _Fiopen(const std::string& filename,
std::ios::openmode mode);
/// return the file stat structure for filename
static int stat(const std::string& filename, llstat* file_status, int suppress_error = ENOENT);
///< for compatibility with existing uses of LL_File::stat() we use ENOENT as default in the
/// optional 'suppress_error' parameter to avoid spamming the log with warnings when the API
/// is used to detect if a file exists
/// @returns 0 on success and -1 on failure.
/// get the file or directory attributes for filename
static unsigned short getattr(const std::string& filename, bool dontFollowSymLink = false, int suppress_error = ENOENT);
///< a more lightweight function on Windows to stat, that just returns the file attribute flags
/// dontFollowSymLinks set to true returns the attributes of the symlink if it is one, rather than resolving it
/// we pass by default ENOENT in the optional 'suppress_error' parameter to not spam the log with
/// warnings when the file or directory does not exist
/// @returns 0 on failure and a st_mode value with either S_IFDIR or S_IFREG set otherwise
/// together with the three access bits which under Windows only the write bit is relevant.
/// check if filename is an existing directory
static bool isdir(const std::string& filename);
///< @returns true if the path is for an existing directory
/// check if filename is an existing file
static bool isfile(const std::string& filename);
///< @returns true if the path is for an existing file
/// check if filename is a symlink
static bool islink(const std::string& filename);
///< @returns true if the path is pointing at a symlink
/// return a path to the temporary directory on the system
static const char * tmpdir();
};
+2 -4
View File
@@ -31,8 +31,6 @@
#include "llrefcount.h"
#include "llexception.h"
#include <stdexcept>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/throw_exception.hpp>
/**
@@ -90,7 +88,7 @@ public:
LLHandle() : mTombStone(getDefaultTombStone()) {}
template<typename U>
LLHandle(const LLHandle<U>& other, typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0)
LLHandle(const LLHandle<U>& other, typename std::enable_if_t<std::is_convertible_v<U*, T*>>* dummy = 0)
: mTombStone(other.mTombStone)
{}
@@ -199,7 +197,7 @@ public:
}
template <typename U>
LLHandle<U> getDerivedHandle(typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0) const
LLHandle<U> getDerivedHandle(typename std::enable_if_t<std::is_convertible_v<U*, T*> >* dummy = 0) const
{
LLHandle<U> downcast_handle;
downcast_handle.mTombStone = getHandle().mTombStone;
+2 -2
View File
@@ -37,7 +37,7 @@
#define LL_LLINITDESTROYCLASS_H
#include "llsingleton.h"
#include <boost/function.hpp>
#include <functional>
#include <typeinfo>
#include <vector>
#include <utility> // std::pair
@@ -50,7 +50,7 @@
class LLCallbackRegistry
{
public:
typedef boost::function<void()> func_t;
typedef std::function<void()> func_t;
void registerCallback(const std::string& name, const func_t& func)
{
+28 -7
View File
@@ -28,11 +28,12 @@
#ifndef LL_LLPARAM_H
#define LL_LLPARAM_H
#include <functional>
#include <type_traits>
#include <vector>
#include <list>
#include <unordered_map>
#include <boost/function.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <boost/unordered_map.hpp>
#include "llerror.h"
@@ -105,6 +106,26 @@ namespace LLTypeTags
};
}
namespace ll
{
// Primary template: general case is false
template<typename T>
struct is_std_function : std::false_type
{
};
// Specialization for std::function
// R is the return type, Args is a parameter pack for argument types
template<typename R, typename... Args>
struct is_std_function<std::function<R(Args...)>> : std::true_type
{
};
// Helper variable template for convenience (C++14 onwards)
template<typename T>
constexpr bool is_std_function_v = is_std_function<T>::value;
}
namespace LLInitParam
{
// used to indicate no matching value to a given name when parsing
@@ -114,7 +135,7 @@ namespace LLInitParam
// wraps comparison operator between any 2 values of the same type
// specialize to handle cases where equality isn't defined well, or at all
template <typename T, bool IS_BOOST_FUNCTION = boost::is_convertible<T, boost::function_base>::value >
template <typename T, bool IS_BOOST_FUNCTION = std::is_constructible_v<T, boost::function_base> || ll::is_std_function_v<T>>
struct ParamCompare
{
static bool equals(const T &a, const T &b)
@@ -123,7 +144,7 @@ namespace LLInitParam
}
};
// boost function types are not comparable
// boost and std function types are not comparable
template<typename T>
struct ParamCompare<T, true>
{
@@ -474,7 +495,7 @@ namespace LLInitParam
typedef bool (*parser_read_func_t)(Parser& parser, void* output);
typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&);
typedef boost::function<void (name_stack_t&, S32, S32, const possible_values_t*)> parser_inspect_func_t;
typedef std::function<void (name_stack_t&, S32, S32, const possible_values_t*)> parser_inspect_func_t;
typedef std::map<const std::type_info*, parser_read_func_t> parser_read_func_map_t;
typedef std::map<const std::type_info*, parser_write_func_t> parser_write_func_map_t;
@@ -491,7 +512,7 @@ namespace LLInitParam
virtual ~Parser();
template <typename T> bool readValue(T& param, typename boost::disable_if<boost::is_enum<T> >::type* dummy = 0)
template <typename T> bool readValue(T& param, typename std::enable_if_t<!std::is_enum_v<T>>* dummy = 0)
{
parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T));
if (found_it != mParserReadFuncs->end())
@@ -502,7 +523,7 @@ namespace LLInitParam
return false;
}
template <typename T> bool readValue(T& param, typename boost::enable_if<boost::is_enum<T> >::type* dummy = 0)
template <typename T> bool readValue(T& param, typename std::enable_if_t<std::is_enum_v<T> >* dummy = 0)
{
parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T));
if (found_it != mParserReadFuncs->end())
+12 -1
View File
@@ -61,7 +61,7 @@ public:
// Pass it a callback to our connect() method, so it can send events
// from a particular LLEventPump to the plugin without having to know
// this class or method name.
mListener(new LLLeapListener(
mListener(std::make_unique<LLLeapListener>(
[this](LLEventPump& pump, const std::string& listener)
{ return connect(pump, listener); }))
{
@@ -188,6 +188,17 @@ public:
<< childout.peek(0, peeklen) << "..." << LL_ENDL;
}
// Handle any remaining stderr data (partial lines) the same way as we do
// for stdout: log it.
LLProcess::ReadPipe& childerr(mChild->getReadPipe(LLProcess::STDERR));
if (childerr.size())
{
LLProcess::ReadPipe::size_type
peeklen((std::min)(LLProcess::ReadPipe::size_type(50), childerr.size()));
LL_WARNS("LLLeap") << "Final stderr " << childerr.size() << " bytes: "
<< childerr.peek(0, peeklen) << "..." << LL_ENDL;
}
// Kill this instance. MUST BE LAST before return!
delete this;
return false;
+2 -3
View File
@@ -13,10 +13,9 @@
#define LL_LLLEAPLISTENER_H
#include "lleventapi.h"
#include <functional>
#include <map>
#include <string>
#include <boost/function.hpp>
#include <boost/ptr_container/ptr_map.hpp>
/// Listener class implementing LLLeap query/control operations.
/// See https://jira.lindenlab.com/jira/browse/DEV-31978.
@@ -31,7 +30,7 @@ public:
* define the signature for a function that will perform that, and make
* our constructor accept such a function.
*/
typedef boost::function<LLBoundListener(LLEventPump&, const std::string& listener)>
typedef std::function<LLBoundListener(LLEventPump&, const std::string& listener)>
ConnectFunc;
LLLeapListener(const ConnectFunc& connect);
~LLLeapListener();
+7 -2
View File
@@ -29,7 +29,6 @@
#include "stdtypes.h"
#include "llthread.h"
#include <boost/noncopyable.hpp>
#include "mutex.h"
#include <shared_mutex>
@@ -249,7 +248,7 @@ private:
* The constructor handles the lock, and the destructor handles
* the unlock. Instances of this class are <b>not</b> thread safe.
*/
class LL_COMMON_API LLScopedLock : private boost::noncopyable
class LL_COMMON_API LLScopedLock
{
public:
/**
@@ -265,6 +264,12 @@ public:
*/
~LLScopedLock();
/*
* @brief Non-copyable constructor and operator
*/
LLScopedLock(const LLScopedLock&) = delete;
LLScopedLock& operator=(const LLScopedLock&) = delete;
/**
* @brief Check lock.
*/
+8 -4
View File
@@ -36,13 +36,13 @@
#define LL_LLPOUNCEABLE_H
#include "llsingleton.h"
#include <boost/noncopyable.hpp>
#include <boost/call_traits.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/utility/value_init.hpp>
#include <boost/unordered_map.hpp>
#include <boost/signals2/signal.hpp>
#include <type_traits>
// Forward declare the user template, since we want to be able to point to it
// in some of its implementation classes.
template <typename T, class TAG>
@@ -139,7 +139,7 @@ private:
// LLPounceable<T> is for an LLPounceable instance on the heap or the stack.
// LLPounceable<T, LLPounceableStatic> is for a static LLPounceable instance.
template <typename T, class TAG=LLPounceableQueue>
class LLPounceable: public boost::noncopyable
class LLPounceable
{
private:
typedef LLPounceableTraits<T, TAG> traits;
@@ -158,9 +158,13 @@ public:
mEmpty(empty)
{}
// Non-copyable
LLPounceable(const LLPounceable&) = delete;
LLPounceable& operator=(const LLPounceable&) = delete;
// make read access to mHeld as cheap and transparent as possible
operator T () const { return mHeld; }
typename boost::remove_pointer<T>::type operator*() const { return *mHeld; }
typename std::remove_pointer<T>::type operator*() const { return *mHeld; }
typename boost::call_traits<T>::value_type operator->() const { return mHeld; }
// uncomment 'explicit' as soon as we allow C++11 compilation
/*explicit*/ operator bool() const { return bool(mHeld); }
+8 -16
View File
@@ -457,7 +457,8 @@ public:
("slot", LLSD::Integer(mIndex))
("name", whichfile(mIndex))
("desc", mDesc)
("eof", state == CLOSED));
("eof", state == CLOSED)
("exhst", state == EXHAUSTED));
}
return false;
@@ -528,18 +529,9 @@ LLProcess::LLProcess(const LLSDOrParams& params):
// preserve existing semantics, we promise that mAttached defaults to the
// same setting as mAutokill.
mAttached(params.attached.isProvided()? params.attached : params.autokill),
mPool(NULL),
mPipes(NSLOTS)
mPool(NULL)
{
// Hmm, when you construct a ptr_vector with a size, it merely reserves
// space, it doesn't actually make it that big. Explicitly make it bigger.
// Because of ptr_vector's odd semantics, have to push_back(0) the right
// number of times! resize() wants to default-construct new BasePipe
// instances, which fails because it's pure virtual. But because of the
// constructor call, these push_back() calls should require no new
// allocation.
for (size_t i = 0; i < mPipes.capacity(); ++i)
mPipes.push_back(0);
mPipes.resize(NSLOTS);
if (! params.validateBlock(true))
{
@@ -751,11 +743,11 @@ LLProcess::LLProcess(const LLSDOrParams& params):
apr_file_t* pipe(mProcess.*(members[i]));
if (i == STDIN)
{
mPipes.replace(i, new WritePipeImpl(desc, pipe));
mPipes[i] = std::make_unique<WritePipeImpl>(desc, pipe);
}
else
{
mPipes.replace(i, new ReadPipeImpl(desc, pipe, FILESLOT(i)));
mPipes[i] = std::make_unique<ReadPipeImpl>(desc, pipe, FILESLOT(i));
}
// Removed temporaily for Xcode 7 build tests: error was:
// "error: expression with side effects will be evaluated despite
@@ -1063,14 +1055,14 @@ PIPETYPE* LLProcess::getPipePtr(std::string& error, FILESLOT slot)
error = STRINGIZE(mDesc << " has no slot " << slot);
return NULL;
}
if (mPipes.is_null(slot))
if (!mPipes[slot])
{
error = STRINGIZE(mDesc << ' ' << whichfile(slot) << " not a monitored pipe");
return NULL;
}
// Make sure we dynamic_cast in pointer domain so we can test, rather than
// accepting runtime's exception.
PIPETYPE* ppipe = dynamic_cast<PIPETYPE*>(&mPipes[slot]);
PIPETYPE* ppipe = dynamic_cast<PIPETYPE*>(mPipes[slot].get());
if (! ppipe)
{
error = STRINGIZE(mDesc << ' ' << whichfile(slot) << " not a " << typeid(PIPETYPE).name());
+6 -4
View File
@@ -31,9 +31,7 @@
#include "llsdparam.h"
#include "llexception.h"
#include "apr_thread_proc.h"
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/optional.hpp>
#include <boost/noncopyable.hpp>
#include <iosfwd> // std::ostream
#if LL_WINDOWS
@@ -67,7 +65,7 @@ typedef std::shared_ptr<LLProcess> LLProcessPtr;
* indra/llcommon/tests/llprocess_test.cpp for an example of waiting for
* child-process termination in a standalone test context.
*/
class LL_COMMON_API LLProcess: public boost::noncopyable
class LL_COMMON_API LLProcess
{
LOG_CLASS(LLProcess);
public:
@@ -542,6 +540,10 @@ public:
static std::string basename(const std::string& path);
static std::string getline(std::istream&);
// Non-copyable
LLProcess(const LLProcess&) = delete;
LLProcess& operator=(const LLProcess&) = delete;
private:
/// constructor is private: use create() instead
LLProcess(const LLSDOrParams& params);
@@ -564,7 +566,7 @@ private:
bool mAutokill, mAttached;
Status mStatus;
// explicitly want this ptr_vector to be able to store NULLs
typedef boost::ptr_vector< boost::nullable<BasePipe> > PipeVector;
typedef std::vector<std::unique_ptr<BasePipe>> PipeVector;
PipeVector mPipes;
apr_pool_t* mPool;
};
+1 -26
View File
@@ -739,32 +739,7 @@ private:
}
}
// *NOTE:Mani - I didn't find any docs that assure me that machdep.cpu.feature_bits will always be
// The feature bits I think it is. Here's a test:
#ifndef LL_RELEASE_FOR_DOWNLOAD
#if defined(__i386__) && defined(__PIC__)
/* %ebx may be the PIC register. */
#define __cpuid(level, a, b, c, d) \
__asm__ ("xchgl\t%%ebx, %1\n\t" \
"cpuid\n\t" \
"xchgl\t%%ebx, %1\n\t" \
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
: "0" (level))
#else
#define __cpuid(level, a, b, c, d) \
__asm__ ("cpuid\n\t" \
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
: "0" (level))
#endif
unsigned int eax, ebx, ecx, edx;
__cpuid(0x1, eax, ebx, ecx, edx);
if(feature_infos[0] != (S32)edx)
{
LL_WARNS() << "machdep.cpu.feature_bits doesn't match expected cpuid result!" << LL_ENDL;
}
#endif // LL_RELEASE_FOR_DOWNLOAD
// @TODO: Audit our usage of machdep.cpu.feature_bits.
uint64_t ext_feature_info = getSysctlInt64("machdep.cpu.extfeature_bits");
S32 *ext_feature_infos = (S32*)(&ext_feature_info);
+4 -4
View File
@@ -51,10 +51,10 @@ public:
typedef U64 time_type; /// Relative microseconds
private:
LLProcInfo(); // Not defined
~LLProcInfo(); // Not defined
LLProcInfo(const LLProcInfo &); // Not defined
void operator=(const LLProcInfo &); // Not defined
LLProcInfo() = delete;
~LLProcInfo() = delete;
LLProcInfo(const LLProcInfo&) = delete;
LLProcInfo& operator=(const LLProcInfo&) = delete;
public:
/// Get accumulated system and user CPU time in
+19 -20
View File
@@ -31,10 +31,9 @@
// associated header
#include "llptrto.h"
// STL headers
#include <type_traits>
// std headers
// external library headers
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
// other Linden headers
#include "llmemory.h"
@@ -76,27 +75,27 @@ public:
int main(int argc, char *argv[])
{
// test LLPtrTo<>
BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<RCFoo>::type, LLPointer<RCFoo> >::value));
BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<RCSubFoo>::type, LLPointer<RCSubFoo> >::value));
BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<TSRCFoo>::type, LLPointer<TSRCFoo> >::value));
BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<Bar>::type, Bar*>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<SubBar>::type, SubBar*>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<int>::type, int*>::value));
static_assert((std::is_same_v<LLPtrTo<RCFoo>::type, LLPointer<RCFoo> >));
static_assert((std::is_same_v<LLPtrTo<RCSubFoo>::type, LLPointer<RCSubFoo> >));
static_assert((std::is_same_v<LLPtrTo<TSRCFoo>::type, LLPointer<TSRCFoo> >));
static_assert((std::is_same_v<LLPtrTo<Bar>::type, Bar*>));
static_assert((std::is_same_v<LLPtrTo<SubBar>::type, SubBar*>));
static_assert((std::is_same_v<LLPtrTo<int>::type, int*>));
// Test LLRemovePointer<>. Note that we remove both pointer variants from
// each kind of type, regardless of whether the variant makes sense.
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<RCFoo*>::type, RCFoo>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<RCFoo> >::type, RCFoo>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<RCSubFoo*>::type, RCSubFoo>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<RCSubFoo> >::type, RCSubFoo>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<TSRCFoo*>::type, TSRCFoo>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<TSRCFoo> >::type, TSRCFoo>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<Bar*>::type, Bar>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<Bar> >::type, Bar>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<SubBar*>::type, SubBar>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<SubBar> >::type, SubBar>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<int*>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<int> >::type, int>::value));
static_assert((std::is_same_v<LLRemovePointer<RCFoo*>::type, RCFoo>));
static_assert((std::is_same_v<LLRemovePointer< LLPointer<RCFoo> >::type, RCFoo>));
static_assert((std::is_same_v<LLRemovePointer<RCSubFoo*>::type, RCSubFoo>));
static_assert((std::is_same_v<LLRemovePointer< LLPointer<RCSubFoo> >::type, RCSubFoo>));
static_assert((std::is_same_v<LLRemovePointer<TSRCFoo*>::type, TSRCFoo>));
static_assert((std::is_same_v<LLRemovePointer< LLPointer<TSRCFoo> >::type, TSRCFoo>));
static_assert((std::is_same_v<LLRemovePointer<Bar*>::type, Bar>));
static_assert((std::is_same_v<LLRemovePointer< LLPointer<Bar> >::type, Bar>));
static_assert((std::is_same_v<LLRemovePointer<SubBar*>::type, SubBar>));
static_assert((std::is_same_v<LLRemovePointer< LLPointer<SubBar> >::type, SubBar>));
static_assert((std::is_same_v<LLRemovePointer<int*>::type, int>));
static_assert((std::is_same_v<LLRemovePointer< LLPointer<int> >::type, int>));
return 0;
}
+3 -5
View File
@@ -35,8 +35,6 @@
#include "llrefcount.h" // LLRefCount
#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <memory> // std::shared_ptr, std::unique_ptr
#include <type_traits>
@@ -58,14 +56,14 @@ struct LLPtrTo
/// specialize for subclasses of LLRefCount
template <class T>
struct LLPtrTo<T, typename std::enable_if< boost::is_base_of<LLRefCount, T>::value >::type>
struct LLPtrTo<T, typename std::enable_if< std::is_base_of<LLRefCount, T>::value >::type>
{
typedef LLPointer<T> type;
};
/// specialize for subclasses of LLThreadSafeRefCount
template <class T>
struct LLPtrTo<T, typename std::enable_if< boost::is_base_of<LLThreadSafeRefCount, T>::value >::type>
struct LLPtrTo<T, typename std::enable_if< std::is_base_of<LLThreadSafeRefCount, T>::value >::type>
{
typedef LLPointer<T> type;
};
@@ -76,7 +74,7 @@ struct LLPtrTo<T, typename std::enable_if< boost::is_base_of<LLThreadSafeRefCoun
template <typename PTRTYPE>
struct LLRemovePointer
{
typedef typename boost::remove_pointer<PTRTYPE>::type type;
typedef typename std::remove_pointer<PTRTYPE>::type type;
};
/// specialize for LLPointer<SOMECLASS>
+27 -7
View File
@@ -80,7 +80,7 @@ void LLQueuedThread::shutdown()
mRequestQueue.close();
}
S32 timeout = 100;
S32 timeout = 50;
for ( ; timeout>0; timeout--)
{
if (isStopped())
@@ -101,19 +101,34 @@ void LLQueuedThread::shutdown()
}
QueuedRequest* req;
S32 active_count = 0;
S32 queued_count = 0;
bool has_active = false;
lockData();
while ( (req = (QueuedRequest*)mRequestHash.pop_element()) )
{
if (req->getStatus() == STATUS_QUEUED || req->getStatus() == STATUS_INPROGRESS)
if (req->getStatus() == STATUS_INPROGRESS)
{
++active_count;
has_active = true;
req->setFlags(FLAG_ABORT | FLAG_AUTO_COMPLETE);
continue;
}
if (req->getStatus() == STATUS_QUEUED)
{
++queued_count;
req->setStatus(STATUS_ABORTED); // avoid assert in deleteRequest
}
req->deleteRequest();
}
if (active_count)
unlockData();
if (queued_count)
{
LL_WARNS() << "~LLQueuedThread() called with active requests: " << active_count << LL_ENDL;
LL_WARNS() << "~LLQueuedThread() called with unpocessed requests: " << queued_count << LL_ENDL;
}
if (has_active)
{
LL_WARNS() << "~LLQueuedThread() called with active requests!" << LL_ENDL;
ms_sleep(100); // last chance for request to finish
printQueueStats();
}
mRequestQueue.close();
@@ -570,7 +585,12 @@ LLQueuedThread::QueuedRequest::QueuedRequest(LLQueuedThread::handle_t handle, U3
LLQueuedThread::QueuedRequest::~QueuedRequest()
{
llassert_always(mStatus == STATUS_DELETE);
if (mStatus != STATUS_DELETE)
{
// The only method to delete a request is deleteRequest(),
// it should have set the status to STATUS_DELETE
LL_ERRS() << "LLQueuedThread::QueuedRequest deleted with status " << mStatus << LL_ENDL;
}
}
//virtual
+3 -3
View File
@@ -117,11 +117,11 @@ public:
virtual ~LLQueuedThread();
virtual void shutdown();
private:
// No copy constructor or copy assignment
LLQueuedThread(const LLQueuedThread&);
LLQueuedThread& operator=(const LLQueuedThread&);
LLQueuedThread(const LLQueuedThread&) = delete;
LLQueuedThread& operator=(const LLQueuedThread&) = delete;
private:
virtual bool runCondition(void);
virtual void run(void);
virtual void startThread(void);
-1
View File
@@ -26,7 +26,6 @@
#ifndef LLREFCOUNT_H
#define LLREFCOUNT_H
#include <boost/noncopyable.hpp>
#include <boost/intrusive_ptr.hpp>
#include "llatomic.h"
+4 -7
View File
@@ -30,7 +30,6 @@
// Project includes
#include "llsdparam.h"
#include "llsdutil.h"
#include "boost/bind.hpp"
static LLInitParam::Parser::parser_read_func_map_t sReadFuncs;
static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs;
@@ -43,8 +42,6 @@ static const LLSD NO_VALUE_MARKER;
LLParamSDParser::LLParamSDParser()
: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs)
{
using boost::bind;
if (sReadFuncs.empty())
{
registerParserFuncs<LLInitParam::Flag>(readFlag, &LLParamSDParser::writeFlag);
@@ -97,7 +94,7 @@ void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool
mNameStack.clear();
setParseSilently(silent);
LLParamSDParserUtilities::readSDValues(boost::bind(&LLParamSDParser::submit, this, boost::ref(block), _1, _2), sd, mNameStack);
LLParamSDParserUtilities::readSDValues(std::bind(&LLParamSDParser::submit, this, std::ref(block), std::placeholders::_1, std::placeholders::_2), sd, mNameStack);
//readSDValues(sd, block);
}
@@ -276,14 +273,14 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI
}
else if (sd.isUndefined())
{
if (!cb.empty())
if (cb != nullptr)
{
cb(NO_VALUE_MARKER, stack);
}
}
else
{
if (!cb.empty())
if (cb != nullptr)
{
cb(sd, stack);
}
@@ -333,7 +330,7 @@ namespace LLInitParam
if (!p.writeValue<LLSD>(mValue, name_stack_range))
{
// otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc)
LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack_range);
LLParamSDParserUtilities::readSDValues(std::bind(&serializeElement, std::ref(p), std::placeholders::_1, std::placeholders::_2), mValue, name_stack_range);
}
return true;
}
+2 -2
View File
@@ -29,14 +29,14 @@
#define LL_LLSDPARAM_H
#include "llinitparam.h"
#include "boost/function.hpp"
#include <functional>
#include "llfasttimer.h"
struct LL_COMMON_API LLParamSDParserUtilities
{
static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range);
typedef boost::function<void (const LLSD&, LLInitParam::Parser::name_stack_t&)> read_sd_cb_t;
typedef std::function<void (const LLSD&, LLInitParam::Parser::name_stack_t&)> read_sd_cb_t;
static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack);
static void readSDValues(read_sd_cb_t cb, const LLSD& sd);
};
+4 -2
View File
@@ -25,7 +25,6 @@
#ifndef LLSINGLETON_H
#define LLSINGLETON_H
#include <boost/noncopyable.hpp>
#include <boost/unordered_set.hpp>
#include <initializer_list>
#include <list>
@@ -43,11 +42,14 @@
#pragma warning(disable : 4506) // no definition for inline function
#endif
class LLSingletonBase: private boost::noncopyable
class LLSingletonBase
{
public:
class MasterList;
LLSingletonBase(const LLSingletonBase&) = delete;
LLSingletonBase& operator=(const LLSingletonBase&) = delete;
private:
// All existing LLSingleton instances are tracked in this master list.
typedef std::list<LLSingletonBase*> list_t;
+2 -2
View File
@@ -1234,9 +1234,9 @@ void LLStringUtilBase<T>::getTokens(const string_type& string, std::vector<strin
// (unless there ARE no escapes).
std::unique_ptr< LLStringUtilBaseImpl::InString<T> > instrp;
if (escapes.empty())
instrp.reset(new LLStringUtilBaseImpl::InString<T>(string.begin(), string.end()));
instrp = std::make_unique<LLStringUtilBaseImpl::InString<T>>(string.begin(), string.end());
else
instrp.reset(new LLStringUtilBaseImpl::InEscString<T>(string.begin(), string.end(), escapes));
instrp = std::make_unique<LLStringUtilBaseImpl::InEscString<T>>(string.begin(), string.end(), escapes);
LLStringUtilBaseImpl::getTokens(*instrp, tokens, drop_delims, keep_delims, quotes);
}
+2 -13
View File
@@ -51,9 +51,6 @@
#include <boost/circular_buffer.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/range.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_float.hpp>
#include "llfasttimer.h"
using namespace llsd;
@@ -722,7 +719,7 @@ public:
// Store every integer type as LLSD::Integer.
template <class T>
void add(const LLSD::String& name, const T& value,
typename boost::enable_if<boost::is_integral<T> >::type* = 0)
typename std::enable_if_t<std::is_integral_v<T> >* = 0)
{
mStats[name] = LLSD::Integer(value);
}
@@ -730,7 +727,7 @@ public:
// Store every floating-point type as LLSD::Real.
template <class T>
void add(const LLSD::String& name, const T& value,
typename boost::enable_if<boost::is_float<T> >::type* = 0)
typename std::enable_if_t<std::is_floating_point_v<T> >* = 0)
{
mStats[name] = LLSD::Real(value);
}
@@ -1348,10 +1345,6 @@ bool gunzip_file(const std::string& srcfile, const std::string& dstfile)
} while(gzeof(src) == 0);
fclose(dst);
dst = NULL;
#if LL_WINDOWS
// Rename in windows needs the dstfile to not exist.
LLFile::remove(dstfile, ENOENT);
#endif
if (LLFile::rename(tmpfile, dstfile) == -1) goto err; /* Flawfinder: ignore */
retval = true;
err:
@@ -1399,10 +1392,6 @@ bool gzip_file(const std::string& srcfile, const std::string& dstfile)
gzclose(dst);
dst = NULL;
#if LL_WINDOWS
// Rename in windows needs the dstfile to not exist.
LLFile::remove(dstfile);
#endif
if (LLFile::rename(tmpfile, dstfile) == -1) goto err; /* Flawfinder: ignore */
retval = true;
err:
+5 -5
View File
@@ -60,10 +60,10 @@
#define LL_LLTREEITERATORS_H
#include "llptrto.h"
#include <functional>
#include <vector>
#include <deque>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/function.hpp>
#include <boost/static_assert.hpp>
namespace LLTreeIter
@@ -93,7 +93,7 @@ protected:
typedef typename LLPtrTo<NODE>::type ptr_type;
/// function that advances from this node to next accepts a node pointer
/// and returns another
typedef boost::function<ptr_type(const ptr_type&)> func_type;
typedef std::function<ptr_type(const ptr_type&)> func_type;
typedef SELFTYPE self_type;
};
@@ -330,7 +330,7 @@ protected:
typedef typename super::ptr_type ptr_type;
// The func_type is different for this: from a NODE pointer, we must
// obtain a CHILDITER.
typedef boost::function<CHILDITER(const ptr_type&)> func_type;
typedef std::function<CHILDITER(const ptr_type&)> func_type;
private:
typedef std::vector<ptr_type> list_type;
public:
@@ -435,7 +435,7 @@ protected:
typedef typename super::ptr_type ptr_type;
// The func_type is different for this: from a NODE pointer, we must
// obtain a CHILDITER.
typedef boost::function<CHILDITER(const ptr_type&)> func_type;
typedef std::function<CHILDITER(const ptr_type&)> func_type;
private:
// Upon reaching a given node in our pending list, we need to know whether
// we've already pushed that node's children, so we must associate a bool
@@ -574,7 +574,7 @@ protected:
typedef typename super::ptr_type ptr_type;
// The func_type is different for this: from a NODE pointer, we must
// obtain a CHILDITER.
typedef boost::function<CHILDITER(const ptr_type&)> func_type;
typedef std::function<CHILDITER(const ptr_type&)> func_type;
private:
// We need a FIFO queue rather than a LIFO stack. Use a deque rather than
// a vector, since vector can't implement pop_front() efficiently.
+1 -1
View File
@@ -33,7 +33,7 @@ LLUriParser::LLUriParser(const std::string& u) : mTmpScheme(false), mNormalizedT
{
if (u.find("://") == std::string::npos)
{
mNormalizedUri = "http://";
mNormalizedUri = "https://";
mTmpScheme = true;
}
+32 -38
View File
@@ -31,7 +31,6 @@
#include <string>
// std headers
// external library headers
#include <boost/assign/list_of.hpp>
// Precompiled header
#include "linden_common.h"
// associated header
@@ -106,8 +105,6 @@ std::ostream& operator<<(std::ostream& out, const std::set<ENTRY>& set)
/*****************************************************************************
* Other helpers
*****************************************************************************/
using boost::assign::list_of;
typedef LLDependencies<> StringDeps;
typedef StringDeps::KeyList StringList;
@@ -165,7 +162,7 @@ namespace tut
// The quick brown fox jumps over the lazy yellow dog.
// (note, "The" and "the" are distinct, else this test wouldn't work)
deps.add("lazy");
ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")));
ensure_equals(sorted_keys(deps), StringList{"lazy"});
deps.add("jumps");
ensure("found lazy", deps.get("lazy"));
ensure("not found dog.", ! deps.get("dog."));
@@ -175,24 +172,23 @@ namespace tut
// A change to the implementation of boost::topological_sort() would
// be an acceptable reason, and you can simply update the expected
// test output.
ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("jumps")));
deps.add("The", 0, empty, list_of("fox")("dog."));
ensure_equals(sorted_keys(deps), StringList{ "lazy", "jumps" });
deps.add("The", 0, empty, { "fox", "dog." });
// Test key accessors
ensure("empty before deps for missing key", is_empty(deps.get_before_range("bogus")));
ensure("empty before deps for jumps", is_empty(deps.get_before_range("jumps")));
ensure_equals(instance_from_range< std::set<std::string> >(deps.get_before_range("The")),
make< std::set<std::string> >(list_of("dog.")("fox")));
ensure_equals(instance_from_range< std::set<std::string> >(deps.get_before_range("The")), std::set<std::string>{ "dog.", "fox" });
// resume building dependencies
ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("jumps")("The")));
deps.add("the", 0, list_of("The"));
ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("jumps")("The")("the")));
deps.add("fox", 0, list_of("The"), list_of("jumps"));
ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps")));
deps.add("the", 0, list_of("The")); // same, see if cache works
ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps")));
deps.add("jumps", 0, empty, list_of("over")); // update jumps deps
ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps")));
/*==========================================================================*|
ensure_equals(sorted_keys(deps), StringList{ "lazy", "jumps", "The" });
deps.add("the", 0, { "The" });
ensure_equals(sorted_keys(deps), StringList{ "lazy", "jumps", "The", "the" });
deps.add("fox", 0, { "The" }, { "jumps" });
ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps" });
deps.add("the", 0, { "The" }); // same, see if cache works
ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps" });
deps.add("jumps", 0, empty, { "over" }); // update jumps deps
ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps" });
/*==========================================================================*|
// It drives me nuts that this test doesn't work in the test
// framework, because -- for reasons unknown -- running the test
// framework on Mac OS X 10.5 Leopard and Windows XP Pro, the catch
@@ -216,22 +212,21 @@ namespace tut
deps.remove("over");
}
|*==========================================================================*/
deps.add("dog.", 0, list_of("yellow")("lazy"));
ensure_equals(instance_from_range< std::set<std::string> >(deps.get_after_range("dog.")),
make< std::set<std::string> >(list_of("lazy")("yellow")));
ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps")("dog.")));
deps.add("quick", 0, list_of("The"), list_of("fox")("brown"));
ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("quick")("fox")("jumps")("dog.")));
deps.add("over", 0, list_of("jumps"), list_of("yellow")("the"));
ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("quick")("fox")("jumps")("over")("the")("dog.")));
deps.add("yellow", 0, list_of("the"), list_of("lazy"));
ensure_equals(sorted_keys(deps), make<StringList>(list_of("The")("quick")("fox")("jumps")("over")("the")("yellow")("lazy")("dog.")));
deps.add("dog.", 0, { "yellow", "lazy" });
ensure_equals(instance_from_range< std::set<std::string> >(deps.get_after_range("dog.")), std::set<std::string>{ "lazy", "yellow" });
ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps", "dog." });
deps.add("quick", 0, { "The" }, { "fox", "brown" });
ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "quick", "fox", "jumps", "dog." });
deps.add("over", 0, { "jumps" }, { "yellow", "the" });
ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "quick", "fox", "jumps", "over", "the", "dog." });
deps.add("yellow", 0, { "the" }, { "lazy" });
ensure_equals(sorted_keys(deps), StringList{ "The", "quick", "fox", "jumps", "over", "the", "yellow", "lazy", "dog." });
deps.add("brown");
// By now the dependencies are pretty well in place. A change to THIS
// order should be viewed with suspicion.
ensure_equals(sorted_keys(deps), make<StringList>(list_of("The")("quick")("brown")("fox")("jumps")("over")("the")("yellow")("lazy")("dog.")));
ensure_equals(sorted_keys(deps), StringList{ "The", "quick", "brown", "fox", "jumps", "over", "the", "yellow", "lazy", "dog." });
StringList keys(make<StringList>(list_of("The")("brown")("dog.")("fox")("jumps")("lazy")("over")("quick")("the")("yellow")));
StringList keys(StringList{ "The", "brown", "dog.", "fox", "jumps", "lazy", "over", "quick", "the", "yellow" });
ensure_equals(instance_from_range<StringList>(deps.get_key_range()), keys);
#if (! defined(__GNUC__)) || (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
// This is the succinct way, works on modern compilers
@@ -255,9 +250,9 @@ namespace tut
typedef LLDependencies<std::string, int> NameIndexDeps;
NameIndexDeps nideps;
const NameIndexDeps& const_nideps(nideps);
nideps.add("def", 2, list_of("ghi"));
nideps.add("def", 2, { "ghi" });
nideps.add("ghi", 3);
nideps.add("abc", 1, list_of("def"));
nideps.add("abc", 1, { "def" });
NameIndexDeps::range range(nideps.get_range());
ensure_equals(range.begin()->first, "abc");
ensure_equals(range.begin()->second, 1);
@@ -269,20 +264,20 @@ namespace tut
ensure_equals(const_iterator->first, "def");
ensure_equals(const_iterator->second, 2);
// NameIndexDeps::node_range node_range(nideps.get_node_range());
// ensure_equals(instance_from_range<std::vector<int> >(node_range), make< std::vector<int> >(list_of(1)(2)(3)));
// ensure_equals(instance_from_range<std::vector<int> >(node_range), make< std::vector<int> >(list_of(1,2,3)));
// *node_range.begin() = 0;
// *node_range.begin() = 1;
NameIndexDeps::const_node_range const_node_range(const_nideps.get_node_range());
ensure_equals(instance_from_range<std::vector<int> >(const_node_range), make< std::vector<int> >(list_of(1)(2)(3)));
ensure_equals(instance_from_range<std::vector<int>>(const_node_range), std::vector<int>{ 1, 2, 3 });
NameIndexDeps::const_key_range const_key_range(const_nideps.get_key_range());
ensure_equals(instance_from_range<StringList>(const_key_range), make<StringList>(list_of("abc")("def")("ghi")));
ensure_equals(instance_from_range<StringList>(const_key_range), StringList{ "abc", "def", "ghi" });
NameIndexDeps::sorted_range sorted(const_nideps.sort());
NameIndexDeps::sorted_iterator sortiter(sorted.begin());
ensure_equals(sortiter->first, "ghi");
ensure_equals(sortiter->second, 3);
// test all iterator-flavored versions of get_after_range()
StringList def(make<StringList>(list_of("def")));
StringList def{"def"};
ensure("empty abc before list", is_empty(nideps.get_before_range(nideps.get_range().begin())));
ensure_equals(instance_from_range<StringList>(nideps.get_after_range(nideps.get_range().begin())),
def);
@@ -296,7 +291,6 @@ namespace tut
def);
// advance from "ghi" to "def", which must come after "ghi"
++sortiter;
ensure_equals(instance_from_range<StringList>(const_nideps.get_after_range(sortiter)),
make<StringList>(list_of("ghi")));
ensure_equals(instance_from_range<StringList>(const_nideps.get_after_range(sortiter)), StringList{ "ghi" });
}
} // namespace tut
@@ -33,7 +33,6 @@
#include <stdexcept>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/range.hpp>
#include <boost/lambda/lambda.hpp>
+46 -17
View File
@@ -21,7 +21,6 @@
// external library headers
#include "llapr.h"
#include "apr_thread_proc.h"
#include <boost/function.hpp>
#include <boost/algorithm/string/find_iterator.hpp>
#include <boost/algorithm/string/finder.hpp>
// other Linden headers
@@ -54,14 +53,29 @@ std::string apr_strerror_helper(apr_status_t rv)
*****************************************************************************/
#define ensure_equals_(left, right) \
ensure_equals(STRINGIZE(#left << " != " << #right), (left), (right))
do { \
auto _left_val = (left); \
auto _right_val = (right); \
if (_left_val != _right_val) { \
std::string _msg = std::string(#left) + " != " + std::string(#right); \
tut::ensure_equals(_msg, _left_val, _right_val); \
} else { \
tut::ensure_equals("", _left_val, _right_val); \
} \
} while(0)
#define aprchk(expr) aprchk_(#expr, (expr))
static void aprchk_(const char* call, apr_status_t rv, apr_status_t expected=APR_SUCCESS)
{
tut::ensure_equals(STRINGIZE(call << " => " << rv << ": " << apr_strerror_helper
(rv)),
rv, expected);
if (rv != expected)
{
std::string msg = std::string(call) + " => " + std::to_string(rv) + ": " + apr_strerror_helper(rv);
tut::ensure_equals(msg, rv, expected);
}
else
{
tut::ensure_equals("", rv, expected);
}
}
/**
@@ -78,11 +92,14 @@ static std::string readfile(const std::string& pathname, const std::string& desc
std::string use_desc(desc);
if (use_desc.empty())
{
use_desc = STRINGIZE("in " << pathname);
use_desc = "in " + pathname;
}
std::ifstream inf(pathname.c_str());
std::string output;
tut::ensure(STRINGIZE("No output " << use_desc), bool(std::getline(inf, output)));
if (!std::getline(inf, output))
{
tut::ensure("No output " + use_desc, false);
}
std::string more;
while (std::getline(inf, more))
{
@@ -108,8 +125,10 @@ void waitfor(LLProcess& proc, int timeout=60)
{
yield();
}
tut::ensure(STRINGIZE("process took longer than " << timeout << " seconds to terminate"),
i < timeout);
// Pump once more after the process exits to flush any final events such as EOF.
yield(0);
std::string msg = "process took longer than " + std::to_string(timeout) + " seconds to terminate";
tut::ensure(msg, i < timeout);
}
void waitfor(LLProcess::handle h, const std::string& desc, int timeout=60)
@@ -119,8 +138,10 @@ void waitfor(LLProcess::handle h, const std::string& desc, int timeout=60)
{
yield();
}
tut::ensure(STRINGIZE("process took longer than " << timeout << " seconds to terminate"),
i < timeout);
// Pump once more after the process exits to flush any final events such as EOF.
yield(0);
std::string msg = "process took longer than " + std::to_string(timeout) + " seconds to terminate";
tut::ensure(msg, i < timeout);
}
/**
@@ -153,7 +174,8 @@ struct PythonProcessLauncher
try
{
mPy = LLProcess::create(mParams);
tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), bool(mPy));
std::string msg = "Couldn't launch " + mDesc + " script";
tut::ensure(msg, bool(mPy));
}
catch (const tut::failure&)
{
@@ -214,7 +236,8 @@ struct PythonProcessLauncher
mParams.args.add(out.getName());
run();
// assuming the script wrote to that file, read it
return readfile(out.getName(), STRINGIZE("from " << mDesc << " script"));
std::string desc = "from " + mDesc + " script";
return readfile(out.getName(), desc);
}
LLProcess::Params mParams;
@@ -240,9 +263,12 @@ static std::string python_out(const std::string& desc, const CONTENT& script)
}
/// Create a temporary directory and clean it up later.
class NamedTempDir: public boost::noncopyable
class NamedTempDir
{
public:
NamedTempDir(const NamedTempDir&) = delete;
NamedTempDir& operator=(const NamedTempDir&) = delete;
NamedTempDir():
mPath(NamedTempFile::temp_path()),
mCreated(boost::filesystem::create_directories(mPath))
@@ -1071,8 +1097,11 @@ namespace tut
ensure_equals("bad child exit code", py.mPy->getStatus().mData, 0);
}
struct EventListener: public boost::noncopyable
struct EventListener
{
EventListener(const EventListener&) = delete;
EventListener& operator=(const EventListener&) = delete;
EventListener(LLEventPump& pump)
{
mConnection =
@@ -1183,8 +1212,8 @@ namespace tut
{
set_test_name("ReadPipe \"eof\" event");
PythonProcessLauncher py(get_test_name(),
"from __future__ import print_function\n"
"print('Hello from Python!')\n");
"import time\n"
"time.sleep(1.5)\n");
py.mParams.files.add(LLProcess::FileParam()); // stdin
py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout
py.launch();
+19 -31
View File
@@ -28,13 +28,10 @@
#include "linden_common.h"
#include <boost/assign/list_of.hpp>
#include "../llstring.h"
#include "StringVec.h" // must come BEFORE lltut.h
#include "../test/lltut.h"
using boost::assign::list_of;
namespace tut
{
struct string_index
@@ -763,14 +760,14 @@ namespace tut
ensure_equals("only delims",
LLStringUtil::getTokens(" \r\n ", " \r\n"), StringVec());
ensure_equals("sequence of delims",
LLStringUtil::getTokens(",,, one ,,,", ","), list_of("one"));
LLStringUtil::getTokens(",,, one ,,,", ","), StringVec{"one"});
// nat considers this a dubious implementation side effect, but I'd
// hate to change it now...
ensure_equals("noncontiguous tokens",
LLStringUtil::getTokens(", ,, , one ,,,", ","), list_of("")("")("one"));
LLStringUtil::getTokens(", ,, , one ,,,", ","), StringVec{ "", "", "one" });
ensure_equals("space-padded tokens",
LLStringUtil::getTokens(", one , two ,", ","), list_of("one")("two"));
ensure_equals("no delims", LLStringUtil::getTokens("one", ","), list_of("one"));
LLStringUtil::getTokens(", one , two ,", ","), StringVec{"one", "two"});
ensure_equals("no delims", LLStringUtil::getTokens("one", ","), StringVec{ "one" });
}
// Shorthand for verifying that getTokens() behaves the same when you
@@ -817,39 +814,33 @@ namespace tut
ensure_getTokens("only delims",
" \r\n ", " \r\n", "", StringVec());
ensure_getTokens("sequence of delims",
",,, one ,,,", ", ", "", list_of("one"));
",,, one ,,,", ", ", "", StringVec{"one"});
// Note contrast with the case in the previous method
ensure_getTokens("noncontiguous tokens",
", ,, , one ,,,", ", ", "", list_of("one"));
", ,, , one ,,,", ", ", "", StringVec{"one"});
ensure_getTokens("space-padded tokens",
", one , two ,", ", ", "",
list_of("one")("two"));
ensure_getTokens("no delims", "one", ",", "", list_of("one"));
StringVec{"one", "two"});
ensure_getTokens("no delims", "one", ",", "", StringVec{ "one" });
// drop_delims vs. keep_delims
ensure_getTokens("arithmetic",
" ab+def / xx* yy ", " ", "+-*/",
list_of("ab")("+")("def")("/")("xx")("*")("yy"));
" ab+def / xx* yy ", " ", "+-*/", { "ab", "+", "def", "/", "xx", "*", "yy" });
// quotes
ensure_getTokens("no quotes",
"She said, \"Don't go.\"", " ", ",", "",
list_of("She")("said")(",")("\"Don't")("go.\""));
"She said, \"Don't go.\"", " ", ",", "", { "She", "said", ",", "\"Don't", "go.\"" });
ensure_getTokens("quotes",
"She said, \"Don't go.\"", " ", ",", "\"",
list_of("She")("said")(",")("Don't go."));
"She said, \"Don't go.\"", " ", ",", "\"", { "She", "said", ",", "Don't go." });
ensure_getTokens("quotes and delims",
"run c:/'Documents and Settings'/someone", " ", "", "'",
list_of("run")("c:/Documents and Settings/someone"));
{ "run", "c:/Documents and Settings/someone" });
ensure_getTokens("unmatched quote",
"baby don't leave", " ", "", "'",
list_of("baby")("don't")("leave"));
"baby don't leave", " ", "", "'", { "baby", "don't", "leave" });
ensure_getTokens("adjacent quoted",
"abc'def \"ghi'\"jkl' mno\"pqr", " ", "", "\"'",
list_of("abcdef \"ghijkl' mnopqr"));
"abc'def \"ghi'\"jkl' mno\"pqr", " ", "", "\"'", { "abcdef \"ghijkl' mnopqr" });
ensure_getTokens("quoted empty string",
"--set SomeVar ''", " ", "", "'",
list_of("--set")("SomeVar")(""));
"--set SomeVar ''", " ", "", "'", { "--set", "SomeVar", "" });
// escapes
// Don't use backslash as an escape for these tests -- you'll go nuts
@@ -857,15 +848,12 @@ namespace tut
// something else!
ensure_equals("escaped delims",
LLStringUtil::getTokens("^ a - dog^-gone^ phrase", " ", "-", "", "^"),
list_of(" a")("-")("dog-gone phrase"));
StringVec{ " a", "-", "dog-gone phrase" });
ensure_equals("escaped quotes",
LLStringUtil::getTokens("say: 'this isn^'t w^orking'.", " ", "", "'", "^"),
list_of("say:")("this isn't working."));
StringVec{ "say:", "this isn't working." });
ensure_equals("escaped escape",
LLStringUtil::getTokens("want x^^2", " ", "", "", "^"),
list_of("want")("x^2"));
ensure_equals("escape at end",
LLStringUtil::getTokens("it's^ up there^", " ", "", "'", "^"),
list_of("it's up")("there^"));
LLStringUtil::getTokens("want x^^2", " ", "", "", "^"), StringVec{ "want", "x^2" });
ensure_equals("escape at end", LLStringUtil::getTokens("it's^ up there^", " ", "", "'", "^"), StringVec{ "it's up", "there^" });
}
}
@@ -32,6 +32,7 @@
// STL headers
// std headers
#include <functional>
#include <iostream>
#include <sstream>
#include <string>
@@ -915,7 +916,7 @@ struct WalkExpected<LLTreeIter::BFS>: public Expected
template <class NODE, typename CHILDITER>
typename LLPtrTo<NODE>::type
get_B2b(const typename LLPtrTo<NODE>::type& root,
const boost::function<CHILDITER(const typename LLPtrTo<NODE>::type&)>& child_begin)
const std::function<CHILDITER(const typename LLPtrTo<NODE>::type&)>& child_begin)
{
typedef typename LLPtrTo<NODE>::type NodePtr;
CHILDITER Bi(child_begin(root));
+4 -4
View File
@@ -61,8 +61,8 @@ public:
virtual ~HttpLibcurl();
private:
HttpLibcurl(const HttpLibcurl &); // Not defined
void operator=(const HttpLibcurl &); // Not defined
HttpLibcurl(const HttpLibcurl&) = delete;
void operator=(const HttpLibcurl&) = delete;
public:
typedef std::shared_ptr<HttpOpRequest> opReqPtr_t;
@@ -179,8 +179,8 @@ protected:
~HandleCache();
private:
HandleCache(const HandleCache &); // Not defined
void operator=(const HandleCache &); // Not defined
HandleCache(const HandleCache&) = delete;
void operator=(const HandleCache&) = delete;
public:
/// Allocate a curl handle for caller. May be freed using
+10 -14
View File
@@ -68,8 +68,7 @@ class HttpService;
/// via queue-like interfaces that are thread compatible
/// and those interfaces establish the access rules.
class HttpOperation : private boost::noncopyable,
public std::enable_shared_from_this<HttpOperation>
class HttpOperation : public std::enable_shared_from_this<HttpOperation>
{
public:
typedef std::shared_ptr<HttpOperation> ptr_t;
@@ -82,6 +81,9 @@ public:
/// Threading: called by any thread.
virtual ~HttpOperation(); // Use release()
// Non-copyable
HttpOperation(const HttpOperation&) = delete;
HttpOperation& operator=(const HttpOperation&) = delete;
public:
/// Register a reply queue and a handler for completion notifications.
@@ -220,12 +222,10 @@ class HttpOpStop : public HttpOperation
{
public:
HttpOpStop();
virtual ~HttpOpStop();
private:
HttpOpStop(const HttpOpStop &); // Not defined
void operator=(const HttpOpStop &); // Not defined
HttpOpStop(const HttpOpStop &) = delete;
HttpOpStop& operator=(const HttpOpStop&) = delete;
public:
virtual void stageFromRequest(HttpService *);
@@ -242,12 +242,10 @@ class HttpOpNull : public HttpOperation
{
public:
HttpOpNull();
virtual ~HttpOpNull();
private:
HttpOpNull(const HttpOpNull &); // Not defined
void operator=(const HttpOpNull &); // Not defined
HttpOpNull(const HttpOpNull&) = delete;
HttpOpNull& operator=(const HttpOpNull&) = delete;
public:
virtual void stageFromRequest(HttpService *);
@@ -264,12 +262,10 @@ public:
// 0 does a hard spin in the operation
// 1 does a soft spin continuously requeuing itself
HttpOpSpin(int mode);
virtual ~HttpOpSpin();
private:
HttpOpSpin(const HttpOpSpin &); // Not defined
void operator=(const HttpOpSpin &); // Not defined
HttpOpSpin(const HttpOpSpin&) = delete;
HttpOpSpin& operator=(const HttpOpSpin&) = delete;
public:
virtual void stageFromRequest(HttpService *);
+3 -3
View File
@@ -153,7 +153,7 @@ HttpOpRequest::HttpOpRequest()
mPolicyRetryLimit(HTTP_RETRY_COUNT_DEFAULT),
mPolicyMinRetryBackoff(HttpTime(HTTP_RETRY_BACKOFF_MIN_DEFAULT)),
mPolicyMaxRetryBackoff(HttpTime(HTTP_RETRY_BACKOFF_MAX_DEFAULT)),
mCallbackSSLVerify(NULL)
mCallbackSSLVerify(nullptr)
{
// *NOTE: As members are added, retry initialization/cleanup
// may need to be extended in @see prepareRequest().
@@ -272,7 +272,7 @@ void HttpOpRequest::visitNotifier(HttpRequest * request)
response->setContentType(mReplyConType);
response->setRetries(mPolicyRetries, mPolicy503Retries);
HttpResponse::TransferStats::ptr_t stats = HttpResponse::TransferStats::ptr_t(new HttpResponse::TransferStats);
HttpResponse::TransferStats::ptr_t stats = std::make_shared<HttpResponse::TransferStats>();
curl_easy_getinfo(mCurlHandle, CURLINFO_SIZE_DOWNLOAD, &stats->mSizeDownload);
curl_easy_getinfo(mCurlHandle, CURLINFO_TOTAL_TIME, &stats->mTotalTime);
@@ -964,7 +964,7 @@ size_t HttpOpRequest::headerCallback(void * data, size_t size, size_t nmemb, voi
// Save headers in response
if (! op->mReplyHeaders)
{
op->mReplyHeaders = HttpHeaders::ptr_t(new HttpHeaders);
op->mReplyHeaders = std::make_shared<HttpHeaders>();
}
op->mReplyHeaders->append(name, value ? value : "");
}
+2 -2
View File
@@ -73,8 +73,8 @@ public:
virtual ~HttpOpRequest(); // Use release()
private:
HttpOpRequest(const HttpOpRequest &); // Not defined
void operator=(const HttpOpRequest &); // Not defined
HttpOpRequest(const HttpOpRequest&) = delete;
void operator=(const HttpOpRequest&) = delete;
public:
enum EMethod
+2 -2
View File
@@ -60,8 +60,8 @@ public:
virtual ~HttpOpSetGet(); // Use release()
private:
HttpOpSetGet(const HttpOpSetGet &); // Not defined
void operator=(const HttpOpSetGet &); // Not defined
HttpOpSetGet(const HttpOpSetGet&) = delete;
void operator=(const HttpOpSetGet&) = delete;
public:
/// Threading: called by application thread
+2 -2
View File
@@ -56,8 +56,8 @@ public:
virtual ~HttpPolicy();
private:
HttpPolicy(const HttpPolicy &); // Not defined
void operator=(const HttpPolicy &); // Not defined
HttpPolicy(const HttpPolicy&) = delete;
void operator=(const HttpPolicy&) = delete;
public:
typedef std::shared_ptr<HttpOpRequest> opReqPtr_t;
+1 -1
View File
@@ -53,7 +53,7 @@ public:
~HttpPolicyClass();
HttpPolicyClass & operator=(const HttpPolicyClass &);
HttpPolicyClass(const HttpPolicyClass &); // Not defined
HttpPolicyClass(const HttpPolicyClass &);
public:
HttpStatus set(HttpRequest::EPolicyOption opt, long value);
+1 -1
View File
@@ -55,7 +55,7 @@ public:
HttpPolicyGlobal & operator=(const HttpPolicyGlobal &);
private:
HttpPolicyGlobal(const HttpPolicyGlobal &); // Not defined
HttpPolicyGlobal(const HttpPolicyGlobal &) = delete;
public:
HttpStatus set(HttpRequest::EPolicyOption opt, long value);
+2 -2
View File
@@ -77,8 +77,8 @@ public:
{}
protected:
HttpReadyQueue(const HttpReadyQueue &); // Not defined
void operator=(const HttpReadyQueue &); // Not defined
HttpReadyQueue(const HttpReadyQueue&) = delete;
void operator=(const HttpReadyQueue&) = delete;
public:
+4 -3
View File
@@ -30,8 +30,6 @@
#include "_refcounted.h"
#include "_mutex.h"
#include "boost/noncopyable.hpp"
namespace LLCore
{
@@ -59,7 +57,7 @@ class HttpOperation;
/// will be coded anyway so it shouldn't be too much of a
/// burden.
class HttpReplyQueue : private boost::noncopyable
class HttpReplyQueue
{
public:
@@ -69,6 +67,9 @@ public:
HttpReplyQueue();
virtual ~HttpReplyQueue();
HttpReplyQueue(const HttpReplyQueue&) = delete;
HttpReplyQueue& operator=(const HttpReplyQueue&) = delete;
public:
typedef std::vector< opPtr_t > OpContainer;
+2 -2
View File
@@ -57,8 +57,8 @@ protected:
virtual ~HttpRequestQueue(); // Use release()
private:
HttpRequestQueue(const HttpRequestQueue &); // Not defined
void operator=(const HttpRequestQueue &); // Not defined
HttpRequestQueue(const HttpRequestQueue&) = delete;
void operator=(const HttpRequestQueue&) = delete;
public:
typedef std::shared_ptr<HttpOperation> opPtr_t;
-1
View File
@@ -27,7 +27,6 @@
#include "_httpservice.h"
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include "_httpoperation.h"
#include "_httprequestqueue.h"
+2 -2
View File
@@ -86,8 +86,8 @@ protected:
virtual ~HttpService();
private:
HttpService(const HttpService &); // Not defined
void operator=(const HttpService &); // Not defined
HttpService(const HttpService&) = delete;
void operator=(const HttpService&) = delete;
public:
enum EState
+3 -5
View File
@@ -31,12 +31,9 @@
#include "linden_common.h"
#include "fix_macros.h"
#include <boost/thread.hpp>
#include <boost/intrusive_ptr.hpp>
#include "llatomic.h"
namespace LLCoreInt
{
@@ -44,8 +41,9 @@ namespace LLCoreInt
class RefCounted
{
private:
RefCounted(); // Not defined - may not be default constructed
void operator=(const RefCounted &); // Not defined
RefCounted() = delete; // may not be default constructed
RefCounted(const RefCounted&) = delete;
RefCounted& operator=(const RefCounted&) = delete;
public:
explicit RefCounted(bool const implicit)
+4 -2
View File
@@ -42,8 +42,10 @@ namespace LLCoreInt
class HttpThread : public RefCounted
{
private:
HttpThread(); // Not defined
void operator=(const HttpThread &); // Not defined
// May not be default constructed or copied
HttpThread() = delete;
HttpThread(const HttpThread&) = delete;
void operator=(const HttpThread &) = delete;
void at_exit()
{
+3 -3
View File
@@ -57,12 +57,12 @@ public:
void operator delete(void *);
void operator delete(void *, size_t len);
Block(const Block&) = delete;
Block& operator=(const Block&) = delete;
protected:
Block(size_t len);
Block(const Block &); // Not defined
void operator=(const Block &); // Not defined
// Allocate the block with the additional space for the
// buffered data at the end of the object.
void * operator new(size_t len, size_t addl_len);
+2 -2
View File
@@ -79,8 +79,8 @@ protected:
virtual ~BufferArray(); // Use release()
private:
BufferArray(const BufferArray &); // Not defined
void operator=(const BufferArray &); // Not defined
BufferArray(const BufferArray&) = delete;
void operator=(const BufferArray&) = delete;
public:
// Internal magic number, may be used by unit tests.
+2 -2
View File
@@ -91,8 +91,8 @@ public:
virtual ~BufferArrayStreamBuf();
private:
BufferArrayStreamBuf(const BufferArrayStreamBuf &); // Not defined
void operator=(const BufferArrayStreamBuf &); // Not defined
BufferArrayStreamBuf(const BufferArrayStreamBuf&) = delete;
void operator=(const BufferArrayStreamBuf&) = delete;
public:
// Input interfaces from std::streambuf
+7 -8
View File
@@ -191,7 +191,6 @@
#include "llsd.h"
#include <string>
#include <curl/curl.h>
#include "boost/noncopyable.hpp"
namespace LLCore
{
@@ -297,25 +296,25 @@ struct HttpStatus
HttpStatus()
{
mDetails = std::shared_ptr<Details>(new Details(LLCORE, HE_SUCCESS));
mDetails = std::make_shared<Details>(LLCORE, HE_SUCCESS);
}
HttpStatus(type_enum_t type, short status)
{
mDetails = std::shared_ptr<Details>(new Details(type, status));
mDetails = std::make_shared<Details>(type, status);
}
HttpStatus(int http_status)
{
mDetails = std::shared_ptr<Details>(new Details(http_status,
(http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR));
mDetails = std::make_shared<Details>(http_status,
(http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR);
llassert(http_status >= 100 && http_status <= 999);
}
HttpStatus(int http_status, const std::string &message)
{
mDetails = std::shared_ptr<Details>(new Details(http_status,
(http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR));
mDetails = std::make_shared<Details>(http_status,
(http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR);
llassert(http_status >= 100 && http_status <= 999);
mDetails->mMessage = message;
}
@@ -337,7 +336,7 @@ struct HttpStatus
HttpStatus & clone(const HttpStatus &rhs)
{
mDetails = std::shared_ptr<Details>(new Details(*rhs.mDetails));
mDetails = std::make_shared<Details>(*rhs.mDetails);
return *this;
}
+5 -5
View File
@@ -74,7 +74,7 @@ namespace LLCore
/// constructor is given a refcount.
///
class HttpHeaders: private boost::noncopyable
class HttpHeaders
{
public:
typedef std::pair<std::string, std::string> header_t;
@@ -94,11 +94,11 @@ public:
HttpHeaders();
virtual ~HttpHeaders(); // Use release()
//typedef LLCoreInt::IntrusivePtr<HttpHeaders> ptr_t;
protected:
// Non-copyable
HttpHeaders(const HttpHeaders&) = delete;
HttpHeaders& operator=(const HttpHeaders&) = delete;
HttpHeaders(const HttpHeaders &); // Not defined
void operator=(const HttpHeaders &); // Not defined
//typedef LLCoreInt::IntrusivePtr<HttpHeaders> ptr_t;
public:
// Empty the list of headers.
+4 -5
View File
@@ -55,7 +55,7 @@ namespace LLCore
/// Allocation: Refcounted, heap only. Caller of the constructor
/// is given a refcount.
///
class HttpOptions : private boost::noncopyable
class HttpOptions
{
public:
HttpOptions();
@@ -64,10 +64,9 @@ public:
virtual ~HttpOptions(); // Use release()
protected:
HttpOptions(const HttpOptions &); // Not defined
void operator=(const HttpOptions &); // Not defined
// Non-copyable
HttpOptions(const HttpOptions&) = delete;
HttpOptions& operator=(const HttpOptions&) = delete;
public:
+15 -15
View File
@@ -60,7 +60,7 @@ HttpRequest::HttpRequest()
mRequestQueue = HttpRequestQueue::instanceOf();
mRequestQueue->addRef();
mReplyQueue.reset( new HttpReplyQueue() );
mReplyQueue = std::make_shared<HttpReplyQueue>();
HTTPStats::instance().recordHTTPRequest();
}
@@ -129,7 +129,7 @@ HttpHandle HttpRequest::setPolicyOption(EPolicyOption opt, policy_t pclass,
{
HttpStatus status;
HttpOpSetGet::ptr_t op(new HttpOpSetGet());
HttpOpSetGet::ptr_t op = std::make_shared<HttpOpSetGet>();
if (! (status = op->setupSet(opt, pclass, value)))
{
mLastReqStatus = status;
@@ -152,7 +152,7 @@ HttpHandle HttpRequest::setPolicyOption(EPolicyOption opt, policy_t pclass,
{
HttpStatus status;
HttpOpSetGet::ptr_t op (new HttpOpSetGet());
HttpOpSetGet::ptr_t op = std::make_shared<HttpOpSetGet>();
if (! (status = op->setupSet(opt, pclass, value)))
{
mLastReqStatus = status;
@@ -190,7 +190,7 @@ HttpHandle HttpRequest::requestGet(policy_t policy_id,
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
HttpStatus status;
HttpOpRequest::ptr_t op(new HttpOpRequest());
HttpOpRequest::ptr_t op = std::make_shared<HttpOpRequest>();
if (! (status = op->setupGet(policy_id, url, options, headers)))
{
mLastReqStatus = status;
@@ -219,7 +219,7 @@ HttpHandle HttpRequest::requestGetByteRange(policy_t policy_id,
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
HttpStatus status;
HttpOpRequest::ptr_t op(new HttpOpRequest());
HttpOpRequest::ptr_t op = std::make_shared<HttpOpRequest>();
if (! (status = op->setupGetByteRange(policy_id, url, offset, len, options, headers)))
{
mLastReqStatus = status;
@@ -246,7 +246,7 @@ HttpHandle HttpRequest::requestPost(policy_t policy_id,
{
HttpStatus status;
HttpOpRequest::ptr_t op(new HttpOpRequest());
HttpOpRequest::ptr_t op = std::make_shared<HttpOpRequest>();
if (! (status = op->setupPost(policy_id, url, body, options, headers)))
{
mLastReqStatus = status;
@@ -273,7 +273,7 @@ HttpHandle HttpRequest::requestPut(policy_t policy_id,
{
HttpStatus status;
HttpOpRequest::ptr_t op (new HttpOpRequest());
HttpOpRequest::ptr_t op = std::make_shared<HttpOpRequest>();
if (! (status = op->setupPut(policy_id, url, body, options, headers)))
{
mLastReqStatus = status;
@@ -298,7 +298,7 @@ HttpHandle HttpRequest::requestDelete(policy_t policy_id,
{
HttpStatus status;
HttpOpRequest::ptr_t op(new HttpOpRequest());
HttpOpRequest::ptr_t op = std::make_shared<HttpOpRequest>();
if (!(status = op->setupDelete(policy_id, url, options, headers)))
{
mLastReqStatus = status;
@@ -324,7 +324,7 @@ HttpHandle HttpRequest::requestPatch(policy_t policy_id,
{
HttpStatus status;
HttpOpRequest::ptr_t op (new HttpOpRequest());
HttpOpRequest::ptr_t op = std::make_shared<HttpOpRequest>();
if (!(status = op->setupPatch(policy_id, url, body, options, headers)))
{
mLastReqStatus = status;
@@ -349,7 +349,7 @@ HttpHandle HttpRequest::requestCopy(policy_t policy_id,
{
HttpStatus status;
HttpOpRequest::ptr_t op(new HttpOpRequest());
HttpOpRequest::ptr_t op = std::make_shared<HttpOpRequest>();
if (!(status = op->setupCopy(policy_id, url, options, headers)))
{
mLastReqStatus = status;
@@ -375,7 +375,7 @@ HttpHandle HttpRequest::requestMove(policy_t policy_id,
{
HttpStatus status;
HttpOpRequest::ptr_t op (new HttpOpRequest());
HttpOpRequest::ptr_t op = std::make_shared<HttpOpRequest>();
if (!(status = op->setupMove(policy_id, url, options, headers)))
{
mLastReqStatus = status;
@@ -397,7 +397,7 @@ HttpHandle HttpRequest::requestNoOp(HttpHandler::ptr_t user_handler)
{
HttpStatus status;
HttpOperation::ptr_t op (new HttpOpNull());
HttpOperation::ptr_t op = std::make_shared<HttpOpNull>();
op->setReplyPath(mReplyQueue, user_handler);
if (! (status = mRequestQueue->addOp(op))) // transfers refcount
{
@@ -463,7 +463,7 @@ HttpHandle HttpRequest::requestCancel(HttpHandle request, HttpHandler::ptr_t use
{
HttpStatus status;
HttpOperation::ptr_t op(new HttpOpCancel(request));
HttpOperation::ptr_t op = std::make_shared<HttpOpCancel>(request);
op->setReplyPath(mReplyQueue, user_handler);
if (! (status = mRequestQueue->addOp(op))) // transfers refcount
{
@@ -528,7 +528,7 @@ HttpHandle HttpRequest::requestStopThread(HttpHandler::ptr_t user_handler)
HttpStatus status;
HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID);
HttpOperation::ptr_t op(new HttpOpStop());
HttpOperation::ptr_t op = std::make_shared<HttpOpStop>();
op->setReplyPath(mReplyQueue, user_handler);
if (! (status = mRequestQueue->addOp(op))) // transfers refcount
{
@@ -548,7 +548,7 @@ HttpHandle HttpRequest::requestSpin(int mode)
HttpStatus status;
HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID);
HttpOperation::ptr_t op(new HttpOpSpin(mode));
HttpOperation::ptr_t op = std::make_shared<HttpOpSpin>(mode);
op->setReplyPath(mReplyQueue, HttpHandler::ptr_t());
if (! (status = mRequestQueue->addOp(op))) // transfers refcount
{
+4 -4
View File
@@ -104,9 +104,9 @@ public:
/// Represents a default, catch-all policy class that guarantees
/// eventual service for any HTTP request.
static const policy_t DEFAULT_POLICY_ID = 0;
static const policy_t INVALID_POLICY_ID = 0xFFFFFFFFU;
static const policy_t GLOBAL_POLICY_ID = 0xFFFFFFFEU;
static constexpr policy_t DEFAULT_POLICY_ID = 0;
static constexpr policy_t INVALID_POLICY_ID = 0xFFFFFFFFU;
static constexpr policy_t GLOBAL_POLICY_ID = 0xFFFFFFFEU;
/// Create a new policy class into which requests can be made.
///
@@ -237,7 +237,7 @@ public:
/// Prototype for policy based callbacks. The callback methods will be executed
/// on the worker thread so no modifications should be made to the HttpHandler object.
typedef boost::function<HttpStatus(const std::string &, const HttpHandler::ptr_t &, void *)> policyCallback_t;
typedef std::function<HttpStatus(const std::string &, const HttpHandler::ptr_t &, void *)> policyCallback_t;
/// Set a policy option for a global or class parameter at
/// startup time (prior to thread start).
+2 -2
View File
@@ -65,8 +65,8 @@ public:
protected:
virtual ~HttpResponse(); // Use release()
HttpResponse(const HttpResponse &); // Not defined
void operator=(const HttpResponse &); // Not defined
HttpResponse(const HttpResponse&) = delete;
void operator=(const HttpResponse&) = delete;
public:
/// Statistics for the HTTP
+2
View File
@@ -100,6 +100,7 @@ const std::string HTTP_IN_HEADER_LOCATION("location");
const std::string HTTP_IN_HEADER_RETRY_AFTER("retry-after");
const std::string HTTP_IN_HEADER_SET_COOKIE("set-cookie");
const std::string HTTP_IN_HEADER_USER_AGENT("user-agent");
const std::string HTTP_IN_HEADER_X_CONTENT_TYPE_OPTIONS("x-content-type-options");
const std::string HTTP_IN_HEADER_X_FORWARDED_FOR("x-forwarded-for");
const std::string HTTP_CONTENT_LLSD_XML("application/llsd+xml");
@@ -122,6 +123,7 @@ const std::string HTTP_CONTENT_IMAGE_BMP("image/bmp");
const std::string HTTP_NO_CACHE("no-cache");
const std::string HTTP_NO_CACHE_CONTROL("no-cache, max-age=0");
const std::string HTTP_NOSNIFF("nosniff");
const std::string HTTP_VERB_INVALID("(invalid)");
const std::string HTTP_VERB_HEAD("HEAD");
+2
View File
@@ -190,6 +190,7 @@ extern const std::string HTTP_IN_HEADER_LOCATION;
extern const std::string HTTP_IN_HEADER_RETRY_AFTER;
extern const std::string HTTP_IN_HEADER_SET_COOKIE;
extern const std::string HTTP_IN_HEADER_USER_AGENT;
extern const std::string HTTP_IN_HEADER_X_CONTENT_TYPE_OPTIONS;
extern const std::string HTTP_IN_HEADER_X_FORWARDED_FOR;
//// HTTP Content Types ////
@@ -215,5 +216,6 @@ extern const std::string HTTP_CONTENT_IMAGE_BMP;
//// HTTP Cache Settings ////
extern const std::string HTTP_NO_CACHE;
extern const std::string HTTP_NO_CACHE_CONTROL;
extern const std::string HTTP_NOSNIFF;
#endif
-4
View File
@@ -576,10 +576,6 @@ bool LLCrashLogger::init()
std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log.old");
std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log");
#if LL_WINDOWS
LLAPRFile::remove(old_log_file);
#endif
LLFile::rename(log_file.c_str(), old_log_file.c_str());
// Set the log file to crashreport.log
+26 -33
View File
@@ -44,16 +44,9 @@
#include "stringize.h"
#include "llstring.h"
#include <boost/filesystem.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/bind.hpp>
#include <boost/ref.hpp>
#include <algorithm>
using boost::assign::list_of;
using boost::assign::map_list_of;
#if LL_WINDOWS
#include "lldir_win32.h"
LLDir_Win32 gDirUtil;
@@ -448,28 +441,28 @@ const std::string &LLDir::getUserName() const
static std::string ELLPathToString(ELLPath location)
{
typedef std::map<ELLPath, const char*> ELLPathMap;
#define ENT(symbol) (symbol, #symbol)
static const ELLPathMap sMap = map_list_of
ENT(LL_PATH_NONE)
ENT(LL_PATH_USER_SETTINGS)
ENT(LL_PATH_APP_SETTINGS)
ENT(LL_PATH_PER_SL_ACCOUNT) // returns/expands to blank string if we don't know the account name yet
ENT(LL_PATH_CACHE)
ENT(LL_PATH_CHARACTER)
ENT(LL_PATH_HELP)
ENT(LL_PATH_LOGS)
ENT(LL_PATH_TEMP)
ENT(LL_PATH_SKINS)
ENT(LL_PATH_TOP_SKIN)
ENT(LL_PATH_CHAT_LOGS)
ENT(LL_PATH_PER_ACCOUNT_CHAT_LOGS)
ENT(LL_PATH_USER_SKIN)
ENT(LL_PATH_LOCAL_ASSETS)
ENT(LL_PATH_EXECUTABLE)
ENT(LL_PATH_DEFAULT_SKIN)
ENT(LL_PATH_FONTS)
ENT(LL_PATH_LAST)
;
#define ENT(symbol) { symbol, #symbol }
static const ELLPathMap sMap = {
ENT(LL_PATH_NONE),
ENT(LL_PATH_USER_SETTINGS),
ENT(LL_PATH_APP_SETTINGS),
ENT(LL_PATH_PER_SL_ACCOUNT), // returns/expands to blank string if we don't know the account name yet
ENT(LL_PATH_CACHE),
ENT(LL_PATH_CHARACTER),
ENT(LL_PATH_HELP),
ENT(LL_PATH_LOGS),
ENT(LL_PATH_TEMP),
ENT(LL_PATH_SKINS),
ENT(LL_PATH_TOP_SKIN),
ENT(LL_PATH_CHAT_LOGS),
ENT(LL_PATH_PER_ACCOUNT_CHAT_LOGS),
ENT(LL_PATH_USER_SKIN),
ENT(LL_PATH_LOCAL_ASSETS),
ENT(LL_PATH_EXECUTABLE),
ENT(LL_PATH_DEFAULT_SKIN),
ENT(LL_PATH_FONTS),
ENT(LL_PATH_LAST),
};
#undef ENT
ELLPathMap::const_iterator found = sMap.find(location);
@@ -725,10 +718,10 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir,
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
// Recognize subdirs that have no localization.
static const std::set<std::string> sUnlocalized = list_of
("") // top-level directory not localized
("textures") // textures not localized
;
static const std::set<std::string> sUnlocalized = {
"", // top-level directory not localized
"textures" // textures not localized
};
LL_DEBUGS("LLDir") << "subdir '" << subdir << "', filename '" << filename
<< "', constraint "
+14 -14
View File
@@ -1,28 +1,28 @@
/**
/**
* @file lldir_utils_objc.mm
* @brief Cocoa implementation of directory utilities for macOS
*
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2020, 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$
*/
*/
#if LL_DARWIN
//WARNING: This file CANNOT use standard linden includes due to conflicts between definitions of BOOL
@@ -39,18 +39,18 @@ std::string getSystemTempFolder()
tempDir = @"/tmp";
result = std::string([tempDir UTF8String]);
}
return result;
}
//findSystemDirectory scoped exclusively to this file.
//findSystemDirectory scoped exclusively to this file.
std::string findSystemDirectory(NSSearchPathDirectory searchPathDirectory,
NSSearchPathDomainMask domainMask)
{
std::string result;
@autoreleasepool {
NSString *path = nil;
// Search for the path
NSArray* paths = NSSearchPathForDirectoriesInDomains(searchPathDirectory,
domainMask,
@@ -60,10 +60,10 @@ std::string findSystemDirectory(NSSearchPathDirectory searchPathDirectory,
path = [paths objectAtIndex:0];
//HACK: Always attempt to create directory, ignore errors.
NSError *error = nil;
[[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error];
result = std::string([path UTF8String]);
}
}
@@ -88,7 +88,7 @@ std::string getSystemResourceFolder()
NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
result = std::string([bundlePath UTF8String]);
}
return result;
}
@@ -102,7 +102,7 @@ std::string getSystemApplicationSupportFolder()
{
return findSystemDirectory (NSApplicationSupportDirectory,
NSUserDomainMask);
}
#endif // LL_DARWIN
-3
View File
@@ -103,9 +103,6 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp
const std::string old_filename = LLDiskCache::metaDataToFilepath(old_file_id, old_file_type);
const std::string new_filename = LLDiskCache::metaDataToFilepath(new_file_id, new_file_type);
// Rename needs the new file to not exist.
LLFileSystem::removeFile(new_file_id, new_file_type, ENOENT);
if (LLFile::rename(old_filename, new_filename) != 0)
{
// We would like to return false here indicating the operation
+29 -75
View File
@@ -34,19 +34,6 @@
#include "../test/lltut.h"
#include "stringize.h"
#include <boost/assign/list_of.hpp>
using boost::assign::list_of;
// We use ensure_equals(..., vec(list_of(...))) not because it's functionally
// required, but because ensure_equals() knows how to format a StringVec.
// Turns out that when ensure_equals() displays a test failure with just
// list_of("string")("another"), you see 'stringanother' vs. '("string",
// "another")'.
StringVec vec(const StringVec& v)
{
return v;
}
// For some tests, use a dummy LLDir that uses memory data instead of touching
// the filesystem
@@ -590,20 +577,18 @@ namespace tut
// top-level directory of a skin isn't localized
ensure_equals(lldir.findSkinnedFilenames(LLDir::SKINBASE, "colors.xml", LLDir::ALL_SKINS),
vec(list_of("install/skins/default/colors.xml")
("user/skins/default/colors.xml")));
StringVec{ "install/skins/default/colors.xml", "user/skins/default/colors.xml" });
// We should not have needed to check for skins/default/en. We should
// just "know" that SKINBASE is not localized.
lldir.ensure_not_checked("install/skins/default/en");
ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_default.jpeg"),
vec(list_of("install/skins/default/textures/only_default.jpeg")));
StringVec{ "install/skins/default/textures/only_default.jpeg" });
// Nor should we have needed to check skins/default/textures/en
// because textures is known not to be localized.
lldir.ensure_not_checked("install/skins/default/textures/en");
StringVec expected(vec(list_of("install/skins/default/xui/en/strings.xml")
("user/skins/default/xui/en/strings.xml")));
StringVec expected(StringVec{ "install/skins/default/xui/en/strings.xml", "user/skins/default/xui/en/strings.xml" });
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS),
expected);
// The first time, we had to probe to find out whether xui was localized.
@@ -616,23 +601,19 @@ namespace tut
lldir.ensure_not_checked("install/skins/default/xui/en");
// localized subdir with "en-us" instead of "en"
ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"),
vec(list_of("install/skins/default/html/en-us/welcome.html")));
ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), StringVec{ "install/skins/default/html/en-us/welcome.html" });
lldir.ensure_checked("install/skins/default/html/en");
lldir.ensure_checked("install/skins/default/html/en-us");
lldir.clear_checked();
ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"),
vec(list_of("install/skins/default/html/en-us/welcome.html")));
ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), StringVec{ "install/skins/default/html/en-us/welcome.html" });
lldir.ensure_not_checked("install/skins/default/html/en");
lldir.ensure_not_checked("install/skins/default/html/en-us");
ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"),
vec(list_of("install/skins/default/future/somefile.txt")));
ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"), StringVec{ "install/skins/default/future/somefile.txt" });
// Test probing for an unrecognized unlocalized future subdir.
lldir.ensure_checked("install/skins/default/future/en");
lldir.clear_checked();
ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"),
vec(list_of("install/skins/default/future/somefile.txt")));
ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"), StringVec{ "install/skins/default/future/somefile.txt" });
// Second time it should remember that future is unlocalized.
lldir.ensure_not_checked("install/skins/default/future/en");
@@ -643,8 +624,7 @@ namespace tut
// make the default localization be "en" and allow "en-gb" (or
// whatever) localizations, which would work much more the way you'd
// expect.
ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"),
vec(list_of("install/skins/default/html/en-us/welcome.html")));
ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), StringVec{ "install/skins/default/html/en-us/welcome.html" });
/*------------------------ "default", "fr" -------------------------*/
// We start being able to distinguish localized subdirs from
@@ -654,100 +634,74 @@ namespace tut
// pass merge=true to request this filename in all relevant skins
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS),
vec(list_of
("install/skins/default/xui/en/strings.xml")
("install/skins/default/xui/fr/strings.xml")
("user/skins/default/xui/en/strings.xml")
("user/skins/default/xui/fr/strings.xml")));
StringVec{ "install/skins/default/xui/en/strings.xml", "install/skins/default/xui/fr/strings.xml",
"user/skins/default/xui/en/strings.xml", "user/skins/default/xui/fr/strings.xml" });
// pass (or default) merge=false to request only most specific skin
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"),
vec(list_of
("user/skins/default/xui/en/strings.xml")
("user/skins/default/xui/fr/strings.xml")));
StringVec{ "user/skins/default/xui/en/strings.xml", "user/skins/default/xui/fr/strings.xml" });
// Our dummy floater.xml has a user localization (for "fr") but no
// English override. This is a case in which CURRENT_SKIN nonetheless
// returns paths from two different skins.
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "floater.xml"),
vec(list_of
("install/skins/default/xui/en/floater.xml")
("user/skins/default/xui/fr/floater.xml")));
StringVec{ "install/skins/default/xui/en/floater.xml", "user/skins/default/xui/fr/floater.xml" });
// Our dummy newfile.xml has an English override but no user
// localization. This is another case in which CURRENT_SKIN
// nonetheless returns paths from two different skins.
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "newfile.xml"),
vec(list_of
("user/skins/default/xui/en/newfile.xml")
("install/skins/default/xui/fr/newfile.xml")));
StringVec{ "user/skins/default/xui/en/newfile.xml", "install/skins/default/xui/fr/newfile.xml" });
ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"),
vec(list_of
("install/skins/default/html/en-us/welcome.html")
("install/skins/default/html/fr/welcome.html")));
StringVec{ "install/skins/default/html/en-us/welcome.html", "install/skins/default/html/fr/welcome.html" });
/*------------------------ "default", "zh" -------------------------*/
lldir.setSkinFolder("default", "zh");
// Because strings.xml has only a "fr" override but no "zh" override
// in any skin, the most localized version we can find is "en".
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"),
vec(list_of("user/skins/default/xui/en/strings.xml")));
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"), StringVec{ "user/skins/default/xui/en/strings.xml" });
/*------------------------- "steam", "en" --------------------------*/
lldir.setSkinFolder("steam", "en");
ensure_equals(lldir.findSkinnedFilenames(LLDir::SKINBASE, "colors.xml", LLDir::ALL_SKINS),
vec(list_of
("install/skins/default/colors.xml")
("install/skins/steam/colors.xml")
("user/skins/default/colors.xml")
("user/skins/steam/colors.xml")));
StringVec{ "install/skins/default/colors.xml", "install/skins/steam/colors.xml", "user/skins/default/colors.xml",
"user/skins/steam/colors.xml" });
ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_default.jpeg"),
vec(list_of("install/skins/default/textures/only_default.jpeg")));
StringVec{ "install/skins/default/textures/only_default.jpeg" });
ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_steam.jpeg"),
vec(list_of("install/skins/steam/textures/only_steam.jpeg")));
StringVec{ "install/skins/steam/textures/only_steam.jpeg" });
ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_user_default.jpeg"),
vec(list_of("user/skins/default/textures/only_user_default.jpeg")));
StringVec{ "user/skins/default/textures/only_user_default.jpeg" });
ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_user_steam.jpeg"),
vec(list_of("user/skins/steam/textures/only_user_steam.jpeg")));
StringVec{ "user/skins/steam/textures/only_user_steam.jpeg" });
// CURRENT_SKIN
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"),
vec(list_of("user/skins/steam/xui/en/strings.xml")));
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"), StringVec{ "user/skins/steam/xui/en/strings.xml" });
// pass constraint=ALL_SKINS to request this filename in all relevant skins
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS),
vec(list_of
("install/skins/default/xui/en/strings.xml")
("install/skins/steam/xui/en/strings.xml")
("user/skins/default/xui/en/strings.xml")
("user/skins/steam/xui/en/strings.xml")));
StringVec{ "install/skins/default/xui/en/strings.xml", "install/skins/steam/xui/en/strings.xml",
"user/skins/default/xui/en/strings.xml", "user/skins/steam/xui/en/strings.xml" });
/*------------------------- "steam", "fr" --------------------------*/
lldir.setSkinFolder("steam", "fr");
// pass CURRENT_SKIN to request only the most specialized files
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"),
vec(list_of
("user/skins/steam/xui/en/strings.xml")
("user/skins/steam/xui/fr/strings.xml")));
StringVec{ "user/skins/steam/xui/en/strings.xml", "user/skins/steam/xui/fr/strings.xml" });
// pass ALL_SKINS to request this filename in all relevant skins
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS),
vec(list_of
("install/skins/default/xui/en/strings.xml")
("install/skins/default/xui/fr/strings.xml")
("install/skins/steam/xui/en/strings.xml")
("install/skins/steam/xui/fr/strings.xml")
("user/skins/default/xui/en/strings.xml")
("user/skins/default/xui/fr/strings.xml")
("user/skins/steam/xui/en/strings.xml")
("user/skins/steam/xui/fr/strings.xml")));
StringVec{ "install/skins/default/xui/en/strings.xml", "install/skins/default/xui/fr/strings.xml",
"install/skins/steam/xui/en/strings.xml", "install/skins/steam/xui/fr/strings.xml",
"user/skins/default/xui/en/strings.xml", "user/skins/default/xui/fr/strings.xml",
"user/skins/steam/xui/en/strings.xml", "user/skins/steam/xui/fr/strings.xml" });
}
template<> template<>
+1 -1
View File
@@ -67,7 +67,7 @@ private:
LLImageDecodeThread::LLImageDecodeThread(bool /*threaded*/)
: mDecodeCount(0)
{
mThreadPool.reset(new LL::ThreadPool("ImageDecode", 8));
mThreadPool = std::make_unique<LL::ThreadPool>("ImageDecode", 8);
mThreadPool->start();
}

Some files were not shown because too many files have changed in this diff Show More