DRTVWR-558: Merge branch 'main' of secondlife/viewer into actions
commit
7efe727f26
|
|
@ -0,0 +1,78 @@
|
|||
llappearance:
|
||||
- indra/llappearance/**/*
|
||||
|
||||
llaudio:
|
||||
- indra/llaudio/**/*
|
||||
|
||||
llcharacter:
|
||||
- indra/llcharacter/**/*
|
||||
|
||||
llcommon:
|
||||
- indra/llcommon/**/*
|
||||
|
||||
llcorehttp:
|
||||
- indra/llcorehttp/**/*
|
||||
|
||||
llcrashlogger:
|
||||
- indra/llcrashlogger/**/*
|
||||
|
||||
llfilesystem:
|
||||
- indra/llfilesystem/**/*
|
||||
|
||||
llimage:
|
||||
- indra/llimage/**/*
|
||||
|
||||
llimagej2coj:
|
||||
- indra/llimagej2coj/**/*
|
||||
|
||||
llinventory:
|
||||
- indra/llinventory/**/*
|
||||
|
||||
llkdu:
|
||||
- indra/llkdu/**/*
|
||||
|
||||
llmath:
|
||||
- indra/llmath/**/*
|
||||
|
||||
llmeshoptimizer:
|
||||
- indra/llmeshoptimizer/**/*
|
||||
|
||||
llmessage:
|
||||
- indra/llmessage/**/*
|
||||
|
||||
llplugin:
|
||||
- indra/llplugin/**/*
|
||||
|
||||
llprimitive:
|
||||
- indra/llprimitive/**/*
|
||||
|
||||
llrender:
|
||||
- indra/llrender/**/*
|
||||
|
||||
llui:
|
||||
- indra/llui/**/*
|
||||
|
||||
llwindow:
|
||||
- indra/llwindow/**/*
|
||||
|
||||
llxml:
|
||||
- indra/llxml/**/*
|
||||
|
||||
cmake:
|
||||
- '**/*.cmake'
|
||||
- '**/*/cmake/*'
|
||||
- '**/CMakeLists.txt'
|
||||
|
||||
python:
|
||||
- '**/*.py'
|
||||
|
||||
c/cpp:
|
||||
- '**/*.c'
|
||||
- '**/*.cpp'
|
||||
- '**/*.cxx'
|
||||
- '**/*.h'
|
||||
- '**/*.hpp'
|
||||
- '**/*.hxx'
|
||||
- '**/*.i'
|
||||
- '**/*.inl'
|
||||
- '**/*.y'
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
name: Check CLA
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_target:
|
||||
types: [opened, closed, synchronize]
|
||||
|
||||
jobs:
|
||||
cla:
|
||||
name: Check CLA
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: CLA Assistant
|
||||
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
|
||||
uses: secondlife-3p/contributor-assistant@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PERSONAL_ACCESS_TOKEN: ${{ secrets.SHARED_CLA_TOKEN }}
|
||||
with:
|
||||
branch: main
|
||||
path-to-document: https://github.com/secondlife/cla/blob/master/CLA.md
|
||||
path-to-signatures: signatures.json
|
||||
remote-organization-name: secondlife
|
||||
remote-repository-name: cla-signatures
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
name: Pull Request Labeler
|
||||
on:
|
||||
- pull_request_target
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@v4
|
||||
with:
|
||||
configuration-path: .github/labeler.yaml
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
name: Stale PRs
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: 0 0 * * *
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
id: stale
|
||||
with:
|
||||
stale-pr-message: This pull request is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 7 days
|
||||
days-before-stale: 60
|
||||
days-before-close: 7
|
||||
exempt-pr-labels: blocked,must,should,keep
|
||||
stale-pr-label: stale
|
||||
- name: Print outputs
|
||||
run: echo ${{ join(steps.stale.outputs.*, ',') }}
|
||||
|
|
@ -1,4 +1,8 @@
|
|||

|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="doc/sl-logo-dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="doc/sl-logo.png">
|
||||
<img alt="Second Life Logo" src="doc/sl-logo.png">
|
||||
</picture>
|
||||
|
||||
**[Second Life][] is a free 3D virtual world where users can create, connect and chat with others from around the
|
||||
world.** This repository contains the source code for the official client.
|
||||
|
|
|
|||
974
autobuild.xml
974
autobuild.xml
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,502 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
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
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
|
@ -236,6 +236,8 @@ Ansariel Hiller
|
|||
SL-15226
|
||||
SL-15227
|
||||
SL-15398
|
||||
SL-18432
|
||||
SL-4126
|
||||
Aralara Rajal
|
||||
Arare Chantilly
|
||||
CHUIBUG-191
|
||||
|
|
@ -281,6 +283,12 @@ Beq Janus
|
|||
SL-11300
|
||||
SL-15709
|
||||
SL-16021
|
||||
SL-18202
|
||||
SL-18586
|
||||
SL-18592
|
||||
SL-18637
|
||||
SL-19317
|
||||
SL-19660
|
||||
Beth Walcher
|
||||
Bezilon Kasei
|
||||
Biancaluce Robbiani
|
||||
|
|
@ -371,6 +379,7 @@ Charlie Sazaland
|
|||
Chaser Zaks
|
||||
BUG-225599
|
||||
BUG-227485
|
||||
SL-16874
|
||||
Cherry Cheevers
|
||||
ChickyBabes Zuzu
|
||||
Chorazin Allen
|
||||
|
|
@ -401,6 +410,7 @@ Cinder Roxley
|
|||
STORM-2127
|
||||
STORM-2144
|
||||
SL-3404
|
||||
SL-17634
|
||||
Clara Young
|
||||
Coaldust Numbers
|
||||
VWR-1095
|
||||
|
|
@ -487,6 +497,8 @@ Evangelista Emerald
|
|||
Faelon Swordthain
|
||||
Farallon Greyskin
|
||||
VWR-2036
|
||||
Fawrsk
|
||||
SL-18893
|
||||
Feep Larsson
|
||||
VWR-447
|
||||
VWR-1314
|
||||
|
|
@ -579,6 +591,8 @@ Henri Beauchamp
|
|||
VWR-1320
|
||||
VWR-1406
|
||||
VWR-4157
|
||||
SL-15175
|
||||
SL-19110
|
||||
herina Bode
|
||||
Hikkoshi Sakai
|
||||
VWR-429
|
||||
|
|
@ -1123,6 +1137,7 @@ Nicky Dasmijn
|
|||
SL-16438
|
||||
SL-17218
|
||||
SL-17238
|
||||
SL-17585
|
||||
Nicky Perian
|
||||
OPEN-1
|
||||
STORM-1087
|
||||
|
|
@ -1168,6 +1183,10 @@ Ollie Kubrick
|
|||
Orenj Marat
|
||||
Orion Delphis
|
||||
Oryx Tempel
|
||||
PanteraPolnocy
|
||||
SL-18891
|
||||
SL-18904
|
||||
SL-18937
|
||||
Parvati Silverweb
|
||||
Patric Mills
|
||||
VWR-2645
|
||||
|
|
@ -1378,6 +1397,7 @@ Sovereign Engineer
|
|||
OPEN-343
|
||||
SL-11625
|
||||
BUG-229030
|
||||
SL-14696
|
||||
SL-14705
|
||||
SL-14706
|
||||
SL-14707
|
||||
|
|
@ -1385,6 +1405,12 @@ Sovereign Engineer
|
|||
SL-14732
|
||||
SL-15096
|
||||
SL-16127
|
||||
SL-18249
|
||||
SL-18394
|
||||
SL-18412
|
||||
SL-18497
|
||||
SL-18525
|
||||
SL-18534
|
||||
SpacedOut Frye
|
||||
VWR-34
|
||||
VWR-45
|
||||
|
|
@ -1647,6 +1673,8 @@ Zi Ree
|
|||
VWR-25588
|
||||
STORM-1790
|
||||
STORM-1842
|
||||
SL-18348
|
||||
SL-18593
|
||||
Zipherius Turas
|
||||
VWR-76
|
||||
VWR-77
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
|
|
@ -54,7 +54,7 @@ if(WINDOWS)
|
|||
|
||||
set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
|
||||
set(release_files
|
||||
openjpeg.dll
|
||||
openjp2.dll
|
||||
libapr-1.dll
|
||||
libaprutil-1.dll
|
||||
libapriconv-1.dll
|
||||
|
|
@ -220,6 +220,7 @@ elseif(LINUX)
|
|||
libfreetype.so.6.6.2
|
||||
libfreetype.so.6
|
||||
libhunspell-1.3.so.0.0.0
|
||||
libopenjp2.so
|
||||
libuuid.so.16
|
||||
libuuid.so.16.0.22
|
||||
libfontconfig.so.1.8.0
|
||||
|
|
@ -295,6 +296,6 @@ if(DARWIN)
|
|||
# that end up in any of the above SHARED_LIB_STAGING_DIR_MUMBLE
|
||||
# directories.
|
||||
add_custom_command( TARGET stage_third_party_libs POST_BUILD
|
||||
COMMAND cmake -E create_symlink ${SHARED_LIB_STAGING_DIR} ${CMAKE_BINARY_DIR}/sharedlibs/Resources
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${SHARED_LIB_STAGING_DIR} ${CMAKE_BINARY_DIR}/sharedlibs/Resources
|
||||
)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ include(APR)
|
|||
include(Boost)
|
||||
include(EXPAT)
|
||||
include(Tracy)
|
||||
include(xxHash)
|
||||
include(ZLIBNG)
|
||||
include(JsonCpp)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ add_library( ll::openjpeg INTERFACE IMPORTED )
|
|||
use_system_binary(openjpeg)
|
||||
use_prebuilt_binary(openjpeg)
|
||||
|
||||
target_link_libraries(ll::openjpeg INTERFACE openjpeg )
|
||||
target_link_libraries(ll::openjpeg INTERFACE openjp2 )
|
||||
target_include_directories( ll::openjpeg SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/openjpeg)
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/Server.cmake)
|
|||
set(INSTALL_PROPRIETARY ON CACHE BOOL "Install proprietary binaries")
|
||||
endif (EXISTS ${CMAKE_SOURCE_DIR}/Server.cmake)
|
||||
set(TEMPLATE_VERIFIER_OPTIONS "" CACHE STRING "Options for scripts/template_verifier.py")
|
||||
set(TEMPLATE_VERIFIER_MASTER_URL "https://bitbucket.org/lindenlab/master-message-template-git/raw/master/message_template.msg" CACHE STRING "Location of the master message template")
|
||||
set(TEMPLATE_VERIFIER_MASTER_URL "https://github.com/secondlife/master-message-template/raw/master/message_template.msg" CACHE STRING "Location of the master message template")
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
|
||||
|
|
@ -191,9 +191,15 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|||
# development must be done after the build as we do in viewer_manifest.py for
|
||||
# released builds
|
||||
# https://stackoverflow.com/a/54296008
|
||||
# With Xcode 14.1, apparently you must take drastic steps to prevent
|
||||
# implicit signing.
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
|
||||
# "-" represents "Sign to Run Locally" and empty string represents "Do Not Sign"
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
|
||||
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION NO)
|
||||
set(CMAKE_OSX_ARCHITECTURES "${ARCH}")
|
||||
string(REPLACE "i686" "i386" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
|
||||
string(REPLACE "AMD64" "x86_64" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
# -*- cmake -*-
|
||||
if (XXHASH_CMAKE_INCLUDED)
|
||||
return()
|
||||
endif (XXHASH_CMAKE_INCLUDED)
|
||||
set (XXHASH_CMAKE_INCLUDED TRUE)
|
||||
|
||||
include(Prebuilt)
|
||||
use_prebuilt_binary(xxhash)
|
||||
|
|
@ -1,4 +1 @@
|
|||
euclid 5/29/2020
|
||||
euclid 7/23/2020
|
||||
euclid 4/29/2021
|
||||
euclid 10/5/2021 DRTVWR-546
|
||||
|
||||
|
|
|
|||
|
|
@ -214,12 +214,10 @@ void LLAvatarAppearance::initInstance()
|
|||
mRoot = createAvatarJoint();
|
||||
mRoot->setName( "mRoot" );
|
||||
|
||||
for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = sAvatarDictionary->getMeshEntries().begin();
|
||||
iter != sAvatarDictionary->getMeshEntries().end();
|
||||
++iter)
|
||||
for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
|
||||
{
|
||||
const EMeshIndex mesh_index = iter->first;
|
||||
const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second;
|
||||
const EMeshIndex mesh_index = mesh_pair.first;
|
||||
const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
|
||||
LLAvatarJoint* joint = createAvatarJoint();
|
||||
joint->setName(mesh_dict->mName);
|
||||
joint->setMeshID(mesh_index);
|
||||
|
|
@ -260,21 +258,16 @@ void LLAvatarAppearance::initInstance()
|
|||
//-------------------------------------------------------------------------
|
||||
// associate baked textures with meshes
|
||||
//-------------------------------------------------------------------------
|
||||
for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = sAvatarDictionary->getMeshEntries().begin();
|
||||
iter != sAvatarDictionary->getMeshEntries().end();
|
||||
++iter)
|
||||
for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
|
||||
{
|
||||
const EMeshIndex mesh_index = iter->first;
|
||||
const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second;
|
||||
const EMeshIndex mesh_index = mesh_pair.first;
|
||||
const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
|
||||
const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID;
|
||||
// Skip it if there's no associated baked texture.
|
||||
if (baked_texture_index == BAKED_NUM_INDICES) continue;
|
||||
|
||||
for (avatar_joint_mesh_list_t::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin();
|
||||
iter != mMeshLOD[mesh_index]->mMeshParts.end();
|
||||
++iter)
|
||||
for (LLAvatarJointMesh* mesh : mMeshLOD[mesh_index]->mMeshParts)
|
||||
{
|
||||
LLAvatarJointMesh* mesh = (*iter);
|
||||
mBakedTextureDatas[(S32)baked_texture_index].mJointMeshes.push_back(mesh);
|
||||
}
|
||||
}
|
||||
|
|
@ -297,15 +290,18 @@ LLAvatarAppearance::~LLAvatarAppearance()
|
|||
delete_and_clear(mBakedTextureDatas[i].mTexLayerSet);
|
||||
mBakedTextureDatas[i].mJointMeshes.clear();
|
||||
|
||||
for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin();
|
||||
iter2 != mBakedTextureDatas[i].mMaskedMorphs.end(); iter2++)
|
||||
for (LLMaskedMorph* masked_morph : mBakedTextureDatas[i].mMaskedMorphs)
|
||||
{
|
||||
LLMaskedMorph* masked_morph = (*iter2);
|
||||
delete masked_morph;
|
||||
}
|
||||
}
|
||||
|
||||
if (mRoot) mRoot->removeAllChildren();
|
||||
if (mRoot)
|
||||
{
|
||||
mRoot->removeAllChildren();
|
||||
delete mRoot;
|
||||
mRoot = nullptr;
|
||||
}
|
||||
mJointMap.clear();
|
||||
|
||||
clearSkeleton();
|
||||
|
|
@ -314,11 +310,8 @@ LLAvatarAppearance::~LLAvatarAppearance()
|
|||
std::for_each(mPolyMeshes.begin(), mPolyMeshes.end(), DeletePairedPointer());
|
||||
mPolyMeshes.clear();
|
||||
|
||||
for (avatar_joint_list_t::iterator jointIter = mMeshLOD.begin();
|
||||
jointIter != mMeshLOD.end();
|
||||
++jointIter)
|
||||
for (LLAvatarJoint* joint : mMeshLOD)
|
||||
{
|
||||
LLAvatarJoint* joint = *jointIter;
|
||||
std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer());
|
||||
joint->mMeshParts.clear();
|
||||
}
|
||||
|
|
@ -472,10 +465,9 @@ void LLAvatarAppearance::compareJointStateMaps(joint_state_map_t& last_state,
|
|||
if (!last_state.empty() && (last_state != curr_state))
|
||||
{
|
||||
S32 diff_count = 0;
|
||||
joint_state_map_t::iterator it;
|
||||
for (it=last_state.begin(); it != last_state.end(); ++it)
|
||||
for (joint_state_map_t::value_type& pair : last_state)
|
||||
{
|
||||
const std::string& key = it->first;
|
||||
const std::string& key = pair.first;
|
||||
if (last_state[key] != curr_state[key])
|
||||
{
|
||||
LL_DEBUGS("AvatarBodySize") << "BodySize change " << key << " " << last_state[key] << "->" << curr_state[key] << LL_ENDL;
|
||||
|
|
@ -685,10 +677,8 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
|
|||
|
||||
|
||||
// setup children
|
||||
LLAvatarBoneInfo::bones_t::const_iterator iter;
|
||||
for (iter = info->mChildren.begin(); iter != info->mChildren.end(); ++iter)
|
||||
for (LLAvatarBoneInfo* child_info : info->mChildren)
|
||||
{
|
||||
LLAvatarBoneInfo *child_info = *iter;
|
||||
if (!setupBone(child_info, joint, volume_num, joint_num))
|
||||
{
|
||||
return FALSE;
|
||||
|
|
@ -740,10 +730,8 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
|
|||
|
||||
S32 current_joint_num = 0;
|
||||
S32 current_volume_num = 0;
|
||||
LLAvatarSkeletonInfo::bone_info_list_t::const_iterator iter;
|
||||
for (iter = info->mBoneInfoList.begin(); iter != info->mBoneInfoList.end(); ++iter)
|
||||
for (LLAvatarBoneInfo* bone_info : info->mBoneInfoList)
|
||||
{
|
||||
LLAvatarBoneInfo *bone_info = *iter;
|
||||
if (!setupBone(bone_info, NULL, current_volume_num, current_joint_num))
|
||||
{
|
||||
LL_ERRS() << "Error parsing bone in skeleton file" << LL_ENDL;
|
||||
|
|
@ -821,14 +809,10 @@ void LLAvatarAppearance::buildCharacter()
|
|||
//-------------------------------------------------------------------------
|
||||
// clear mesh data
|
||||
//-------------------------------------------------------------------------
|
||||
for (avatar_joint_list_t::iterator jointIter = mMeshLOD.begin();
|
||||
jointIter != mMeshLOD.end(); ++jointIter)
|
||||
for (LLAvatarJoint* joint : mMeshLOD)
|
||||
{
|
||||
LLAvatarJoint* joint = *jointIter;
|
||||
for (avatar_joint_mesh_list_t::iterator meshIter = joint->mMeshParts.begin();
|
||||
meshIter != joint->mMeshParts.end(); ++meshIter)
|
||||
for (LLAvatarJointMesh* mesh : joint->mMeshParts)
|
||||
{
|
||||
LLAvatarJointMesh * mesh = *meshIter;
|
||||
mesh->setMesh(NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -927,6 +911,9 @@ BOOL LLAvatarAppearance::loadAvatar()
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// initialize mJointAliasMap
|
||||
getJointAliases();
|
||||
|
||||
// avatar_lad.xml : <skeleton>
|
||||
if( !loadSkeletonNode() )
|
||||
{
|
||||
|
|
@ -999,12 +986,8 @@ BOOL LLAvatarAppearance::loadAvatar()
|
|||
}
|
||||
|
||||
// avatar_lad.xml : <morph_masks>
|
||||
for (LLAvatarXmlInfo::morph_info_list_t::iterator iter = sAvatarXmlInfo->mMorphMaskInfoList.begin();
|
||||
iter != sAvatarXmlInfo->mMorphMaskInfoList.end();
|
||||
++iter)
|
||||
for (LLAvatarXmlInfo::LLAvatarMorphInfo* info : sAvatarXmlInfo->mMorphMaskInfoList)
|
||||
{
|
||||
LLAvatarXmlInfo::LLAvatarMorphInfo *info = *iter;
|
||||
|
||||
EBakedTextureIndex baked = sAvatarDictionary->findBakedByRegionName(info->mRegion);
|
||||
if (baked != BAKED_NUM_INDICES)
|
||||
{
|
||||
|
|
@ -1023,11 +1006,8 @@ BOOL LLAvatarAppearance::loadAvatar()
|
|||
loadLayersets();
|
||||
|
||||
// avatar_lad.xml : <driver_parameters>
|
||||
for (LLAvatarXmlInfo::driver_info_list_t::iterator iter = sAvatarXmlInfo->mDriverInfoList.begin();
|
||||
iter != sAvatarXmlInfo->mDriverInfoList.end();
|
||||
++iter)
|
||||
for (LLDriverParamInfo* info : sAvatarXmlInfo->mDriverInfoList)
|
||||
{
|
||||
LLDriverParamInfo *info = *iter;
|
||||
LLDriverParam* driver_param = new LLDriverParam( this );
|
||||
if (driver_param->setInfo(info))
|
||||
{
|
||||
|
|
@ -1047,7 +1027,6 @@ BOOL LLAvatarAppearance::loadAvatar()
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1060,11 +1039,8 @@ BOOL LLAvatarAppearance::loadSkeletonNode ()
|
|||
mRoot->addChild( mSkeleton[0] );
|
||||
|
||||
// make meshes children before calling parent version of the function
|
||||
for (avatar_joint_list_t::iterator iter = mMeshLOD.begin();
|
||||
iter != mMeshLOD.end();
|
||||
++iter)
|
||||
for (LLAvatarJoint* joint : mMeshLOD)
|
||||
{
|
||||
LLAvatarJoint *joint = *iter;
|
||||
joint->mUpdateXform = FALSE;
|
||||
joint->setMeshesToChildren();
|
||||
}
|
||||
|
|
@ -1096,12 +1072,9 @@ BOOL LLAvatarAppearance::loadSkeletonNode ()
|
|||
|
||||
// SKELETAL DISTORTIONS
|
||||
{
|
||||
LLAvatarXmlInfo::skeletal_distortion_info_list_t::iterator iter;
|
||||
for (iter = sAvatarXmlInfo->mSkeletalDistortionInfoList.begin();
|
||||
iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end();
|
||||
++iter)
|
||||
for (LLViewerVisualParamInfo* visual_param_info : sAvatarXmlInfo->mSkeletalDistortionInfoList)
|
||||
{
|
||||
LLPolySkeletalDistortionInfo *info = (LLPolySkeletalDistortionInfo*)*iter;
|
||||
LLPolySkeletalDistortionInfo *info = (LLPolySkeletalDistortionInfo*)visual_param_info;
|
||||
LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this);
|
||||
if (!param->setInfo(info))
|
||||
{
|
||||
|
|
@ -1125,11 +1098,8 @@ BOOL LLAvatarAppearance::loadSkeletonNode ()
|
|||
//-----------------------------------------------------------------------------
|
||||
BOOL LLAvatarAppearance::loadMeshNodes()
|
||||
{
|
||||
for (LLAvatarXmlInfo::mesh_info_list_t::const_iterator meshinfo_iter = sAvatarXmlInfo->mMeshInfoList.begin();
|
||||
meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end();
|
||||
++meshinfo_iter)
|
||||
for (const LLAvatarXmlInfo::LLAvatarMeshInfo* info : sAvatarXmlInfo->mMeshInfoList)
|
||||
{
|
||||
const LLAvatarXmlInfo::LLAvatarMeshInfo *info = *meshinfo_iter;
|
||||
const std::string &type = info->mType;
|
||||
S32 lod = info->mLOD;
|
||||
|
||||
|
|
@ -1141,12 +1111,10 @@ BOOL LLAvatarAppearance::loadMeshNodes()
|
|||
switch(lod)
|
||||
case 0:
|
||||
mesh = &mHairMesh0; */
|
||||
for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator mesh_iter = sAvatarDictionary->getMeshEntries().begin();
|
||||
mesh_iter != sAvatarDictionary->getMeshEntries().end();
|
||||
++mesh_iter)
|
||||
for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
|
||||
{
|
||||
const EMeshIndex mesh_index = mesh_iter->first;
|
||||
const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_iter->second;
|
||||
const EMeshIndex mesh_index = mesh_pair.first;
|
||||
const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
|
||||
if (type.compare(mesh_dict->mName) == 0)
|
||||
{
|
||||
mesh_id = mesh_index;
|
||||
|
|
@ -1214,20 +1182,17 @@ BOOL LLAvatarAppearance::loadMeshNodes()
|
|||
mesh->setMesh( poly_mesh );
|
||||
mesh->setLOD( info->mMinPixelArea );
|
||||
|
||||
for (LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_list_t::const_iterator xmlinfo_iter = info->mPolyMorphTargetInfoList.begin();
|
||||
xmlinfo_iter != info->mPolyMorphTargetInfoList.end();
|
||||
++xmlinfo_iter)
|
||||
for (const LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_pair_t& info_pair : info->mPolyMorphTargetInfoList)
|
||||
{
|
||||
const LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_pair_t *info_pair = &(*xmlinfo_iter);
|
||||
LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh());
|
||||
if (!param->setInfo((LLPolyMorphTargetInfo*)info_pair->first))
|
||||
if (!param->setInfo((LLPolyMorphTargetInfo*)info_pair.first))
|
||||
{
|
||||
delete param;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (info_pair->second)
|
||||
if (info_pair.second)
|
||||
{
|
||||
addSharedVisualParam(param);
|
||||
param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
|
||||
|
|
@ -1250,11 +1215,8 @@ BOOL LLAvatarAppearance::loadMeshNodes()
|
|||
BOOL LLAvatarAppearance::loadLayersets()
|
||||
{
|
||||
BOOL success = TRUE;
|
||||
for (LLAvatarXmlInfo::layer_info_list_t::const_iterator layerset_iter = sAvatarXmlInfo->mLayerInfoList.begin();
|
||||
layerset_iter != sAvatarXmlInfo->mLayerInfoList.end();
|
||||
++layerset_iter)
|
||||
for (LLTexLayerSetInfo* layerset_info : sAvatarXmlInfo->mLayerInfoList)
|
||||
{
|
||||
LLTexLayerSetInfo *layerset_info = *layerset_iter;
|
||||
if (isSelf())
|
||||
{
|
||||
// Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
|
||||
|
|
@ -1270,14 +1232,12 @@ BOOL LLAvatarAppearance::loadLayersets()
|
|||
|
||||
// scan baked textures and associate the layerset with the appropriate one
|
||||
EBakedTextureIndex baked_index = BAKED_NUM_INDICES;
|
||||
for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
|
||||
baked_iter != sAvatarDictionary->getBakedTextures().end();
|
||||
++baked_iter)
|
||||
for (const LLAvatarAppearanceDictionary::BakedTextures::value_type& baked_pair : sAvatarDictionary->getBakedTextures())
|
||||
{
|
||||
const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
|
||||
const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_pair.second;
|
||||
if (layer_set->isBodyRegion(baked_dict->mName))
|
||||
{
|
||||
baked_index = baked_iter->first;
|
||||
baked_index = baked_pair.first;
|
||||
// ensure both structures are aware of each other
|
||||
mBakedTextureDatas[baked_index].mTexLayerSet = layer_set;
|
||||
layer_set->setBakedTexIndex(baked_index);
|
||||
|
|
@ -1293,11 +1253,8 @@ BOOL LLAvatarAppearance::loadLayersets()
|
|||
}
|
||||
|
||||
// scan morph masks and let any affected layers know they have an associated morph
|
||||
for (LLAvatarAppearance::morph_list_t::const_iterator morph_iter = mBakedTextureDatas[baked_index].mMaskedMorphs.begin();
|
||||
morph_iter != mBakedTextureDatas[baked_index].mMaskedMorphs.end();
|
||||
++morph_iter)
|
||||
for (LLMaskedMorph* morph : mBakedTextureDatas[baked_index].mMaskedMorphs)
|
||||
{
|
||||
LLMaskedMorph *morph = *morph_iter;
|
||||
LLTexLayerInterface* layer = layer_set->findLayerByName(morph->mLayer);
|
||||
if (layer)
|
||||
{
|
||||
|
|
@ -1313,7 +1270,6 @@ BOOL LLAvatarAppearance::loadLayersets()
|
|||
else // !isSelf()
|
||||
{
|
||||
// Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
|
||||
LLTexLayerSetInfo *layerset_info = *layerset_iter;
|
||||
layerset_info->createVisualParams(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -1740,13 +1696,13 @@ void LLAvatarAppearance::makeJointAliases(LLAvatarBoneInfo *bone_info)
|
|||
|
||||
boost::char_separator<char> sep(" ");
|
||||
boost::tokenizer<boost::char_separator<char> > tok(aliases, sep);
|
||||
for(boost::tokenizer<boost::char_separator<char> >::iterator i = tok.begin(); i != tok.end(); ++i)
|
||||
for(const std::string& i : tok)
|
||||
{
|
||||
if ( mJointAliasMap.find(*i) != mJointAliasMap.end() )
|
||||
if ( mJointAliasMap.find(i) != mJointAliasMap.end() )
|
||||
{
|
||||
LL_WARNS() << "avatar skeleton: Joint alias \"" << *i << "\" remapped from " << mJointAliasMap[*i] << " to " << bone_name << LL_ENDL;
|
||||
LL_WARNS() << "avatar skeleton: Joint alias \"" << i << "\" remapped from " << mJointAliasMap[i] << " to " << bone_name << LL_ENDL;
|
||||
}
|
||||
mJointAliasMap[*i] = bone_name;
|
||||
mJointAliasMap[i] = bone_name;
|
||||
}
|
||||
|
||||
for (LLAvatarBoneInfo* bone : bone_info->mChildren)
|
||||
|
|
@ -1761,21 +1717,14 @@ const LLAvatarAppearance::joint_alias_map_t& LLAvatarAppearance::getJointAliases
|
|||
if (mJointAliasMap.empty())
|
||||
{
|
||||
|
||||
LLAvatarSkeletonInfo::bone_info_list_t::const_iterator iter;
|
||||
for (iter = sAvatarSkeletonInfo->mBoneInfoList.begin();
|
||||
iter != sAvatarSkeletonInfo->mBoneInfoList.end();
|
||||
++iter)
|
||||
for (LLAvatarBoneInfo* bone_info : sAvatarSkeletonInfo->mBoneInfoList)
|
||||
{
|
||||
//LLAvatarBoneInfo *bone_info = *iter;
|
||||
makeJointAliases( *iter );
|
||||
makeJointAliases(bone_info);
|
||||
}
|
||||
|
||||
LLAvatarXmlInfo::attachment_info_list_t::iterator attach_iter;
|
||||
for (attach_iter = sAvatarXmlInfo->mAttachmentInfoList.begin();
|
||||
attach_iter != sAvatarXmlInfo->mAttachmentInfoList.end();
|
||||
++attach_iter)
|
||||
for (LLAvatarXmlInfo::LLAvatarAttachmentInfo* info : sAvatarXmlInfo->mAttachmentInfoList)
|
||||
{
|
||||
LLAvatarXmlInfo::LLAvatarAttachmentInfo *info = *attach_iter;
|
||||
std::string bone_name = info->mName;
|
||||
|
||||
// Also accept the name with spaces substituted with
|
||||
|
|
|
|||
|
|
@ -387,10 +387,9 @@ protected:
|
|||
LLAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {}
|
||||
~LLAvatarMeshInfo()
|
||||
{
|
||||
morph_info_list_t::iterator iter;
|
||||
for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++)
|
||||
for (morph_info_list_t::value_type& pair : mPolyMorphTargetInfoList)
|
||||
{
|
||||
delete iter->first;
|
||||
delete pair.first;
|
||||
}
|
||||
mPolyMorphTargetInfoList.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,18 +183,15 @@ LLAvatarAppearanceDictionary::~LLAvatarAppearanceDictionary()
|
|||
// map it to the baked texture.
|
||||
void LLAvatarAppearanceDictionary::createAssociations()
|
||||
{
|
||||
for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++)
|
||||
for (BakedTextures::value_type& baked_pair : mBakedTextures)
|
||||
{
|
||||
const EBakedTextureIndex baked_index = (iter->first);
|
||||
const BakedEntry *dict = (iter->second);
|
||||
const EBakedTextureIndex baked_index = baked_pair.first;
|
||||
const BakedEntry *dict = baked_pair.second;
|
||||
|
||||
// For each texture that this baked texture index affects, associate those textures
|
||||
// with this baked texture index.
|
||||
for (texture_vec_t::const_iterator local_texture_iter = dict->mLocalTextures.begin();
|
||||
local_texture_iter != dict->mLocalTextures.end();
|
||||
local_texture_iter++)
|
||||
for (const ETextureIndex local_texture_index : dict->mLocalTextures)
|
||||
{
|
||||
const ETextureIndex local_texture_index = (ETextureIndex) *local_texture_iter;
|
||||
mTextures[local_texture_index]->mIsUsedByBakedTexture = true;
|
||||
mTextures[local_texture_index]->mBakedTextureIndex = baked_index;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,10 +100,9 @@ void LLAvatarJoint::setValid( BOOL valid, BOOL recursive )
|
|||
//----------------------------------------------------------------
|
||||
if (recursive)
|
||||
{
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* child : mChildren)
|
||||
{
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
|
||||
joint->setValid(valid, TRUE);
|
||||
}
|
||||
}
|
||||
|
|
@ -118,10 +117,9 @@ void LLAvatarJoint::setSkeletonComponents( U32 comp, BOOL recursive )
|
|||
mComponents = comp;
|
||||
if (recursive)
|
||||
{
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (auto child : mChildren)
|
||||
{
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
|
||||
joint->setSkeletonComponents(comp, recursive);
|
||||
}
|
||||
}
|
||||
|
|
@ -133,10 +131,9 @@ void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive)
|
|||
|
||||
if (recursive)
|
||||
{
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* child : mChildren)
|
||||
{
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
|
||||
joint->setVisible(visible, recursive);
|
||||
}
|
||||
}
|
||||
|
|
@ -144,30 +141,27 @@ void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive)
|
|||
|
||||
void LLAvatarJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area)
|
||||
{
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* child : mChildren)
|
||||
{
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
|
||||
joint->updateFaceSizes(num_vertices, num_indices, pixel_area);
|
||||
}
|
||||
}
|
||||
|
||||
void LLAvatarJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update)
|
||||
{
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* child : mChildren)
|
||||
{
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
|
||||
joint->updateFaceData(face, pixel_area, damp_wind, terse_update);
|
||||
}
|
||||
}
|
||||
|
||||
void LLAvatarJoint::updateJointGeometry()
|
||||
{
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* child : mChildren)
|
||||
{
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
|
||||
joint->updateJointGeometry();
|
||||
}
|
||||
}
|
||||
|
|
@ -178,10 +172,9 @@ BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate)
|
|||
BOOL lod_changed = FALSE;
|
||||
BOOL found_lod = FALSE;
|
||||
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* child : mChildren)
|
||||
{
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
|
||||
F32 jointLOD = joint->getLOD();
|
||||
|
||||
if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD)
|
||||
|
|
@ -207,10 +200,9 @@ BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate)
|
|||
|
||||
void LLAvatarJoint::dump()
|
||||
{
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* child : mChildren)
|
||||
{
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
|
||||
joint->dump();
|
||||
}
|
||||
}
|
||||
|
|
@ -219,10 +211,9 @@ void LLAvatarJoint::dump()
|
|||
void LLAvatarJoint::setMeshesToChildren()
|
||||
{
|
||||
removeAllChildren();
|
||||
for (avatar_joint_mesh_list_t::iterator iter = mMeshParts.begin();
|
||||
iter != mMeshParts.end(); iter++)
|
||||
for (LLAvatarJointMesh* mesh : mMeshParts)
|
||||
{
|
||||
addChild((*iter));
|
||||
addChild(mesh);
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -379,10 +379,9 @@ void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint)
|
|||
}
|
||||
|
||||
// depth-first traversal
|
||||
for (LLJoint::joints_t::iterator iter = current_joint->mChildren.begin();
|
||||
iter != current_joint->mChildren.end(); ++iter)
|
||||
for (LLJoint* joint : current_joint->mChildren)
|
||||
{
|
||||
LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter);
|
||||
LLAvatarJoint* child_joint = (LLAvatarJoint*)joint;
|
||||
setupJoint(child_joint);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,9 +102,8 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
|||
LLViewerVisualParamInfo::toStream(out);
|
||||
out << "driver" << "\t";
|
||||
out << mDrivenInfoList.size() << "\t";
|
||||
for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
|
||||
for (LLDrivenEntryInfo& driven : mDrivenInfoList)
|
||||
{
|
||||
LLDrivenEntryInfo driven = *iter;
|
||||
out << driven.mDrivenID << "\t";
|
||||
}
|
||||
|
||||
|
|
@ -121,9 +120,8 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
|||
if(mDriverParam && mDriverParam->getAvatarAppearance()->isSelf() &&
|
||||
mDriverParam->getAvatarAppearance()->isValid())
|
||||
{
|
||||
for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
|
||||
for (LLDrivenEntryInfo& driven : mDrivenInfoList)
|
||||
{
|
||||
LLDrivenEntryInfo driven = *iter;
|
||||
LLViewerVisualParam *param =
|
||||
(LLViewerVisualParam*)mDriverParam->getAvatarAppearance()->getVisualParam(driven.mDrivenID);
|
||||
if (param)
|
||||
|
|
@ -232,19 +230,19 @@ void LLDriverParam::setWeight(F32 weight)
|
|||
//-------|----|-------|----|-------> driver
|
||||
// | min1 max1 max2 min2
|
||||
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for(LLDrivenEntry& driven : mDriven)
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
LLDrivenEntryInfo* info = driven->mInfo;
|
||||
LLDrivenEntry* drivenp = &driven;
|
||||
LLDrivenEntryInfo* info = drivenp->mInfo;
|
||||
|
||||
F32 driven_weight = 0.f;
|
||||
F32 driven_min = driven->mParam->getMinWeight();
|
||||
F32 driven_max = driven->mParam->getMaxWeight();
|
||||
F32 driven_min = drivenp->mParam->getMinWeight();
|
||||
F32 driven_max = drivenp->mParam->getMaxWeight();
|
||||
|
||||
if (mIsAnimating)
|
||||
{
|
||||
// driven param doesn't interpolate (textures, for example)
|
||||
if (!driven->mParam->getAnimating())
|
||||
if (!drivenp->mParam->getAnimating())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -268,7 +266,7 @@ void LLDriverParam::setWeight(F32 weight)
|
|||
driven_weight = driven_min;
|
||||
}
|
||||
|
||||
setDrivenWeight(driven,driven_weight);
|
||||
setDrivenWeight(drivenp,driven_weight);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
|
@ -292,23 +290,22 @@ void LLDriverParam::setWeight(F32 weight)
|
|||
driven_weight = driven_min;
|
||||
}
|
||||
|
||||
setDrivenWeight(driven,driven_weight);
|
||||
setDrivenWeight(drivenp,driven_weight);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
driven_weight = getDrivenWeight(driven, mCurWeight);
|
||||
setDrivenWeight(driven,driven_weight);
|
||||
driven_weight = getDrivenWeight(drivenp, mCurWeight);
|
||||
setDrivenWeight(drivenp,driven_weight);
|
||||
}
|
||||
}
|
||||
|
||||
F32 LLDriverParam::getTotalDistortion()
|
||||
{
|
||||
F32 sum = 0.f;
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for(LLDrivenEntry& driven : mDriven)
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
sum += driven->mParam->getTotalDistortion();
|
||||
sum += driven.mParam->getTotalDistortion();
|
||||
}
|
||||
|
||||
return sum;
|
||||
|
|
@ -320,10 +317,9 @@ const LLVector4a &LLDriverParam::getAvgDistortion()
|
|||
LLVector4a sum;
|
||||
sum.clear();
|
||||
S32 count = 0;
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for(LLDrivenEntry& driven : mDriven)
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
sum.add(driven->mParam->getAvgDistortion());
|
||||
sum.add(driven.mParam->getAvgDistortion());
|
||||
count++;
|
||||
}
|
||||
sum.mul( 1.f/(F32)count);
|
||||
|
|
@ -335,10 +331,9 @@ const LLVector4a &LLDriverParam::getAvgDistortion()
|
|||
F32 LLDriverParam::getMaxDistortion()
|
||||
{
|
||||
F32 max = 0.f;
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for(LLDrivenEntry& driven : mDriven)
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
F32 param_max = driven->mParam->getMaxDistortion();
|
||||
F32 param_max = driven.mParam->getMaxDistortion();
|
||||
if( param_max > max )
|
||||
{
|
||||
max = param_max;
|
||||
|
|
@ -353,10 +348,9 @@ LLVector4a LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)
|
|||
{
|
||||
LLVector4a sum;
|
||||
sum.clear();
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for(LLDrivenEntry& driven : mDriven)
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
sum.add(driven->mParam->getVertexDistortion( index, poly_mesh ));
|
||||
sum.add(driven.mParam->getVertexDistortion(index, poly_mesh));
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
|
@ -365,13 +359,12 @@ const LLVector4a* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **pol
|
|||
{
|
||||
mCurrentDistortionParam = NULL;
|
||||
const LLVector4a* v = NULL;
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for(LLDrivenEntry& driven : mDriven)
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
v = driven->mParam->getFirstDistortion( index, poly_mesh );
|
||||
v = driven.mParam->getFirstDistortion(index, poly_mesh);
|
||||
if( v )
|
||||
{
|
||||
mCurrentDistortionParam = driven->mParam;
|
||||
mCurrentDistortionParam = driven.mParam;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -415,7 +408,7 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly
|
|||
for( iter++; iter != mDriven.end(); iter++ )
|
||||
{
|
||||
driven = &(*iter);
|
||||
v = driven->mParam->getFirstDistortion( index, poly_mesh );
|
||||
v = driven->mParam->getFirstDistortion(index, poly_mesh);
|
||||
if( v )
|
||||
{
|
||||
mCurrentDistortionParam = driven->mParam;
|
||||
|
|
@ -448,14 +441,14 @@ void LLDriverParam::setAnimationTarget( F32 target_value)
|
|||
{
|
||||
LLVisualParam::setAnimationTarget(target_value);
|
||||
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for(LLDrivenEntry& driven : mDriven)
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
F32 driven_weight = getDrivenWeight(driven, mTargetWeight);
|
||||
LLDrivenEntry* drivenp = &driven;
|
||||
F32 driven_weight = getDrivenWeight(drivenp, mTargetWeight);
|
||||
|
||||
// this isn't normally necessary, as driver params handle interpolation of their driven params
|
||||
// but texture params need to know to assume their final value at beginning of interpolation
|
||||
driven->mParam->setAnimationTarget(driven_weight);
|
||||
drivenp->mParam->setAnimationTarget(driven_weight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -466,10 +459,9 @@ void LLDriverParam::stopAnimating()
|
|||
{
|
||||
LLVisualParam::stopAnimating();
|
||||
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for(LLDrivenEntry& driven : mDriven)
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
driven->mParam->setAnimating(FALSE);
|
||||
driven.mParam->setAnimating(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -477,17 +469,15 @@ void LLDriverParam::stopAnimating()
|
|||
BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params)
|
||||
{
|
||||
BOOL success = TRUE;
|
||||
LLDriverParamInfo::entry_info_list_t::iterator iter;
|
||||
for (iter = getInfo()->mDrivenInfoList.begin(); iter != getInfo()->mDrivenInfoList.end(); ++iter)
|
||||
for (LLDrivenEntryInfo& driven_info : getInfo()->mDrivenInfoList)
|
||||
{
|
||||
LLDrivenEntryInfo *driven_info = &(*iter);
|
||||
S32 driven_id = driven_info->mDrivenID;
|
||||
S32 driven_id = driven_info.mDrivenID;
|
||||
|
||||
// check for already existing links. Do not overwrite.
|
||||
BOOL found = FALSE;
|
||||
for (entry_list_t::iterator driven_iter = mDriven.begin(); driven_iter != mDriven.end() && !found; ++driven_iter)
|
||||
for (auto& driven : mDriven)
|
||||
{
|
||||
if (driven_iter->mInfo->mDrivenID == driven_id)
|
||||
if (driven.mInfo->mDrivenID == driven_id)
|
||||
{
|
||||
found = TRUE;
|
||||
}
|
||||
|
|
@ -500,7 +490,7 @@ BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross
|
|||
bool push = param && (!only_cross_params || param->getCrossWearable());
|
||||
if (push)
|
||||
{
|
||||
mDriven.push_back(LLDrivenEntry( param, driven_info ));
|
||||
mDriven.push_back(LLDrivenEntry( param, &driven_info ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -523,10 +513,9 @@ void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
|
|||
bool needs_update = (getWearableType()==driven_type);
|
||||
|
||||
// if the driver has a driven entry for the passed-in wearable type, we need to refresh the value
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for(LLDrivenEntry& driven : mDriven)
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
if (driven && driven->mParam && driven->mParam->getCrossWearable() && driven->mParam->getWearableType() == driven_type)
|
||||
if (driven.mParam && driven.mParam->getCrossWearable() && driven.mParam->getWearableType() == driven_type)
|
||||
{
|
||||
needs_update = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ LLLocalTextureObject::LLLocalTextureObject(const LLLocalTextureObject& lto) :
|
|||
|
||||
LLLocalTextureObject::~LLLocalTextureObject()
|
||||
{
|
||||
delete_and_clear(mTexLayers);
|
||||
}
|
||||
|
||||
LLGLTexture* LLLocalTextureObject::getImage() const
|
||||
|
|
@ -95,9 +96,8 @@ LLTexLayer* LLLocalTextureObject::getTexLayer(U32 index) const
|
|||
|
||||
LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name)
|
||||
{
|
||||
for( tex_layer_vec_t::iterator iter = mTexLayers.begin(); iter != mTexLayers.end(); iter++)
|
||||
for(LLTexLayer* layer : mTexLayers)
|
||||
{
|
||||
LLTexLayer *layer = *iter;
|
||||
if (layer->getName().compare(name) == 0)
|
||||
{
|
||||
return layer;
|
||||
|
|
|
|||
|
|
@ -612,14 +612,16 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
|
|||
// we reached the end of the morphs
|
||||
break;
|
||||
}
|
||||
LLPolyMorphData* morph_data = new LLPolyMorphData(std::string(morphName));
|
||||
std::string morph_name(morphName);
|
||||
LLPolyMorphData* morph_data = new LLPolyMorphData(morph_name);
|
||||
|
||||
BOOL result = morph_data->loadBinary(fp, this);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
delete morph_data;
|
||||
continue;
|
||||
LL_WARNS() << "Failure loading " << morph_name << " from " << fileName << LL_ENDL;
|
||||
delete morph_data;
|
||||
continue;
|
||||
}
|
||||
|
||||
mMorphData.insert(morph_data);
|
||||
|
|
@ -888,11 +890,10 @@ void LLPolyMesh::dumpDiagInfo()
|
|||
LL_INFOS() << "-----------------------------------------------------" << LL_ENDL;
|
||||
|
||||
// print each loaded mesh, and it's memory usage
|
||||
for(LLPolyMeshSharedDataTable::iterator iter = sGlobalSharedMeshList.begin();
|
||||
iter != sGlobalSharedMeshList.end(); ++iter)
|
||||
for(const LLPolyMeshSharedDataTable::value_type& mesh_pair : sGlobalSharedMeshList)
|
||||
{
|
||||
const std::string& mesh_name = iter->first;
|
||||
LLPolyMeshSharedData* mesh = iter->second;
|
||||
const std::string& mesh_name = mesh_pair.first;
|
||||
LLPolyMeshSharedData* mesh = mesh_pair.second;
|
||||
|
||||
S32 num_verts = mesh->mNumVertices;
|
||||
S32 num_faces = mesh->mNumFaces;
|
||||
|
|
@ -995,14 +996,12 @@ LLPolyMorphData* LLPolyMesh::getMorphData(const std::string& morph_name)
|
|||
{
|
||||
if (!mSharedData)
|
||||
return NULL;
|
||||
for (LLPolyMeshSharedData::morphdata_list_t::iterator iter = mSharedData->mMorphData.begin();
|
||||
iter != mSharedData->mMorphData.end(); ++iter)
|
||||
for (LLPolyMorphData* morph_data : mSharedData->mMorphData)
|
||||
{
|
||||
LLPolyMorphData *morph_data = *iter;
|
||||
if (morph_data->getName() == morph_name)
|
||||
{
|
||||
return morph_data;
|
||||
}
|
||||
if (morph_data->getName() == morph_name)
|
||||
{
|
||||
return morph_data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,9 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
|
|||
|
||||
if (mVertexIndices[v] > 10000)
|
||||
{
|
||||
LL_ERRS() << "Bad morph index: " << mVertexIndices[v] << LL_ENDL;
|
||||
// Bad install? These are usually .llm files from 'character' fodler
|
||||
LL_WARNS() << "Bad morph index " << v << ": " << mVertexIndices[v] << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -361,18 +363,16 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
|
|||
setWeight(getDefaultWeight());
|
||||
|
||||
LLAvatarAppearance* avatarp = mMesh->getAvatar();
|
||||
LLPolyMorphTargetInfo::volume_info_list_t::iterator iter;
|
||||
for (iter = getInfo()->mVolumeInfoList.begin(); iter != getInfo()->mVolumeInfoList.end(); iter++)
|
||||
for (LLPolyVolumeMorphInfo& volume_info : getInfo()->mVolumeInfoList)
|
||||
{
|
||||
LLPolyVolumeMorphInfo *volume_info = &(*iter);
|
||||
for (S32 i = 0; i < avatarp->mNumCollisionVolumes; i++)
|
||||
{
|
||||
if (avatarp->mCollisionVolumes[i].getName() == volume_info->mName)
|
||||
if (avatarp->mCollisionVolumes[i].getName() == volume_info.mName)
|
||||
{
|
||||
mVolumeMorphs.push_back(
|
||||
LLPolyVolumeMorph(&avatarp->mCollisionVolumes[i],
|
||||
volume_info->mScale,
|
||||
volume_info->mPos));
|
||||
volume_info.mScale,
|
||||
volume_info.mPos));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -639,15 +639,14 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )
|
|||
}
|
||||
|
||||
// now apply volume changes
|
||||
for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); iter++ )
|
||||
for(LLPolyVolumeMorph& volume_morph : mVolumeMorphs)
|
||||
{
|
||||
LLPolyVolumeMorph* volume_morph = &(*iter);
|
||||
LLVector3 scale_delta = volume_morph->mScale * delta_weight;
|
||||
LLVector3 pos_delta = volume_morph->mPos * delta_weight;
|
||||
LLVector3 scale_delta = volume_morph.mScale * delta_weight;
|
||||
LLVector3 pos_delta = volume_morph.mPos * delta_weight;
|
||||
|
||||
volume_morph->mVolume->setScale(volume_morph->mVolume->getScale() + scale_delta);
|
||||
volume_morph.mVolume->setScale(volume_morph.mVolume->getScale() + scale_delta);
|
||||
// SL-315
|
||||
volume_morph->mVolume->setPosition(volume_morph->mVolume->getPosition() + pos_delta);
|
||||
volume_morph.mVolume->setPosition(volume_morph.mVolume->getPosition() + pos_delta);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -733,15 +732,14 @@ void LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S3
|
|||
void LLPolyMorphTarget::applyVolumeChanges(F32 delta_weight)
|
||||
{
|
||||
// now apply volume changes
|
||||
for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); iter++ )
|
||||
for(LLPolyVolumeMorph& volume_morph : mVolumeMorphs)
|
||||
{
|
||||
LLPolyVolumeMorph* volume_morph = &(*iter);
|
||||
LLVector3 scale_delta = volume_morph->mScale * delta_weight;
|
||||
LLVector3 pos_delta = volume_morph->mPos * delta_weight;
|
||||
LLVector3 scale_delta = volume_morph.mScale * delta_weight;
|
||||
LLVector3 pos_delta = volume_morph.mPos * delta_weight;
|
||||
|
||||
volume_morph->mVolume->setScale(volume_morph->mVolume->getScale() + scale_delta);
|
||||
volume_morph.mVolume->setScale(volume_morph.mVolume->getScale() + scale_delta);
|
||||
// SL-315
|
||||
volume_morph->mVolume->setPosition(volume_morph->mVolume->getPosition() + pos_delta);
|
||||
volume_morph.mVolume->setPosition(volume_morph.mVolume->getPosition() + pos_delta);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,38 +143,35 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
|
|||
mID = info->mID;
|
||||
setWeight(getDefaultWeight());
|
||||
|
||||
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
|
||||
for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
|
||||
for (LLPolySkeletalBoneInfo& bone_info : getInfo()->mBoneInfoList)
|
||||
{
|
||||
LLPolySkeletalBoneInfo *bone_info = &(*iter);
|
||||
LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
|
||||
LLJoint* joint = mAvatar->getJoint(bone_info.mBoneName);
|
||||
if (!joint)
|
||||
{
|
||||
// There's no point continuing after this error - means
|
||||
// that either the skeleton or lad file is broken.
|
||||
LL_WARNS() << "Joint " << bone_info->mBoneName << " not found." << LL_ENDL;
|
||||
LL_WARNS() << "Joint " << bone_info.mBoneName << " not found." << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// store it
|
||||
mJointScales[joint] = bone_info->mScaleDeformation;
|
||||
mJointScales[joint] = bone_info.mScaleDeformation;
|
||||
|
||||
// apply to children that need to inherit it
|
||||
for (LLJoint::joints_t::iterator iter = joint->mChildren.begin();
|
||||
iter != joint->mChildren.end(); ++iter)
|
||||
for (LLJoint* joint : joint->mChildren)
|
||||
{
|
||||
LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter);
|
||||
LLAvatarJoint* child_joint = (LLAvatarJoint*)joint;
|
||||
if (child_joint->inheritScale())
|
||||
{
|
||||
LLVector3 childDeformation = LLVector3(child_joint->getScale());
|
||||
childDeformation.scaleVec(bone_info->mScaleDeformation);
|
||||
childDeformation.scaleVec(bone_info.mScaleDeformation);
|
||||
mJointScales[child_joint] = childDeformation;
|
||||
}
|
||||
}
|
||||
|
||||
if (bone_info->mHasPositionDeformation)
|
||||
if (bone_info.mHasPositionDeformation)
|
||||
{
|
||||
mJointOffsets[joint] = bone_info->mPositionDeformation;
|
||||
mJointOffsets[joint] = bone_info.mPositionDeformation;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
|
@ -195,15 +192,12 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
|
|||
F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
|
||||
|
||||
LLJoint* joint;
|
||||
joint_vec_map_t::iterator iter;
|
||||
|
||||
for (iter = mJointScales.begin();
|
||||
iter != mJointScales.end();
|
||||
iter++)
|
||||
for (joint_vec_map_t::value_type& scale_pair : mJointScales)
|
||||
{
|
||||
joint = iter->first;
|
||||
joint = scale_pair.first;
|
||||
LLVector3 newScale = joint->getScale();
|
||||
LLVector3 scaleDelta = iter->second;
|
||||
LLVector3 scaleDelta = scale_pair.second;
|
||||
LLVector3 offset = (effective_weight - mLastWeight) * scaleDelta;
|
||||
newScale = newScale + offset;
|
||||
//An aspect of attached mesh objects (which contain joint offsets) that need to be cleaned up when detached
|
||||
|
|
@ -218,13 +212,11 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
|
|||
joint->setScale(newScale, true);
|
||||
}
|
||||
|
||||
for (iter = mJointOffsets.begin();
|
||||
iter != mJointOffsets.end();
|
||||
iter++)
|
||||
for (joint_vec_map_t::value_type& offset_pair : mJointOffsets)
|
||||
{
|
||||
joint = iter->first;
|
||||
joint = offset_pair.first;
|
||||
LLVector3 newPosition = joint->getPosition();
|
||||
LLVector3 positionDelta = iter->second;
|
||||
LLVector3 positionDelta = offset_pair.second;
|
||||
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
|
||||
// SL-315
|
||||
bool allow_attachment_pos_overrides = true;
|
||||
|
|
|
|||
|
|
@ -55,12 +55,10 @@ BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info)
|
|||
//mID = info->mID; // No ID
|
||||
|
||||
mParamGlobalColorList.reserve(mInfo->mParamColorInfoList.size());
|
||||
for (param_color_info_list_t::iterator iter = mInfo->mParamColorInfoList.begin();
|
||||
iter != mInfo->mParamColorInfoList.end();
|
||||
iter++)
|
||||
for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList)
|
||||
{
|
||||
LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this);
|
||||
if (!param_color->setInfo(*iter, TRUE))
|
||||
if (!param_color->setInfo(color_info, TRUE))
|
||||
{
|
||||
mInfo = NULL;
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -241,11 +241,8 @@ BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node)
|
|||
void LLTexLayerSetInfo::createVisualParams(LLAvatarAppearance *appearance)
|
||||
{
|
||||
//layer_info_list_t mLayerInfoList;
|
||||
for (layer_info_list_t::iterator layer_iter = mLayerInfoList.begin();
|
||||
layer_iter != mLayerInfoList.end();
|
||||
layer_iter++)
|
||||
for (LLTexLayerInfo* layer_info : mLayerInfoList)
|
||||
{
|
||||
LLTexLayerInfo *layer_info = *layer_iter;
|
||||
layer_info->createVisualParams(appearance);
|
||||
}
|
||||
}
|
||||
|
|
@ -287,12 +284,10 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info)
|
|||
//mID = info->mID; // No ID
|
||||
|
||||
mLayerList.reserve(info->mLayerInfoList.size());
|
||||
for (LLTexLayerSetInfo::layer_info_list_t::const_iterator iter = info->mLayerInfoList.begin();
|
||||
iter != info->mLayerInfoList.end();
|
||||
iter++)
|
||||
for (LLTexLayerInfo* layer_info : info->mLayerInfoList)
|
||||
{
|
||||
LLTexLayerInterface *layer = NULL;
|
||||
if ( (*iter)->isUserSettable() )
|
||||
if (layer_info->isUserSettable())
|
||||
{
|
||||
layer = new LLTexLayerTemplate( this, getAvatarAppearance() );
|
||||
}
|
||||
|
|
@ -301,7 +296,7 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info)
|
|||
layer = new LLTexLayer(this);
|
||||
}
|
||||
// this is the first time this layer (of either type) is being created - make sure you add the parameters to the avatar appearance
|
||||
if (!layer->setInfo(*iter, NULL))
|
||||
if (!layer->setInfo(layer_info, NULL))
|
||||
{
|
||||
mInfo = NULL;
|
||||
return FALSE;
|
||||
|
|
@ -348,14 +343,12 @@ BOOL LLTexLayerSet::parseData(LLXmlTreeNode* node)
|
|||
|
||||
void LLTexLayerSet::deleteCaches()
|
||||
{
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for(LLTexLayerInterface* layer : mLayerList)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
layer->deleteCaches();
|
||||
}
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++)
|
||||
for (LLTexLayerInterface* layer : mMaskLayerList)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
layer->deleteCaches();
|
||||
}
|
||||
}
|
||||
|
|
@ -368,9 +361,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget*
|
|||
|
||||
if (mMaskLayerList.size() > 0)
|
||||
{
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++)
|
||||
for (LLTexLayerInterface* layer : mMaskLayerList)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
if (layer->isInvisibleAlphaMask())
|
||||
{
|
||||
mIsVisible = FALSE;
|
||||
|
|
@ -399,9 +391,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget*
|
|||
if (mIsVisible)
|
||||
{
|
||||
// composite color layers
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for(LLTexLayerInterface* layer : mLayerList)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
if (layer->getRenderPass() == LLTexLayer::RP_COLOR)
|
||||
{
|
||||
gGL.flush();
|
||||
|
|
@ -473,9 +464,8 @@ void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S
|
|||
LL_PROFILE_ZONE_SCOPED;
|
||||
memset(data, 255, width * height);
|
||||
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for(LLTexLayerInterface* layer : mLayerList)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
layer->gatherAlphaMasks(data, origin_x, origin_y, width, height, bound_target);
|
||||
}
|
||||
|
||||
|
|
@ -526,9 +516,8 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
|
|||
if (mMaskLayerList.size() > 0)
|
||||
{
|
||||
gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA);
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++)
|
||||
for (LLTexLayerInterface* layer : mMaskLayerList)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
gGL.flush();
|
||||
layer->blendAlphaTexture(x,y,width, height);
|
||||
gGL.flush();
|
||||
|
|
@ -549,9 +538,8 @@ void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_
|
|||
|
||||
BOOL LLTexLayerSet::isMorphValid() const
|
||||
{
|
||||
for(layer_list_t::const_iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for(const LLTexLayerInterface* layer : mLayerList)
|
||||
{
|
||||
const LLTexLayerInterface* layer = *iter;
|
||||
if (layer && !layer->isMorphValid())
|
||||
{
|
||||
return FALSE;
|
||||
|
|
@ -562,9 +550,8 @@ BOOL LLTexLayerSet::isMorphValid() const
|
|||
|
||||
void LLTexLayerSet::invalidateMorphMasks()
|
||||
{
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for(LLTexLayerInterface* layer : mLayerList)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
if (layer)
|
||||
{
|
||||
layer->invalidateMorphMasks();
|
||||
|
|
@ -661,14 +648,12 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
|
|||
/* if ("upper_shirt" == local_texture_name)
|
||||
mLocalTexture = TEX_UPPER_SHIRT; */
|
||||
mLocalTexture = TEX_NUM_INDICES;
|
||||
for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
|
||||
iter != LLAvatarAppearance::getDictionary()->getTextures().end();
|
||||
iter++)
|
||||
for (const LLAvatarAppearanceDictionary::Textures::value_type& dict_pair : LLAvatarAppearance::getDictionary()->getTextures())
|
||||
{
|
||||
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
|
||||
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = dict_pair.second;
|
||||
if (local_texture_name == texture_dict->mName)
|
||||
{
|
||||
mLocalTexture = iter->first;
|
||||
mLocalTexture = dict_pair.first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -735,11 +720,8 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
|
|||
BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance)
|
||||
{
|
||||
BOOL success = TRUE;
|
||||
for (param_color_info_list_t::iterator color_info_iter = mParamColorInfoList.begin();
|
||||
color_info_iter != mParamColorInfoList.end();
|
||||
color_info_iter++)
|
||||
for (LLTexLayerParamColorInfo* color_info : mParamColorInfoList)
|
||||
{
|
||||
LLTexLayerParamColorInfo * color_info = *color_info_iter;
|
||||
LLTexLayerParamColor* param_color = new LLTexLayerParamColor(appearance);
|
||||
if (!param_color->setInfo(color_info, TRUE))
|
||||
{
|
||||
|
|
@ -749,11 +731,8 @@ BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance)
|
|||
}
|
||||
}
|
||||
|
||||
for (param_alpha_info_list_t::iterator alpha_info_iter = mParamAlphaInfoList.begin();
|
||||
alpha_info_iter != mParamAlphaInfoList.end();
|
||||
alpha_info_iter++)
|
||||
for (LLTexLayerParamAlphaInfo* alpha_info : mParamAlphaInfoList)
|
||||
{
|
||||
LLTexLayerParamAlphaInfo * alpha_info = *alpha_info_iter;
|
||||
LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(appearance);
|
||||
if (!param_alpha->setInfo(alpha_info, TRUE))
|
||||
{
|
||||
|
|
@ -796,15 +775,13 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab
|
|||
//mID = info->mID; // No ID
|
||||
|
||||
mParamColorList.reserve(mInfo->mParamColorInfoList.size());
|
||||
for (param_color_info_list_t::const_iterator iter = mInfo->mParamColorInfoList.begin();
|
||||
iter != mInfo->mParamColorInfoList.end();
|
||||
iter++)
|
||||
for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList)
|
||||
{
|
||||
LLTexLayerParamColor* param_color;
|
||||
if (!wearable)
|
||||
{
|
||||
param_color = new LLTexLayerParamColor(this);
|
||||
if (!param_color->setInfo(*iter, TRUE))
|
||||
if (!param_color->setInfo(color_info, TRUE))
|
||||
{
|
||||
mInfo = NULL;
|
||||
return FALSE;
|
||||
|
|
@ -812,7 +789,7 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab
|
|||
}
|
||||
else
|
||||
{
|
||||
param_color = (LLTexLayerParamColor*)wearable->getVisualParam((*iter)->getID());
|
||||
param_color = (LLTexLayerParamColor*)wearable->getVisualParam(color_info->getID());
|
||||
if (!param_color)
|
||||
{
|
||||
mInfo = NULL;
|
||||
|
|
@ -823,15 +800,13 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab
|
|||
}
|
||||
|
||||
mParamAlphaList.reserve(mInfo->mParamAlphaInfoList.size());
|
||||
for (param_alpha_info_list_t::const_iterator iter = mInfo->mParamAlphaInfoList.begin();
|
||||
iter != mInfo->mParamAlphaInfoList.end();
|
||||
iter++)
|
||||
for (LLTexLayerParamAlphaInfo* alpha_info : mInfo->mParamAlphaInfoList)
|
||||
{
|
||||
LLTexLayerParamAlpha* param_alpha;
|
||||
if (!wearable)
|
||||
{
|
||||
param_alpha = new LLTexLayerParamAlpha( this );
|
||||
if (!param_alpha->setInfo(*iter, TRUE))
|
||||
if (!param_alpha->setInfo(alpha_info, TRUE))
|
||||
{
|
||||
mInfo = NULL;
|
||||
return FALSE;
|
||||
|
|
@ -839,7 +814,7 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab
|
|||
}
|
||||
else
|
||||
{
|
||||
param_alpha = (LLTexLayerParamAlpha*) wearable->getVisualParam((*iter)->getID());
|
||||
param_alpha = (LLTexLayerParamAlpha*) wearable->getVisualParam(alpha_info->getID());
|
||||
if (!param_alpha)
|
||||
{
|
||||
mInfo = NULL;
|
||||
|
|
@ -873,12 +848,9 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const
|
|||
if (TEX_INVALID == te)
|
||||
{
|
||||
LLWearableType::EType type = LLWearableType::WT_INVALID;
|
||||
param_color_list_t::const_iterator color_iter = mParamColorList.begin();
|
||||
param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin();
|
||||
|
||||
for (; color_iter != mParamColorList.end(); color_iter++)
|
||||
for (LLTexLayerParamColor* param : mParamColorList)
|
||||
{
|
||||
LLTexLayerParamColor* param = *color_iter;
|
||||
if (param)
|
||||
{
|
||||
LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType();
|
||||
|
|
@ -893,9 +865,8 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const
|
|||
}
|
||||
}
|
||||
|
||||
for (; alpha_iter != mParamAlphaList.end(); alpha_iter++)
|
||||
for (LLTexLayerParamAlpha* param : mParamAlphaList)
|
||||
{
|
||||
LLTexLayerParamAlpha* param = *alpha_iter;
|
||||
if (param)
|
||||
{
|
||||
LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType();
|
||||
|
|
@ -938,18 +909,18 @@ void LLTexLayerInterface::invalidateMorphMasks()
|
|||
LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) const
|
||||
{
|
||||
LLViewerVisualParam *result = NULL;
|
||||
for (param_color_list_t::const_iterator color_iter = mParamColorList.begin(); color_iter != mParamColorList.end() && !result; ++color_iter)
|
||||
for (LLTexLayerParamColor* param : mParamColorList)
|
||||
{
|
||||
if ((*color_iter)->getID() == index)
|
||||
if (param->getID() == index)
|
||||
{
|
||||
result = *color_iter;
|
||||
result = param;
|
||||
}
|
||||
}
|
||||
for (param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin(); alpha_iter != mParamAlphaList.end() && !result; ++alpha_iter)
|
||||
for (LLTexLayerParamAlpha* param : mParamAlphaList)
|
||||
{
|
||||
if ((*alpha_iter)->getID() == index)
|
||||
if (param->getID() == index)
|
||||
{
|
||||
result = *alpha_iter;
|
||||
result = param;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -994,10 +965,9 @@ LLTexLayer::~LLTexLayer()
|
|||
//std::for_each(mParamAlphaList.begin(), mParamAlphaList.end(), DeletePointer());
|
||||
//std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer());
|
||||
|
||||
for( alpha_cache_t::iterator iter = mAlphaCache.begin();
|
||||
iter != mAlphaCache.end(); iter++ )
|
||||
for (alpha_cache_t::value_type& alpha_pair : mAlphaCache)
|
||||
{
|
||||
U8* alpha_data = iter->second;
|
||||
U8* alpha_data = alpha_pair.second;
|
||||
ll_aligned_free_32(alpha_data);
|
||||
}
|
||||
|
||||
|
|
@ -1021,10 +991,8 @@ BOOL LLTexLayer::setInfo(const LLTexLayerInfo* info, LLWearable* wearable )
|
|||
//static
|
||||
void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color)
|
||||
{
|
||||
for (param_color_list_t::const_iterator iter = param_list.begin();
|
||||
iter != param_list.end(); iter++)
|
||||
for (const LLTexLayerParamColor* param : param_list)
|
||||
{
|
||||
const LLTexLayerParamColor* param = *iter;
|
||||
LLColor4 param_net = param->getNetColor();
|
||||
const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)param->getInfo();
|
||||
switch(info->getOperation())
|
||||
|
|
@ -1049,10 +1017,8 @@ void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LL
|
|||
/*virtual*/ void LLTexLayer::deleteCaches()
|
||||
{
|
||||
// Only need to delete caches for alpha params. Color params don't hold extra memory
|
||||
for (param_alpha_list_t::iterator iter = mParamAlphaList.begin();
|
||||
iter != mParamAlphaList.end(); iter++ )
|
||||
for (LLTexLayerParamAlpha* param : mParamAlphaList)
|
||||
{
|
||||
LLTexLayerParamAlpha* param = *iter;
|
||||
param->deleteCaches();
|
||||
}
|
||||
}
|
||||
|
|
@ -1226,9 +1192,8 @@ const U8* LLTexLayer::getAlphaData() const
|
|||
const LLUUID& uuid = getUUID();
|
||||
alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES);
|
||||
|
||||
for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++)
|
||||
for (const LLTexLayerParamAlpha* param : mParamAlphaList)
|
||||
{
|
||||
const LLTexLayerParamAlpha* param = *iter;
|
||||
// MULTI-WEARABLE: verify visual parameters used here
|
||||
F32 param_weight = param->getWeight();
|
||||
alpha_mask_crc.update((U8*)¶m_weight, sizeof(F32));
|
||||
|
|
@ -1365,9 +1330,8 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
|
|||
// Accumulate alphas
|
||||
LLGLSNoAlphaTest gls_no_alpha_test;
|
||||
gGL.color4f( 1.f, 1.f, 1.f, 1.f );
|
||||
for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++)
|
||||
for (LLTexLayerParamAlpha* param : mParamAlphaList)
|
||||
{
|
||||
LLTexLayerParamAlpha* param = *iter;
|
||||
success &= param->render( x, y, width, height );
|
||||
if (!success && !force_render)
|
||||
{
|
||||
|
|
@ -1441,9 +1405,8 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
|
|||
const LLUUID& uuid = getUUID();
|
||||
alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES);
|
||||
|
||||
for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++)
|
||||
for (const LLTexLayerParamAlpha* param : mParamAlphaList)
|
||||
{
|
||||
const LLTexLayerParamAlpha* param = *iter;
|
||||
F32 param_weight = param->getWeight();
|
||||
alpha_mask_crc.update((U8*)¶m_weight, sizeof(F32));
|
||||
}
|
||||
|
|
@ -1683,12 +1646,10 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
|
|||
|
||||
BOOL success = TRUE;
|
||||
updateWearableCache();
|
||||
for (wearable_cache_t::const_iterator iter = mWearableCache.begin(); iter!= mWearableCache.end(); iter++)
|
||||
for (LLWearable* wearable : mWearableCache)
|
||||
{
|
||||
LLWearable* wearable = NULL;
|
||||
LLLocalTextureObject *lto = NULL;
|
||||
LLTexLayer *layer = NULL;
|
||||
wearable = *iter;
|
||||
if (wearable)
|
||||
{
|
||||
lto = wearable->getLocalTextureObject(mInfo->mLocalTexture);
|
||||
|
|
@ -1785,17 +1746,15 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
|
|||
//-----------------------------------------------------------------------------
|
||||
LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name)
|
||||
{
|
||||
for (layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for (LLTexLayerInterface* layer : mLayerList)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
if (layer->getName() == name)
|
||||
{
|
||||
return layer;
|
||||
}
|
||||
}
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ )
|
||||
for (LLTexLayerInterface* layer : mMaskLayerList)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
if (layer->getName() == name)
|
||||
{
|
||||
return layer;
|
||||
|
|
@ -1807,20 +1766,20 @@ LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name)
|
|||
void LLTexLayerSet::cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable *wearable)
|
||||
{
|
||||
// initialize all texlayers with this texture type for this LTO
|
||||
for( LLTexLayerSet::layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for(LLTexLayerInterface* layer : mLayerList)
|
||||
{
|
||||
LLTexLayerTemplate* layer = (LLTexLayerTemplate*)*iter;
|
||||
if (layer->getInfo()->getLocalTexture() == (S32) tex_index)
|
||||
LLTexLayerTemplate* layer_template = (LLTexLayerTemplate*)layer;
|
||||
if (layer_template->getInfo()->getLocalTexture() == (S32)tex_index)
|
||||
{
|
||||
lto->addTexLayer(layer, wearable);
|
||||
lto->addTexLayer(layer_template, wearable);
|
||||
}
|
||||
}
|
||||
for( LLTexLayerSet::layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ )
|
||||
for(LLTexLayerInterface* layer : mMaskLayerList)
|
||||
{
|
||||
LLTexLayerTemplate* layer = (LLTexLayerTemplate*)*iter;
|
||||
if (layer->getInfo()->getLocalTexture() == (S32) tex_index)
|
||||
LLTexLayerTemplate* layer_template = (LLTexLayerTemplate*)layer;
|
||||
if (layer_template->getInfo()->getLocalTexture() == (S32)tex_index)
|
||||
{
|
||||
lto->addTexLayer(layer, wearable);
|
||||
lto->addTexLayer(layer_template, wearable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,10 +103,8 @@ void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes)
|
|||
{
|
||||
*gl_bytes = 0;
|
||||
|
||||
for (param_alpha_ptr_list_t::iterator iter = sInstances.begin();
|
||||
iter != sInstances.end(); iter++)
|
||||
for (LLTexLayerParamAlpha* instance : sInstances)
|
||||
{
|
||||
LLTexLayerParamAlpha* instance = *iter;
|
||||
LLGLTexture* tex = instance->mCachedProcessedTexture;
|
||||
if (tex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@ LLWearable::LLWearable()
|
|||
// virtual
|
||||
LLWearable::~LLWearable()
|
||||
{
|
||||
for (visual_param_index_map_t::iterator vpIter = mVisualParamIndexMap.begin(); vpIter != mVisualParamIndexMap.end(); ++vpIter)
|
||||
for (visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
|
||||
{
|
||||
LLVisualParam* vp = vpIter->second;
|
||||
LLVisualParam* vp = vp_pair.second;
|
||||
vp->clearNextParam();
|
||||
delete vp;
|
||||
vpIter->second = NULL;
|
||||
vp_pair.second = NULL;
|
||||
}
|
||||
|
||||
destroyTextures();
|
||||
|
|
@ -122,12 +122,10 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const
|
|||
// parameters
|
||||
output_stream << "parameters " << mVisualParamIndexMap.size() << "\n";
|
||||
|
||||
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
|
||||
iter != mVisualParamIndexMap.end();
|
||||
++iter)
|
||||
for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
|
||||
{
|
||||
S32 param_id = iter->first;
|
||||
const LLVisualParam* param = iter->second;
|
||||
S32 param_id = vp_pair.first;
|
||||
const LLVisualParam* param = vp_pair.second;
|
||||
F32 param_weight = param->getWeight();
|
||||
output_stream << param_id << " " << terse_F32_to_string( param_weight ) << "\n";
|
||||
}
|
||||
|
|
@ -135,11 +133,11 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const
|
|||
// texture entries
|
||||
output_stream << "textures " << mTEMap.size() << "\n";
|
||||
|
||||
for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter)
|
||||
for (const te_map_t::value_type& te_pair : mTEMap)
|
||||
{
|
||||
S32 te = iter->first;
|
||||
const LLUUID& image_id = iter->second->getID();
|
||||
output_stream << te << " " << image_id << "\n";
|
||||
S32 te = te_pair.first;
|
||||
const LLUUID& image_id = te_pair.second->getID();
|
||||
output_stream << te << " " << image_id << "\n";
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -160,11 +158,9 @@ void LLWearable::createVisualParams(LLAvatarAppearance *avatarp)
|
|||
}
|
||||
|
||||
// resync driver parameters to point to the newly cloned driven parameters
|
||||
for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin();
|
||||
param_iter != mVisualParamIndexMap.end();
|
||||
++param_iter)
|
||||
for (visual_param_index_map_t::value_type& param_pair : mVisualParamIndexMap)
|
||||
{
|
||||
LLVisualParam* param = param_iter->second;
|
||||
LLVisualParam* param = param_pair.second;
|
||||
LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam;
|
||||
// need this line to disambiguate between versions of LLCharacter::getVisualParam()
|
||||
LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam;
|
||||
|
|
@ -523,10 +519,9 @@ std::vector<LLLocalTextureObject*> LLWearable::getLocalTextureListSeq()
|
|||
{
|
||||
std::vector<LLLocalTextureObject*> result;
|
||||
|
||||
for(te_map_t::const_iterator iter = mTEMap.begin();
|
||||
iter != mTEMap.end(); iter++)
|
||||
for(te_map_t::value_type& te_pair : mTEMap)
|
||||
{
|
||||
LLLocalTextureObject* lto = iter->second;
|
||||
LLLocalTextureObject* lto = te_pair.second;
|
||||
result.push_back(lto);
|
||||
}
|
||||
|
||||
|
|
@ -547,37 +542,15 @@ void LLWearable::revertValues()
|
|||
// FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance.
|
||||
|
||||
//update saved settings so wearable is no longer dirty
|
||||
// non-driver params first
|
||||
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
|
||||
// One loop should be necessary here
|
||||
for (param_map_t::value_type& vp_pair : mSavedVisualParamMap)
|
||||
{
|
||||
S32 id = iter->first;
|
||||
F32 value = iter->second;
|
||||
S32 id = vp_pair.first;
|
||||
LLVisualParam *param = getVisualParam(id);
|
||||
if(param && !dynamic_cast<LLDriverParam*>(param) )
|
||||
if(param)
|
||||
{
|
||||
F32 value = vp_pair.second;
|
||||
setVisualParamWeight(id, value);
|
||||
}
|
||||
}
|
||||
|
||||
//then driver params
|
||||
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
|
||||
{
|
||||
S32 id = iter->first;
|
||||
F32 value = iter->second;
|
||||
LLVisualParam *param = getVisualParam(id);
|
||||
if(param && dynamic_cast<LLDriverParam*>(param) )
|
||||
{
|
||||
setVisualParamWeight(id, value);
|
||||
}
|
||||
}
|
||||
|
||||
// make sure that saved values are sane
|
||||
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
|
||||
{
|
||||
S32 id = iter->first;
|
||||
LLVisualParam *param = getVisualParam(id);
|
||||
if( param )
|
||||
{
|
||||
mSavedVisualParamMap[id] = param->getWeight();
|
||||
}
|
||||
}
|
||||
|
|
@ -589,10 +562,10 @@ void LLWearable::saveValues()
|
|||
{
|
||||
//update saved settings so wearable is no longer dirty
|
||||
mSavedVisualParamMap.clear();
|
||||
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter)
|
||||
for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
|
||||
{
|
||||
S32 id = iter->first;
|
||||
LLVisualParam *wearable_param = iter->second;
|
||||
S32 id = vp_pair.first;
|
||||
LLVisualParam *wearable_param = vp_pair.second;
|
||||
F32 value = wearable_param->getWeight();
|
||||
mSavedVisualParamMap[id] = value;
|
||||
}
|
||||
|
|
@ -706,23 +679,18 @@ LLVisualParam* LLWearable::getVisualParam(S32 index) const
|
|||
|
||||
void LLWearable::getVisualParams(visual_param_vec_t &list)
|
||||
{
|
||||
visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
|
||||
visual_param_index_map_t::iterator end = mVisualParamIndexMap.end();
|
||||
|
||||
// add all visual params to the passed-in vector
|
||||
for( ; iter != end; ++iter )
|
||||
for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
|
||||
{
|
||||
list.push_back(iter->second);
|
||||
list.push_back(vp_pair.second);
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearable::animateParams(F32 delta)
|
||||
{
|
||||
for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
|
||||
iter != mVisualParamIndexMap.end();
|
||||
++iter)
|
||||
for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
|
||||
{
|
||||
LLVisualParam *param = (LLVisualParam*) iter->second;
|
||||
LLVisualParam *param = (LLVisualParam*)vp_pair.second;
|
||||
param->animate(delta);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@
|
|||
#include "llendianswizzle.h"
|
||||
#include "llassetstorage.h"
|
||||
#include "llrefcount.h"
|
||||
#include "threadpool.h"
|
||||
#include "workqueue.h"
|
||||
|
||||
#include "llvorbisencode.h"
|
||||
|
||||
|
|
@ -45,15 +47,13 @@
|
|||
|
||||
extern LLAudioEngine *gAudiop;
|
||||
|
||||
LLAudioDecodeMgr *gAudioDecodeMgrp = NULL;
|
||||
|
||||
static const S32 WAV_HEADER_SIZE = 44;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class LLVorbisDecodeState : public LLRefCount
|
||||
class LLVorbisDecodeState : public LLThreadSafeRefCount
|
||||
{
|
||||
public:
|
||||
class WriteResponder : public LLLFSThread::Responder
|
||||
|
|
@ -532,146 +532,254 @@ void LLVorbisDecodeState::flushBadFile()
|
|||
|
||||
class LLAudioDecodeMgr::Impl
|
||||
{
|
||||
friend class LLAudioDecodeMgr;
|
||||
public:
|
||||
Impl() {};
|
||||
~Impl() {};
|
||||
friend class LLAudioDecodeMgr;
|
||||
Impl();
|
||||
public:
|
||||
|
||||
void processQueue(const F32 num_secs = 0.005);
|
||||
void processQueue();
|
||||
|
||||
protected:
|
||||
std::deque<LLUUID> mDecodeQueue;
|
||||
LLPointer<LLVorbisDecodeState> mCurrentDecodep;
|
||||
void startMoreDecodes();
|
||||
void enqueueFinishAudio(const LLUUID &decode_id, LLPointer<LLVorbisDecodeState>& decode_state);
|
||||
void checkDecodesFinished();
|
||||
|
||||
protected:
|
||||
std::deque<LLUUID> mDecodeQueue;
|
||||
std::map<LLUUID, LLPointer<LLVorbisDecodeState>> mDecodes;
|
||||
};
|
||||
|
||||
|
||||
void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
|
||||
LLAudioDecodeMgr::Impl::Impl()
|
||||
{
|
||||
LLUUID uuid;
|
||||
}
|
||||
|
||||
LLTimer decode_timer;
|
||||
// Returns the in-progress decode_state, which may be an empty LLPointer if
|
||||
// there was an error and there is no more work to be done.
|
||||
LLPointer<LLVorbisDecodeState> beginDecodingAndWritingAudio(const LLUUID &decode_id);
|
||||
|
||||
BOOL done = FALSE;
|
||||
while (!done)
|
||||
{
|
||||
if (mCurrentDecodep)
|
||||
{
|
||||
BOOL res;
|
||||
// Return true if finished
|
||||
bool tryFinishAudio(const LLUUID &decode_id, LLPointer<LLVorbisDecodeState> decode_state);
|
||||
|
||||
// Decode in a loop until we're done or have run out of time.
|
||||
while(!(res = mCurrentDecodep->decodeSection()) && (decode_timer.getElapsedTimeF32() < num_secs))
|
||||
{
|
||||
// decodeSection does all of the work above
|
||||
}
|
||||
void LLAudioDecodeMgr::Impl::processQueue()
|
||||
{
|
||||
// First, check if any audio from in-progress decodes are ready to play. If
|
||||
// so, mark them ready for playback (or errored, in case of error).
|
||||
checkDecodesFinished();
|
||||
|
||||
if (mCurrentDecodep->isDone() && !mCurrentDecodep->isValid())
|
||||
{
|
||||
// We had an error when decoding, abort.
|
||||
LL_WARNS("AudioEngine") << mCurrentDecodep->getUUID() << " has invalid vorbis data, aborting decode" << LL_ENDL;
|
||||
mCurrentDecodep->flushBadFile();
|
||||
// Second, start as many decodes from the queue as permitted
|
||||
startMoreDecodes();
|
||||
}
|
||||
|
||||
if (gAudiop)
|
||||
{
|
||||
LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID());
|
||||
adp->setHasValidData(false);
|
||||
adp->setHasCompletedDecode(true);
|
||||
}
|
||||
void LLAudioDecodeMgr::Impl::startMoreDecodes()
|
||||
{
|
||||
llassert_always(gAudiop);
|
||||
|
||||
mCurrentDecodep = NULL;
|
||||
done = TRUE;
|
||||
}
|
||||
LL::WorkQueue::ptr_t main_queue = LL::WorkQueue::getInstance("mainloop");
|
||||
// *NOTE: main_queue->postTo casts this refcounted smart pointer to a weak
|
||||
// pointer
|
||||
LL::WorkQueue::ptr_t general_queue = LL::WorkQueue::getInstance("General");
|
||||
const LL::ThreadPool::ptr_t general_thread_pool = LL::ThreadPool::getInstance("General");
|
||||
llassert_always(main_queue);
|
||||
llassert_always(general_queue);
|
||||
llassert_always(general_thread_pool);
|
||||
// Set max decodes to double the thread count of the general work queue.
|
||||
// This ensures the general work queue is full, but prevents theoretical
|
||||
// buildup of buffers in memory due to disk writes once the
|
||||
// LLVorbisDecodeState leaves the worker thread (see
|
||||
// LLLFSThread::sLocal->write). This is probably as fast as we can get it
|
||||
// without modifying/removing LLVorbisDecodeState, at which point we should
|
||||
// consider decoding the audio during the asset download process.
|
||||
// -Cosmic,2022-05-11
|
||||
const size_t max_decodes = general_thread_pool->getWidth() * 2;
|
||||
|
||||
if (!res)
|
||||
{
|
||||
// We've used up out time slice, bail...
|
||||
done = TRUE;
|
||||
}
|
||||
else if (mCurrentDecodep)
|
||||
{
|
||||
if (gAudiop && mCurrentDecodep->finishDecode())
|
||||
{
|
||||
// We finished!
|
||||
LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID());
|
||||
if (!adp)
|
||||
{
|
||||
LL_WARNS("AudioEngine") << "Missing LLAudioData for decode of " << mCurrentDecodep->getUUID() << LL_ENDL;
|
||||
}
|
||||
else if (mCurrentDecodep->isValid() && mCurrentDecodep->isDone())
|
||||
{
|
||||
adp->setHasCompletedDecode(true);
|
||||
adp->setHasDecodedData(true);
|
||||
adp->setHasValidData(true);
|
||||
while (!mDecodeQueue.empty() && mDecodes.size() < max_decodes)
|
||||
{
|
||||
const LLUUID decode_id = mDecodeQueue.front();
|
||||
mDecodeQueue.pop_front();
|
||||
|
||||
// At this point, we could see if anyone needs this sound immediately, but
|
||||
// I'm not sure that there's a reason to - we need to poll all of the playing
|
||||
// sounds anyway.
|
||||
//LL_INFOS("AudioEngine") << "Finished the vorbis decode, now what?" << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
adp->setHasCompletedDecode(true);
|
||||
LL_INFOS("AudioEngine") << "Vorbis decode failed for " << mCurrentDecodep->getUUID() << LL_ENDL;
|
||||
}
|
||||
mCurrentDecodep = NULL;
|
||||
}
|
||||
done = TRUE; // done for now
|
||||
}
|
||||
}
|
||||
// Don't decode the same file twice
|
||||
if (mDecodes.find(decode_id) != mDecodes.end())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (gAudiop->hasDecodedFile(decode_id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!done)
|
||||
{
|
||||
if (mDecodeQueue.empty())
|
||||
{
|
||||
// Nothing else on the queue.
|
||||
done = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LLUUID uuid;
|
||||
uuid = mDecodeQueue.front();
|
||||
mDecodeQueue.pop_front();
|
||||
if (!gAudiop || gAudiop->hasDecodedFile(uuid))
|
||||
{
|
||||
// This file has already been decoded, don't decode it again.
|
||||
continue;
|
||||
}
|
||||
// Kick off a decode
|
||||
mDecodes[decode_id] = LLPointer<LLVorbisDecodeState>(NULL);
|
||||
try
|
||||
{
|
||||
main_queue->postTo(
|
||||
general_queue,
|
||||
[decode_id]() // Work done on general queue
|
||||
{
|
||||
LLPointer<LLVorbisDecodeState> decode_state = beginDecodingAndWritingAudio(decode_id);
|
||||
|
||||
LL_DEBUGS() << "Decoding " << uuid << " from audio queue!" << LL_ENDL;
|
||||
if (!decode_state)
|
||||
{
|
||||
// Audio decode has errored
|
||||
return decode_state;
|
||||
}
|
||||
|
||||
std::string uuid_str;
|
||||
std::string d_path;
|
||||
// Disk write of decoded audio is now in progress off-thread
|
||||
return decode_state;
|
||||
},
|
||||
[decode_id, this](LLPointer<LLVorbisDecodeState> decode_state) // Callback to main thread
|
||||
mutable {
|
||||
if (!gAudiop)
|
||||
{
|
||||
// There is no LLAudioEngine anymore. This might happen if
|
||||
// an audio decode is enqueued just before shutdown.
|
||||
return;
|
||||
}
|
||||
|
||||
LLTimer timer;
|
||||
timer.reset();
|
||||
// At this point, we can be certain that the pointer to "this"
|
||||
// is valid because the lifetime of "this" is dependent upon
|
||||
// the lifetime of gAudiop.
|
||||
|
||||
uuid.toString(uuid_str);
|
||||
d_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + ".dsf";
|
||||
enqueueFinishAudio(decode_id, decode_state);
|
||||
});
|
||||
}
|
||||
catch (const LLThreadSafeQueueInterrupt&)
|
||||
{
|
||||
// Shutdown
|
||||
// Consider making processQueue() do a cleanup instead
|
||||
// of starting more decodes
|
||||
LL_WARNS() << "Tried to start decoding on shutdown" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mCurrentDecodep = new LLVorbisDecodeState(uuid, d_path);
|
||||
if (!mCurrentDecodep->initDecode())
|
||||
{
|
||||
mCurrentDecodep = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LLPointer<LLVorbisDecodeState> beginDecodingAndWritingAudio(const LLUUID &decode_id)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA;
|
||||
|
||||
LL_DEBUGS() << "Decoding " << decode_id << " from audio queue!" << LL_ENDL;
|
||||
|
||||
std::string d_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, decode_id.asString()) + ".dsf";
|
||||
LLPointer<LLVorbisDecodeState> decode_state = new LLVorbisDecodeState(decode_id, d_path);
|
||||
|
||||
if (!decode_state->initDecode())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Decode in a loop until we're done
|
||||
while (!decode_state->decodeSection())
|
||||
{
|
||||
// decodeSection does all of the work above
|
||||
}
|
||||
|
||||
if (!decode_state->isDone())
|
||||
{
|
||||
// Decode stopped early, or something bad happened to the file
|
||||
// during decoding.
|
||||
LL_WARNS("AudioEngine") << decode_id << " has invalid vorbis data or decode has been canceled, aborting decode" << LL_ENDL;
|
||||
decode_state->flushBadFile();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!decode_state->isValid())
|
||||
{
|
||||
// We had an error when decoding, abort.
|
||||
LL_WARNS("AudioEngine") << decode_id << " has invalid vorbis data, aborting decode" << LL_ENDL;
|
||||
decode_state->flushBadFile();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Kick off the writing of the decoded audio to the disk cache.
|
||||
// The receiving thread can then cheaply call finishDecode() again to check
|
||||
// if writing has finished. Someone has to hold on to the refcounted
|
||||
// decode_state to prevent it from getting destroyed during write.
|
||||
decode_state->finishDecode();
|
||||
|
||||
return decode_state;
|
||||
}
|
||||
|
||||
void LLAudioDecodeMgr::Impl::enqueueFinishAudio(const LLUUID &decode_id, LLPointer<LLVorbisDecodeState>& decode_state)
|
||||
{
|
||||
// Assumed fast
|
||||
if (tryFinishAudio(decode_id, decode_state))
|
||||
{
|
||||
// Done early!
|
||||
auto decode_iter = mDecodes.find(decode_id);
|
||||
llassert(decode_iter != mDecodes.end());
|
||||
mDecodes.erase(decode_iter);
|
||||
return;
|
||||
}
|
||||
|
||||
// Not done yet... enqueue it
|
||||
mDecodes[decode_id] = decode_state;
|
||||
}
|
||||
|
||||
void LLAudioDecodeMgr::Impl::checkDecodesFinished()
|
||||
{
|
||||
auto decode_iter = mDecodes.begin();
|
||||
while (decode_iter != mDecodes.end())
|
||||
{
|
||||
const LLUUID& decode_id = decode_iter->first;
|
||||
const LLPointer<LLVorbisDecodeState>& decode_state = decode_iter->second;
|
||||
if (tryFinishAudio(decode_id, decode_state))
|
||||
{
|
||||
decode_iter = mDecodes.erase(decode_iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
++decode_iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool tryFinishAudio(const LLUUID &decode_id, LLPointer<LLVorbisDecodeState> decode_state)
|
||||
{
|
||||
// decode_state is a file write in progress unless finished is true
|
||||
bool finished = decode_state && decode_state->finishDecode();
|
||||
if (!finished)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
llassert_always(gAudiop);
|
||||
|
||||
LLAudioData *adp = gAudiop->getAudioData(decode_id);
|
||||
if (!adp)
|
||||
{
|
||||
LL_WARNS("AudioEngine") << "Missing LLAudioData for decode of " << decode_id << LL_ENDL;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool valid = decode_state && decode_state->isValid();
|
||||
// Mark current decode finished regardless of success or failure
|
||||
adp->setHasCompletedDecode(true);
|
||||
// Flip flags for decoded data
|
||||
adp->setHasDecodeFailed(!valid);
|
||||
adp->setHasDecodedData(valid);
|
||||
// When finished decoding, there will also be a decoded wav file cached on
|
||||
// disk with the .dsf extension
|
||||
if (valid)
|
||||
{
|
||||
adp->setHasWAVLoadFailed(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LLAudioDecodeMgr::LLAudioDecodeMgr()
|
||||
{
|
||||
mImpl = new Impl;
|
||||
mImpl = new Impl();
|
||||
}
|
||||
|
||||
LLAudioDecodeMgr::~LLAudioDecodeMgr()
|
||||
{
|
||||
delete mImpl;
|
||||
delete mImpl;
|
||||
mImpl = nullptr;
|
||||
}
|
||||
|
||||
void LLAudioDecodeMgr::processQueue(const F32 num_secs)
|
||||
void LLAudioDecodeMgr::processQueue()
|
||||
{
|
||||
mImpl->processQueue(num_secs);
|
||||
mImpl->processQueue();
|
||||
}
|
||||
|
||||
BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
|
||||
|
|
@ -687,7 +795,7 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
|
|||
{
|
||||
// Just put it on the decode queue.
|
||||
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has local asset file already" << LL_ENDL;
|
||||
mImpl->mDecodeQueue.push_back(uuid);
|
||||
mImpl->mDecodeQueue.push_back(uuid);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,24 +32,23 @@
|
|||
|
||||
#include "llassettype.h"
|
||||
#include "llframetimer.h"
|
||||
#include "llsingleton.h"
|
||||
|
||||
template<class T> class LLPointer;
|
||||
class LLVorbisDecodeState;
|
||||
|
||||
class LLAudioDecodeMgr
|
||||
class LLAudioDecodeMgr : public LLSingleton<LLAudioDecodeMgr>
|
||||
{
|
||||
LLSINGLETON(LLAudioDecodeMgr);
|
||||
~LLAudioDecodeMgr();
|
||||
public:
|
||||
LLAudioDecodeMgr();
|
||||
~LLAudioDecodeMgr();
|
||||
|
||||
void processQueue(const F32 num_secs = 0.005);
|
||||
void processQueue();
|
||||
BOOL addDecodeRequest(const LLUUID &uuid);
|
||||
void addAudioRequest(const LLUUID &uuid);
|
||||
|
||||
protected:
|
||||
class Impl;
|
||||
Impl* mImpl;
|
||||
Impl* mImpl;
|
||||
};
|
||||
|
||||
extern LLAudioDecodeMgr *gAudioDecodeMgrp;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -83,18 +83,10 @@ void LLAudioEngine::setDefaults()
|
|||
|
||||
mLastStatus = 0;
|
||||
|
||||
mNumChannels = 0;
|
||||
mEnableWind = false;
|
||||
|
||||
S32 i;
|
||||
for (i = 0; i < MAX_CHANNELS; i++)
|
||||
{
|
||||
mChannels[i] = NULL;
|
||||
}
|
||||
for (i = 0; i < MAX_BUFFERS; i++)
|
||||
{
|
||||
mBuffers[i] = NULL;
|
||||
}
|
||||
mChannels.fill(nullptr);
|
||||
mBuffers.fill(nullptr);
|
||||
|
||||
mMasterGain = 1.f;
|
||||
// Setting mInternalGain to an out of range value fixes the issue reported in STORM-830.
|
||||
|
|
@ -111,18 +103,14 @@ void LLAudioEngine::setDefaults()
|
|||
}
|
||||
|
||||
|
||||
bool LLAudioEngine::init(const S32 num_channels, void* userdata, const std::string &app_title)
|
||||
bool LLAudioEngine::init(void* userdata, const std::string &app_title)
|
||||
{
|
||||
setDefaults();
|
||||
|
||||
mNumChannels = num_channels;
|
||||
mUserData = userdata;
|
||||
|
||||
allocateListener();
|
||||
|
||||
// Initialize the decode manager
|
||||
gAudioDecodeMgrp = new LLAudioDecodeMgr;
|
||||
|
||||
LL_INFOS("AudioEngine") << "LLAudioEngine::init() AudioEngine successfully initialized" << LL_ENDL;
|
||||
|
||||
return true;
|
||||
|
|
@ -131,39 +119,33 @@ bool LLAudioEngine::init(const S32 num_channels, void* userdata, const std::stri
|
|||
|
||||
void LLAudioEngine::shutdown()
|
||||
{
|
||||
// Clean up decode manager
|
||||
delete gAudioDecodeMgrp;
|
||||
gAudioDecodeMgrp = NULL;
|
||||
|
||||
// Clean up wind source
|
||||
cleanupWind();
|
||||
|
||||
// Clean up audio sources
|
||||
source_map::iterator iter_src;
|
||||
for (iter_src = mAllSources.begin(); iter_src != mAllSources.end(); iter_src++)
|
||||
for (source_map::value_type& src_pair : mAllSources)
|
||||
{
|
||||
delete iter_src->second;
|
||||
delete src_pair.second;
|
||||
}
|
||||
|
||||
|
||||
// Clean up audio data
|
||||
data_map::iterator iter_data;
|
||||
for (iter_data = mAllData.begin(); iter_data != mAllData.end(); iter_data++)
|
||||
for (data_map::value_type& data_pair : mAllData)
|
||||
{
|
||||
delete iter_data->second;
|
||||
delete data_pair.second;
|
||||
}
|
||||
|
||||
|
||||
// Clean up channels
|
||||
S32 i;
|
||||
for (i = 0; i < MAX_CHANNELS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_CHANNELS; i++)
|
||||
{
|
||||
delete mChannels[i];
|
||||
mChannels[i] = NULL;
|
||||
}
|
||||
|
||||
// Clean up buffers
|
||||
for (i = 0; i < MAX_BUFFERS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_BUFFERS; i++)
|
||||
{
|
||||
delete mBuffers[i];
|
||||
mBuffers[i] = NULL;
|
||||
|
|
@ -229,7 +211,7 @@ std::string LLAudioEngine::getInternetStreamURL()
|
|||
void LLAudioEngine::updateChannels()
|
||||
{
|
||||
S32 i;
|
||||
for (i = 0; i < MAX_CHANNELS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_CHANNELS; i++)
|
||||
{
|
||||
if (mChannels[i])
|
||||
{
|
||||
|
|
@ -240,20 +222,14 @@ void LLAudioEngine::updateChannels()
|
|||
}
|
||||
}
|
||||
|
||||
static const F32 default_max_decode_time = .002f; // 2 ms
|
||||
void LLAudioEngine::idle(F32 max_decode_time)
|
||||
void LLAudioEngine::idle()
|
||||
{
|
||||
if (max_decode_time <= 0.f)
|
||||
{
|
||||
max_decode_time = default_max_decode_time;
|
||||
}
|
||||
|
||||
// "Update" all of our audio sources, clean up dead ones.
|
||||
// Primarily does position updating, cleanup of unused audio sources.
|
||||
// Also does regeneration of the current priority of each audio source.
|
||||
|
||||
S32 i;
|
||||
for (i = 0; i < MAX_BUFFERS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_BUFFERS; i++)
|
||||
{
|
||||
if (mBuffers[i])
|
||||
{
|
||||
|
|
@ -332,12 +308,12 @@ void LLAudioEngine::idle(F32 max_decode_time)
|
|||
updateChannels();
|
||||
|
||||
// Update queued sounds (switch to next queued data if the current has finished playing)
|
||||
for (iter = mAllSources.begin(); iter != mAllSources.end(); ++iter)
|
||||
for (source_map::value_type& src_pair : mAllSources)
|
||||
{
|
||||
// This is lame, instead of this I could actually iterate through all the sources
|
||||
// attached to each channel, since only those with active channels
|
||||
// can have anything interesting happen with their queue? (Maybe not true)
|
||||
LLAudioSource *sourcep = iter->second;
|
||||
LLAudioSource *sourcep = src_pair.second;
|
||||
if (!sourcep->mQueuedDatap || sourcep->isMuted())
|
||||
{
|
||||
// Muted, or nothing queued, so we don't care.
|
||||
|
|
@ -417,9 +393,9 @@ void LLAudioEngine::idle(F32 max_decode_time)
|
|||
LLAudioSource *sync_masterp = NULL;
|
||||
LLAudioChannel *master_channelp = NULL;
|
||||
F32 max_sm_priority = -1.f;
|
||||
for (iter = mAllSources.begin(); iter != mAllSources.end(); ++iter)
|
||||
for (source_map::value_type& src_pair : mAllSources)
|
||||
{
|
||||
LLAudioSource *sourcep = iter->second;
|
||||
LLAudioSource *sourcep = src_pair.second;
|
||||
if (sourcep->isMuted())
|
||||
{
|
||||
continue;
|
||||
|
|
@ -439,9 +415,9 @@ void LLAudioEngine::idle(F32 max_decode_time)
|
|||
{
|
||||
// Synchronize loop slaves with their masters
|
||||
// Update queued sounds (switch to next queued data if the current has finished playing)
|
||||
for (iter = mAllSources.begin(); iter != mAllSources.end(); ++iter)
|
||||
for (source_map::value_type& src_pair : mAllSources)
|
||||
{
|
||||
LLAudioSource *sourcep = iter->second;
|
||||
LLAudioSource *sourcep = src_pair.second;
|
||||
|
||||
if (!sourcep->isSyncSlave())
|
||||
{
|
||||
|
|
@ -473,7 +449,7 @@ void LLAudioEngine::idle(F32 max_decode_time)
|
|||
commitDeferredChanges();
|
||||
|
||||
// Flush unused buffers that are stale enough
|
||||
for (i = 0; i < MAX_BUFFERS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_BUFFERS; i++)
|
||||
{
|
||||
if (mBuffers[i])
|
||||
{
|
||||
|
|
@ -489,7 +465,7 @@ void LLAudioEngine::idle(F32 max_decode_time)
|
|||
|
||||
|
||||
// Clear all of the looped flags for the channels
|
||||
for (i = 0; i < MAX_CHANNELS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_CHANNELS; i++)
|
||||
{
|
||||
if (mChannels[i])
|
||||
{
|
||||
|
|
@ -498,7 +474,7 @@ void LLAudioEngine::idle(F32 max_decode_time)
|
|||
}
|
||||
|
||||
// Decode audio files
|
||||
gAudioDecodeMgrp->processQueue(max_decode_time);
|
||||
LLAudioDecodeMgr::getInstance()->processQueue();
|
||||
|
||||
// Call this every frame, just in case we somehow
|
||||
// missed picking it up in all the places that can add
|
||||
|
|
@ -532,7 +508,7 @@ bool LLAudioEngine::updateBufferForData(LLAudioData *adp, const LLUUID &audio_uu
|
|||
{
|
||||
if (audio_uuid.notNull())
|
||||
{
|
||||
gAudioDecodeMgrp->addDecodeRequest(audio_uuid);
|
||||
LLAudioDecodeMgr::getInstance()->addDecodeRequest(audio_uuid);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -561,7 +537,7 @@ void LLAudioEngine::enableWind(bool enable)
|
|||
LLAudioBuffer * LLAudioEngine::getFreeBuffer()
|
||||
{
|
||||
S32 i;
|
||||
for (i = 0; i < MAX_BUFFERS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_BUFFERS; i++)
|
||||
{
|
||||
if (!mBuffers[i])
|
||||
{
|
||||
|
|
@ -574,7 +550,7 @@ LLAudioBuffer * LLAudioEngine::getFreeBuffer()
|
|||
// Grab the oldest unused buffer
|
||||
F32 max_age = -1.f;
|
||||
S32 buffer_id = -1;
|
||||
for (i = 0; i < MAX_BUFFERS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_BUFFERS; i++)
|
||||
{
|
||||
if (mBuffers[i])
|
||||
{
|
||||
|
|
@ -605,7 +581,7 @@ LLAudioBuffer * LLAudioEngine::getFreeBuffer()
|
|||
LLAudioChannel * LLAudioEngine::getFreeChannel(const F32 priority)
|
||||
{
|
||||
S32 i;
|
||||
for (i = 0; i < mNumChannels; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_CHANNELS; i++)
|
||||
{
|
||||
if (!mChannels[i])
|
||||
{
|
||||
|
|
@ -633,7 +609,7 @@ LLAudioChannel * LLAudioEngine::getFreeChannel(const F32 priority)
|
|||
F32 min_priority = 10000.f;
|
||||
LLAudioChannel *min_channelp = NULL;
|
||||
|
||||
for (i = 0; i < mNumChannels; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_CHANNELS; i++)
|
||||
{
|
||||
LLAudioChannel *channelp = mChannels[i];
|
||||
LLAudioSource *sourcep = channelp->getSource();
|
||||
|
|
@ -660,7 +636,7 @@ LLAudioChannel * LLAudioEngine::getFreeChannel(const F32 priority)
|
|||
void LLAudioEngine::cleanupBuffer(LLAudioBuffer *bufferp)
|
||||
{
|
||||
S32 i;
|
||||
for (i = 0; i < MAX_BUFFERS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_BUFFERS; i++)
|
||||
{
|
||||
if (mBuffers[i] == bufferp)
|
||||
{
|
||||
|
|
@ -678,7 +654,7 @@ bool LLAudioEngine::preloadSound(const LLUUID &uuid)
|
|||
getAudioData(uuid); // We don't care about the return value, this is just to make sure
|
||||
// that we have an entry, which will mean that the audio engine knows about this
|
||||
|
||||
if (gAudioDecodeMgrp->addDecodeRequest(uuid))
|
||||
if (LLAudioDecodeMgr::getInstance()->addDecodeRequest(uuid))
|
||||
{
|
||||
// This means that we do have a local copy, and we're working on decoding it.
|
||||
return true;
|
||||
|
|
@ -954,6 +930,7 @@ LLAudioSource * LLAudioEngine::findAudioSource(const LLUUID &source_id)
|
|||
|
||||
LLAudioData * LLAudioEngine::getAudioData(const LLUUID &audio_uuid)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA;
|
||||
data_map::iterator iter;
|
||||
iter = mAllData.find(audio_uuid);
|
||||
if (iter == mAllData.end())
|
||||
|
|
@ -1040,7 +1017,7 @@ void LLAudioEngine::startNextTransfer()
|
|||
|
||||
// Check all channels for currently playing sounds.
|
||||
F32 max_pri = -1.f;
|
||||
for (i = 0; i < MAX_CHANNELS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_CHANNELS; i++)
|
||||
{
|
||||
if (!mChannels[i])
|
||||
{
|
||||
|
|
@ -1068,7 +1045,7 @@ void LLAudioEngine::startNextTransfer()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!adp->hasLocalData() && adp->hasValidData())
|
||||
if (!adp->hasLocalData() && !adp->hasDecodeFailed())
|
||||
{
|
||||
asset_id = adp->getID();
|
||||
max_pri = asp->getPriority();
|
||||
|
|
@ -1079,7 +1056,7 @@ void LLAudioEngine::startNextTransfer()
|
|||
if (asset_id.isNull())
|
||||
{
|
||||
max_pri = -1.f;
|
||||
for (i = 0; i < MAX_CHANNELS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_CHANNELS; i++)
|
||||
{
|
||||
if (!mChannels[i])
|
||||
{
|
||||
|
|
@ -1104,7 +1081,7 @@ void LLAudioEngine::startNextTransfer()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!adp->hasLocalData() && adp->hasValidData())
|
||||
if (!adp->hasLocalData() && !adp->hasDecodeFailed())
|
||||
{
|
||||
asset_id = adp->getID();
|
||||
max_pri = asp->getPriority();
|
||||
|
|
@ -1116,7 +1093,7 @@ void LLAudioEngine::startNextTransfer()
|
|||
if (asset_id.isNull())
|
||||
{
|
||||
max_pri = -1.f;
|
||||
for (i = 0; i < MAX_CHANNELS; i++)
|
||||
for (i = 0; i < LL_MAX_AUDIO_CHANNELS; i++)
|
||||
{
|
||||
if (!mChannels[i])
|
||||
{
|
||||
|
|
@ -1136,15 +1113,15 @@ void LLAudioEngine::startNextTransfer()
|
|||
}
|
||||
|
||||
|
||||
for (data_iter = asp->mPreloadMap.begin(); data_iter != asp->mPreloadMap.end(); data_iter++)
|
||||
for (data_map::value_type& preload_pair : asp->mPreloadMap)
|
||||
{
|
||||
LLAudioData *adp = data_iter->second;
|
||||
LLAudioData *adp = preload_pair.second;
|
||||
if (!adp)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!adp->hasLocalData() && adp->hasValidData())
|
||||
if (!adp->hasLocalData() && !adp->hasDecodeFailed())
|
||||
{
|
||||
asset_id = adp->getID();
|
||||
max_pri = asp->getPriority();
|
||||
|
|
@ -1158,9 +1135,9 @@ void LLAudioEngine::startNextTransfer()
|
|||
{
|
||||
max_pri = -1.f;
|
||||
source_map::iterator source_iter;
|
||||
for (source_iter = mAllSources.begin(); source_iter != mAllSources.end(); source_iter++)
|
||||
for (source_map::value_type& source_pair : mAllSources)
|
||||
{
|
||||
asp = source_iter->second;
|
||||
asp = source_pair.second;
|
||||
if (!asp)
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1172,7 +1149,7 @@ void LLAudioEngine::startNextTransfer()
|
|||
}
|
||||
|
||||
adp = asp->getCurrentData();
|
||||
if (adp && !adp->hasLocalData() && adp->hasValidData())
|
||||
if (adp && !adp->hasLocalData() && !adp->hasDecodeFailed())
|
||||
{
|
||||
asset_id = adp->getID();
|
||||
max_pri = asp->getPriority();
|
||||
|
|
@ -1180,22 +1157,22 @@ void LLAudioEngine::startNextTransfer()
|
|||
}
|
||||
|
||||
adp = asp->getQueuedData();
|
||||
if (adp && !adp->hasLocalData() && adp->hasValidData())
|
||||
if (adp && !adp->hasLocalData() && !adp->hasDecodeFailed())
|
||||
{
|
||||
asset_id = adp->getID();
|
||||
max_pri = asp->getPriority();
|
||||
continue;
|
||||
}
|
||||
|
||||
for (data_iter = asp->mPreloadMap.begin(); data_iter != asp->mPreloadMap.end(); data_iter++)
|
||||
for (data_map::value_type& preload_pair : asp->mPreloadMap)
|
||||
{
|
||||
LLAudioData *adp = data_iter->second;
|
||||
LLAudioData *adp = preload_pair.second;
|
||||
if (!adp)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!adp->hasLocalData() && adp->hasValidData())
|
||||
if (!adp->hasLocalData() && !adp->hasDecodeFailed())
|
||||
{
|
||||
asset_id = adp->getID();
|
||||
max_pri = asp->getPriority();
|
||||
|
|
@ -1236,7 +1213,7 @@ void LLAudioEngine::assetCallback(const LLUUID &uuid, LLAssetType::EType type, v
|
|||
LLAudioData *adp = gAudiop->getAudioData(uuid);
|
||||
if (adp)
|
||||
{ // Make sure everything is cleared
|
||||
adp->setHasValidData(false);
|
||||
adp->setHasDecodeFailed(true);
|
||||
adp->setHasLocalData(false);
|
||||
adp->setHasDecodedData(false);
|
||||
adp->setHasCompletedDecode(true);
|
||||
|
|
@ -1253,9 +1230,9 @@ void LLAudioEngine::assetCallback(const LLUUID &uuid, LLAssetType::EType type, v
|
|||
else
|
||||
{
|
||||
// LL_INFOS() << "Got asset callback with good audio data for " << uuid << ", making decode request" << LL_ENDL;
|
||||
adp->setHasValidData(true);
|
||||
adp->setHasDecodeFailed(false);
|
||||
adp->setHasLocalData(true);
|
||||
gAudioDecodeMgrp->addDecodeRequest(uuid);
|
||||
LLAudioDecodeMgr::getInstance()->addDecodeRequest(uuid);
|
||||
}
|
||||
}
|
||||
gAudiop->mCurrentTransfer = LLUUID::null;
|
||||
|
|
@ -1325,11 +1302,15 @@ void LLAudioSource::update()
|
|||
{
|
||||
// Hack - try and load the sound. Will do this as a callback
|
||||
// on decode later.
|
||||
if (adp->load() && adp->getBuffer())
|
||||
if (adp->getBuffer())
|
||||
{
|
||||
play(adp->getID());
|
||||
}
|
||||
else if (adp->hasCompletedDecode()) // Only mark corrupted after decode is done
|
||||
else if (adp->hasDecodedData() && !adp->hasWAVLoadFailed())
|
||||
{
|
||||
adp->load();
|
||||
}
|
||||
else if (adp->hasCompletedDecode() && adp->hasDecodeFailed()) // Only mark corrupted after decode is done
|
||||
{
|
||||
LL_WARNS() << "Marking LLAudioSource corrupted for " << adp->getID() << LL_ENDL;
|
||||
mCorrupted = true ;
|
||||
|
|
@ -1620,17 +1601,16 @@ void LLAudioSource::addAudioData(LLAudioData *adp, const bool set_current)
|
|||
bool LLAudioSource::hasPendingPreloads() const
|
||||
{
|
||||
// Check to see if we've got any preloads on deck for this source
|
||||
data_map::const_iterator iter;
|
||||
for (iter = mPreloadMap.begin(); iter != mPreloadMap.end(); iter++)
|
||||
for (const data_map::value_type& preload_pair : mPreloadMap)
|
||||
{
|
||||
LLAudioData *adp = iter->second;
|
||||
LLAudioData *adp = preload_pair.second;
|
||||
// note: a bad UUID will forever be !hasDecodedData()
|
||||
// but also !hasValidData(), hence the check for hasValidData()
|
||||
// but also hasDecodeFailed(), hence the check for hasDecodeFailed()
|
||||
if (!adp)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!adp->hasDecodedData() && adp->hasValidData())
|
||||
if (!adp->hasDecodedData() && !adp->hasDecodeFailed())
|
||||
{
|
||||
// This source is still waiting for a preload
|
||||
return true;
|
||||
|
|
@ -1787,7 +1767,8 @@ LLAudioData::LLAudioData(const LLUUID &uuid) :
|
|||
mHasLocalData(false),
|
||||
mHasDecodedData(false),
|
||||
mHasCompletedDecode(false),
|
||||
mHasValidData(true)
|
||||
mHasDecodeFailed(false),
|
||||
mHasWAVLoadFailed(false)
|
||||
{
|
||||
if (uuid.isNull())
|
||||
{
|
||||
|
|
@ -1822,12 +1803,14 @@ bool LLAudioData::load()
|
|||
{
|
||||
// We already have this sound in a buffer, don't do anything.
|
||||
LL_INFOS() << "Already have a buffer for this sound, don't bother loading!" << LL_ENDL;
|
||||
mHasWAVLoadFailed = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!gAudiop)
|
||||
{
|
||||
LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
|
||||
mHasWAVLoadFailed = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1836,6 +1819,8 @@ bool LLAudioData::load()
|
|||
{
|
||||
// No free buffers, abort.
|
||||
LL_INFOS() << "Not able to allocate a new audio buffer, aborting." << LL_ENDL;
|
||||
// *TODO: Mark this failure differently so the audio engine could retry loading this buffer in the future
|
||||
mHasWAVLoadFailed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1844,7 +1829,8 @@ bool LLAudioData::load()
|
|||
mID.toString(uuid_str);
|
||||
wav_path= gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + ".dsf";
|
||||
|
||||
if (!mBufferp->loadWAV(wav_path))
|
||||
mHasWAVLoadFailed = !mBufferp->loadWAV(wav_path);
|
||||
if (mHasWAVLoadFailed)
|
||||
{
|
||||
// Hrm. Right now, let's unset the buffer, since it's empty.
|
||||
gAudiop->cleanupBuffer(mBufferp);
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ const F32 LL_WIND_UNDERWATER_CENTER_FREQ = 20.f;
|
|||
const F32 ATTACHED_OBJECT_TIMEOUT = 5.0f;
|
||||
const F32 DEFAULT_MIN_DISTANCE = 2.0f;
|
||||
|
||||
#define MAX_CHANNELS 30
|
||||
#define MAX_BUFFERS 40 // Some extra for preloading, maybe?
|
||||
#define LL_MAX_AUDIO_CHANNELS 30
|
||||
#define LL_MAX_AUDIO_BUFFERS 40 // Some extra for preloading, maybe?
|
||||
|
||||
class LLAudioSource;
|
||||
class LLAudioData;
|
||||
|
|
@ -88,7 +88,7 @@ public:
|
|||
virtual ~LLAudioEngine();
|
||||
|
||||
// initialization/startup/shutdown
|
||||
virtual bool init(const S32 num_channels, void *userdata, const std::string &app_title);
|
||||
virtual bool init(void *userdata, const std::string &app_title);
|
||||
virtual std::string getDriverName(bool verbose) = 0;
|
||||
virtual void shutdown();
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ public:
|
|||
//virtual void processQueue(const LLUUID &sound_guid);
|
||||
virtual void setListener(LLVector3 pos,LLVector3 vel,LLVector3 up,LLVector3 at);
|
||||
virtual void updateWind(LLVector3 direction, F32 camera_height_above_water) = 0;
|
||||
virtual void idle(F32 max_decode_time = 0.f);
|
||||
virtual void idle();
|
||||
virtual void updateChannels();
|
||||
|
||||
//
|
||||
|
|
@ -209,7 +209,6 @@ protected:
|
|||
|
||||
S32 mLastStatus;
|
||||
|
||||
S32 mNumChannels;
|
||||
bool mEnableWind;
|
||||
|
||||
LLUUID mCurrentTransfer; // Audio file currently being transferred by the system
|
||||
|
|
@ -224,11 +223,11 @@ protected:
|
|||
source_map mAllSources;
|
||||
data_map mAllData;
|
||||
|
||||
LLAudioChannel *mChannels[MAX_CHANNELS];
|
||||
std::array<LLAudioChannel*, LL_MAX_AUDIO_CHANNELS> mChannels;
|
||||
|
||||
// Buffers needs to change into a different data structure, as the number of buffers
|
||||
// that we have active should be limited by RAM usage, not count.
|
||||
LLAudioBuffer *mBuffers[MAX_BUFFERS];
|
||||
std::array<LLAudioBuffer*, LL_MAX_AUDIO_BUFFERS> mBuffers;
|
||||
|
||||
F32 mMasterGain;
|
||||
F32 mInternalGain; // Actual gain set; either mMasterGain or 0 when mMuted is true.
|
||||
|
|
@ -360,32 +359,36 @@ protected:
|
|||
|
||||
class LLAudioData
|
||||
{
|
||||
public:
|
||||
LLAudioData(const LLUUID &uuid);
|
||||
bool load();
|
||||
public:
|
||||
LLAudioData(const LLUUID &uuid);
|
||||
bool load();
|
||||
|
||||
LLUUID getID() const { return mID; }
|
||||
LLAudioBuffer *getBuffer() const { return mBufferp; }
|
||||
LLUUID getID() const { return mID; }
|
||||
LLAudioBuffer *getBuffer() const { return mBufferp; }
|
||||
|
||||
bool hasLocalData() const { return mHasLocalData; }
|
||||
bool hasDecodedData() const { return mHasDecodedData; }
|
||||
bool hasCompletedDecode() const { return mHasCompletedDecode; }
|
||||
bool hasValidData() const { return mHasValidData; }
|
||||
bool hasLocalData() const { return mHasLocalData; }
|
||||
bool hasDecodedData() const { return mHasDecodedData; }
|
||||
bool hasCompletedDecode() const { return mHasCompletedDecode; }
|
||||
bool hasDecodeFailed() const { return mHasDecodeFailed; }
|
||||
bool hasWAVLoadFailed() const { return mHasWAVLoadFailed; }
|
||||
|
||||
void setHasLocalData(const bool hld) { mHasLocalData = hld; }
|
||||
void setHasDecodedData(const bool hdd) { mHasDecodedData = hdd; }
|
||||
void setHasCompletedDecode(const bool hcd) { mHasCompletedDecode = hcd; }
|
||||
void setHasValidData(const bool hvd) { mHasValidData = hvd; }
|
||||
void setHasLocalData(const bool hld) { mHasLocalData = hld; }
|
||||
void setHasDecodedData(const bool hdd) { mHasDecodedData = hdd; }
|
||||
void setHasCompletedDecode(const bool hcd) { mHasCompletedDecode = hcd; }
|
||||
void setHasDecodeFailed(const bool hdf) { mHasDecodeFailed = hdf; }
|
||||
void setHasWAVLoadFailed(const bool hwlf) { mHasWAVLoadFailed = hwlf; }
|
||||
|
||||
friend class LLAudioEngine; // Severe laziness, bad.
|
||||
friend class LLAudioEngine; // Severe laziness, bad.
|
||||
|
||||
protected:
|
||||
LLUUID mID;
|
||||
LLAudioBuffer *mBufferp; // If this data is being used by the audio system, a pointer to the buffer will be set here.
|
||||
bool mHasLocalData; // Set true if the sound asset file is available locally
|
||||
bool mHasDecodedData; // Set true if the sound file has been decoded
|
||||
bool mHasCompletedDecode; // Set true when the sound is decoded
|
||||
bool mHasValidData; // Set false if decoding failed, meaning the sound asset is bad
|
||||
protected:
|
||||
LLUUID mID;
|
||||
LLAudioBuffer *mBufferp; // If this data is being used by the audio system, a pointer to the buffer will be set here.
|
||||
bool mHasLocalData; // Set true if the encoded sound asset file is available locally
|
||||
bool mHasDecodedData; // Set true if the decoded sound file is available on disk
|
||||
bool mHasCompletedDecode; // Set true when the sound is decoded
|
||||
bool mHasDecodeFailed; // Set true if decoding failed, meaning the sound asset is bad
|
||||
bool mHasWAVLoadFailed; // Set true if loading the decoded WAV file failed, meaning the sound asset should be decoded instead if
|
||||
// possible
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ static inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata, const std::string &app_title)
|
||||
bool LLAudioEngine_FMODSTUDIO::init(void* userdata, const std::string &app_title)
|
||||
{
|
||||
U32 version;
|
||||
FMOD_RESULT result;
|
||||
|
|
@ -86,7 +86,7 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata, cons
|
|||
return false;
|
||||
|
||||
//will call LLAudioEngine_FMODSTUDIO::allocateListener, which needs a valid mSystem pointer.
|
||||
LLAudioEngine::init(num_channels, userdata, app_title);
|
||||
LLAudioEngine::init(userdata, app_title);
|
||||
|
||||
result = mSystem->getVersion(&version);
|
||||
Check_FMOD_Error(result, "FMOD::System::getVersion");
|
||||
|
|
@ -98,7 +98,7 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata, cons
|
|||
}
|
||||
|
||||
// In this case, all sounds, PLUS wind and stream will be software.
|
||||
result = mSystem->setSoftwareChannels(num_channels + 2);
|
||||
result = mSystem->setSoftwareChannels(LL_MAX_AUDIO_CHANNELS + 2);
|
||||
Check_FMOD_Error(result, "FMOD::System::setSoftwareChannels");
|
||||
|
||||
FMOD_ADVANCEDSETTINGS settings;
|
||||
|
|
@ -127,7 +127,7 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata, cons
|
|||
{
|
||||
LL_DEBUGS("AppInit") << "Trying PulseAudio audio output..." << LL_ENDL;
|
||||
if (mSystem->setOutput(FMOD_OUTPUTTYPE_PULSEAUDIO) == FMOD_OK &&
|
||||
(result = mSystem->init(num_channels + 2, fmod_flags, const_cast<char*>(app_title.c_str()))) == FMOD_OK)
|
||||
(result = mSystem->init(LL_MAX_AUDIO_CHANNELS + 2, fmod_flags, const_cast<char*>(app_title.c_str()))) == FMOD_OK)
|
||||
{
|
||||
LL_DEBUGS("AppInit") << "PulseAudio output initialized OKAY" << LL_ENDL;
|
||||
audio_ok = true;
|
||||
|
|
@ -149,7 +149,7 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata, cons
|
|||
{
|
||||
LL_DEBUGS("AppInit") << "Trying ALSA audio output..." << LL_ENDL;
|
||||
if (mSystem->setOutput(FMOD_OUTPUTTYPE_ALSA) == FMOD_OK &&
|
||||
(result = mSystem->init(num_channels + 2, fmod_flags, 0)) == FMOD_OK)
|
||||
(result = mSystem->init(LL_MAX_AUDIO_CHANNELS + 2, fmod_flags, 0)) == FMOD_OK)
|
||||
{
|
||||
LL_DEBUGS("AppInit") << "ALSA audio output initialized OKAY" << LL_ENDL;
|
||||
audio_ok = true;
|
||||
|
|
@ -190,7 +190,7 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata, cons
|
|||
// initialize the FMOD engine
|
||||
// number of channel in this case looks to be identiacal to number of max simultaneously
|
||||
// playing objects and we can set practically any number
|
||||
result = mSystem->init(num_channels + 2, fmod_flags, 0);
|
||||
result = mSystem->init(LL_MAX_AUDIO_CHANNELS + 2, fmod_flags, 0);
|
||||
if (Check_FMOD_Error(result, "Error initializing FMOD Studio with default settins, retrying with other format"))
|
||||
{
|
||||
result = mSystem->setSoftwareFormat(44100, FMOD_SPEAKERMODE_STEREO, 0/*- ignore*/);
|
||||
|
|
@ -198,7 +198,7 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata, cons
|
|||
{
|
||||
return false;
|
||||
}
|
||||
result = mSystem->init(num_channels + 2, fmod_flags, 0);
|
||||
result = mSystem->init(LL_MAX_AUDIO_CHANNELS + 2, fmod_flags, 0);
|
||||
}
|
||||
if (Check_FMOD_Error(result, "Error initializing FMOD Studio"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public:
|
|||
virtual ~LLAudioEngine_FMODSTUDIO();
|
||||
|
||||
// initialization/startup/shutdown
|
||||
virtual bool init(const S32 num_channels, void *user_data, const std::string &app_title);
|
||||
virtual bool init(void *user_data, const std::string &app_title);
|
||||
virtual std::string getDriverName(bool verbose);
|
||||
virtual void allocateListener();
|
||||
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ LLAudioEngine_OpenAL::~LLAudioEngine_OpenAL()
|
|||
}
|
||||
|
||||
// virtual
|
||||
bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata, const std::string &app_title)
|
||||
bool LLAudioEngine_OpenAL::init(void* userdata, const std::string &app_title)
|
||||
{
|
||||
mWindGen = NULL;
|
||||
LLAudioEngine::init(num_channels, userdata, app_title);
|
||||
LLAudioEngine::init(userdata, app_title);
|
||||
|
||||
if(!alutInit(NULL, NULL))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class LLAudioEngine_OpenAL : public LLAudioEngine
|
|||
LLAudioEngine_OpenAL();
|
||||
virtual ~LLAudioEngine_OpenAL();
|
||||
|
||||
virtual bool init(const S32 num_channels, void *user_data, const std::string &app_title);
|
||||
virtual bool init(void *user_data, const std::string &app_title);
|
||||
virtual std::string getDriverName(bool verbose);
|
||||
virtual void allocateListener();
|
||||
|
||||
|
|
|
|||
|
|
@ -379,12 +379,11 @@ LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, BOOL allo
|
|||
|
||||
if (true_name)
|
||||
{
|
||||
for (anim_map_t::iterator iter = mAnimMap.begin();
|
||||
iter != mAnimMap.end(); iter++)
|
||||
for (anim_map_t::value_type& anim_pair : mAnimMap)
|
||||
{
|
||||
if (iter->second == true_name)
|
||||
if (anim_pair.second == true_name)
|
||||
{
|
||||
id = iter->first;
|
||||
id = anim_pair.first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,10 +156,9 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error
|
|||
}
|
||||
|
||||
// Recognize all names we've been told are legal.
|
||||
std::map<std::string, std::string>::iterator iter;
|
||||
for (iter = joint_alias_map.begin(); iter != joint_alias_map.end(); iter++)
|
||||
for (std::map<std::string, std::string>::value_type& alias_pair : joint_alias_map)
|
||||
{
|
||||
makeTranslation( iter->first , iter->second );
|
||||
makeTranslation( alias_pair.first , alias_pair.second );
|
||||
}
|
||||
|
||||
char error_text[128]; /* Flawfinder: ignore */
|
||||
|
|
@ -950,10 +949,8 @@ ELoadStatus LLBVHLoader::loadBVHFile(const char *buffer, char* error_text, S32 &
|
|||
//------------------------------------------------------------------------
|
||||
void LLBVHLoader::applyTranslations()
|
||||
{
|
||||
JointVector::iterator ji;
|
||||
for (ji = mJoints.begin(); ji != mJoints.end(); ++ji )
|
||||
for (Joint* joint : mJoints)
|
||||
{
|
||||
Joint *joint = *ji;
|
||||
//----------------------------------------------------------------
|
||||
// Look for a translation for this joint.
|
||||
// If none, skip to next joint
|
||||
|
|
@ -1066,10 +1063,8 @@ void LLBVHLoader::optimize()
|
|||
mEaseOut *= factor;
|
||||
}
|
||||
|
||||
JointVector::iterator ji;
|
||||
for (ji = mJoints.begin(); ji != mJoints.end(); ++ji)
|
||||
for (Joint* joint : mJoints)
|
||||
{
|
||||
Joint *joint = *ji;
|
||||
BOOL pos_changed = FALSE;
|
||||
BOOL rot_changed = FALSE;
|
||||
|
||||
|
|
@ -1294,15 +1289,12 @@ U32 LLBVHLoader::getOutputSize()
|
|||
// writes contents to datapacker
|
||||
BOOL LLBVHLoader::serialize(LLDataPacker& dp)
|
||||
{
|
||||
JointVector::iterator ji;
|
||||
KeyVector::iterator ki;
|
||||
F32 time;
|
||||
|
||||
// count number of non-ignored joints
|
||||
S32 numJoints = 0;
|
||||
for (ji=mJoints.begin(); ji!=mJoints.end(); ++ji)
|
||||
for (Joint* joint : mJoints)
|
||||
{
|
||||
Joint *joint = *ji;
|
||||
if ( ! joint->mIgnore )
|
||||
numJoints++;
|
||||
}
|
||||
|
|
@ -1321,11 +1313,8 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
|
|||
dp.packU32(mHand, "hand_pose");
|
||||
dp.packU32(numJoints, "num_joints");
|
||||
|
||||
for ( ji = mJoints.begin();
|
||||
ji != mJoints.end();
|
||||
++ji )
|
||||
for (Joint* joint : mJoints)
|
||||
{
|
||||
Joint *joint = *ji;
|
||||
// if ignored, skip it
|
||||
if ( joint->mIgnore )
|
||||
continue;
|
||||
|
|
@ -1348,17 +1337,15 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
|
|||
Joint *mergeParent = NULL;
|
||||
Joint *mergeChild = NULL;
|
||||
|
||||
JointVector::iterator mji;
|
||||
for (mji=mJoints.begin(); mji!=mJoints.end(); ++mji)
|
||||
for (Joint* mjoint : mJoints)
|
||||
{
|
||||
Joint *mjoint = *mji;
|
||||
if ( !joint->mMergeParentName.empty() && (mjoint->mName == joint->mMergeParentName) )
|
||||
{
|
||||
mergeParent = *mji;
|
||||
mergeParent = mjoint;
|
||||
}
|
||||
if ( !joint->mMergeChildName.empty() && (mjoint->mName == joint->mMergeChildName) )
|
||||
{
|
||||
mergeChild = *mji;
|
||||
mergeChild = mjoint;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1367,19 +1354,17 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
|
|||
LLQuaternion::Order order = bvhStringToOrder( joint->mOrder );
|
||||
S32 outcount = 0;
|
||||
S32 frame = 0;
|
||||
for ( ki = joint->mKeys.begin();
|
||||
ki != joint->mKeys.end();
|
||||
++ki )
|
||||
for (Key& key : joint->mKeys)
|
||||
{
|
||||
|
||||
if ((frame == 0) && joint->mRelativeRotationKey)
|
||||
{
|
||||
first_frame_rot = mayaQ( ki->mRot[0], ki->mRot[1], ki->mRot[2], order);
|
||||
first_frame_rot = mayaQ( key.mRot[0], key.mRot[1], key.mRot[2], order);
|
||||
|
||||
fixup_rot.shortestArc(LLVector3::z_axis * first_frame_rot * frameRot, LLVector3::z_axis);
|
||||
}
|
||||
|
||||
if (ki->mIgnoreRot)
|
||||
if (key.mIgnoreRot)
|
||||
{
|
||||
frame++;
|
||||
continue;
|
||||
|
|
@ -1418,7 +1403,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
|
|||
mergeChildRot.loadIdentity();
|
||||
}
|
||||
|
||||
LLQuaternion inRot = mayaQ( ki->mRot[0], ki->mRot[1], ki->mRot[2], order);
|
||||
LLQuaternion inRot = mayaQ( key.mRot[0], key.mRot[1], key.mRot[2], order);
|
||||
|
||||
LLQuaternion outRot = frameRotInv* mergeChildRot * inRot * mergeParentRot * ~first_frame_rot * frameRot * offsetRot;
|
||||
|
||||
|
|
@ -1446,16 +1431,14 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
|
|||
LLVector3 relKey;
|
||||
|
||||
frame = 0;
|
||||
for ( ki = joint->mKeys.begin();
|
||||
ki != joint->mKeys.end();
|
||||
++ki )
|
||||
for (Key& key : joint->mKeys)
|
||||
{
|
||||
if ((frame == 0) && joint->mRelativePositionKey)
|
||||
{
|
||||
relKey.setVec(ki->mPos);
|
||||
relKey.setVec(key.mPos);
|
||||
}
|
||||
|
||||
if (ki->mIgnorePos)
|
||||
if (key.mIgnorePos)
|
||||
{
|
||||
frame++;
|
||||
continue;
|
||||
|
|
@ -1463,7 +1446,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
|
|||
|
||||
time = llmax((F32)(frame - NUMBER_OF_IGNORED_FRAMES_AT_START), 0.0f) * mFrameTime; // Time elapsed before this frame starts.
|
||||
|
||||
LLVector3 inPos = (LLVector3(ki->mPos) - relKey) * ~first_frame_rot;// * fixup_rot;
|
||||
LLVector3 inPos = (LLVector3(key.mPos) - relKey) * ~first_frame_rot;// * fixup_rot;
|
||||
LLVector3 outPos = inPos * frameRot * offsetRot;
|
||||
|
||||
outPos *= INCHES_TO_METERS;
|
||||
|
|
@ -1496,24 +1479,22 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
|
|||
S32 num_constraints = (S32)mConstraints.size();
|
||||
dp.packS32(num_constraints, "num_constraints");
|
||||
|
||||
for (ConstraintVector::iterator constraint_it = mConstraints.begin();
|
||||
constraint_it != mConstraints.end();
|
||||
constraint_it++)
|
||||
for (Constraint& constraint : mConstraints)
|
||||
{
|
||||
U8 byte = constraint_it->mChainLength;
|
||||
U8 byte = constraint.mChainLength;
|
||||
dp.packU8(byte, "chain_length");
|
||||
|
||||
byte = constraint_it->mConstraintType;
|
||||
byte = constraint.mConstraintType;
|
||||
dp.packU8(byte, "constraint_type");
|
||||
dp.packBinaryDataFixed((U8*)constraint_it->mSourceJointName, 16, "source_volume");
|
||||
dp.packVector3(constraint_it->mSourceOffset, "source_offset");
|
||||
dp.packBinaryDataFixed((U8*)constraint_it->mTargetJointName, 16, "target_volume");
|
||||
dp.packVector3(constraint_it->mTargetOffset, "target_offset");
|
||||
dp.packVector3(constraint_it->mTargetDir, "target_dir");
|
||||
dp.packF32(constraint_it->mEaseInStart, "ease_in_start");
|
||||
dp.packF32(constraint_it->mEaseInStop, "ease_in_stop");
|
||||
dp.packF32(constraint_it->mEaseOutStart, "ease_out_start");
|
||||
dp.packF32(constraint_it->mEaseOutStop, "ease_out_stop");
|
||||
dp.packBinaryDataFixed((U8*)constraint.mSourceJointName, 16, "source_volume");
|
||||
dp.packVector3(constraint.mSourceOffset, "source_offset");
|
||||
dp.packBinaryDataFixed((U8*)constraint.mTargetJointName, 16, "target_volume");
|
||||
dp.packVector3(constraint.mTargetOffset, "target_offset");
|
||||
dp.packVector3(constraint.mTargetDir, "target_dir");
|
||||
dp.packF32(constraint.mEaseInStart, "ease_in_start");
|
||||
dp.packF32(constraint.mEaseInStop, "ease_in_stop");
|
||||
dp.packF32(constraint.mEaseOutStart, "ease_out_start");
|
||||
dp.packF32(constraint.mEaseOutStop, "ease_out_stop");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -246,10 +246,8 @@ void LLCharacter::dumpCharacter( LLJoint* joint )
|
|||
LL_INFOS() << "DEBUG: " << joint->getName() << " (" << (joint->getParent()?joint->getParent()->getName():std::string("ROOT")) << ")" << LL_ENDL;
|
||||
|
||||
// recurse
|
||||
for (LLJoint::joints_t::iterator iter = joint->mChildren.begin();
|
||||
iter != joint->mChildren.end(); ++iter)
|
||||
for (LLJoint* child_joint : joint->mChildren)
|
||||
{
|
||||
LLJoint* child_joint = *iter;
|
||||
dumpCharacter(child_joint);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,11 +218,9 @@ public:
|
|||
S32 getVisualParamCountInGroup(const EVisualParamGroup group) const
|
||||
{
|
||||
S32 rtn = 0;
|
||||
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
|
||||
iter != mVisualParamIndexMap.end();
|
||||
/**/ )
|
||||
for (const visual_param_index_map_t::value_type& index_pair : mVisualParamIndexMap)
|
||||
{
|
||||
if ((iter++)->second->getGroup() == group)
|
||||
if (index_pair.second->getGroup() == group)
|
||||
{
|
||||
++rtn;
|
||||
}
|
||||
|
|
@ -237,11 +235,10 @@ public:
|
|||
}
|
||||
S32 getVisualParamID(LLVisualParam *id)
|
||||
{
|
||||
visual_param_index_map_t::iterator iter;
|
||||
for (iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++)
|
||||
for (visual_param_index_map_t::value_type& index_pair : mVisualParamIndexMap)
|
||||
{
|
||||
if (iter->second == id)
|
||||
return iter->first;
|
||||
if (index_pair.second == id)
|
||||
return index_pair.first;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,15 +199,14 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
|
|||
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
|
||||
boost::char_separator<char> sep(" ");
|
||||
tokenizer tokens(string, sep);
|
||||
tokenizer::iterator token_iter;
|
||||
|
||||
for( token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
|
||||
for(const std::string& cur_token : tokens)
|
||||
{
|
||||
LLGesture* gesture = NULL;
|
||||
|
||||
if( !found_gestures ) // Only pay attention to the first gesture in the string.
|
||||
{
|
||||
std::string cur_token_lower = *token_iter;
|
||||
std::string cur_token_lower = cur_token;
|
||||
LLStringUtil::toLower(cur_token_lower);
|
||||
|
||||
for (U32 i = 0; i < mList.size(); i++)
|
||||
|
|
@ -228,7 +227,7 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
|
|||
LLStringUtil::toLower(output_lower);
|
||||
if( cur_token_lower == output_lower )
|
||||
{
|
||||
revised_string->append(*token_iter);
|
||||
revised_string->append(cur_token);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -249,7 +248,7 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
|
|||
{
|
||||
revised_string->append( " " );
|
||||
}
|
||||
revised_string->append( *token_iter );
|
||||
revised_string->append( cur_token );
|
||||
}
|
||||
|
||||
first_token = FALSE;
|
||||
|
|
|
|||
|
|
@ -67,11 +67,10 @@ void LLVector3OverrideMap::showJointVector3Overrides( std::ostringstream& os ) c
|
|||
map_type::const_iterator max_it = std::max_element(m_map.begin(),
|
||||
m_map.end(),
|
||||
attachment_map_iter_compare_key<map_type::value_type>);
|
||||
for (map_type::const_iterator it = m_map.begin();
|
||||
it != m_map.end(); ++it)
|
||||
for (const map_type::value_type& pos_pair : m_map)
|
||||
{
|
||||
const LLVector3& pos = it->second;
|
||||
os << " " << "[" << it->first <<": " << pos << "]" << ((it==max_it) ? "*" : "");
|
||||
const LLVector3& pos = pos_pair.second;
|
||||
os << " " << "[" << pos_pair.first <<": " << pos << "]" << ((pos_pair==(*max_it)) ? "*" : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -209,10 +208,8 @@ void LLJoint::touch(U32 flags)
|
|||
child_flags |= POSITION_DIRTY;
|
||||
}
|
||||
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* joint : mChildren)
|
||||
{
|
||||
LLJoint* joint = *iter;
|
||||
joint->touch(child_flags);
|
||||
}
|
||||
}
|
||||
|
|
@ -251,10 +248,8 @@ LLJoint *LLJoint::findJoint( const std::string &name )
|
|||
if (name == getName())
|
||||
return this;
|
||||
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* joint : mChildren)
|
||||
{
|
||||
LLJoint* joint = *iter;
|
||||
LLJoint *found = joint->findJoint(name);
|
||||
if (found)
|
||||
{
|
||||
|
|
@ -514,10 +509,9 @@ void LLJoint::getAllAttachmentPosOverrides(S32& num_pos_overrides,
|
|||
std::set<LLVector3>& distinct_pos_overrides) const
|
||||
{
|
||||
num_pos_overrides = m_attachmentPosOverrides.count();
|
||||
LLVector3OverrideMap::map_type::const_iterator it = m_attachmentPosOverrides.getMap().begin();
|
||||
for (; it != m_attachmentPosOverrides.getMap().end(); ++it)
|
||||
for (const LLVector3OverrideMap::map_type::value_type& pos_override_pair : m_attachmentPosOverrides.getMap())
|
||||
{
|
||||
distinct_pos_overrides.insert(it->second);
|
||||
distinct_pos_overrides.insert(pos_override_pair.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -528,10 +522,9 @@ void LLJoint::getAllAttachmentScaleOverrides(S32& num_scale_overrides,
|
|||
std::set<LLVector3>& distinct_scale_overrides) const
|
||||
{
|
||||
num_scale_overrides = m_attachmentScaleOverrides.count();
|
||||
LLVector3OverrideMap::map_type::const_iterator it = m_attachmentScaleOverrides.getMap().begin();
|
||||
for (; it != m_attachmentScaleOverrides.getMap().end(); ++it)
|
||||
for (const LLVector3OverrideMap::map_type::value_type& scale_override_pair : m_attachmentScaleOverrides.getMap())
|
||||
{
|
||||
distinct_scale_overrides.insert(it->second);
|
||||
distinct_scale_overrides.insert(scale_override_pair.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -556,10 +549,9 @@ void LLJoint::showAttachmentPosOverrides(const std::string& av_info) const
|
|||
{
|
||||
LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " has " << count << " attachment pos overrides" << LL_ENDL;
|
||||
std::set<LLVector3> distinct_offsets;
|
||||
LLVector3OverrideMap::map_type::const_iterator it = m_attachmentPosOverrides.getMap().begin();
|
||||
for (; it != m_attachmentPosOverrides.getMap().end(); ++it)
|
||||
for (const LLVector3OverrideMap::map_type::value_type& pos_override_pair : m_attachmentPosOverrides.getMap())
|
||||
{
|
||||
distinct_offsets.insert(it->second);
|
||||
distinct_offsets.insert(pos_override_pair.second);
|
||||
}
|
||||
if (distinct_offsets.size()>1)
|
||||
{
|
||||
|
|
@ -569,11 +561,10 @@ void LLJoint::showAttachmentPosOverrides(const std::string& av_info) const
|
|||
{
|
||||
LL_DEBUGS("Avatar") << "no conflicts" << LL_ENDL;
|
||||
}
|
||||
std::set<LLVector3>::iterator dit = distinct_offsets.begin();
|
||||
for ( ; dit != distinct_offsets.end(); ++dit)
|
||||
for (const LLVector3& offset : distinct_offsets)
|
||||
{
|
||||
std::string highlight = (has_active_override && *dit == active_override) ? "*" : "";
|
||||
LL_DEBUGS("Avatar") << " POS " << highlight << "" << (*dit) << " default " << mDefaultPosition << LL_ENDL;
|
||||
std::string highlight = (has_active_override && offset == active_override) ? "*" : "";
|
||||
LL_DEBUGS("Avatar") << " POS " << highlight << "" << offset << " default " << mDefaultPosition << LL_ENDL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -717,10 +708,9 @@ void LLJoint::showAttachmentScaleOverrides(const std::string& av_info) const
|
|||
{
|
||||
LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " has " << count << " attachment scale overrides" << LL_ENDL;
|
||||
std::set<LLVector3> distinct_offsets;
|
||||
LLVector3OverrideMap::map_type::const_iterator it = m_attachmentScaleOverrides.getMap().begin();
|
||||
for (; it != m_attachmentScaleOverrides.getMap().end(); ++it)
|
||||
for (const LLVector3OverrideMap::map_type::value_type& scale_override_pair : m_attachmentScaleOverrides.getMap())
|
||||
{
|
||||
distinct_offsets.insert(it->second);
|
||||
distinct_offsets.insert(scale_override_pair.second);
|
||||
}
|
||||
if (distinct_offsets.size()>1)
|
||||
{
|
||||
|
|
@ -730,11 +720,10 @@ void LLJoint::showAttachmentScaleOverrides(const std::string& av_info) const
|
|||
{
|
||||
LL_DEBUGS("Avatar") << "no conflicts" << LL_ENDL;
|
||||
}
|
||||
std::set<LLVector3>::iterator dit = distinct_offsets.begin();
|
||||
for ( ; dit != distinct_offsets.end(); ++dit)
|
||||
for (const LLVector3& offset : distinct_offsets)
|
||||
{
|
||||
std::string highlight = (has_active_override && *dit == active_override) ? "*" : "";
|
||||
LL_DEBUGS("Avatar") << " POS " << highlight << "" << (*dit) << " default " << mDefaultScale << LL_ENDL;
|
||||
std::string highlight = (has_active_override && offset == active_override) ? "*" : "";
|
||||
LL_DEBUGS("Avatar") << " POS " << highlight << "" << offset << " default " << mDefaultScale << LL_ENDL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -993,10 +982,8 @@ void LLJoint::updateWorldMatrixChildren()
|
|||
{
|
||||
updateWorldMatrix();
|
||||
}
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* joint : mChildren)
|
||||
{
|
||||
LLJoint* joint = *iter;
|
||||
joint->updateWorldMatrixChildren();
|
||||
}
|
||||
}
|
||||
|
|
@ -1040,10 +1027,8 @@ void LLJoint::clampRotation(LLQuaternion old_rot, LLQuaternion new_rot)
|
|||
{
|
||||
LLVector3 main_axis(1.f, 0.f, 0.f);
|
||||
|
||||
for (joints_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
for (LLJoint* joint : mChildren)
|
||||
{
|
||||
LLJoint* joint = *iter;
|
||||
if (joint->isAnimatable())
|
||||
{
|
||||
main_axis = joint->getPosition();
|
||||
|
|
|
|||
|
|
@ -626,10 +626,8 @@ BOOL LLKeyframeMotion::setupPose()
|
|||
}
|
||||
|
||||
// initialize joint constraints
|
||||
for (JointMotionList::constraint_list_t::iterator iter = mJointMotionList->mConstraints.begin();
|
||||
iter != mJointMotionList->mConstraints.end(); ++iter)
|
||||
for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints)
|
||||
{
|
||||
JointConstraintSharedData* shared_constraintp = *iter;
|
||||
JointConstraint* constraintp = new JointConstraint(shared_constraintp);
|
||||
initializeConstraint(constraintp);
|
||||
mConstraints.push_front(constraintp);
|
||||
|
|
@ -764,19 +762,15 @@ void LLKeyframeMotion::applyConstraints(F32 time, U8* joint_mask)
|
|||
if (mCharacter->getSkeletonSerialNum() != mLastSkeletonSerialNum)
|
||||
{
|
||||
mLastSkeletonSerialNum = mCharacter->getSkeletonSerialNum();
|
||||
for (constraint_list_t::iterator iter = mConstraints.begin();
|
||||
iter != mConstraints.end(); ++iter)
|
||||
for (JointConstraint* constraintp : mConstraints)
|
||||
{
|
||||
JointConstraint* constraintp = *iter;
|
||||
initializeConstraint(constraintp);
|
||||
}
|
||||
}
|
||||
|
||||
// apply constraints
|
||||
for (constraint_list_t::iterator iter = mConstraints.begin();
|
||||
iter != mConstraints.end(); ++iter)
|
||||
for (JointConstraint* constraintp : mConstraints)
|
||||
{
|
||||
JointConstraint* constraintp = *iter;
|
||||
applyConstraint(constraintp, time, joint_mask);
|
||||
}
|
||||
}
|
||||
|
|
@ -786,10 +780,8 @@ void LLKeyframeMotion::applyConstraints(F32 time, U8* joint_mask)
|
|||
//-----------------------------------------------------------------------------
|
||||
void LLKeyframeMotion::onDeactivate()
|
||||
{
|
||||
for (constraint_list_t::iterator iter = mConstraints.begin();
|
||||
iter != mConstraints.end(); ++iter)
|
||||
for (JointConstraint* constraintp : mConstraints)
|
||||
{
|
||||
JointConstraint* constraintp = *iter;
|
||||
deactivateConstraint(constraintp);
|
||||
}
|
||||
}
|
||||
|
|
@ -1222,11 +1214,14 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
// deserialize()
|
||||
//
|
||||
// allow_invalid_joints should be true when handling existing content, to avoid breakage.
|
||||
// During upload, we should be more restrictive and reject such animations.
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
||||
BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints)
|
||||
{
|
||||
BOOL old_version = FALSE;
|
||||
mJointMotionList = new LLKeyframeMotion::JointMotionList;
|
||||
std::unique_ptr<LLKeyframeMotion::JointMotionList> joint_motion_list(new LLKeyframeMotion::JointMotionList);
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// get base priority
|
||||
|
|
@ -1269,16 +1264,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
mJointMotionList->mBasePriority = (LLJoint::JointPriority) temp_priority;
|
||||
joint_motion_list->mBasePriority = (LLJoint::JointPriority) temp_priority;
|
||||
|
||||
if (mJointMotionList->mBasePriority >= LLJoint::ADDITIVE_PRIORITY)
|
||||
if (joint_motion_list->mBasePriority >= LLJoint::ADDITIVE_PRIORITY)
|
||||
{
|
||||
mJointMotionList->mBasePriority = (LLJoint::JointPriority)((S32)LLJoint::ADDITIVE_PRIORITY-1);
|
||||
mJointMotionList->mMaxPriority = mJointMotionList->mBasePriority;
|
||||
joint_motion_list->mBasePriority = (LLJoint::JointPriority)((S32)LLJoint::ADDITIVE_PRIORITY-1);
|
||||
joint_motion_list->mMaxPriority = joint_motion_list->mBasePriority;
|
||||
}
|
||||
else if (mJointMotionList->mBasePriority < LLJoint::USE_MOTION_PRIORITY)
|
||||
else if (joint_motion_list->mBasePriority < LLJoint::USE_MOTION_PRIORITY)
|
||||
{
|
||||
LL_WARNS() << "bad animation base_priority " << mJointMotionList->mBasePriority
|
||||
LL_WARNS() << "bad animation base_priority " << joint_motion_list->mBasePriority
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -1286,15 +1281,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
//-------------------------------------------------------------------------
|
||||
// get duration
|
||||
//-------------------------------------------------------------------------
|
||||
if (!dp.unpackF32(mJointMotionList->mDuration, "duration"))
|
||||
if (!dp.unpackF32(joint_motion_list->mDuration, "duration"))
|
||||
{
|
||||
LL_WARNS() << "can't read duration"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (mJointMotionList->mDuration > MAX_ANIM_DURATION ||
|
||||
!llfinite(mJointMotionList->mDuration))
|
||||
if (joint_motion_list->mDuration > MAX_ANIM_DURATION ||
|
||||
!llfinite(joint_motion_list->mDuration))
|
||||
{
|
||||
LL_WARNS() << "invalid animation duration"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
|
|
@ -1304,14 +1299,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
//-------------------------------------------------------------------------
|
||||
// get emote (optional)
|
||||
//-------------------------------------------------------------------------
|
||||
if (!dp.unpackString(mJointMotionList->mEmoteName, "emote_name"))
|
||||
if (!dp.unpackString(joint_motion_list->mEmoteName, "emote_name"))
|
||||
{
|
||||
LL_WARNS() << "can't read optional_emote_animation"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(mJointMotionList->mEmoteName==mID.asString())
|
||||
if(joint_motion_list->mEmoteName==mID.asString())
|
||||
{
|
||||
LL_WARNS() << "Malformed animation mEmoteName==mID"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
|
|
@ -1321,42 +1316,51 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
//-------------------------------------------------------------------------
|
||||
// get loop
|
||||
//-------------------------------------------------------------------------
|
||||
if (!dp.unpackF32(mJointMotionList->mLoopInPoint, "loop_in_point") ||
|
||||
!llfinite(mJointMotionList->mLoopInPoint))
|
||||
if (!dp.unpackF32(joint_motion_list->mLoopInPoint, "loop_in_point") ||
|
||||
!llfinite(joint_motion_list->mLoopInPoint))
|
||||
{
|
||||
LL_WARNS() << "can't read loop point"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!dp.unpackF32(mJointMotionList->mLoopOutPoint, "loop_out_point") ||
|
||||
!llfinite(mJointMotionList->mLoopOutPoint))
|
||||
if (!dp.unpackF32(joint_motion_list->mLoopOutPoint, "loop_out_point") ||
|
||||
!llfinite(joint_motion_list->mLoopOutPoint))
|
||||
{
|
||||
LL_WARNS() << "can't read loop point"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!dp.unpackS32(mJointMotionList->mLoop, "loop"))
|
||||
if (!dp.unpackS32(joint_motion_list->mLoop, "loop"))
|
||||
{
|
||||
LL_WARNS() << "can't read loop"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//SL-17206 hack to alter Female_land loop setting, while current behavior won't be changed serverside
|
||||
LLUUID const female_land_anim("ca1baf4d-0a18-5a1f-0330-e4bd1e71f09e");
|
||||
LLUUID const formal_female_land_anim("6a9a173b-61fa-3ad5-01fa-a851cfc5f66a");
|
||||
if (female_land_anim == asset_id || formal_female_land_anim == asset_id)
|
||||
{
|
||||
LL_WARNS() << "Animation(" << asset_id << ") won't be looped." << LL_ENDL;
|
||||
joint_motion_list->mLoop = FALSE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// get easeIn and easeOut
|
||||
//-------------------------------------------------------------------------
|
||||
if (!dp.unpackF32(mJointMotionList->mEaseInDuration, "ease_in_duration") ||
|
||||
!llfinite(mJointMotionList->mEaseInDuration))
|
||||
if (!dp.unpackF32(joint_motion_list->mEaseInDuration, "ease_in_duration") ||
|
||||
!llfinite(joint_motion_list->mEaseInDuration))
|
||||
{
|
||||
LL_WARNS() << "can't read easeIn"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!dp.unpackF32(mJointMotionList->mEaseOutDuration, "ease_out_duration") ||
|
||||
!llfinite(mJointMotionList->mEaseOutDuration))
|
||||
if (!dp.unpackF32(joint_motion_list->mEaseOutDuration, "ease_out_duration") ||
|
||||
!llfinite(joint_motion_list->mEaseOutDuration))
|
||||
{
|
||||
LL_WARNS() << "can't read easeOut"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
|
|
@ -1381,7 +1385,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
mJointMotionList->mHandPose = (LLHandMotion::eHandPose)word;
|
||||
joint_motion_list->mHandPose = (LLHandMotion::eHandPose)word;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// get number of joint motions
|
||||
|
|
@ -1407,8 +1411,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
mJointMotionList->mJointMotionArray.clear();
|
||||
mJointMotionList->mJointMotionArray.reserve(num_motions);
|
||||
joint_motion_list->mJointMotionArray.clear();
|
||||
joint_motion_list->mJointMotionArray.reserve(num_motions);
|
||||
mJointStates.clear();
|
||||
mJointStates.reserve(num_motions);
|
||||
|
||||
|
|
@ -1419,7 +1423,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
for(U32 i=0; i<num_motions; ++i)
|
||||
{
|
||||
JointMotion* joint_motion = new JointMotion;
|
||||
mJointMotionList->mJointMotionArray.push_back(joint_motion);
|
||||
joint_motion_list->mJointMotionArray.push_back(joint_motion);
|
||||
|
||||
std::string joint_name;
|
||||
if (!dp.unpackString(joint_name, "joint_name"))
|
||||
|
|
@ -1443,6 +1447,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
if (joint)
|
||||
{
|
||||
S32 joint_num = joint->getJointNum();
|
||||
joint_name = joint->getName(); // canonical name in case this is an alias.
|
||||
// LL_INFOS() << " joint: " << joint_name << LL_ENDL;
|
||||
if ((joint_num >= (S32)LL_CHARACTER_MAX_ANIMATED_JOINTS) || (joint_num < 0))
|
||||
{
|
||||
|
|
@ -1457,7 +1462,10 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "invalid joint name: " << joint_name
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
//return FALSE;
|
||||
if (!allow_invalid_joints)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
joint_motion->mJointName = joint_name;
|
||||
|
|
@ -1487,9 +1495,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
|
||||
joint_motion->mPriority = (LLJoint::JointPriority)joint_priority;
|
||||
if (joint_priority != LLJoint::USE_MOTION_PRIORITY &&
|
||||
joint_priority > mJointMotionList->mMaxPriority)
|
||||
joint_priority > joint_motion_list->mMaxPriority)
|
||||
{
|
||||
mJointMotionList->mMaxPriority = (LLJoint::JointPriority)joint_priority;
|
||||
joint_motion_list->mMaxPriority = (LLJoint::JointPriority)joint_priority;
|
||||
}
|
||||
|
||||
joint_state->setPriority((LLJoint::JointPriority)joint_priority);
|
||||
|
|
@ -1540,9 +1548,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
time = U16_to_F32(time_short, 0.f, mJointMotionList->mDuration);
|
||||
time = U16_to_F32(time_short, 0.f, joint_motion_list->mDuration);
|
||||
|
||||
if (time < 0 || time > mJointMotionList->mDuration)
|
||||
if (time < 0 || time > joint_motion_list->mDuration)
|
||||
{
|
||||
LL_WARNS() << "invalid frame time"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
|
|
@ -1555,38 +1563,57 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
LLVector3 rot_angles;
|
||||
U16 x, y, z;
|
||||
|
||||
BOOL success = TRUE;
|
||||
|
||||
if (old_version)
|
||||
{
|
||||
success = dp.unpackVector3(rot_angles, "rot_angles") && rot_angles.isFinite();
|
||||
if (!dp.unpackVector3(rot_angles, "rot_angles"))
|
||||
{
|
||||
LL_WARNS() << "can't read rot_angles in rotation key (" << k << ")" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
if (!rot_angles.isFinite())
|
||||
{
|
||||
LL_WARNS() << "non-finite angle in rotation key (" << k << ")" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
LLQuaternion::Order ro = StringToOrder("ZYX");
|
||||
rot_key.mRotation = mayaQ(rot_angles.mV[VX], rot_angles.mV[VY], rot_angles.mV[VZ], ro);
|
||||
}
|
||||
else
|
||||
{
|
||||
success &= dp.unpackU16(x, "rot_angle_x");
|
||||
success &= dp.unpackU16(y, "rot_angle_y");
|
||||
success &= dp.unpackU16(z, "rot_angle_z");
|
||||
if (!dp.unpackU16(x, "rot_angle_x"))
|
||||
{
|
||||
LL_WARNS() << "can't read rot_angle_x in rotation key (" << k << ")" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
if (!dp.unpackU16(y, "rot_angle_y"))
|
||||
{
|
||||
LL_WARNS() << "can't read rot_angle_y in rotation key (" << k << ")" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
if (!dp.unpackU16(z, "rot_angle_z"))
|
||||
{
|
||||
LL_WARNS() << "can't read rot_angle_z in rotation key (" << k << ")" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
LLVector3 rot_vec;
|
||||
rot_vec.mV[VX] = U16_to_F32(x, -1.f, 1.f);
|
||||
rot_vec.mV[VY] = U16_to_F32(y, -1.f, 1.f);
|
||||
rot_vec.mV[VZ] = U16_to_F32(z, -1.f, 1.f);
|
||||
|
||||
if(!rot_vec.isFinite())
|
||||
{
|
||||
LL_WARNS() << "non-finite angle in rotation key (" << k << ")"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
rot_key.mRotation.unpackFromVector3(rot_vec);
|
||||
}
|
||||
|
||||
if( !(rot_key.mRotation.isFinite()) )
|
||||
if(!rot_key.mRotation.isFinite())
|
||||
{
|
||||
LL_WARNS() << "non-finite angle in rotation key"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
LL_WARNS() << "can't read rotation key (" << k << ")"
|
||||
LL_WARNS() << "non-finite angle in rotation key (" << k << ")"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -1639,14 +1666,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
pos_key.mTime = U16_to_F32(time_short, 0.f, mJointMotionList->mDuration);
|
||||
pos_key.mTime = U16_to_F32(time_short, 0.f, joint_motion_list->mDuration);
|
||||
}
|
||||
|
||||
BOOL success = TRUE;
|
||||
|
||||
if (old_version)
|
||||
{
|
||||
success = dp.unpackVector3(pos_key.mPosition, "pos");
|
||||
if (!dp.unpackVector3(pos_key.mPosition, "pos"))
|
||||
{
|
||||
LL_WARNS() << "can't read pos in position key (" << k << ")" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//MAINT-6162
|
||||
pos_key.mPosition.mV[VX] = llclamp( pos_key.mPosition.mV[VX], -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
|
||||
|
|
@ -1658,25 +1687,30 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
U16 x, y, z;
|
||||
|
||||
success &= dp.unpackU16(x, "pos_x");
|
||||
success &= dp.unpackU16(y, "pos_y");
|
||||
success &= dp.unpackU16(z, "pos_z");
|
||||
if (!dp.unpackU16(x, "pos_x"))
|
||||
{
|
||||
LL_WARNS() << "can't read pos_x in position key (" << k << ")" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
if (!dp.unpackU16(y, "pos_y"))
|
||||
{
|
||||
LL_WARNS() << "can't read pos_y in position key (" << k << ")" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
if (!dp.unpackU16(z, "pos_z"))
|
||||
{
|
||||
LL_WARNS() << "can't read pos_z in position key (" << k << ")" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pos_key.mPosition.mV[VX] = U16_to_F32(x, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
|
||||
pos_key.mPosition.mV[VY] = U16_to_F32(y, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
|
||||
pos_key.mPosition.mV[VZ] = U16_to_F32(z, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
|
||||
}
|
||||
|
||||
if( !(pos_key.mPosition.isFinite()) )
|
||||
if(!pos_key.mPosition.isFinite())
|
||||
{
|
||||
LL_WARNS() << "non-finite position in key"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
LL_WARNS() << "can't read position key (" << k << ")"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -1685,7 +1719,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
|
||||
if (is_pelvis)
|
||||
{
|
||||
mJointMotionList->mPelvisBBox.addPoint(pos_key.mPosition);
|
||||
joint_motion_list->mPelvisBBox.addPoint(pos_key.mPosition);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1717,23 +1751,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
for(S32 i = 0; i < num_constraints; ++i)
|
||||
{
|
||||
// read in constraint data
|
||||
JointConstraintSharedData* constraintp = new JointConstraintSharedData;
|
||||
std::unique_ptr<JointConstraintSharedData> constraintp(new JointConstraintSharedData);
|
||||
U8 byte = 0;
|
||||
|
||||
if (!dp.unpackU8(byte, "chain_length"))
|
||||
{
|
||||
LL_WARNS() << "can't read constraint chain length"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
constraintp->mChainLength = (S32) byte;
|
||||
|
||||
if((U32)constraintp->mChainLength > mJointMotionList->getNumJointMotions())
|
||||
if((U32)constraintp->mChainLength > joint_motion_list->getNumJointMotions())
|
||||
{
|
||||
LL_WARNS() << "invalid constraint chain length"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1741,7 +1773,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "can't read constraint type"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1749,7 +1780,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "invalid constraint type"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
constraintp->mConstraintType = (EConstraintType)byte;
|
||||
|
|
@ -1760,7 +1790,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "can't read source volume name"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1771,7 +1800,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "not a valid source constraint volume " << str
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1779,7 +1807,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "can't read constraint source offset"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1787,7 +1814,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "non-finite constraint source offset"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1795,7 +1821,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "can't read target volume name"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1814,7 +1839,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "not a valid target constraint volume " << str
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -1823,7 +1847,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "can't read constraint target offset"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1831,7 +1854,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "non-finite constraint target offset"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1839,7 +1861,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "can't read constraint target direction"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1847,7 +1868,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "non-finite constraint target direction"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1861,7 +1881,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "can't read constraint ease in start time"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1869,7 +1888,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "can't read constraint ease in stop time"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1877,7 +1895,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "can't read constraint ease out start time"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1885,33 +1902,31 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "can't read constraint ease out stop time"
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mJointMotionList->mConstraints.push_front(constraintp);
|
||||
|
||||
constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; // note: mChainLength is size-limited - comes from a byte
|
||||
|
||||
LLJoint* joint = mCharacter->findCollisionVolume(constraintp->mSourceConstraintVolume);
|
||||
// get joint to which this collision volume is attached
|
||||
if (!joint)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; // note: mChainLength is size-limited - comes from a byte
|
||||
|
||||
for (S32 i = 0; i < constraintp->mChainLength + 1; i++)
|
||||
{
|
||||
LLJoint* parent = joint->getParent();
|
||||
if (!parent)
|
||||
{
|
||||
LL_WARNS() << "Joint with no parent: " << joint->getName()
|
||||
<< " Emote: " << mJointMotionList->mEmoteName
|
||||
<< " Emote: " << joint_motion_list->mEmoteName
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
joint = parent;
|
||||
constraintp->mJointStateIndices[i] = -1;
|
||||
for (U32 j = 0; j < mJointMotionList->getNumJointMotions(); j++)
|
||||
for (U32 j = 0; j < joint_motion_list->getNumJointMotions(); j++)
|
||||
{
|
||||
LLJoint* constraint_joint = getJoint(j);
|
||||
|
||||
|
|
@ -1932,14 +1947,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)
|
|||
{
|
||||
LL_WARNS() << "No joint index for constraint " << i
|
||||
<< " for animation " << asset_id << LL_ENDL;
|
||||
delete constraintp;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
joint_motion_list->mConstraints.push_front(constraintp.release());
|
||||
}
|
||||
}
|
||||
|
||||
// *FIX: support cleanup of old keyframe data
|
||||
mJointMotionList = joint_motion_list.release(); // release from unique_ptr to member;
|
||||
LLKeyframeDataCache::addKeyframeData(getID(), mJointMotionList);
|
||||
mAssetStatus = ASSET_LOADED;
|
||||
|
||||
|
|
@ -1991,10 +2008,9 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
|
|||
success &= dp.packS32(joint_motionp->mRotationCurve.mNumKeys, "num_rot_keys");
|
||||
|
||||
LL_DEBUGS("BVH") << "Joint " << joint_motionp->mJointName << LL_ENDL;
|
||||
for (RotationCurve::key_map_t::iterator iter = joint_motionp->mRotationCurve.mKeys.begin();
|
||||
iter != joint_motionp->mRotationCurve.mKeys.end(); ++iter)
|
||||
for (RotationCurve::key_map_t::value_type& rot_pair : joint_motionp->mRotationCurve.mKeys)
|
||||
{
|
||||
RotationKey& rot_key = iter->second;
|
||||
RotationKey& rot_key = rot_pair.second;
|
||||
U16 time_short = F32_to_U16(rot_key.mTime, 0.f, mJointMotionList->mDuration);
|
||||
success &= dp.packU16(time_short, "time");
|
||||
|
||||
|
|
@ -2013,10 +2029,9 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
|
|||
}
|
||||
|
||||
success &= dp.packS32(joint_motionp->mPositionCurve.mNumKeys, "num_pos_keys");
|
||||
for (PositionCurve::key_map_t::iterator iter = joint_motionp->mPositionCurve.mKeys.begin();
|
||||
iter != joint_motionp->mPositionCurve.mKeys.end(); ++iter)
|
||||
for (PositionCurve::key_map_t::value_type& pos_pair : joint_motionp->mPositionCurve.mKeys)
|
||||
{
|
||||
PositionKey& pos_key = iter->second;
|
||||
PositionKey& pos_key = pos_pair.second;
|
||||
U16 time_short = F32_to_U16(pos_key.mTime, 0.f, mJointMotionList->mDuration);
|
||||
success &= dp.packU16(time_short, "time");
|
||||
|
||||
|
|
@ -2035,10 +2050,8 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
|
|||
|
||||
success &= dp.packS32(mJointMotionList->mConstraints.size(), "num_constraints");
|
||||
LL_DEBUGS("BVH") << "num_constraints " << mJointMotionList->mConstraints.size() << LL_ENDL;
|
||||
for (JointMotionList::constraint_list_t::const_iterator iter = mJointMotionList->mConstraints.begin();
|
||||
iter != mJointMotionList->mConstraints.end(); ++iter)
|
||||
for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints)
|
||||
{
|
||||
JointConstraintSharedData* shared_constraintp = *iter;
|
||||
success &= dp.packU8(shared_constraintp->mChainLength, "chain_length");
|
||||
success &= dp.packU8(shared_constraintp->mConstraintType, "constraint_type");
|
||||
char source_volume[16]; /* Flawfinder: ignore */
|
||||
|
|
@ -2096,8 +2109,9 @@ U32 LLKeyframeMotion::getFileSize()
|
|||
//-----------------------------------------------------------------------------
|
||||
// dumpToFile()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLKeyframeMotion::dumpToFile(const std::string& name)
|
||||
bool LLKeyframeMotion::dumpToFile(const std::string& name)
|
||||
{
|
||||
bool succ = false;
|
||||
if (isLoaded())
|
||||
{
|
||||
std::string outfile_base;
|
||||
|
|
@ -2114,10 +2128,24 @@ void LLKeyframeMotion::dumpToFile(const std::string& name)
|
|||
const LLUUID& id = getID();
|
||||
outfile_base = id.asString();
|
||||
}
|
||||
std::string outfilename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfile_base + ".anim");
|
||||
|
||||
if (gDirUtilp->getExtension(outfile_base).empty())
|
||||
{
|
||||
outfile_base += ".anim";
|
||||
}
|
||||
std::string outfilename;
|
||||
if (gDirUtilp->getDirName(outfile_base).empty())
|
||||
{
|
||||
outfilename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfile_base);
|
||||
}
|
||||
else
|
||||
{
|
||||
outfilename = outfile_base;
|
||||
}
|
||||
if (LLFile::isfile(outfilename))
|
||||
{
|
||||
return;
|
||||
LL_WARNS() << outfilename << " already exists, write failed" << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
S32 file_size = getFileSize();
|
||||
|
|
@ -2131,11 +2159,13 @@ void LLKeyframeMotion::dumpToFile(const std::string& name)
|
|||
outfile.open(outfilename, LL_APR_WPB);
|
||||
if (outfile.getFileHandle())
|
||||
{
|
||||
outfile.write(buffer, file_size);
|
||||
S32 wrote_bytes = outfile.write(buffer, file_size);
|
||||
succ = (wrote_bytes == file_size);
|
||||
}
|
||||
}
|
||||
delete [] buffer;
|
||||
}
|
||||
return succ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -2373,14 +2403,13 @@ void LLKeyframeDataCache::dumpDiagInfo()
|
|||
LL_INFOS() << "-----------------------------------------------------" << LL_ENDL;
|
||||
|
||||
// print each loaded mesh, and it's memory usage
|
||||
for (keyframe_data_map_t::iterator map_it = sKeyframeDataMap.begin();
|
||||
map_it != sKeyframeDataMap.end(); ++map_it)
|
||||
for (keyframe_data_map_t::value_type& data_pair : sKeyframeDataMap)
|
||||
{
|
||||
U32 joint_motion_kb;
|
||||
|
||||
LLKeyframeMotion::JointMotionList *motion_list_p = map_it->second;
|
||||
LLKeyframeMotion::JointMotionList *motion_list_p = data_pair.second;
|
||||
|
||||
LL_INFOS() << "Motion: " << map_it->first << LL_ENDL;
|
||||
LL_INFOS() << "Motion: " << data_pair.first << LL_ENDL;
|
||||
|
||||
joint_motion_kb = motion_list_p->dumpDiagInfo();
|
||||
|
||||
|
|
|
|||
|
|
@ -156,9 +156,9 @@ public:
|
|||
public:
|
||||
U32 getFileSize();
|
||||
BOOL serialize(LLDataPacker& dp) const;
|
||||
BOOL deserialize(LLDataPacker& dp, const LLUUID& asset_id);
|
||||
BOOL deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints = true);
|
||||
BOOL isLoaded() { return mJointMotionList != NULL; }
|
||||
void dumpToFile(const std::string& name);
|
||||
bool dumpToFile(const std::string& name);
|
||||
|
||||
|
||||
// setters for modifying a keyframe animation
|
||||
|
|
@ -432,6 +432,9 @@ protected:
|
|||
F32 mLastUpdateTime;
|
||||
F32 mLastLoopedTime;
|
||||
AssetStatus mAssetStatus;
|
||||
|
||||
public:
|
||||
void setCharacter(LLCharacter* character) { mCharacter = character; }
|
||||
};
|
||||
|
||||
class LLKeyframeDataCache
|
||||
|
|
|
|||
|
|
@ -64,13 +64,11 @@ LLKeyframeMotionParam::LLKeyframeMotionParam( const LLUUID &id) : LLMotion(id)
|
|||
//-----------------------------------------------------------------------------
|
||||
LLKeyframeMotionParam::~LLKeyframeMotionParam()
|
||||
{
|
||||
for (motion_map_t::iterator iter = mParameterizedMotions.begin();
|
||||
iter != mParameterizedMotions.end(); ++iter)
|
||||
for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
|
||||
{
|
||||
motion_list_t& motionList = iter->second;
|
||||
for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
|
||||
motion_list_t& motionList = motion_pair.second;
|
||||
for (const ParameterizedMotion& paramMotion : motionList)
|
||||
{
|
||||
const ParameterizedMotion& paramMotion = *iter2;
|
||||
delete paramMotion.mMotion;
|
||||
}
|
||||
motionList.clear();
|
||||
|
|
@ -90,13 +88,11 @@ LLMotion::LLMotionInitStatus LLKeyframeMotionParam::onInitialize(LLCharacter *ch
|
|||
return STATUS_FAILURE;
|
||||
}
|
||||
|
||||
for (motion_map_t::iterator iter = mParameterizedMotions.begin();
|
||||
iter != mParameterizedMotions.end(); ++iter)
|
||||
for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
|
||||
{
|
||||
motion_list_t& motionList = iter->second;
|
||||
for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
|
||||
motion_list_t& motionList = motion_pair.second;
|
||||
for (const ParameterizedMotion& paramMotion : motionList)
|
||||
{
|
||||
const ParameterizedMotion& paramMotion = *iter2;
|
||||
LLMotion* motion = paramMotion.mMotion;
|
||||
motion->onInitialize(character);
|
||||
|
||||
|
|
@ -139,13 +135,11 @@ LLMotion::LLMotionInitStatus LLKeyframeMotionParam::onInitialize(LLCharacter *ch
|
|||
//-----------------------------------------------------------------------------
|
||||
BOOL LLKeyframeMotionParam::onActivate()
|
||||
{
|
||||
for (motion_map_t::iterator iter = mParameterizedMotions.begin();
|
||||
iter != mParameterizedMotions.end(); ++iter)
|
||||
for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
|
||||
{
|
||||
motion_list_t& motionList = iter->second;
|
||||
for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
|
||||
motion_list_t& motionList = motion_pair.second;
|
||||
for (const ParameterizedMotion& paramMotion : motionList)
|
||||
{
|
||||
const ParameterizedMotion& paramMotion = *iter2;
|
||||
paramMotion.mMotion->activate(mActivationTimestamp);
|
||||
}
|
||||
}
|
||||
|
|
@ -162,23 +156,20 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask)
|
|||
F32 weightFactor = 1.f / (F32)mParameterizedMotions.size();
|
||||
|
||||
// zero out all pose weights
|
||||
for (motion_map_t::iterator iter = mParameterizedMotions.begin();
|
||||
iter != mParameterizedMotions.end(); ++iter)
|
||||
for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
|
||||
{
|
||||
motion_list_t& motionList = iter->second;
|
||||
for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
|
||||
motion_list_t& motionList = motion_pair.second;
|
||||
for (const ParameterizedMotion& paramMotion : motionList)
|
||||
{
|
||||
const ParameterizedMotion& paramMotion = *iter2;
|
||||
// LL_INFOS() << "Weight for pose " << paramMotion.mMotion->getName() << " is " << paramMotion.mMotion->getPose()->getWeight() << LL_ENDL;
|
||||
paramMotion.mMotion->getPose()->setWeight(0.f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (motion_map_t::iterator iter = mParameterizedMotions.begin();
|
||||
iter != mParameterizedMotions.end(); ++iter)
|
||||
for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
|
||||
{
|
||||
const std::string& paramName = iter->first;
|
||||
const std::string& paramName = motion_pair.first;
|
||||
F32* paramValue = (F32 *)mCharacter->getAnimationData(paramName);
|
||||
if (NULL == paramValue) // unexpected, but...
|
||||
{
|
||||
|
|
@ -190,10 +181,9 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask)
|
|||
const ParameterizedMotion* firstMotion = NULL;
|
||||
const ParameterizedMotion* secondMotion = NULL;
|
||||
|
||||
motion_list_t& motionList = iter->second;
|
||||
for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
|
||||
motion_list_t& motionList = motion_pair.second;
|
||||
for (const ParameterizedMotion& paramMotion : motionList)
|
||||
{
|
||||
const ParameterizedMotion& paramMotion = *iter2;
|
||||
paramMotion.mMotion->onUpdate(time, joint_mask);
|
||||
|
||||
F32 distToParam = paramMotion.mParam - *paramValue;
|
||||
|
|
@ -280,13 +270,11 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask)
|
|||
//-----------------------------------------------------------------------------
|
||||
void LLKeyframeMotionParam::onDeactivate()
|
||||
{
|
||||
for (motion_map_t::iterator iter = mParameterizedMotions.begin();
|
||||
iter != mParameterizedMotions.end(); ++iter)
|
||||
for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
|
||||
{
|
||||
motion_list_t& motionList = iter->second;
|
||||
for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
|
||||
motion_list_t& motionList = motion_pair.second;
|
||||
for (const ParameterizedMotion& paramMotion : motionList)
|
||||
{
|
||||
const ParameterizedMotion& paramMotion = *iter2;
|
||||
paramMotion.mMotion->onDeactivate();
|
||||
}
|
||||
}
|
||||
|
|
@ -318,13 +306,11 @@ BOOL LLKeyframeMotionParam::addKeyframeMotion(char *name, const LLUUID &id, char
|
|||
//-----------------------------------------------------------------------------
|
||||
void LLKeyframeMotionParam::setDefaultKeyframeMotion(char *name)
|
||||
{
|
||||
for (motion_map_t::iterator iter = mParameterizedMotions.begin();
|
||||
iter != mParameterizedMotions.end(); ++iter)
|
||||
for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
|
||||
{
|
||||
motion_list_t& motionList = iter->second;
|
||||
for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
|
||||
motion_list_t& motionList = motion_pair.second;
|
||||
for (const ParameterizedMotion& paramMotion : motionList)
|
||||
{
|
||||
const ParameterizedMotion& paramMotion = *iter2;
|
||||
if (paramMotion.mMotion->getName() == name)
|
||||
{
|
||||
mDefaultKeyframeMotion = paramMotion.mMotion;
|
||||
|
|
|
|||
|
|
@ -211,11 +211,8 @@ void LLMotionController::purgeExcessMotions()
|
|||
{
|
||||
// too many motions active this frame, kill all blenders
|
||||
mPoseBlender.clearBlenders();
|
||||
for (motion_set_t::iterator loaded_motion_it = mLoadedMotions.begin();
|
||||
loaded_motion_it != mLoadedMotions.end();
|
||||
++loaded_motion_it)
|
||||
for (LLMotion* cur_motionp : mLoadedMotions)
|
||||
{
|
||||
LLMotion* cur_motionp = *loaded_motion_it;
|
||||
// motion isn't playing, delete it
|
||||
if (!isMotionActive(cur_motionp))
|
||||
{
|
||||
|
|
@ -225,13 +222,10 @@ void LLMotionController::purgeExcessMotions()
|
|||
}
|
||||
|
||||
// clean up all inactive, loaded motions
|
||||
for (std::set<LLUUID>::iterator motion_it = motions_to_kill.begin();
|
||||
motion_it != motions_to_kill.end();
|
||||
++motion_it)
|
||||
for (LLUUID motion_id : motions_to_kill)
|
||||
{
|
||||
// look up the motion again by ID to get canonical instance
|
||||
// and kill it only if that one is inactive
|
||||
LLUUID motion_id = *motion_it;
|
||||
LLMotion* motionp = findMotion(motion_id);
|
||||
if (motionp && !isMotionActive(motionp))
|
||||
{
|
||||
|
|
@ -1059,12 +1053,11 @@ LLMotion* LLMotionController::findMotion(const LLUUID& id) const
|
|||
void LLMotionController::dumpMotions()
|
||||
{
|
||||
LL_INFOS() << "=====================================" << LL_ENDL;
|
||||
for (motion_map_t::iterator iter = mAllMotions.begin();
|
||||
iter != mAllMotions.end(); iter++)
|
||||
for (motion_map_t::value_type& motion_pair : mAllMotions)
|
||||
{
|
||||
LLUUID id = iter->first;
|
||||
LLUUID id = motion_pair.first;
|
||||
std::string state_string;
|
||||
LLMotion *motion = iter->second;
|
||||
LLMotion *motion = motion_pair.second;
|
||||
if (mLoadingMotions.find(motion) != mLoadingMotions.end())
|
||||
state_string += std::string("l");
|
||||
if (mLoadedMotions.find(motion) != mLoadedMotions.end())
|
||||
|
|
@ -1083,10 +1076,9 @@ void LLMotionController::dumpMotions()
|
|||
//-----------------------------------------------------------------------------
|
||||
void LLMotionController::deactivateAllMotions()
|
||||
{
|
||||
for (motion_map_t::iterator iter = mAllMotions.begin();
|
||||
iter != mAllMotions.end(); iter++)
|
||||
for (motion_map_t::value_type& motion_pair : mAllMotions)
|
||||
{
|
||||
LLMotion* motionp = iter->second;
|
||||
LLMotion* motionp = motion_pair.second;
|
||||
deactivateMotionInstance(motionp);
|
||||
}
|
||||
}
|
||||
|
|
@ -1118,10 +1110,9 @@ void LLMotionController::flushAllMotions()
|
|||
mCharacter->removeAnimationData("Hand Pose");
|
||||
|
||||
// restart motions
|
||||
for (std::vector<std::pair<LLUUID,F32> >::iterator iter = active_motions.begin();
|
||||
iter != active_motions.end(); ++iter)
|
||||
for (std::vector<std::pair<LLUUID,F32> >::value_type& motion_pair : active_motions)
|
||||
{
|
||||
startMotion(iter->first, iter->second);
|
||||
startMotion(motion_pair.first, motion_pair.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,10 +88,8 @@ S32 LLMultiGesture::getMaxSerialSize() const
|
|||
|
||||
max_size += 64; // step count S32
|
||||
|
||||
std::vector<LLGestureStep*>::const_iterator it;
|
||||
for (it = mSteps.begin(); it != mSteps.end(); ++it)
|
||||
for (LLGestureStep* step : mSteps)
|
||||
{
|
||||
LLGestureStep* step = *it;
|
||||
max_size += 64; // type S32
|
||||
max_size += step->getMaxSerialSize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,11 +148,9 @@ LLJointState* LLPose::findJointState(const std::string &name)
|
|||
void LLPose::setWeight(F32 weight)
|
||||
{
|
||||
joint_map_iterator iter;
|
||||
for(iter = mJointMap.begin();
|
||||
iter != mJointMap.end();
|
||||
++iter)
|
||||
for (joint_map_value_type& joint_pair : mJointMap)
|
||||
{
|
||||
iter->second->setWeight(weight);
|
||||
joint_pair.second->setWeight(weight);
|
||||
}
|
||||
mWeight = weight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,10 +169,9 @@ void LLStateDiagram::setDefaultState(LLFSMState& default_state)
|
|||
S32 LLStateDiagram::numDeadendStates()
|
||||
{
|
||||
S32 numDeadends = 0;
|
||||
StateMap::iterator state_it;
|
||||
for(state_it = mStates.begin(); state_it != mStates.end(); ++state_it)
|
||||
for (StateMap::value_type& state_pair : mStates)
|
||||
{
|
||||
if (state_it->second.size() == 0)
|
||||
if (state_pair.second.size() == 0)
|
||||
{
|
||||
numDeadends++;
|
||||
}
|
||||
|
|
@ -191,12 +190,11 @@ BOOL LLStateDiagram::stateIsValid(LLFSMState& state)
|
|||
|
||||
LLFSMState* LLStateDiagram::getState(U32 state_id)
|
||||
{
|
||||
StateMap::iterator state_it;
|
||||
for(state_it = mStates.begin(); state_it != mStates.end(); ++state_it)
|
||||
for (StateMap::value_type& state_pair : mStates)
|
||||
{
|
||||
if (state_it->first->getID() == state_id)
|
||||
if (state_pair.first->getID() == state_id)
|
||||
{
|
||||
return state_it->first;
|
||||
return state_pair.first;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -215,18 +213,16 @@ BOOL LLStateDiagram::saveDotFile(const std::string& filename)
|
|||
}
|
||||
apr_file_printf(dot_file, "digraph StateMachine {\n\tsize=\"100,100\";\n\tfontsize=40;\n\tlabel=\"Finite State Machine\";\n\torientation=landscape\n\tratio=.77\n");
|
||||
|
||||
StateMap::iterator state_it;
|
||||
for(state_it = mStates.begin(); state_it != mStates.end(); ++state_it)
|
||||
for (StateMap::value_type& state_pair : mStates)
|
||||
{
|
||||
apr_file_printf(dot_file, "\t\"%s\" [fontsize=28,shape=box]\n", state_it->first->getName().c_str());
|
||||
apr_file_printf(dot_file, "\t\"%s\" [fontsize=28,shape=box]\n", state_pair.first->getName().c_str());
|
||||
}
|
||||
apr_file_printf(dot_file, "\t\"All States\" [fontsize=30,style=bold,shape=box]\n");
|
||||
|
||||
Transitions::iterator transitions_it;
|
||||
for(transitions_it = mDefaultTransitions.begin(); transitions_it != mDefaultTransitions.end(); ++transitions_it)
|
||||
for (Transitions::value_type& transition_pair : mDefaultTransitions)
|
||||
{
|
||||
apr_file_printf(dot_file, "\t\"All States\" -> \"%s\" [label = \"%s\",fontsize=24];\n", transitions_it->second->getName().c_str(),
|
||||
transitions_it->second->getName().c_str());
|
||||
apr_file_printf(dot_file, "\t\"All States\" -> \"%s\" [label = \"%s\",fontsize=24];\n", transition_pair.second->getName().c_str(),
|
||||
transition_pair.second->getName().c_str());
|
||||
}
|
||||
|
||||
if (mDefaultState)
|
||||
|
|
@ -235,18 +231,15 @@ BOOL LLStateDiagram::saveDotFile(const std::string& filename)
|
|||
}
|
||||
|
||||
|
||||
for(state_it = mStates.begin(); state_it != mStates.end(); ++state_it)
|
||||
for (StateMap::value_type& state_pair : mStates)
|
||||
{
|
||||
LLFSMState *state = state_it->first;
|
||||
LLFSMState *state = state_pair.first;
|
||||
|
||||
Transitions::iterator transitions_it;
|
||||
for(transitions_it = state_it->second.begin();
|
||||
transitions_it != state_it->second.end();
|
||||
++transitions_it)
|
||||
for (Transitions::value_type& transition_pair : state_pair.second)
|
||||
{
|
||||
std::string state_name = state->getName();
|
||||
std::string target_name = transitions_it->second->getName();
|
||||
std::string transition_name = transitions_it->first->getName();
|
||||
std::string target_name = transition_pair.second->getName();
|
||||
std::string transition_name = transition_pair.first->getName();
|
||||
apr_file_printf(dot_file, "\t\"%s\" -> \"%s\" [label = \"%s\",fontsize=24];\n", state->getName().c_str(),
|
||||
target_name.c_str(),
|
||||
transition_name.c_str());
|
||||
|
|
@ -265,25 +258,18 @@ std::ostream& operator<<(std::ostream &s, LLStateDiagram &FSM)
|
|||
s << "Default State: " << FSM.mDefaultState->getName() << "\n";
|
||||
}
|
||||
|
||||
LLStateDiagram::Transitions::iterator transitions_it;
|
||||
for(transitions_it = FSM.mDefaultTransitions.begin();
|
||||
transitions_it != FSM.mDefaultTransitions.end();
|
||||
++transitions_it)
|
||||
for (LLStateDiagram::Transitions::value_type& transition_pair : FSM.mDefaultTransitions)
|
||||
{
|
||||
s << "Any State -- " << transitions_it->first->getName()
|
||||
<< " --> " << transitions_it->second->getName() << "\n";
|
||||
s << "Any State -- " << transition_pair.first->getName()
|
||||
<< " --> " << transition_pair.second->getName() << "\n";
|
||||
}
|
||||
|
||||
LLStateDiagram::StateMap::iterator state_it;
|
||||
for(state_it = FSM.mStates.begin(); state_it != FSM.mStates.end(); ++state_it)
|
||||
for (LLStateDiagram::StateMap::value_type& state_pair : FSM.mStates)
|
||||
{
|
||||
LLStateDiagram::Transitions::iterator transitions_it;
|
||||
for(transitions_it = state_it->second.begin();
|
||||
transitions_it != state_it->second.end();
|
||||
++transitions_it)
|
||||
for (LLStateDiagram::Transitions::value_type& transition_pair : state_pair.second)
|
||||
{
|
||||
s << state_it->first->getName() << " -- " << transitions_it->first->getName()
|
||||
<< " --> " << transitions_it->second->getName() << "\n";
|
||||
s << state_pair.first->getName() << " -- " << transition_pair.first->getName()
|
||||
<< " --> " << transition_pair.second->getName() << "\n";
|
||||
}
|
||||
s << "\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ set(llcommon_SOURCE_FILES
|
|||
llsys.cpp
|
||||
lltempredirect.cpp
|
||||
llthread.cpp
|
||||
llthreadlocalstorage.cpp
|
||||
llthreadsafequeue.cpp
|
||||
lltimer.cpp
|
||||
lltrace.cpp
|
||||
|
|
@ -106,6 +105,7 @@ set(llcommon_SOURCE_FILES
|
|||
lluriparser.cpp
|
||||
lluuid.cpp
|
||||
llworkerthread.cpp
|
||||
hbxxh.cpp
|
||||
u64.cpp
|
||||
threadpool.cpp
|
||||
workqueue.cpp
|
||||
|
|
@ -242,6 +242,7 @@ set(llcommon_HEADER_FILES
|
|||
llwin32headers.h
|
||||
llwin32headerslean.h
|
||||
llworkerthread.h
|
||||
hbxxh.h
|
||||
lockstatic.h
|
||||
stdtypes.h
|
||||
stringize.h
|
||||
|
|
@ -253,6 +254,11 @@ set(llcommon_HEADER_FILES
|
|||
workqueue.h
|
||||
StackWalker.h
|
||||
)
|
||||
|
||||
if (DARWIN)
|
||||
list(APPEND llcommon_HEADER_FILES llsys_objc.h)
|
||||
list(APPEND llcommon_SOURCE_FILES llsys_objc.mm)
|
||||
endif (DARWIN)
|
||||
|
||||
list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
|
||||
|
||||
|
|
@ -261,7 +267,6 @@ add_library (llcommon ${llcommon_SOURCE_FILES})
|
|||
target_link_libraries(
|
||||
llcommon
|
||||
ll::apr
|
||||
ll::bugsplat
|
||||
ll::expat
|
||||
ll::jsoncpp
|
||||
ll::zlib-ng
|
||||
|
|
@ -271,8 +276,8 @@ target_link_libraries(
|
|||
ll::tracy
|
||||
)
|
||||
|
||||
target_include_directories( llcommon INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories( llcommon PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
target_include_directories(llcommon INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(llcommon PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_dependencies(llcommon stage_third_party_libs)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,377 @@
|
|||
/**
|
||||
* @file hbxxh.cpp
|
||||
* @brief High performances vectorized hashing based on xxHash.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (c) 2023, Henri Beauchamp.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
// This define ensures that xxHash will be compiled within this module, with
|
||||
// vectorized (*) and inlined functions (with no exported API symbol); our
|
||||
// xxhash "pre-built library" package actually only contains the xxhash.h
|
||||
// header (no library needed at link time).
|
||||
// (*) SSE2 is normally used for x86(_64) builds, unless you enabled AVX2
|
||||
// in your build, in which case the latter would be used instead. For ARM64
|
||||
// builds, this would also automatically enable NEON vectorization.
|
||||
#define XXH_INLINE_ALL
|
||||
#include "xxhash/xxhash.h"
|
||||
|
||||
#include "hbxxh.h"
|
||||
|
||||
// How many bytes to grab at a time when hashing files or streams
|
||||
constexpr size_t BLOCK_LEN = 4096;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// HBXXH64 class
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//static
|
||||
U64 HBXXH64::digest(const void* buffer, size_t len)
|
||||
{
|
||||
return XXH3_64bits(buffer, len);
|
||||
}
|
||||
|
||||
//static
|
||||
U64 HBXXH64::digest(const char* str)
|
||||
{
|
||||
return XXH3_64bits((const void*)str, strlen(str));
|
||||
}
|
||||
|
||||
//static
|
||||
U64 HBXXH64::digest(const std::string& str)
|
||||
{
|
||||
return XXH3_64bits((const void*)str.c_str(), str.size());
|
||||
}
|
||||
|
||||
// Must be called by all constructors.
|
||||
void HBXXH64::init()
|
||||
{
|
||||
mDigest = 0;
|
||||
mState = (void*)XXH3_createState();
|
||||
if (!mState || XXH3_64bits_reset((XXH3_state_t*)mState) != XXH_OK)
|
||||
{
|
||||
LL_WARNS() << "Failed to initialize state !" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
HBXXH64::~HBXXH64()
|
||||
{
|
||||
if (mState)
|
||||
{
|
||||
XXH3_freeState((XXH3_state_t*)mState);
|
||||
}
|
||||
}
|
||||
|
||||
void HBXXH64::update(const void* buffer, size_t len)
|
||||
{
|
||||
if (mState)
|
||||
{
|
||||
XXH3_64bits_update((XXH3_state_t*)mState, buffer, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
void HBXXH64::update(const std::string& str)
|
||||
{
|
||||
if (mState)
|
||||
{
|
||||
XXH3_64bits_update((XXH3_state_t*)mState, (const void*)str.c_str(),
|
||||
str.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
void HBXXH64::update(std::istream& stream)
|
||||
{
|
||||
if (!mState)
|
||||
{
|
||||
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
char buffer[BLOCK_LEN];
|
||||
size_t len;
|
||||
while (stream.good())
|
||||
{
|
||||
stream.read(buffer, BLOCK_LEN);
|
||||
len = stream.gcount();
|
||||
XXH3_64bits_update((XXH3_state_t*)mState, (const void*)buffer, len);
|
||||
}
|
||||
}
|
||||
|
||||
void HBXXH64::update(FILE* file)
|
||||
{
|
||||
if (!mState)
|
||||
{
|
||||
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
char buffer[BLOCK_LEN];
|
||||
size_t len;
|
||||
while ((len = fread((void*)buffer, 1, BLOCK_LEN, file)))
|
||||
{
|
||||
XXH3_64bits_update((XXH3_state_t*)mState, (const void*)buffer, len);
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void HBXXH64::finalize()
|
||||
{
|
||||
if (!mState)
|
||||
{
|
||||
LL_WARNS() << "Already finalized !" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
mDigest = XXH3_64bits_digest((XXH3_state_t*)mState);
|
||||
XXH3_freeState((XXH3_state_t*)mState);
|
||||
mState = NULL;
|
||||
}
|
||||
|
||||
U64 HBXXH64::digest() const
|
||||
{
|
||||
return mState ? XXH3_64bits_digest((XXH3_state_t*)mState) : mDigest;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, HBXXH64 context)
|
||||
{
|
||||
stream << context.digest();
|
||||
return stream;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// HBXXH128 class
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//static
|
||||
LLUUID HBXXH128::digest(const void* buffer, size_t len)
|
||||
{
|
||||
XXH128_hash_t hash = XXH3_128bits(buffer, len);
|
||||
LLUUID id;
|
||||
U64* data = (U64*)id.mData;
|
||||
// Note: we do not check endianness here and we just store in the same
|
||||
// order as XXH128_hash_t, that is low word "first".
|
||||
data[0] = hash.low64;
|
||||
data[1] = hash.high64;
|
||||
return id;
|
||||
}
|
||||
|
||||
//static
|
||||
LLUUID HBXXH128::digest(const char* str)
|
||||
{
|
||||
XXH128_hash_t hash = XXH3_128bits((const void*)str, strlen(str));
|
||||
LLUUID id;
|
||||
U64* data = (U64*)id.mData;
|
||||
// Note: we do not check endianness here and we just store in the same
|
||||
// order as XXH128_hash_t, that is low word "first".
|
||||
data[0] = hash.low64;
|
||||
data[1] = hash.high64;
|
||||
return id;
|
||||
}
|
||||
|
||||
//static
|
||||
LLUUID HBXXH128::digest(const std::string& str)
|
||||
{
|
||||
XXH128_hash_t hash = XXH3_128bits((const void*)str.c_str(), str.size());
|
||||
LLUUID id;
|
||||
U64* data = (U64*)id.mData;
|
||||
// Note: we do not check endianness here and we just store in the same
|
||||
// order as XXH128_hash_t, that is low word "first".
|
||||
data[0] = hash.low64;
|
||||
data[1] = hash.high64;
|
||||
return id;
|
||||
}
|
||||
|
||||
//static
|
||||
void HBXXH128::digest(LLUUID& result, const void* buffer, size_t len)
|
||||
{
|
||||
XXH128_hash_t hash = XXH3_128bits(buffer, len);
|
||||
U64* data = (U64*)result.mData;
|
||||
// Note: we do not check endianness here and we just store in the same
|
||||
// order as XXH128_hash_t, that is low word "first".
|
||||
data[0] = hash.low64;
|
||||
data[1] = hash.high64;
|
||||
}
|
||||
|
||||
//static
|
||||
void HBXXH128::digest(LLUUID& result, const char* str)
|
||||
{
|
||||
XXH128_hash_t hash = XXH3_128bits((const void*)str, strlen(str));
|
||||
U64* data = (U64*)result.mData;
|
||||
// Note: we do not check endianness here and we just store in the same
|
||||
// order as XXH128_hash_t, that is low word "first".
|
||||
data[0] = hash.low64;
|
||||
data[1] = hash.high64;
|
||||
}
|
||||
|
||||
//static
|
||||
void HBXXH128::digest(LLUUID& result, const std::string& str)
|
||||
{
|
||||
XXH128_hash_t hash = XXH3_128bits((const void*)str.c_str(), str.size());
|
||||
U64* data = (U64*)result.mData;
|
||||
// Note: we do not check endianness here and we just store in the same
|
||||
// order as XXH128_hash_t, that is low word "first".
|
||||
data[0] = hash.low64;
|
||||
data[1] = hash.high64;
|
||||
}
|
||||
|
||||
// Must be called by all constructors.
|
||||
void HBXXH128::init()
|
||||
{
|
||||
mState = (void*)XXH3_createState();
|
||||
if (!mState || XXH3_128bits_reset((XXH3_state_t*)mState) != XXH_OK)
|
||||
{
|
||||
LL_WARNS() << "Failed to initialize state !" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
HBXXH128::~HBXXH128()
|
||||
{
|
||||
if (mState)
|
||||
{
|
||||
XXH3_freeState((XXH3_state_t*)mState);
|
||||
}
|
||||
}
|
||||
|
||||
void HBXXH128::update(const void* buffer, size_t len)
|
||||
{
|
||||
if (mState)
|
||||
{
|
||||
XXH3_128bits_update((XXH3_state_t*)mState, buffer, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
void HBXXH128::update(const std::string& str)
|
||||
{
|
||||
if (mState)
|
||||
{
|
||||
XXH3_128bits_update((XXH3_state_t*)mState, (const void*)str.c_str(),
|
||||
str.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
void HBXXH128::update(std::istream& stream)
|
||||
{
|
||||
if (!mState)
|
||||
{
|
||||
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
char buffer[BLOCK_LEN];
|
||||
size_t len;
|
||||
while (stream.good())
|
||||
{
|
||||
stream.read(buffer, BLOCK_LEN);
|
||||
len = stream.gcount();
|
||||
XXH3_128bits_update((XXH3_state_t*)mState, (const void*)buffer, len);
|
||||
}
|
||||
}
|
||||
|
||||
void HBXXH128::update(FILE* file)
|
||||
{
|
||||
if (!mState)
|
||||
{
|
||||
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
char buffer[BLOCK_LEN];
|
||||
size_t len;
|
||||
while ((len = fread((void*)buffer, 1, BLOCK_LEN, file)))
|
||||
{
|
||||
XXH3_128bits_update((XXH3_state_t*)mState, (const void*)buffer, len);
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void HBXXH128::finalize()
|
||||
{
|
||||
if (!mState)
|
||||
{
|
||||
LL_WARNS() << "Already finalized !" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
XXH128_hash_t hash = XXH3_128bits_digest((XXH3_state_t*)mState);
|
||||
U64* data = (U64*)mDigest.mData;
|
||||
// Note: we do not check endianness here and we just store in the same
|
||||
// order as XXH128_hash_t, that is low word "first".
|
||||
data[0] = hash.low64;
|
||||
data[1] = hash.high64;
|
||||
XXH3_freeState((XXH3_state_t*)mState);
|
||||
mState = NULL;
|
||||
}
|
||||
|
||||
const LLUUID& HBXXH128::digest() const
|
||||
{
|
||||
if (mState)
|
||||
{
|
||||
XXH128_hash_t hash = XXH3_128bits_digest((XXH3_state_t*)mState);
|
||||
// We cheat the const-ness of the method here, but this is OK, since
|
||||
// mDigest is private and cannot be accessed indirectly by other
|
||||
// methods than digest() ones, that do check for mState to decide
|
||||
// wether mDigest's current value may be provided as is or not. This
|
||||
// cheat saves us a temporary LLLUID copy.
|
||||
U64* data = (U64*)mDigest.mData;
|
||||
// Note: we do not check endianness here and we just store in the same
|
||||
// order as XXH128_hash_t, that is low word "first".
|
||||
data[0] = hash.low64;
|
||||
data[1] = hash.high64;
|
||||
}
|
||||
return mDigest;
|
||||
}
|
||||
|
||||
void HBXXH128::digest(LLUUID& result) const
|
||||
{
|
||||
if (!mState)
|
||||
{
|
||||
result = mDigest;
|
||||
return;
|
||||
}
|
||||
XXH128_hash_t hash = XXH3_128bits_digest((XXH3_state_t*)mState);
|
||||
U64* data = (U64*)result.mData;
|
||||
// Note: we do not check endianness here and we just store in the same
|
||||
// order as XXH128_hash_t, that is low word "first".
|
||||
data[0] = hash.low64;
|
||||
data[1] = hash.high64;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, HBXXH128 context)
|
||||
{
|
||||
stream << context.digest();
|
||||
return stream;
|
||||
}
|
||||
|
|
@ -0,0 +1,259 @@
|
|||
/**
|
||||
* @file hbxxh.h
|
||||
* @brief High performances vectorized hashing based on xxHash.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (c) 2023, Henri Beauchamp.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_HBXXH_H
|
||||
#define LL_HBXXH_H
|
||||
|
||||
#include "lluuid.h"
|
||||
|
||||
// HBXXH* classes are to be used where speed matters and cryptographic quality
|
||||
// is not required (no "one-way" guarantee, though they are likely not worst in
|
||||
// this respect than MD5 which got busted and is now considered too weak). The
|
||||
// xxHash code they are built upon is vectorized and about 50 times faster than
|
||||
// MD5. A 64 bits hash class is also provided for when 128 bits of entropy are
|
||||
// not needed. The hashes collision rate is similar to MD5's.
|
||||
// See https://github.com/Cyan4973/xxHash#readme for details.
|
||||
|
||||
// 64 bits hashing class
|
||||
|
||||
class HBXXH64
|
||||
{
|
||||
friend std::ostream& operator<<(std::ostream&, HBXXH64);
|
||||
|
||||
protected:
|
||||
LOG_CLASS(HBXXH64);
|
||||
|
||||
public:
|
||||
inline HBXXH64() { init(); }
|
||||
|
||||
// Constructors for special circumstances; they all digest the first passed
|
||||
// parameter. Set 'do_finalize' to false if you do not want to finalize the
|
||||
// context, which is useful/needed when you want to update() it afterwards.
|
||||
// Ideally, the compiler should be smart enough to get our clue and
|
||||
// optimize out the const bool test during inlining...
|
||||
|
||||
inline HBXXH64(const void* buffer, size_t len,
|
||||
const bool do_finalize = true)
|
||||
{
|
||||
init();
|
||||
update(buffer, len);
|
||||
if (do_finalize)
|
||||
{
|
||||
finalize();
|
||||
}
|
||||
}
|
||||
|
||||
inline HBXXH64(const std::string& str, const bool do_finalize = true)
|
||||
{
|
||||
init();
|
||||
update(str);
|
||||
if (do_finalize)
|
||||
{
|
||||
finalize();
|
||||
}
|
||||
}
|
||||
|
||||
inline HBXXH64(std::istream& s, const bool do_finalize = true)
|
||||
{
|
||||
init();
|
||||
update(s);
|
||||
if (do_finalize)
|
||||
{
|
||||
finalize();
|
||||
}
|
||||
}
|
||||
|
||||
inline HBXXH64(FILE* file, const bool do_finalize = true)
|
||||
{
|
||||
init();
|
||||
update(file);
|
||||
if (do_finalize)
|
||||
{
|
||||
finalize();
|
||||
}
|
||||
}
|
||||
|
||||
~HBXXH64();
|
||||
|
||||
void update(const void* buffer, size_t len);
|
||||
void update(const std::string& str);
|
||||
void update(std::istream& s);
|
||||
void update(FILE* file);
|
||||
|
||||
// Note that unlike what happens with LLMD5, you do not need to finalize()
|
||||
// HBXXH64 before using digest(), and you may keep updating() it even after
|
||||
// you got a first digest() (the next digest would of course change after
|
||||
// any update). It is still useful to use finalize() when you do not want
|
||||
// to store a final digest() result in a separate U64; after this method
|
||||
// has been called, digest() simply returns mDigest value.
|
||||
void finalize();
|
||||
|
||||
U64 digest() const;
|
||||
|
||||
// Fast static methods. Use them when hashing just one contiguous block of
|
||||
// data.
|
||||
static U64 digest(const void* buffer, size_t len);
|
||||
static U64 digest(const char* str); // str must be NUL-terminated
|
||||
static U64 digest(const std::string& str);
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
private:
|
||||
// We use a void pointer to avoid including xxhash.h here for XXH3_state_t
|
||||
// (which cannot either be trivially forward-declared, due to complex API
|
||||
// related pre-processor macros in xxhash.h).
|
||||
void* mState;
|
||||
U64 mDigest;
|
||||
};
|
||||
|
||||
inline bool operator==(const HBXXH64& a, const HBXXH64& b)
|
||||
{
|
||||
return a.digest() == b.digest();
|
||||
}
|
||||
|
||||
inline bool operator!=(const HBXXH64& a, const HBXXH64& b)
|
||||
{
|
||||
return a.digest() != b.digest();
|
||||
}
|
||||
|
||||
// 128 bits hashing class
|
||||
|
||||
class HBXXH128
|
||||
{
|
||||
friend std::ostream& operator<<(std::ostream&, HBXXH128);
|
||||
|
||||
protected:
|
||||
LOG_CLASS(HBXXH128);
|
||||
|
||||
public:
|
||||
inline HBXXH128() { init(); }
|
||||
|
||||
// Constructors for special circumstances; they all digest the first passed
|
||||
// parameter. Set 'do_finalize' to false if you do not want to finalize the
|
||||
// context, which is useful/needed when you want to update() it afterwards.
|
||||
// Ideally, the compiler should be smart enough to get our clue and
|
||||
// optimize out the const bool test during inlining...
|
||||
|
||||
inline HBXXH128(const void* buffer, size_t len,
|
||||
const bool do_finalize = true)
|
||||
{
|
||||
init();
|
||||
update(buffer, len);
|
||||
if (do_finalize)
|
||||
{
|
||||
finalize();
|
||||
}
|
||||
}
|
||||
|
||||
inline HBXXH128(const std::string& str, const bool do_finalize = true)
|
||||
{
|
||||
init();
|
||||
update(str);
|
||||
if (do_finalize)
|
||||
{
|
||||
finalize();
|
||||
}
|
||||
}
|
||||
|
||||
inline HBXXH128(std::istream& s, const bool do_finalize = true)
|
||||
{
|
||||
init();
|
||||
update(s);
|
||||
if (do_finalize)
|
||||
{
|
||||
finalize();
|
||||
}
|
||||
}
|
||||
|
||||
inline HBXXH128(FILE* file, const bool do_finalize = true)
|
||||
{
|
||||
init();
|
||||
update(file);
|
||||
if (do_finalize)
|
||||
{
|
||||
finalize();
|
||||
}
|
||||
}
|
||||
|
||||
~HBXXH128();
|
||||
|
||||
void update(const void* buffer, size_t len);
|
||||
void update(const std::string& str);
|
||||
void update(std::istream& s);
|
||||
void update(FILE* file);
|
||||
|
||||
// Note that unlike what happens with LLMD5, you do not need to finalize()
|
||||
// HBXXH128 before using digest(), and you may keep updating() it even
|
||||
// after you got a first digest() (the next digest would of course change
|
||||
// after any update). It is still useful to use finalize() when you do not
|
||||
// want to store a final digest() result in a separate LLUUID; after this
|
||||
// method has been called, digest() simply returns a reference on mDigest.
|
||||
void finalize();
|
||||
|
||||
// We use an LLUUID for the digest, since this is a 128 bits wide native
|
||||
// type available in the viewer code, making it easy to manipulate. It also
|
||||
// allows to use HBXXH128 efficiently in LLUUID generate() and combine()
|
||||
// methods.
|
||||
const LLUUID& digest() const;
|
||||
|
||||
// Here, we avoid an LLUUID copy whenever we already got one to store the
|
||||
// result *and* we did not yet call finalize().
|
||||
void digest(LLUUID& result) const;
|
||||
|
||||
// Fast static methods. Use them when hashing just one contiguous block of
|
||||
// data.
|
||||
static LLUUID digest(const void* buffer, size_t len);
|
||||
static LLUUID digest(const char* str); // str must be NUL-terminated
|
||||
static LLUUID digest(const std::string& str);
|
||||
// Same as above, but saves you from an LLUUID copy when you already got
|
||||
// one for storage use.
|
||||
static void digest(LLUUID& result, const void* buffer, size_t len);
|
||||
static void digest(LLUUID& result, const char* str); // str NUL-terminated
|
||||
static void digest(LLUUID& result, const std::string& str);
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
private:
|
||||
// We use a void pointer to avoid including xxhash.h here for XXH3_state_t
|
||||
// (which cannot either be trivially forward-declared, due to complex API
|
||||
// related pre-processor macros in xxhash.h).
|
||||
void* mState;
|
||||
LLUUID mDigest;
|
||||
};
|
||||
|
||||
inline bool operator==(const HBXXH128& a, const HBXXH128& b)
|
||||
{
|
||||
return a.digest() == b.digest();
|
||||
}
|
||||
|
||||
inline bool operator!=(const HBXXH128& a, const HBXXH128& b)
|
||||
{
|
||||
return a.digest() != b.digest();
|
||||
}
|
||||
|
||||
#endif // LL_HBXXH_H
|
||||
|
|
@ -130,15 +130,13 @@ void LLAllocatorHeapProfile::parse(std::string const & prof_text)
|
|||
|
||||
void LLAllocatorHeapProfile::dump(std::ostream & out) const
|
||||
{
|
||||
lines_t::const_iterator i;
|
||||
for(i = mLines.begin(); i != mLines.end(); ++i)
|
||||
for (const LLAllocatorHeapProfile::line& line : mLines)
|
||||
{
|
||||
out << i->mLiveCount << ": " << i->mLiveSize << '[' << i->mTotalCount << ": " << i->mTotalSize << "] @";
|
||||
out << line.mLiveCount << ": " << line.mLiveSize << '[' << line.mTotalCount << ": " << line.mTotalSize << "] @";
|
||||
|
||||
stack_trace::const_iterator j;
|
||||
for(j = i->mTrace.begin(); j != i->mTrace.end(); ++j)
|
||||
for (const stack_marker marker : line.mTrace)
|
||||
{
|
||||
out << ' ' << *j;
|
||||
out << ' ' << marker;
|
||||
}
|
||||
out << '\n';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -862,14 +862,14 @@ bool unix_post_minidump_callback(const char *dump_dir,
|
|||
// heap allocations in a crash handler.
|
||||
|
||||
// path format: <dump_dir>/<minidump_id>.dmp
|
||||
int dirPathLength = strlen(dump_dir);
|
||||
int idLength = strlen(minidump_id);
|
||||
auto dirPathLength = strlen(dump_dir);
|
||||
auto idLength = strlen(minidump_id);
|
||||
|
||||
// The path must not be truncated.
|
||||
llassert((dirPathLength + idLength + 5) <= LLApp::MAX_MINDUMP_PATH_LENGTH);
|
||||
|
||||
char * path = LLApp::instance()->getMiniDumpFilename();
|
||||
S32 remaining = LLApp::MAX_MINDUMP_PATH_LENGTH;
|
||||
auto remaining = LLApp::MAX_MINDUMP_PATH_LENGTH;
|
||||
strncpy(path, dump_dir, remaining);
|
||||
remaining -= dirPathLength;
|
||||
path += dirPathLength;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include "llapr.h"
|
||||
#include "llmutex.h"
|
||||
#include "apr_dso.h"
|
||||
#include "llthreadlocalstorage.h"
|
||||
|
||||
apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool
|
||||
LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool.
|
||||
|
|
@ -54,7 +53,6 @@ void ll_init_apr()
|
|||
LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool(FALSE) ;
|
||||
}
|
||||
|
||||
LLThreadLocalPointerBase::initAllThreadLocalStorage();
|
||||
gAPRInitialized = true;
|
||||
}
|
||||
|
||||
|
|
@ -70,8 +68,6 @@ void ll_cleanup_apr()
|
|||
|
||||
LL_DEBUGS("APR") << "Cleaning up APR" << LL_ENDL;
|
||||
|
||||
LLThreadLocalPointerBase::destroyAllThreadLocalStorage();
|
||||
|
||||
if (gAPRPoolp)
|
||||
{
|
||||
apr_pool_destroy(gAPRPoolp);
|
||||
|
|
|
|||
|
|
@ -150,14 +150,12 @@ LLAssetType::EType LLAssetType::lookup(const char* name)
|
|||
LLAssetType::EType LLAssetType::lookup(const std::string& type_name)
|
||||
{
|
||||
const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
|
||||
for (LLAssetDictionary::const_iterator iter = dict->begin();
|
||||
iter != dict->end();
|
||||
iter++)
|
||||
for (const LLAssetDictionary::value_type& pair : *dict)
|
||||
{
|
||||
const AssetEntry *entry = iter->second;
|
||||
const AssetEntry *entry = pair.second;
|
||||
if (type_name == entry->mTypeName)
|
||||
{
|
||||
return iter->first;
|
||||
return pair.first;
|
||||
}
|
||||
}
|
||||
return AT_UNKNOWN;
|
||||
|
|
@ -188,14 +186,12 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name)
|
|||
LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_name)
|
||||
{
|
||||
const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
|
||||
for (LLAssetDictionary::const_iterator iter = dict->begin();
|
||||
iter != dict->end();
|
||||
iter++)
|
||||
for (const LLAssetDictionary::value_type& pair : *dict)
|
||||
{
|
||||
const AssetEntry *entry = iter->second;
|
||||
const AssetEntry *entry = pair.second;
|
||||
if (entry->mHumanName && (readable_name == entry->mHumanName))
|
||||
{
|
||||
return iter->first;
|
||||
return pair.first;
|
||||
}
|
||||
}
|
||||
return AT_NONE;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size)
|
|||
&& input_size > 0)
|
||||
{
|
||||
// Yes, it returns int.
|
||||
int b64_buffer_length = apr_base64_encode_len(input_size);
|
||||
int b64_buffer_length = apr_base64_encode_len(narrow(input_size));
|
||||
char* b64_buffer = new char[b64_buffer_length];
|
||||
|
||||
// This is faster than apr_base64_encode() if you know
|
||||
|
|
@ -52,7 +52,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size)
|
|||
b64_buffer_length = apr_base64_encode_binary(
|
||||
b64_buffer,
|
||||
input,
|
||||
input_size);
|
||||
narrow(input_size));
|
||||
output.assign(b64_buffer);
|
||||
delete[] b64_buffer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ void LLCallbackList::deleteAllFunctions()
|
|||
|
||||
void LLCallbackList::callFunctions()
|
||||
{
|
||||
for (callback_list_t::iterator iter = mCallbackList.begin(); iter != mCallbackList.end(); )
|
||||
for (callback_list_t::iterator iter = mCallbackList.begin(); iter != mCallbackList.end(); )
|
||||
{
|
||||
callback_list_t::iterator curiter = iter++;
|
||||
curiter->first(curiter->second);
|
||||
|
|
|
|||
|
|
@ -91,10 +91,9 @@ LLCallStack::LLCallStack(S32 skip_count, bool verbose):
|
|||
|
||||
bool LLCallStack::contains(const std::string& str)
|
||||
{
|
||||
for (std::vector<std::string>::const_iterator it = m_strings.begin();
|
||||
it != m_strings.end(); ++it)
|
||||
for (const std::string& src_str : m_strings)
|
||||
{
|
||||
if (it->find(str) != std::string::npos)
|
||||
if (src_str.find(str) != std::string::npos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -105,10 +104,9 @@ bool LLCallStack::contains(const std::string& str)
|
|||
std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack)
|
||||
{
|
||||
#ifndef LL_RELEASE_FOR_DOWNLOAD
|
||||
std::vector<std::string>::const_iterator it;
|
||||
for (it=call_stack.m_strings.begin(); it!=call_stack.m_strings.end(); ++it)
|
||||
for (const std::string& str : call_stack.m_strings)
|
||||
{
|
||||
s << *it;
|
||||
s << str;
|
||||
}
|
||||
#else
|
||||
s << "UNAVAILABLE IN RELEASE";
|
||||
|
|
@ -156,9 +154,9 @@ bool LLContextStrings::contains(const std::string& str)
|
|||
{
|
||||
const std::map<std::string,S32>& strings =
|
||||
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
|
||||
for (std::map<std::string,S32>::const_iterator it = strings.begin(); it!=strings.end(); ++it)
|
||||
for (const std::map<std::string,S32>::value_type& str_pair : strings)
|
||||
{
|
||||
if (it->first.find(str) != std::string::npos)
|
||||
if (str_pair.first.find(str) != std::string::npos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -171,9 +169,9 @@ void LLContextStrings::output(std::ostream& os)
|
|||
{
|
||||
const std::map<std::string,S32>& strings =
|
||||
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
|
||||
for (std::map<std::string,S32>::const_iterator it = strings.begin(); it!=strings.end(); ++it)
|
||||
for (const std::map<std::string,S32>::value_type& str_pair : strings)
|
||||
{
|
||||
os << it->first << "[" << it->second << "]" << "\n";
|
||||
os << str_pair.first << "[" << str_pair.second << "]" << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -288,25 +288,15 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl
|
|||
return name;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
#if LL_WINDOWS
|
||||
|
||||
static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
|
||||
|
||||
U32 cpp_exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop, const std::string& name)
|
||||
U32 exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop)
|
||||
{
|
||||
// C++ exceptions were logged in toplevelTryWrapper, but not SEH
|
||||
// log SEH exceptions here, to make sure it gets into bugsplat's
|
||||
// report and because __try won't allow std::string operations
|
||||
if (code != STATUS_MSC_EXCEPTION)
|
||||
{
|
||||
LL_WARNS() << "SEH crash in " << name << ", code: " << code << LL_ENDL;
|
||||
}
|
||||
// Handle bugsplat here, since GetExceptionInformation() can only be
|
||||
// called from within filter for __except(filter), not from __except's {}
|
||||
// Bugsplat should get all exceptions, C++ and SEH
|
||||
LLApp::instance()->reportCrashToBugsplat(exception_infop);
|
||||
|
||||
// Only convert non C++ exceptions.
|
||||
if (code == STATUS_MSC_EXCEPTION)
|
||||
{
|
||||
// C++ exception, go on
|
||||
|
|
@ -319,28 +309,38 @@ U32 cpp_exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop,
|
|||
}
|
||||
}
|
||||
|
||||
void LLCoros::sehHandle(const std::string& name, const LLCoros::callable_t& callable)
|
||||
void sehandle(const LLCoros::callable_t& callable)
|
||||
{
|
||||
__try
|
||||
{
|
||||
LLCoros::toplevelTryWrapper(name, callable);
|
||||
callable();
|
||||
}
|
||||
__except (cpp_exception_filter(GetExceptionCode(), GetExceptionInformation(), name))
|
||||
__except (exception_filter(GetExceptionCode(), GetExceptionInformation()))
|
||||
{
|
||||
// convert to C++ styled exception for handlers other than bugsplat
|
||||
// convert to C++ styled exception
|
||||
// Note: it might be better to use _se_set_translator
|
||||
// if you want exception to inherit full callstack
|
||||
//
|
||||
// in case of bugsplat this will get to exceptionTerminateHandler and
|
||||
// looks like fiber will terminate application after that
|
||||
char integer_string[512];
|
||||
sprintf(integer_string, "SEH crash in %s, code: %lu\n", name.c_str(), GetExceptionCode());
|
||||
sprintf(integer_string, "SEH, code: %lu\n", GetExceptionCode());
|
||||
throw std::exception(integer_string);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void LLCoros::toplevelTryWrapper(const std::string& name, const callable_t& callable)
|
||||
#else // ! LL_WINDOWS
|
||||
|
||||
inline void sehandle(const LLCoros::callable_t& callable)
|
||||
{
|
||||
callable();
|
||||
}
|
||||
|
||||
#endif // ! LL_WINDOWS
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// Top-level wrapper around caller's coroutine callable.
|
||||
// Normally we like to pass strings and such by const reference -- but in this
|
||||
// case, we WANT to copy both the name and the callable to our local stack!
|
||||
void LLCoros::toplevel(std::string name, callable_t callable)
|
||||
{
|
||||
// keep the CoroData on this top-level function's stack frame
|
||||
CoroData corodata(name);
|
||||
|
|
@ -350,12 +350,12 @@ void LLCoros::toplevelTryWrapper(const std::string& name, const callable_t& call
|
|||
// run the code the caller actually wants in the coroutine
|
||||
try
|
||||
{
|
||||
callable();
|
||||
sehandle(callable);
|
||||
}
|
||||
catch (const Stop& exc)
|
||||
{
|
||||
LL_INFOS("LLCoros") << "coroutine " << name << " terminating because "
|
||||
<< exc.what() << LL_ENDL;
|
||||
<< exc.what() << LL_ENDL;
|
||||
}
|
||||
catch (const LLContinueError&)
|
||||
{
|
||||
|
|
@ -366,36 +366,14 @@ void LLCoros::toplevelTryWrapper(const std::string& name, const callable_t& call
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
#if LL_WINDOWS
|
||||
// Any OTHER kind of uncaught exception will cause the viewer to
|
||||
// crash, SEH handling should catch it and report to bugsplat.
|
||||
LOG_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << name));
|
||||
// to not modify callstack
|
||||
throw;
|
||||
#else
|
||||
// Stash any OTHER kind of uncaught exception in the rethrow() queue
|
||||
// to be rethrown by the main fiber.
|
||||
LL_WARNS("LLCoros") << "Capturing uncaught exception in coroutine "
|
||||
<< name << LL_ENDL;
|
||||
LLCoros::instance().saveException(name, std::current_exception());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Top-level wrapper around caller's coroutine callable.
|
||||
// Normally we like to pass strings and such by const reference -- but in this
|
||||
// case, we WANT to copy both the name and the callable to our local stack!
|
||||
void LLCoros::toplevel(std::string name, callable_t callable)
|
||||
{
|
||||
#if LL_WINDOWS
|
||||
// Because SEH can's have unwinding, need to call a wrapper
|
||||
// 'try' is inside SEH handling to not catch LLContinue
|
||||
sehHandle(name, callable);
|
||||
#else
|
||||
toplevelTryWrapper(name, callable);
|
||||
#endif
|
||||
}
|
||||
|
||||
//static
|
||||
void LLCoros::checkStop()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -307,11 +307,7 @@ public:
|
|||
|
||||
private:
|
||||
std::string generateDistinctName(const std::string& prefix) const;
|
||||
void toplevelTryWrapper(const std::string& name, const callable_t& callable);
|
||||
#if LL_WINDOWS
|
||||
void sehHandle(const std::string& name, const callable_t& callable); // calls toplevelTryWrapper
|
||||
#endif
|
||||
void toplevel(std::string name, callable_t callable); // calls sehHandle or toplevelTryWrapper
|
||||
void toplevel(std::string name, callable_t callable);
|
||||
struct CoroData;
|
||||
static CoroData& get_CoroData(const std::string& caller);
|
||||
void saveException(const std::string& name, std::exception_ptr exc);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#define LL_LLDEFS_H
|
||||
|
||||
#include "stdtypes.h"
|
||||
#include <type_traits>
|
||||
|
||||
// Often used array indices
|
||||
const U32 VX = 0;
|
||||
|
|
@ -168,80 +169,79 @@ const U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luc
|
|||
// llclampb(a) // clamps a to [0 .. 255]
|
||||
//
|
||||
|
||||
template <class LLDATATYPE>
|
||||
inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2)
|
||||
template <typename T1, typename T2>
|
||||
inline auto llmax(T1 d1, T2 d2)
|
||||
{
|
||||
return (d1 > d2) ? d1 : d2;
|
||||
}
|
||||
|
||||
template <class LLDATATYPE>
|
||||
inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3)
|
||||
template <typename T1, typename T2, typename T3>
|
||||
inline auto llmax(T1 d1, T2 d2, T3 d3)
|
||||
{
|
||||
LLDATATYPE r = llmax(d1,d2);
|
||||
auto r = llmax(d1,d2);
|
||||
return llmax(r, d3);
|
||||
}
|
||||
|
||||
template <class LLDATATYPE>
|
||||
inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3, const LLDATATYPE& d4)
|
||||
template <typename T1, typename T2, typename T3, typename T4>
|
||||
inline auto llmax(T1 d1, T2 d2, T3 d3, T4 d4)
|
||||
{
|
||||
LLDATATYPE r1 = llmax(d1,d2);
|
||||
LLDATATYPE r2 = llmax(d3,d4);
|
||||
auto r1 = llmax(d1,d2);
|
||||
auto r2 = llmax(d3,d4);
|
||||
return llmax(r1, r2);
|
||||
}
|
||||
|
||||
template <class LLDATATYPE>
|
||||
inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2)
|
||||
template <typename T1, typename T2>
|
||||
inline auto llmin(T1 d1, T2 d2)
|
||||
{
|
||||
return (d1 < d2) ? d1 : d2;
|
||||
}
|
||||
|
||||
template <class LLDATATYPE>
|
||||
inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3)
|
||||
template <typename T1, typename T2, typename T3>
|
||||
inline auto llmin(T1 d1, T2 d2, T3 d3)
|
||||
{
|
||||
LLDATATYPE r = llmin(d1,d2);
|
||||
auto r = llmin(d1,d2);
|
||||
return (r < d3 ? r : d3);
|
||||
}
|
||||
|
||||
template <class LLDATATYPE>
|
||||
inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3, const LLDATATYPE& d4)
|
||||
template <typename T1, typename T2, typename T3, typename T4>
|
||||
inline auto llmin(T1 d1, T2 d2, T3 d3, T4 d4)
|
||||
{
|
||||
LLDATATYPE r1 = llmin(d1,d2);
|
||||
LLDATATYPE r2 = llmin(d3,d4);
|
||||
auto r1 = llmin(d1,d2);
|
||||
auto r2 = llmin(d3,d4);
|
||||
return llmin(r1, r2);
|
||||
}
|
||||
|
||||
template <class LLDATATYPE>
|
||||
inline LLDATATYPE llclamp(const LLDATATYPE& a, const LLDATATYPE& minval, const LLDATATYPE& maxval)
|
||||
template <typename A, typename MIN, typename MAX>
|
||||
inline A llclamp(A a, MIN minval, MAX maxval)
|
||||
{
|
||||
if ( a < minval )
|
||||
A aminval{ static_cast<A>(minval) }, amaxval{ static_cast<A>(maxval) };
|
||||
if ( a < aminval )
|
||||
{
|
||||
return minval;
|
||||
return aminval;
|
||||
}
|
||||
else if ( a > maxval )
|
||||
else if ( a > amaxval )
|
||||
{
|
||||
return maxval;
|
||||
return amaxval;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
template <class LLDATATYPE>
|
||||
inline LLDATATYPE llclampf(const LLDATATYPE& a)
|
||||
inline LLDATATYPE llclampf(LLDATATYPE a)
|
||||
{
|
||||
return llmin(llmax(a, (LLDATATYPE)0), (LLDATATYPE)1);
|
||||
return llmin(llmax(a, LLDATATYPE(0)), LLDATATYPE(1));
|
||||
}
|
||||
|
||||
template <class LLDATATYPE>
|
||||
inline LLDATATYPE llclampb(const LLDATATYPE& a)
|
||||
inline LLDATATYPE llclampb(LLDATATYPE a)
|
||||
{
|
||||
return llmin(llmax(a, (LLDATATYPE)0), (LLDATATYPE)255);
|
||||
return llmin(llmax(a, LLDATATYPE(0)), LLDATATYPE(255));
|
||||
}
|
||||
|
||||
template <class LLDATATYPE>
|
||||
inline void llswap(LLDATATYPE& lhs, LLDATATYPE& rhs)
|
||||
{
|
||||
LLDATATYPE tmp = lhs;
|
||||
lhs = rhs;
|
||||
rhs = tmp;
|
||||
std::swap(lhs, rhs);
|
||||
}
|
||||
|
||||
#endif // LL_LLDEFS_H
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
// other Linden headers
|
||||
#include "llexception.h"
|
||||
|
||||
LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(int vertices, const EdgeList& edges) const
|
||||
LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(size_t vertices, const EdgeList& edges) const
|
||||
{
|
||||
// Construct a Boost Graph Library graph according to the constraints
|
||||
// we've collected. It seems as though we ought to be able to capture
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ public:
|
|||
protected:
|
||||
typedef std::vector< std::pair<std::size_t, std::size_t> > EdgeList;
|
||||
typedef std::vector<std::size_t> VertexList;
|
||||
VertexList topo_sort(int vertices, const EdgeList& edges) const;
|
||||
VertexList topo_sort(size_t vertices, const EdgeList& edges) const;
|
||||
|
||||
/**
|
||||
* refpair is specifically intended to capture a pair of references. This
|
||||
|
|
@ -539,7 +539,7 @@ public:
|
|||
for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end();
|
||||
nmi != nmend; ++nmi)
|
||||
{
|
||||
int thisnode = vmap[nmi->first];
|
||||
auto thisnode = vmap[nmi->first];
|
||||
// after dependencies: build edges from the named node to this one
|
||||
for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(),
|
||||
aend = nmi->second.after.end();
|
||||
|
|
|
|||
|
|
@ -586,11 +586,9 @@ namespace
|
|||
|
||||
void Globals::invalidateCallSites()
|
||||
{
|
||||
for (CallSiteVector::const_iterator i = callSites.begin();
|
||||
i != callSites.end();
|
||||
++i)
|
||||
for (LLError::CallSite* site : callSites)
|
||||
{
|
||||
(*i)->invalidate();
|
||||
site->invalidate();
|
||||
}
|
||||
|
||||
callSites.clear();
|
||||
|
|
@ -943,7 +941,7 @@ namespace LLError
|
|||
for (a = sets.beginArray(), end = sets.endArray(); a != end; ++a)
|
||||
{
|
||||
const LLSD& entry = *a;
|
||||
if (entry.isMap() && !entry.emptyMap())
|
||||
if (entry.isMap() && entry.size() != 0)
|
||||
{
|
||||
ELevel level = decodeLevel(entry["level"]);
|
||||
|
||||
|
|
@ -1224,12 +1222,8 @@ namespace
|
|||
std::string escaped_message;
|
||||
|
||||
LLMutexLock lock(&s->mRecorderMutex);
|
||||
for (Recorders::const_iterator i = s->mRecorders.begin();
|
||||
i != s->mRecorders.end();
|
||||
++i)
|
||||
for (LLError::RecorderPtr& r : s->mRecorders)
|
||||
{
|
||||
LLError::RecorderPtr r = *i;
|
||||
|
||||
if (!r->enabled())
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1514,7 +1508,7 @@ namespace LLError
|
|||
const size_t BUF_SIZE = 64;
|
||||
char time_str[BUF_SIZE]; /* Flawfinder: ignore */
|
||||
|
||||
int chars = strftime(time_str, BUF_SIZE,
|
||||
auto chars = strftime(time_str, BUF_SIZE,
|
||||
"%Y-%m-%dT%H:%M:%SZ",
|
||||
gmtime(&now));
|
||||
|
||||
|
|
|
|||
|
|
@ -203,10 +203,9 @@ void LLSimpleDispatcher::removeListener(LLEventListener* listener)
|
|||
std::vector<LLListenerEntry> LLSimpleDispatcher::getListeners() const
|
||||
{
|
||||
std::vector<LLListenerEntry> ret;
|
||||
std::vector<LLListenerEntry>::const_iterator itor;
|
||||
for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor)
|
||||
for (const LLListenerEntry& entry : mListeners)
|
||||
{
|
||||
ret.push_back(*itor);
|
||||
ret.push_back(entry);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -215,14 +214,12 @@ std::vector<LLListenerEntry> LLSimpleDispatcher::getListeners() const
|
|||
// virtual
|
||||
bool LLSimpleDispatcher::fireEvent(LLPointer<LLEvent> event, LLSD filter)
|
||||
{
|
||||
std::vector<LLListenerEntry>::iterator itor;
|
||||
std::string filter_string = filter.asString();
|
||||
for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor)
|
||||
for (LLListenerEntry& entry : mListeners)
|
||||
{
|
||||
LLListenerEntry& entry = *itor;
|
||||
if (filter_string == "" || entry.filter.asString() == filter_string)
|
||||
{
|
||||
(entry.listener)->handleEvent(event, (*itor).userdata);
|
||||
(entry.listener)->handleEvent(event, entry.userdata);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -276,10 +273,9 @@ void LLSimpleListener::clearDispatchers()
|
|||
bool LLSimpleListener::handleAttach(LLEventDispatcher *dispatcher)
|
||||
{
|
||||
// Add dispatcher if it doesn't already exist
|
||||
std::vector<LLEventDispatcher *>::iterator itor;
|
||||
for (itor = mDispatchers.begin(); itor != mDispatchers.end(); ++itor)
|
||||
for (LLEventDispatcher* disp : mDispatchers)
|
||||
{
|
||||
if ((*itor) == dispatcher) return true;
|
||||
if (disp == dispatcher) return true;
|
||||
}
|
||||
mDispatchers.push_back(dispatcher);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ private:
|
|||
// store it as a map from name string to position index. Of course that's
|
||||
// easy to generate from the incoming names array, but why do it more than
|
||||
// once?
|
||||
typedef std::map<LLSD::String, LLSD::Integer> IndexMap;
|
||||
typedef std::map<LLSD::String, size_t> IndexMap;
|
||||
IndexMap _indexes;
|
||||
// Generated array of default values, aligned with the array of param names.
|
||||
LLSD _defaults;
|
||||
|
|
@ -197,9 +197,9 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function,
|
|||
{
|
||||
LL_ERRS("LLSDArgsMapper") << function << " names must be an array, not " << names << LL_ENDL;
|
||||
}
|
||||
LLSD::Integer nparams(_names.size());
|
||||
auto nparams(_names.size());
|
||||
// From _names generate _indexes.
|
||||
for (LLSD::Integer ni = 0, nend = _names.size(); ni < nend; ++ni)
|
||||
for (size_t ni = 0, nend = _names.size(); ni < nend; ++ni)
|
||||
{
|
||||
_indexes[_names[ni]] = ni;
|
||||
}
|
||||
|
|
@ -214,7 +214,7 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function,
|
|||
|
||||
if (defaults.isUndefined() || defaults.isArray())
|
||||
{
|
||||
LLSD::Integer ndefaults = defaults.size();
|
||||
auto ndefaults = defaults.size();
|
||||
// defaults is a (possibly empty) array. Right-align it with names.
|
||||
if (ndefaults > nparams)
|
||||
{
|
||||
|
|
@ -224,10 +224,10 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function,
|
|||
|
||||
// Offset by which we slide defaults array right to right-align with
|
||||
// _names array
|
||||
LLSD::Integer offset = nparams - ndefaults;
|
||||
auto offset = nparams - ndefaults;
|
||||
// Fill rightmost _defaults entries from defaults, and mark them as
|
||||
// filled
|
||||
for (LLSD::Integer i = 0, iend = ndefaults; i < iend; ++i)
|
||||
for (size_t i = 0, iend = ndefaults; i < iend; ++i)
|
||||
{
|
||||
_defaults[i + offset] = defaults[i];
|
||||
_has_dft[i + offset] = 1;
|
||||
|
|
@ -247,7 +247,7 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function,
|
|||
continue;
|
||||
}
|
||||
|
||||
LLSD::Integer pos = ixit->second;
|
||||
auto pos = ixit->second;
|
||||
// Store default value at that position in the _defaults array.
|
||||
_defaults[pos] = mi->second;
|
||||
// Don't forget to record the fact that we've filled this
|
||||
|
|
@ -301,7 +301,7 @@ LLSD LLSDArgsMapper::map(const LLSD& argsmap) const
|
|||
{
|
||||
// Fill args from array. If there are too many args in passed array,
|
||||
// ignore the rest.
|
||||
LLSD::Integer size(argsmap.size());
|
||||
auto size(argsmap.size());
|
||||
if (size > args.size())
|
||||
{
|
||||
// We don't just use std::min() because we want to sneak in this
|
||||
|
|
@ -338,7 +338,7 @@ LLSD LLSDArgsMapper::map(const LLSD& argsmap) const
|
|||
<< mi->first << "=" << mi->second << LL_ENDL;
|
||||
continue;
|
||||
}
|
||||
LLSD::Integer pos = ixit->second;
|
||||
auto pos = ixit->second;
|
||||
// Store the value at that position in the args array.
|
||||
args[pos] = mi->second;
|
||||
// Don't forget to record the fact that we've filled this
|
||||
|
|
@ -349,7 +349,7 @@ LLSD LLSDArgsMapper::map(const LLSD& argsmap) const
|
|||
|
||||
// Fill any remaining holes from _defaults.
|
||||
LLSD unfilled(LLSD::emptyArray());
|
||||
for (LLSD::Integer i = 0, iend = args.size(); i < iend; ++i)
|
||||
for (size_t i = 0, iend = args.size(); i < iend; ++i)
|
||||
{
|
||||
if (! filled[i])
|
||||
{
|
||||
|
|
@ -503,9 +503,9 @@ struct LLEventDispatcher::MapParamsDispatchEntry: public LLEventDispatcher::Para
|
|||
if (defaults.isArray() || defaults.isUndefined())
|
||||
{
|
||||
// Right-align the params and defaults arrays.
|
||||
LLSD::Integer offset = params.size() - defaults.size();
|
||||
auto offset = params.size() - defaults.size();
|
||||
// Now the name of every defaults[i] is at params[i + offset].
|
||||
for (LLSD::Integer i(0), iend(defaults.size()); i < iend; ++i)
|
||||
for (size_t i(0), iend(defaults.size()); i < iend; ++i)
|
||||
{
|
||||
// Erase this optional param from mRequired.
|
||||
mRequired.erase(params[i + offset].asString());
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ LLHeteroMap::~LLHeteroMap()
|
|||
{
|
||||
// For each entry in our map, we must call its deleter, which is the only
|
||||
// record we have of its original type.
|
||||
for (TypeMap::iterator mi(mMap.begin()), me(mMap.end()); mi != me; ++mi)
|
||||
for (TypeMap::value_type& pair : mMap)
|
||||
{
|
||||
// mi->second is the std::pair; mi->second.first is the void*;
|
||||
// mi->second.second points to the deleter function
|
||||
(mi->second.second)(mi->second.first);
|
||||
mi->second.first = NULL;
|
||||
// pair.second is the std::pair; pair.second.first is the void*;
|
||||
// pair.second.second points to the deleter function
|
||||
(pair.second.second)(pair.second.first);
|
||||
pair.second.first = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,9 @@
|
|||
|
||||
void LLCallbackRegistry::fireCallbacks() const
|
||||
{
|
||||
for (FuncList::const_iterator fi = mCallbacks.begin(), fe = mCallbacks.end();
|
||||
fi != fe; ++fi)
|
||||
for (FuncList::value_type pair : mCallbacks)
|
||||
{
|
||||
LL_INFOS("LLInitDestroyClass") << "calling " << fi->first << "()" << LL_ENDL;
|
||||
fi->second();
|
||||
LL_INFOS("LLInitDestroyClass") << "calling " << pair.first << "()" << LL_ENDL;
|
||||
pair.second();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,10 +207,10 @@ namespace LLInitParam
|
|||
if (!mValidated)
|
||||
{
|
||||
const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
|
||||
for (BlockDescriptor::param_validation_list_t::const_iterator it = block_data.mValidationList.begin(); it != block_data.mValidationList.end(); ++it)
|
||||
for (const BlockDescriptor::param_validation_list_t::value_type& pair : block_data.mValidationList)
|
||||
{
|
||||
const Param* param = getParamFromHandle(it->first);
|
||||
if (!it->second(param))
|
||||
const Param* param = getParamFromHandle(pair.first);
|
||||
if (!pair.second(param))
|
||||
{
|
||||
if (emit_errors)
|
||||
{
|
||||
|
|
@ -235,13 +235,11 @@ namespace LLInitParam
|
|||
// unnamed param is like LLView::Params::rect - implicit
|
||||
const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
|
||||
|
||||
for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin();
|
||||
it != block_data.mUnnamedParams.end();
|
||||
++it)
|
||||
for (const ParamDescriptorPtr& ptr : block_data.mUnnamedParams)
|
||||
{
|
||||
param_handle_t param_handle = (*it)->mParamHandle;
|
||||
param_handle_t param_handle = ptr->mParamHandle;
|
||||
const Param* param = getParamFromHandle(param_handle);
|
||||
ParamDescriptor::serialize_func_t serialize_func = (*it)->mSerializeFunc;
|
||||
ParamDescriptor::serialize_func_t serialize_func = ptr->mSerializeFunc;
|
||||
if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided())))
|
||||
{
|
||||
const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL;
|
||||
|
|
@ -249,23 +247,19 @@ namespace LLInitParam
|
|||
}
|
||||
}
|
||||
|
||||
for(BlockDescriptor::param_map_t::const_iterator it = block_data.mNamedParams.begin();
|
||||
it != block_data.mNamedParams.end();
|
||||
++it)
|
||||
for (const BlockDescriptor::param_map_t::value_type& pair : block_data.mNamedParams)
|
||||
{
|
||||
param_handle_t param_handle = it->second->mParamHandle;
|
||||
param_handle_t param_handle = pair.second->mParamHandle;
|
||||
const Param* param = getParamFromHandle(param_handle);
|
||||
ParamDescriptor::serialize_func_t serialize_func = it->second->mSerializeFunc;
|
||||
ParamDescriptor::serialize_func_t serialize_func = pair.second->mSerializeFunc;
|
||||
if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided())))
|
||||
{
|
||||
// Ensure this param has not already been serialized
|
||||
// Prevents <rect> from being serialized as its own tag.
|
||||
bool duplicate = false;
|
||||
for (BlockDescriptor::param_list_t::const_iterator it2 = block_data.mUnnamedParams.begin();
|
||||
it2 != block_data.mUnnamedParams.end();
|
||||
++it2)
|
||||
for (const ParamDescriptorPtr& ptr : block_data.mUnnamedParams)
|
||||
{
|
||||
if (param_handle == (*it2)->mParamHandle)
|
||||
if (param_handle == ptr->mParamHandle)
|
||||
{
|
||||
duplicate = true;
|
||||
break;
|
||||
|
|
@ -279,7 +273,7 @@ namespace LLInitParam
|
|||
continue;
|
||||
}
|
||||
|
||||
name_stack.push_back(std::make_pair(it->first, !duplicate));
|
||||
name_stack.push_back(std::make_pair(pair.first, !duplicate));
|
||||
const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL;
|
||||
serialized |= serialize_func(*param, parser, name_stack, predicate_rule, diff_param);
|
||||
name_stack.pop_back();
|
||||
|
|
@ -300,45 +294,39 @@ namespace LLInitParam
|
|||
// unnamed param is like LLView::Params::rect - implicit
|
||||
const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
|
||||
|
||||
for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin();
|
||||
it != block_data.mUnnamedParams.end();
|
||||
++it)
|
||||
for (const ParamDescriptorPtr& ptr : block_data.mUnnamedParams)
|
||||
{
|
||||
param_handle_t param_handle = (*it)->mParamHandle;
|
||||
param_handle_t param_handle = ptr->mParamHandle;
|
||||
const Param* param = getParamFromHandle(param_handle);
|
||||
ParamDescriptor::inspect_func_t inspect_func = (*it)->mInspectFunc;
|
||||
ParamDescriptor::inspect_func_t inspect_func = ptr->mInspectFunc;
|
||||
if (inspect_func)
|
||||
{
|
||||
name_stack.push_back(std::make_pair("", true));
|
||||
inspect_func(*param, parser, name_stack, (*it)->mMinCount, (*it)->mMaxCount);
|
||||
inspect_func(*param, parser, name_stack, ptr->mMinCount, ptr->mMaxCount);
|
||||
name_stack.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
for(BlockDescriptor::param_map_t::const_iterator it = block_data.mNamedParams.begin();
|
||||
it != block_data.mNamedParams.end();
|
||||
++it)
|
||||
for(const BlockDescriptor::param_map_t::value_type& pair : block_data.mNamedParams)
|
||||
{
|
||||
param_handle_t param_handle = it->second->mParamHandle;
|
||||
param_handle_t param_handle = pair.second->mParamHandle;
|
||||
const Param* param = getParamFromHandle(param_handle);
|
||||
ParamDescriptor::inspect_func_t inspect_func = it->second->mInspectFunc;
|
||||
ParamDescriptor::inspect_func_t inspect_func = pair.second->mInspectFunc;
|
||||
if (inspect_func)
|
||||
{
|
||||
// Ensure this param has not already been inspected
|
||||
bool duplicate = false;
|
||||
for (BlockDescriptor::param_list_t::const_iterator it2 = block_data.mUnnamedParams.begin();
|
||||
it2 != block_data.mUnnamedParams.end();
|
||||
++it2)
|
||||
for (const ParamDescriptorPtr &ptr : block_data.mUnnamedParams)
|
||||
{
|
||||
if (param_handle == (*it2)->mParamHandle)
|
||||
if (param_handle == ptr->mParamHandle)
|
||||
{
|
||||
duplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
name_stack.push_back(std::make_pair(it->first, !duplicate));
|
||||
inspect_func(*param, parser, name_stack, it->second->mMinCount, it->second->mMaxCount);
|
||||
name_stack.push_back(std::make_pair(pair.first, !duplicate));
|
||||
inspect_func(*param, parser, name_stack, pair.second->mMinCount, pair.second->mMaxCount);
|
||||
name_stack.pop_back();
|
||||
}
|
||||
}
|
||||
|
|
@ -382,12 +370,10 @@ namespace LLInitParam
|
|||
}
|
||||
|
||||
// try to parse unnamed parameters, in declaration order
|
||||
for ( BlockDescriptor::param_list_t::iterator it = block_data.mUnnamedParams.begin();
|
||||
it != block_data.mUnnamedParams.end();
|
||||
++it)
|
||||
for (ParamDescriptorPtr& ptr : block_data.mUnnamedParams)
|
||||
{
|
||||
Param* paramp = getParamFromHandle((*it)->mParamHandle);
|
||||
ParamDescriptor::deserialize_func_t deserialize_func = (*it)->mDeserializeFunc;
|
||||
Param* paramp = getParamFromHandle(ptr->mParamHandle);
|
||||
ParamDescriptor::deserialize_func_t deserialize_func = ptr->mDeserializeFunc;
|
||||
|
||||
if (deserialize_func && deserialize_func(*paramp, p, name_stack_range, new_name))
|
||||
{
|
||||
|
|
@ -453,12 +439,9 @@ namespace LLInitParam
|
|||
{
|
||||
param_handle_t handle = getHandleFromParam(¶m);
|
||||
BlockDescriptor& descriptor = mostDerivedBlockDescriptor();
|
||||
BlockDescriptor::all_params_list_t::iterator end_it = descriptor.mAllParams.end();
|
||||
for (BlockDescriptor::all_params_list_t::iterator it = descriptor.mAllParams.begin();
|
||||
it != end_it;
|
||||
++it)
|
||||
for (ParamDescriptorPtr& ptr : descriptor.mAllParams)
|
||||
{
|
||||
if ((*it)->mParamHandle == handle) return *it;
|
||||
if (ptr->mParamHandle == handle) return ptr;
|
||||
}
|
||||
return ParamDescriptorPtr();
|
||||
}
|
||||
|
|
@ -468,17 +451,14 @@ namespace LLInitParam
|
|||
bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite)
|
||||
{
|
||||
bool some_param_changed = false;
|
||||
BlockDescriptor::all_params_list_t::const_iterator end_it = block_data.mAllParams.end();
|
||||
for (BlockDescriptor::all_params_list_t::const_iterator it = block_data.mAllParams.begin();
|
||||
it != end_it;
|
||||
++it)
|
||||
for (const ParamDescriptorPtr& ptr : block_data.mAllParams)
|
||||
{
|
||||
const Param* other_paramp = other.getParamFromHandle((*it)->mParamHandle);
|
||||
ParamDescriptor::merge_func_t merge_func = (*it)->mMergeFunc;
|
||||
const Param* other_paramp = other.getParamFromHandle(ptr->mParamHandle);
|
||||
ParamDescriptor::merge_func_t merge_func = ptr->mMergeFunc;
|
||||
if (merge_func)
|
||||
{
|
||||
Param* paramp = getParamFromHandle((*it)->mParamHandle);
|
||||
llassert(paramp->getEnclosingBlockOffset() == (*it)->mParamHandle);
|
||||
Param* paramp = getParamFromHandle(ptr->mParamHandle);
|
||||
llassert(paramp->getEnclosingBlockOffset() == ptr->mParamHandle);
|
||||
some_param_changed |= merge_func(*paramp, *other_paramp, overwrite);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -325,13 +325,11 @@ namespace LLInitParam
|
|||
std::string calcValueName(const value_t& value) const
|
||||
{
|
||||
value_name_map_t* map = getValueNames();
|
||||
for (typename value_name_map_t::iterator it = map->begin(), end_it = map->end();
|
||||
it != end_it;
|
||||
++it)
|
||||
for (typename value_name_map_t::value_type& map_pair : *map)
|
||||
{
|
||||
if (ParamCompare<T>::equals(it->second, value))
|
||||
if (ParamCompare<T>::equals(map_pair.second, value))
|
||||
{
|
||||
return it->first;
|
||||
return map_pair.first;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -376,11 +374,9 @@ namespace LLInitParam
|
|||
static std::vector<std::string> sValues;
|
||||
|
||||
value_name_map_t* map = getValueNames();
|
||||
for (typename value_name_map_t::iterator it = map->begin(), end_it = map->end();
|
||||
it != end_it;
|
||||
++it)
|
||||
for (typename value_name_map_t::value_type& map_pair : *map)
|
||||
{
|
||||
sValues.push_back(it->first);
|
||||
sValues.push_back(map_pair.first);
|
||||
}
|
||||
return &sValues;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public:
|
|||
return mSelf;
|
||||
}
|
||||
|
||||
static S32 instanceCount()
|
||||
static size_t instanceCount()
|
||||
{
|
||||
return LockStatic()->mMap.size();
|
||||
}
|
||||
|
|
@ -363,7 +363,7 @@ public:
|
|||
return mSelf;
|
||||
}
|
||||
|
||||
static S32 instanceCount()
|
||||
static size_t instanceCount()
|
||||
{
|
||||
return LockStatic()->mSet.size();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "llsd.h"
|
||||
#include "llsdutil.h"
|
||||
#include <algorithm>
|
||||
|
||||
LLKeyData::LLKeyData()
|
||||
:
|
||||
|
|
@ -180,10 +181,10 @@ LLKeyBind::LLKeyBind(const LLSD &key_bind)
|
|||
|
||||
bool LLKeyBind::operator==(const LLKeyBind& rhs)
|
||||
{
|
||||
U32 size = mData.size();
|
||||
auto size = mData.size();
|
||||
if (size != rhs.mData.size()) return false;
|
||||
|
||||
for (U32 i = 0; i < size; i++)
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
if (mData[i] != rhs.mData[i]) return false;
|
||||
}
|
||||
|
|
@ -193,7 +194,7 @@ bool LLKeyBind::operator==(const LLKeyBind& rhs)
|
|||
|
||||
bool LLKeyBind::operator!=(const LLKeyBind& rhs)
|
||||
{
|
||||
U32 size = mData.size();
|
||||
auto size = mData.size();
|
||||
if (size != rhs.mData.size()) return true;
|
||||
|
||||
for (U32 i = 0; i < size; i++)
|
||||
|
|
@ -206,26 +207,29 @@ bool LLKeyBind::operator!=(const LLKeyBind& rhs)
|
|||
|
||||
bool LLKeyBind::isEmpty() const
|
||||
{
|
||||
for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++)
|
||||
for (const LLKeyData& key_data : mData)
|
||||
{
|
||||
if (!iter->isEmpty()) return false;
|
||||
if (!key_data.isEmpty()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
LLKeyBind::data_vector_t::const_iterator LLKeyBind::endNonEmpty() const
|
||||
{
|
||||
// search backwards for last non-empty entry, then turn back into forwards
|
||||
// iterator (.base() call)
|
||||
return std::find_if_not(mData.rbegin(), mData.rend(),
|
||||
[](const auto& kdata){ return kdata.empty(); }).base();
|
||||
}
|
||||
|
||||
LLSD LLKeyBind::asLLSD() const
|
||||
{
|
||||
S32 last = mData.size() - 1;
|
||||
while (mData[last].empty())
|
||||
{
|
||||
last--;
|
||||
}
|
||||
|
||||
LLSD data;
|
||||
for (S32 i = 0; i <= last; ++i)
|
||||
for (const LLKeyData& key_data : mData)
|
||||
{
|
||||
// append even if empty to not affect visual representation
|
||||
data.append(mData[i].asLLSD());
|
||||
// append intermediate entries even if empty to not affect visual
|
||||
// representation
|
||||
data.append(key_data.asLLSD());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
|
@ -238,9 +242,9 @@ bool LLKeyBind::canHandle(EMouseClickType mouse, KEY key, MASK mask) const
|
|||
return false;
|
||||
}
|
||||
|
||||
for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++)
|
||||
for (const LLKeyData& key_data : mData)
|
||||
{
|
||||
if (iter->canHandle(mouse, key, mask))
|
||||
if (key_data.canHandle(mouse, key, mask))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -262,12 +266,12 @@ bool LLKeyBind::hasKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignor
|
|||
{
|
||||
if (mouse != CLICK_NONE || key != KEY_NONE)
|
||||
{
|
||||
for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++)
|
||||
for (const LLKeyData& key_data : mData)
|
||||
{
|
||||
if (iter->mKey == key
|
||||
&& iter->mMask == mask
|
||||
&& iter->mMouse == mouse
|
||||
&& iter->mIgnoreMasks == ignore)
|
||||
if (key_data.mKey == key
|
||||
&& key_data.mMask == mask
|
||||
&& key_data.mMouse == mouse
|
||||
&& key_data.mIgnoreMasks == ignore)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -349,16 +353,16 @@ void LLKeyBind::replaceKeyData(const LLKeyData& data, U32 index)
|
|||
{
|
||||
// if both click and key are none (isEmpty()), we are inserting a placeholder, we don't want to reset anything
|
||||
// otherwise reset identical key
|
||||
for (data_vector_t::iterator iter = mData.begin(); iter != mData.end(); iter++)
|
||||
for (LLKeyData& key_data : mData)
|
||||
{
|
||||
if (iter->mKey == data.mKey
|
||||
&& iter->mMouse == data.mMouse
|
||||
&& iter->mIgnoreMasks == data.mIgnoreMasks
|
||||
&& iter->mMask == data.mMask)
|
||||
if (key_data.mKey == data.mKey
|
||||
&& key_data.mMouse == data.mMouse
|
||||
&& key_data.mIgnoreMasks == data.mIgnoreMasks
|
||||
&& key_data.mMask == data.mMask)
|
||||
{
|
||||
// Replacing only fully equal combinations even in case 'ignore' is set
|
||||
// Reason: Simplicity and user might decide to do a 'move' command as W and Shift+Ctrl+W, and 'run' as Shift+W
|
||||
iter->reset();
|
||||
key_data.reset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -380,16 +384,10 @@ void LLKeyBind::resetKeyData(S32 index)
|
|||
|
||||
void LLKeyBind::trimEmpty()
|
||||
{
|
||||
S32 last = mData.size() - 1;
|
||||
while (last >= 0 && mData[last].empty())
|
||||
{
|
||||
mData.erase(mData.begin() + last);
|
||||
last--;
|
||||
}
|
||||
mData.erase(endNonEmpty(), mData.end());
|
||||
}
|
||||
|
||||
U32 LLKeyBind::getDataCount()
|
||||
size_t LLKeyBind::getDataCount()
|
||||
{
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,11 +95,13 @@ public:
|
|||
void clear() { mData.clear(); }
|
||||
// if there any empty LLKeyData in the end of the array, remove them
|
||||
void trimEmpty();
|
||||
U32 getDataCount();
|
||||
size_t getDataCount();
|
||||
|
||||
private:
|
||||
typedef std::vector<LLKeyData> data_vector_t;
|
||||
data_vector_t mData;
|
||||
|
||||
data_vector_t::const_iterator endNonEmpty() const;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -231,7 +231,8 @@ public:
|
|||
}
|
||||
|*==========================================================================*/
|
||||
|
||||
LL_DEBUGS("EventHost") << "Sending: " << buffer.tellp() << ':';
|
||||
LL_DEBUGS("EventHost") << "Sending: "
|
||||
<< static_cast<U64>(buffer.tellp()) << ':';
|
||||
std::string::size_type truncate(80);
|
||||
if (buffer.tellp() <= truncate)
|
||||
{
|
||||
|
|
@ -244,7 +245,8 @@ public:
|
|||
LL_CONT << LL_ENDL;
|
||||
|
||||
LLProcess::WritePipe& childin(mChild->getWritePipe(LLProcess::STDIN));
|
||||
childin.get_ostream() << buffer.tellp() << ':' << buffer.str() << std::flush;
|
||||
childin.get_ostream() << static_cast<U64>(buffer.tellp())
|
||||
<< ':' << buffer.str() << std::flush;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,10 +96,10 @@ LLMD5::LLMD5()
|
|||
// operation, processing another message block, and updating the
|
||||
// context.
|
||||
|
||||
void LLMD5::update (const uint1 *input, const uint4 input_length) {
|
||||
void LLMD5::update (const uint1 *input, const size_t input_length) {
|
||||
|
||||
uint4 input_index, buffer_index;
|
||||
uint4 buffer_space; // how much space is left in buffer
|
||||
size_t input_index, buffer_index;
|
||||
size_t buffer_space; // how much space is left in buffer
|
||||
|
||||
if (finalized){ // so we can't update!
|
||||
std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl;
|
||||
|
|
@ -107,14 +107,10 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
|
|||
}
|
||||
|
||||
// Compute number of bytes mod 64
|
||||
buffer_index = (unsigned int)((count[0] >> 3) & 0x3F);
|
||||
buffer_index = size_t((count >> 3) & 0x3F);
|
||||
|
||||
// Update number of bits
|
||||
if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) )
|
||||
count[1]++;
|
||||
|
||||
count[1] += ((uint4)input_length >> 29);
|
||||
|
||||
count += input_length << 3;
|
||||
|
||||
buffer_space = 64 - buffer_index; // how much space is left in buffer
|
||||
|
||||
|
|
@ -192,7 +188,7 @@ void LLMD5::update(const std::string& s)
|
|||
void LLMD5::finalize (){
|
||||
|
||||
unsigned char bits[8]; /* Flawfinder: ignore */
|
||||
unsigned int index, padLen;
|
||||
size_t index, padLen;
|
||||
static uint1 PADDING[64]={
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
|
@ -204,11 +200,12 @@ void LLMD5::finalize (){
|
|||
return;
|
||||
}
|
||||
|
||||
// Save number of bits
|
||||
encode (bits, count, 8);
|
||||
// Save number of bits.
|
||||
// Treat count, a uint64_t, as uint4[2].
|
||||
encode (bits, reinterpret_cast<uint4*>(&count), 8);
|
||||
|
||||
// Pad out to 56 mod 64.
|
||||
index = (uint4) ((count[0] >> 3) & 0x3f);
|
||||
index = size_t((count >> 3) & 0x3f);
|
||||
padLen = (index < 56) ? (56 - index) : (120 - index);
|
||||
update (PADDING, padLen);
|
||||
|
||||
|
|
@ -340,8 +337,7 @@ void LLMD5::init(){
|
|||
finalized=0; // we just started!
|
||||
|
||||
// Nothing counted, so count=0
|
||||
count[0] = 0;
|
||||
count[1] = 0;
|
||||
count = 0;
|
||||
|
||||
// Load magic initialization constants.
|
||||
state[0] = 0x67452301;
|
||||
|
|
@ -508,9 +504,9 @@ void LLMD5::transform (const U8 block[64]){
|
|||
|
||||
// Encodes input (UINT4) into output (unsigned char). Assumes len is
|
||||
// a multiple of 4.
|
||||
void LLMD5::encode (uint1 *output, const uint4 *input, const uint4 len) {
|
||||
void LLMD5::encode (uint1 *output, const uint4 *input, const size_t len) {
|
||||
|
||||
unsigned int i, j;
|
||||
size_t i, j;
|
||||
|
||||
for (i = 0, j = 0; j < len; i++, j += 4) {
|
||||
output[j] = (uint1) (input[i] & 0xff);
|
||||
|
|
@ -525,9 +521,9 @@ void LLMD5::encode (uint1 *output, const uint4 *input, const uint4 len) {
|
|||
|
||||
// Decodes input (unsigned char) into output (UINT4). Assumes len is
|
||||
// a multiple of 4.
|
||||
void LLMD5::decode (uint4 *output, const uint1 *input, const uint4 len){
|
||||
void LLMD5::decode (uint4 *output, const uint1 *input, const size_t len){
|
||||
|
||||
unsigned int i, j;
|
||||
size_t i, j;
|
||||
|
||||
for (i = 0, j = 0; j < len; i++, j += 4)
|
||||
output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) |
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class LL_COMMON_API LLMD5 {
|
|||
public:
|
||||
// methods for controlled operation:
|
||||
LLMD5 (); // simple initializer
|
||||
void update (const uint1 *input, const uint4 input_length);
|
||||
void update (const uint1 *input, const size_t input_length);
|
||||
void update (std::istream& stream);
|
||||
void update (FILE *file);
|
||||
void update (const std::string& str);
|
||||
|
|
@ -110,7 +110,7 @@ private:
|
|||
|
||||
// next, the private data:
|
||||
uint4 state[4];
|
||||
uint4 count[2]; // number of *bits*, mod 2^64
|
||||
uint64_t count; // number of *bits*, mod 2^64
|
||||
uint1 buffer[64]; // input buffer
|
||||
uint1 digest[16];
|
||||
uint1 finalized;
|
||||
|
|
@ -120,8 +120,8 @@ private:
|
|||
void transform (const uint1 *buffer); // does the real update work. Note
|
||||
// that length is implied to be 64.
|
||||
|
||||
static void encode (uint1 *dest, const uint4 *src, const uint4 length);
|
||||
static void decode (uint4 *dest, const uint1 *src, const uint4 length);
|
||||
static void encode (uint1 *dest, const uint4 *src, const size_t length);
|
||||
static void decode (uint4 *dest, const uint1 *src, const size_t length);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -212,11 +212,9 @@ U64 LLMemory::getCurrentRSS()
|
|||
mach_msg_type_number_t basicInfoCount = MACH_TASK_BASIC_INFO_COUNT;
|
||||
if (task_info(mach_task_self(), MACH_TASK_BASIC_INFO, (task_info_t)&basicInfo, &basicInfoCount) == KERN_SUCCESS)
|
||||
{
|
||||
// residentSize = basicInfo.resident_size;
|
||||
// Although this method is defined to return the "resident set size,"
|
||||
// in fact what callers want from it is the total virtual memory
|
||||
// consumed by the application.
|
||||
residentSize = basicInfo.virtual_size;
|
||||
residentSize = basicInfo.resident_size;
|
||||
// 64-bit macos apps allocate 32 GB or more at startup, and this is reflected in virtual_size.
|
||||
// basicInfo.virtual_size is not what we want.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ LLMetricPerformanceTesterBasic::name_tester_map_t LLMetricPerformanceTesterBasic
|
|||
/*static*/
|
||||
void LLMetricPerformanceTesterBasic::cleanupClass()
|
||||
{
|
||||
for (name_tester_map_t::iterator iter = sTesterMap.begin() ; iter != sTesterMap.end() ; ++iter)
|
||||
for (name_tester_map_t::value_type& pair : sTesterMap)
|
||||
{
|
||||
delete iter->second ;
|
||||
delete pair.second;
|
||||
}
|
||||
sTesterMap.clear() ;
|
||||
}
|
||||
|
|
@ -111,8 +111,8 @@ LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& i
|
|||
{
|
||||
ret[label]["Name"] = iter->second["Name"] ;
|
||||
|
||||
S32 num_of_metrics = tester->getNumberOfMetrics() ;
|
||||
for(S32 index = 0 ; index < num_of_metrics ; index++)
|
||||
auto num_of_metrics = tester->getNumberOfMetrics() ;
|
||||
for(size_t index = 0 ; index < num_of_metrics ; index++)
|
||||
{
|
||||
ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ;
|
||||
}
|
||||
|
|
@ -154,10 +154,9 @@ void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std
|
|||
llofstream os(output.c_str());
|
||||
|
||||
os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n";
|
||||
for(LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin() ;
|
||||
iter != LLMetricPerformanceTesterBasic::sTesterMap.end() ; ++iter)
|
||||
for (LLMetricPerformanceTesterBasic::name_tester_map_t::value_type& pair : LLMetricPerformanceTesterBasic::sTesterMap)
|
||||
{
|
||||
LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second) ;
|
||||
LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)pair.second);
|
||||
tester->analyzePerformance(&os, &base, ¤t) ;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,12 +67,12 @@ public:
|
|||
/**
|
||||
* @return Returns the number of the test metrics in this tester instance.
|
||||
*/
|
||||
S32 getNumberOfMetrics() const { return mMetricStrings.size() ;}
|
||||
auto getNumberOfMetrics() const { return mMetricStrings.size() ;}
|
||||
/**
|
||||
* @return Returns the metric name at index
|
||||
* @param[in] index - Index on the list of metrics managed by this tester instance.
|
||||
*/
|
||||
std::string getMetricName(S32 index) const { return mMetricStrings[index] ;}
|
||||
std::string getMetricName(size_t index) const { return mMetricStrings[index] ;}
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ LLMortician::~LLMortician()
|
|||
sGraveyard.remove(this);
|
||||
}
|
||||
|
||||
U32 LLMortician::logClass(std::stringstream &str)
|
||||
size_t LLMortician::logClass(std::stringstream &str)
|
||||
{
|
||||
U32 size = sGraveyard.size();
|
||||
auto size = sGraveyard.size();
|
||||
str << "Mortician graveyard count: " << size;
|
||||
str << " Zealous: " << (sDestroyImmediate ? "True" : "False");
|
||||
if (size == 0)
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ class LL_COMMON_API LLMortician
|
|||
{
|
||||
public:
|
||||
LLMortician() { mIsDead = FALSE; }
|
||||
static U32 graveyardCount() { return sGraveyard.size(); };
|
||||
static U32 logClass(std::stringstream &str);
|
||||
static auto graveyardCount() { return sGraveyard.size(); };
|
||||
static size_t logClass(std::stringstream &str);
|
||||
static void updateClass();
|
||||
virtual ~LLMortician();
|
||||
void die();
|
||||
|
|
|
|||
|
|
@ -86,12 +86,10 @@ public:
|
|||
// O(N)! (currently only used in one place... (newsim/llstate.cpp))
|
||||
const char *resolveData(const DATA &data) const
|
||||
{
|
||||
const_iter_t iter = mNameMap.begin();
|
||||
const_iter_t end = mNameMap.end();
|
||||
for (; iter != end; ++iter)
|
||||
for (const name_map_t::value_type& pair : mNameMap)
|
||||
{
|
||||
if (iter->second == data)
|
||||
return iter->first;
|
||||
if (pair.second == data)
|
||||
return pair.first;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,9 +115,9 @@ public:
|
|||
LL_WARNS() << "Data not on priority queue!" << LL_ENDL;
|
||||
// OK, try iterating through all of the data and seeing if we just screwed up the priority
|
||||
// somehow.
|
||||
for (iter = mMap.begin(); iter != mMap.end(); iter++)
|
||||
for (pqm_pair pair : mMap)
|
||||
{
|
||||
if ((*(iter)).second == data)
|
||||
if (pair.second == data)
|
||||
{
|
||||
LL_ERRS() << "Data on priority queue but priority not matched!" << LL_ENDL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,6 +272,14 @@ public:
|
|||
boost::bind(&ReadPipeImpl::tick, this, _1));
|
||||
}
|
||||
|
||||
~ReadPipeImpl()
|
||||
{
|
||||
if (mConnection.connected())
|
||||
{
|
||||
mConnection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
// Much of the implementation is simply connecting the abstract virtual
|
||||
// methods with implementation data concealed from the base class.
|
||||
virtual std::istream& get_istream() { return mStream; }
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void LLQueuedThread::shutdown()
|
|||
|
||||
// MAIN THREAD
|
||||
// virtual
|
||||
S32 LLQueuedThread::update(F32 max_time_ms)
|
||||
size_t LLQueuedThread::update(F32 max_time_ms)
|
||||
{
|
||||
if (!mStarted)
|
||||
{
|
||||
|
|
@ -123,11 +123,11 @@ S32 LLQueuedThread::update(F32 max_time_ms)
|
|||
return updateQueue(max_time_ms);
|
||||
}
|
||||
|
||||
S32 LLQueuedThread::updateQueue(F32 max_time_ms)
|
||||
size_t LLQueuedThread::updateQueue(F32 max_time_ms)
|
||||
{
|
||||
F64 max_time = (F64)max_time_ms * .001;
|
||||
LLTimer timer;
|
||||
S32 pending = 1;
|
||||
size_t pending = 1;
|
||||
|
||||
// Frame Update
|
||||
if (mThreaded)
|
||||
|
|
@ -164,9 +164,9 @@ void LLQueuedThread::incQueue()
|
|||
|
||||
//virtual
|
||||
// May be called from any thread
|
||||
S32 LLQueuedThread::getPending()
|
||||
size_t LLQueuedThread::getPending()
|
||||
{
|
||||
S32 res;
|
||||
size_t res;
|
||||
lockData();
|
||||
res = mRequestQueue.size();
|
||||
unlockData();
|
||||
|
|
@ -399,7 +399,7 @@ bool LLQueuedThread::check()
|
|||
//============================================================================
|
||||
// Runs on its OWN thread
|
||||
|
||||
S32 LLQueuedThread::processNextRequest()
|
||||
size_t LLQueuedThread::processNextRequest()
|
||||
{
|
||||
QueuedRequest *req;
|
||||
// Get next request from pool
|
||||
|
|
@ -473,8 +473,7 @@ S32 LLQueuedThread::processNextRequest()
|
|||
LLTrace::get_thread_recorder()->pushToParent();
|
||||
}
|
||||
|
||||
S32 pending = getPending();
|
||||
return pending;
|
||||
return getPending();
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
|
@ -511,7 +510,7 @@ void LLQueuedThread::run()
|
|||
|
||||
threadedUpdate();
|
||||
|
||||
int pending_work = processNextRequest();
|
||||
auto pending_work = processNextRequest();
|
||||
|
||||
if (pending_work == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -167,19 +167,19 @@ private:
|
|||
protected:
|
||||
handle_t generateHandle();
|
||||
bool addRequest(QueuedRequest* req);
|
||||
S32 processNextRequest(void);
|
||||
size_t processNextRequest(void);
|
||||
void incQueue();
|
||||
|
||||
public:
|
||||
bool waitForResult(handle_t handle, bool auto_complete = true);
|
||||
|
||||
virtual S32 update(F32 max_time_ms);
|
||||
S32 updateQueue(F32 max_time_ms);
|
||||
|
||||
virtual size_t update(F32 max_time_ms);
|
||||
size_t updateQueue(F32 max_time_ms);
|
||||
|
||||
void waitOnPending();
|
||||
void printQueueStats();
|
||||
|
||||
virtual S32 getPending();
|
||||
virtual size_t getPending();
|
||||
bool getThreaded() { return mThreaded ? true : false; }
|
||||
|
||||
// Request accessors
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include "llerror.h"
|
||||
|
||||
// maximum reference count before sounding memory leak alarm
|
||||
const S32 gMaxRefCount = 65536;
|
||||
const S32 gMaxRefCount = S32_MAX;
|
||||
|
||||
LLRefCount::LLRefCount(const LLRefCount& other)
|
||||
: mRef(0)
|
||||
|
|
|
|||
|
|
@ -141,11 +141,9 @@ public:
|
|||
|
||||
ptr_value_t getValue(ref_const_key_t key)
|
||||
{
|
||||
for(scope_list_iterator_t it = mActiveScopes.begin();
|
||||
it != mActiveScopes.end();
|
||||
++it)
|
||||
for(Registrar* scope : mActiveScopes)
|
||||
{
|
||||
ptr_value_t valuep = (*it)->getValue(key);
|
||||
ptr_value_t valuep = scope->getValue(key);
|
||||
if (valuep != NULL) return valuep;
|
||||
}
|
||||
return mDefaultRegistrar.getValue(key);
|
||||
|
|
@ -153,11 +151,9 @@ public:
|
|||
|
||||
ptr_const_value_t getValue(ref_const_key_t key) const
|
||||
{
|
||||
for(scope_list_const_iterator_t it = mActiveScopes.begin();
|
||||
it != mActiveScopes.end();
|
||||
++it)
|
||||
for(const Registrar* scope : mActiveScopes)
|
||||
{
|
||||
ptr_value_t valuep = (*it)->getValue(key);
|
||||
ptr_const_value_t valuep = scope->getValue(key);
|
||||
if (valuep != NULL) return valuep;
|
||||
}
|
||||
return mDefaultRegistrar.getValue(key);
|
||||
|
|
@ -165,11 +161,9 @@ public:
|
|||
|
||||
bool exists(ref_const_key_t key) const
|
||||
{
|
||||
for(scope_list_const_iterator_t it = mActiveScopes.begin();
|
||||
it != mActiveScopes.end();
|
||||
++it)
|
||||
for(const Registrar* scope : mActiveScopes)
|
||||
{
|
||||
if ((*it)->exists(key)) return true;
|
||||
if (scope->exists(key)) return true;
|
||||
}
|
||||
|
||||
return mDefaultRegistrar.exists(key);
|
||||
|
|
@ -177,11 +171,9 @@ public:
|
|||
|
||||
bool empty() const
|
||||
{
|
||||
for(scope_list_const_iterator_t it = mActiveScopes.begin();
|
||||
it != mActiveScopes.end();
|
||||
++it)
|
||||
for(const Registrar* scope : mActiveScopes)
|
||||
{
|
||||
if (!(*it)->empty()) return false;
|
||||
if (!scope->empty()) return false;
|
||||
}
|
||||
|
||||
return mDefaultRegistrar.empty();
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ LLRunner::~LLRunner()
|
|||
mRunEvery.clear();
|
||||
}
|
||||
|
||||
S32 LLRunner::run()
|
||||
size_t LLRunner::run()
|
||||
{
|
||||
// We collect all of the runnables which should be run. Since the
|
||||
// runnables are allowed to adjust the run list, we need to copy
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public:
|
|||
*
|
||||
* @return Returns the number of runnables run.
|
||||
*/
|
||||
S32 run();
|
||||
size_t run();
|
||||
|
||||
/**
|
||||
* @brief Add a runnable to the run list.
|
||||
|
|
|
|||
|
|
@ -36,6 +36,18 @@
|
|||
#include "llsdserialize.h"
|
||||
#include "stringize.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
// Defend against a caller forcibly passing a negative number into an unsigned
|
||||
// size_t index param
|
||||
inline
|
||||
bool was_negative(size_t i)
|
||||
{
|
||||
return (i > std::numeric_limits<int>::max());
|
||||
}
|
||||
#define NEGATIVE_EXIT(i) if (was_negative(i)) return
|
||||
#define NEGATIVE_RETURN(i, result) NEGATIVE_EXIT(i) (result)
|
||||
|
||||
#ifndef LL_RELEASE_FOR_DOWNLOAD
|
||||
#define NAME_UNNAMED_NAMESPACE
|
||||
#endif
|
||||
|
|
@ -136,10 +148,10 @@ public:
|
|||
virtual void erase(const String&) { }
|
||||
virtual const LLSD& ref(const String&) const{ return undef(); }
|
||||
|
||||
virtual int size() const { return 0; }
|
||||
virtual LLSD get(Integer) const { return LLSD(); }
|
||||
virtual void erase(Integer) { }
|
||||
virtual const LLSD& ref(Integer) const { return undef(); }
|
||||
virtual size_t size() const { return 0; }
|
||||
virtual LLSD get(size_t) const { return LLSD(); }
|
||||
virtual void erase(size_t) { }
|
||||
virtual const LLSD& ref(size_t) const { return undef(); }
|
||||
|
||||
virtual LLSD::map_const_iterator beginMap() const { return endMap(); }
|
||||
virtual LLSD::map_const_iterator endMap() const { static const std::map<String, LLSD> empty; return empty.end(); }
|
||||
|
|
@ -272,7 +284,7 @@ namespace
|
|||
virtual LLSD::UUID asUUID() const { return LLUUID(mValue); }
|
||||
virtual LLSD::Date asDate() const { return LLDate(mValue); }
|
||||
virtual LLSD::URI asURI() const { return LLURI(mValue); }
|
||||
virtual int size() const { return mValue.size(); }
|
||||
virtual size_t size() const { return mValue.size(); }
|
||||
virtual const LLSD::String& asStringRef() const { return mValue; }
|
||||
};
|
||||
|
||||
|
|
@ -377,9 +389,9 @@ namespace
|
|||
|
||||
virtual bool has(const LLSD::String&) const;
|
||||
|
||||
using LLSD::Impl::get; // Unhiding get(LLSD::Integer)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
|
||||
using LLSD::Impl::get; // Unhiding get(size_t)
|
||||
using LLSD::Impl::erase; // Unhiding erase(size_t)
|
||||
using LLSD::Impl::ref; // Unhiding ref(size_t)
|
||||
virtual LLSD get(const LLSD::String&) const;
|
||||
virtual LLSD getKeys() const;
|
||||
void insert(const LLSD::String& k, const LLSD& v);
|
||||
|
|
@ -387,7 +399,7 @@ namespace
|
|||
LLSD& ref(const LLSD::String&);
|
||||
virtual const LLSD& ref(const LLSD::String&) const;
|
||||
|
||||
virtual int size() const { return mData.size(); }
|
||||
virtual size_t size() const { return mData.size(); }
|
||||
|
||||
LLSD::map_iterator beginMap() { return mData.begin(); }
|
||||
LLSD::map_iterator endMap() { return mData.end(); }
|
||||
|
|
@ -518,14 +530,14 @@ namespace
|
|||
using LLSD::Impl::get; // Unhiding get(LLSD::String)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::String)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::String)
|
||||
virtual int size() const;
|
||||
virtual LLSD get(LLSD::Integer) const;
|
||||
void set(LLSD::Integer, const LLSD&);
|
||||
void insert(LLSD::Integer, const LLSD&);
|
||||
virtual size_t size() const;
|
||||
virtual LLSD get(size_t) const;
|
||||
void set(size_t, const LLSD&);
|
||||
void insert(size_t, const LLSD&);
|
||||
LLSD& append(const LLSD&);
|
||||
virtual void erase(LLSD::Integer);
|
||||
LLSD& ref(LLSD::Integer);
|
||||
virtual const LLSD& ref(LLSD::Integer) const;
|
||||
virtual void erase(size_t);
|
||||
LLSD& ref(size_t);
|
||||
virtual const LLSD& ref(size_t) const;
|
||||
|
||||
LLSD::array_iterator beginArray() { return mData.begin(); }
|
||||
LLSD::array_iterator endArray() { return mData.end(); }
|
||||
|
|
@ -550,85 +562,82 @@ namespace
|
|||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
int ImplArray::size() const { return mData.size(); }
|
||||
|
||||
LLSD ImplArray::get(LLSD::Integer i) const
|
||||
|
||||
size_t ImplArray::size() const { return mData.size(); }
|
||||
|
||||
LLSD ImplArray::get(size_t i) const
|
||||
{
|
||||
if (i < 0) { return LLSD(); }
|
||||
NEGATIVE_RETURN(i, LLSD());
|
||||
DataVector::size_type index = i;
|
||||
|
||||
|
||||
return (index < mData.size()) ? mData[index] : LLSD();
|
||||
}
|
||||
|
||||
void ImplArray::set(LLSD::Integer i, const LLSD& v)
|
||||
|
||||
void ImplArray::set(size_t i, const LLSD& v)
|
||||
{
|
||||
if (i < 0) { return; }
|
||||
NEGATIVE_EXIT(i);
|
||||
DataVector::size_type index = i;
|
||||
|
||||
|
||||
if (index >= mData.size())
|
||||
{
|
||||
mData.resize(index + 1);
|
||||
}
|
||||
|
||||
|
||||
mData[index] = v;
|
||||
}
|
||||
|
||||
void ImplArray::insert(LLSD::Integer i, const LLSD& v)
|
||||
|
||||
void ImplArray::insert(size_t i, const LLSD& v)
|
||||
{
|
||||
if (i < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
NEGATIVE_EXIT(i);
|
||||
DataVector::size_type index = i;
|
||||
|
||||
|
||||
if (index >= mData.size()) // tbd - sanity check limit for index ?
|
||||
{
|
||||
mData.resize(index + 1);
|
||||
}
|
||||
|
||||
|
||||
mData.insert(mData.begin() + index, v);
|
||||
}
|
||||
|
||||
|
||||
LLSD& ImplArray::append(const LLSD& v)
|
||||
{
|
||||
mData.push_back(v);
|
||||
return mData.back();
|
||||
}
|
||||
|
||||
void ImplArray::erase(LLSD::Integer i)
|
||||
|
||||
void ImplArray::erase(size_t i)
|
||||
{
|
||||
if (i < 0) { return; }
|
||||
NEGATIVE_EXIT(i);
|
||||
DataVector::size_type index = i;
|
||||
|
||||
|
||||
if (index < mData.size())
|
||||
{
|
||||
mData.erase(mData.begin() + index);
|
||||
}
|
||||
}
|
||||
|
||||
LLSD& ImplArray::ref(LLSD::Integer i)
|
||||
|
||||
LLSD& ImplArray::ref(size_t i)
|
||||
{
|
||||
DataVector::size_type index = i >= 0 ? i : 0;
|
||||
|
||||
DataVector::size_type index = was_negative(i)? 0 : i;
|
||||
|
||||
if (index >= mData.size())
|
||||
{
|
||||
mData.resize(i + 1);
|
||||
mData.resize(index + 1);
|
||||
}
|
||||
|
||||
|
||||
return mData[index];
|
||||
}
|
||||
|
||||
const LLSD& ImplArray::ref(LLSD::Integer i) const
|
||||
const LLSD& ImplArray::ref(size_t i) const
|
||||
{
|
||||
if (i < 0) { return undef(); }
|
||||
NEGATIVE_RETURN(i, undef());
|
||||
DataVector::size_type index = i;
|
||||
|
||||
|
||||
if (index >= mData.size())
|
||||
{
|
||||
return undef();
|
||||
}
|
||||
|
||||
|
||||
return mData[index];
|
||||
}
|
||||
|
||||
|
|
@ -841,9 +850,6 @@ LLSD::LLSD(const Date& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
|
|||
LLSD::LLSD(const URI& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
|
||||
LLSD::LLSD(const Binary& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
|
||||
|
||||
// Convenience Constructors
|
||||
LLSD::LLSD(F32 v) : impl(0) { ALLOC_LLSD_OBJECT; assign((Real)v); }
|
||||
|
||||
// Scalar Assignment
|
||||
void LLSD::assign(Boolean v) { safe(impl).assign(impl, v); }
|
||||
void LLSD::assign(Integer v) { safe(impl).assign(impl, v); }
|
||||
|
|
@ -912,7 +918,7 @@ LLSD LLSD::emptyArray()
|
|||
return v;
|
||||
}
|
||||
|
||||
int LLSD::size() const { return safe(impl).size(); }
|
||||
size_t LLSD::size() const { return safe(impl).size(); }
|
||||
|
||||
LLSD LLSD::get(Integer i) const { return safe(impl).get(i); }
|
||||
void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); }
|
||||
|
|
@ -926,12 +932,12 @@ LLSD& LLSD::with(Integer i, const LLSD& v)
|
|||
LLSD& LLSD::append(const LLSD& v) { return makeArray(impl).append(v); }
|
||||
void LLSD::erase(Integer i) { makeArray(impl).erase(i); }
|
||||
|
||||
LLSD& LLSD::operator[](Integer i)
|
||||
LLSD& LLSD::operator[](size_t i)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD;
|
||||
return makeArray(impl).ref(i);
|
||||
}
|
||||
const LLSD& LLSD::operator[](Integer i) const
|
||||
const LLSD& LLSD::operator[](size_t i) const
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD;
|
||||
return safe(impl).ref(i);
|
||||
|
|
@ -956,7 +962,7 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat)
|
|||
out << LLSDNotationStreamer(llsd);
|
||||
out_string = out.str();
|
||||
}
|
||||
int len = out_string.length();
|
||||
auto len = out_string.length();
|
||||
sStorage = new char[len + 1];
|
||||
memcpy(sStorage, out_string.c_str(), len);
|
||||
sStorage[len] = '\0';
|
||||
|
|
|
|||
|
|
@ -192,7 +192,17 @@ public:
|
|||
|
||||
/** @name Convenience Constructors */
|
||||
//@{
|
||||
LLSD(F32); // F32 -> Real
|
||||
// support construction from size_t et al.
|
||||
template <typename VALUE,
|
||||
typename std::enable_if<std::is_integral<VALUE>::value &&
|
||||
! std::is_same<VALUE, Boolean>::value,
|
||||
bool>::type = true>
|
||||
LLSD(VALUE v): LLSD(Integer(narrow(v))) {}
|
||||
// support construction from F32 et al.
|
||||
template <typename VALUE,
|
||||
typename std::enable_if<std::is_floating_point<VALUE>::value,
|
||||
bool>::type = true>
|
||||
LLSD(VALUE v): LLSD(Real(narrow(v))) {}
|
||||
//@}
|
||||
|
||||
/** @name Scalar Assignment */
|
||||
|
|
@ -275,7 +285,7 @@ public:
|
|||
//@{
|
||||
LLSD(const char*);
|
||||
void assign(const char*);
|
||||
LLSD& operator=(const char* v) { assign(v); return *this; }
|
||||
LLSD& operator=(const char* v) { assign(v); return *this; }
|
||||
//@}
|
||||
|
||||
/** @name Map Values */
|
||||
|
|
@ -313,14 +323,24 @@ public:
|
|||
LLSD& append(const LLSD&);
|
||||
void erase(Integer);
|
||||
LLSD& with(Integer, const LLSD&);
|
||||
|
||||
const LLSD& operator[](Integer) const;
|
||||
LLSD& operator[](Integer);
|
||||
|
||||
// accept size_t so we can index relative to size()
|
||||
const LLSD& operator[](size_t) const;
|
||||
LLSD& operator[](size_t);
|
||||
// template overloads to support int literals, U32 et al.
|
||||
template <typename IDX,
|
||||
typename std::enable_if<std::is_convertible<IDX, size_t>::value,
|
||||
bool>::type = true>
|
||||
const LLSD& operator[](IDX i) const { return (*this)[size_t(i)]; }
|
||||
template <typename IDX,
|
||||
typename std::enable_if<std::is_convertible<IDX, size_t>::value,
|
||||
bool>::type = true>
|
||||
LLSD& operator[](IDX i) { return (*this)[size_t(i)]; }
|
||||
//@}
|
||||
|
||||
/** @name Iterators */
|
||||
//@{
|
||||
int size() const;
|
||||
size_t size() const;
|
||||
|
||||
typedef std::map<String, LLSD>::iterator map_iterator;
|
||||
typedef std::map<String, LLSD>::const_iterator map_const_iterator;
|
||||
|
|
|
|||
|
|
@ -113,11 +113,9 @@ void LLParamSDParser::writeSDImpl(LLSD& sd, const LLInitParam::BaseBlock& block,
|
|||
/*virtual*/ std::string LLParamSDParser::getCurrentElementName()
|
||||
{
|
||||
std::string full_name = "sd";
|
||||
for (name_stack_t::iterator it = mNameStack.begin();
|
||||
it != mNameStack.end();
|
||||
++it)
|
||||
for (name_stack_t::value_type& stack_pair : mNameStack)
|
||||
{
|
||||
full_name += llformat("[%s]", it->first.c_str());
|
||||
full_name += llformat("[%s]", stack_pair.first.c_str());
|
||||
}
|
||||
|
||||
return full_name;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@
|
|||
#include <iostream>
|
||||
#include "apr_base64.h"
|
||||
|
||||
#include <boost/iostreams/device/array.hpp>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
|
||||
#ifdef LL_USESYSTEMLIBS
|
||||
# include <zlib.h>
|
||||
#else
|
||||
|
|
@ -50,7 +53,7 @@
|
|||
#include "lluri.h"
|
||||
|
||||
// File constants
|
||||
static const int MAX_HDR_LEN = 20;
|
||||
static const size_t MAX_HDR_LEN = 20;
|
||||
static const S32 UNZIP_LLSD_MAX_DEPTH = 96;
|
||||
static const char LEGACY_NON_HEADER[] = "<llsd>";
|
||||
const std::string LLSD_BINARY_HEADER("LLSD/Binary");
|
||||
|
|
@ -99,7 +102,7 @@ void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize
|
|||
}
|
||||
|
||||
// static
|
||||
bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes)
|
||||
bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, llssize max_bytes)
|
||||
{
|
||||
LLPointer<LLSDParser> p = NULL;
|
||||
char hdr_buf[MAX_HDR_LEN + 1] = ""; /* Flawfinder: ignore */
|
||||
|
|
@ -252,7 +255,7 @@ F64 ll_ntohd(F64 netdouble)
|
|||
* @return Returns number of bytes read off of the stream. Returns
|
||||
* PARSE_FAILURE (-1) on failure.
|
||||
*/
|
||||
int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes);
|
||||
llssize deserialize_string(std::istream& istr, std::string& value, llssize max_bytes);
|
||||
|
||||
/**
|
||||
* @brief Parse a delimited string.
|
||||
|
|
@ -263,7 +266,7 @@ int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes);
|
|||
* @return Returns number of bytes read off of the stream. Returns
|
||||
* PARSE_FAILURE (-1) on failure.
|
||||
*/
|
||||
int deserialize_string_delim(std::istream& istr, std::string& value, char d);
|
||||
llssize deserialize_string_delim(std::istream& istr, std::string& value, char d);
|
||||
|
||||
/**
|
||||
* @brief Read a raw string off the stream.
|
||||
|
|
@ -277,10 +280,10 @@ int deserialize_string_delim(std::istream& istr, std::string& value, char d);
|
|||
* @return Returns number of bytes read off of the stream. Returns
|
||||
* PARSE_FAILURE (-1) on failure.
|
||||
*/
|
||||
int deserialize_string_raw(
|
||||
llssize deserialize_string_raw(
|
||||
std::istream& istr,
|
||||
std::string& value,
|
||||
S32 max_bytes);
|
||||
llssize max_bytes);
|
||||
|
||||
/**
|
||||
* @brief helper method for dealing with the different notation boolean format.
|
||||
|
|
@ -292,7 +295,7 @@ int deserialize_string_raw(
|
|||
* @return Returns number of bytes read off of the stream. Returns
|
||||
* PARSE_FAILURE (-1) on failure.
|
||||
*/
|
||||
int deserialize_boolean(
|
||||
llssize deserialize_boolean(
|
||||
std::istream& istr,
|
||||
LLSD& data,
|
||||
const std::string& compare,
|
||||
|
|
@ -329,7 +332,7 @@ LLSDParser::LLSDParser()
|
|||
LLSDParser::~LLSDParser()
|
||||
{ }
|
||||
|
||||
S32 LLSDParser::parse(std::istream& istr, LLSD& data, S32 max_bytes, S32 max_depth)
|
||||
S32 LLSDParser::parse(std::istream& istr, LLSD& data, llssize max_bytes, S32 max_depth)
|
||||
{
|
||||
mCheckLimits = (LLSDSerialize::SIZE_UNLIMITED == max_bytes) ? false : true;
|
||||
mMaxBytesLeft = max_bytes;
|
||||
|
|
@ -359,7 +362,7 @@ std::istream& LLSDParser::get(
|
|||
char delim) const
|
||||
{
|
||||
istr.get(s, n, delim);
|
||||
if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
|
||||
if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
|
||||
return istr;
|
||||
}
|
||||
|
||||
|
|
@ -369,7 +372,7 @@ std::istream& LLSDParser::get(
|
|||
char delim) const
|
||||
{
|
||||
istr.get(sb, delim);
|
||||
if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
|
||||
if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
|
||||
return istr;
|
||||
}
|
||||
|
||||
|
|
@ -393,11 +396,11 @@ std::istream& LLSDParser::read(
|
|||
std::streamsize n) const
|
||||
{
|
||||
istr.read(s, n);
|
||||
if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
|
||||
if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
|
||||
return istr;
|
||||
}
|
||||
|
||||
void LLSDParser::account(S32 bytes) const
|
||||
void LLSDParser::account(llssize bytes) const
|
||||
{
|
||||
if(mCheckLimits) mMaxBytesLeft -= bytes;
|
||||
}
|
||||
|
|
@ -502,7 +505,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c
|
|||
c = istr.peek();
|
||||
if(isalpha(c))
|
||||
{
|
||||
int cnt = deserialize_boolean(
|
||||
auto cnt = deserialize_boolean(
|
||||
istr,
|
||||
data,
|
||||
NOTATION_FALSE_SERIAL,
|
||||
|
|
@ -532,7 +535,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c
|
|||
c = istr.peek();
|
||||
if(isalpha(c))
|
||||
{
|
||||
int cnt = deserialize_boolean(istr,data,NOTATION_TRUE_SERIAL,true);
|
||||
auto cnt = deserialize_boolean(istr,data,NOTATION_TRUE_SERIAL,true);
|
||||
if(PARSE_FAILURE == cnt) parse_count = cnt;
|
||||
else account(cnt);
|
||||
}
|
||||
|
|
@ -608,7 +611,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c
|
|||
c = get(istr); // pop the 'l'
|
||||
c = get(istr); // pop the delimiter
|
||||
std::string str;
|
||||
int cnt = deserialize_string_delim(istr, str, c);
|
||||
auto cnt = deserialize_string_delim(istr, str, c);
|
||||
if(PARSE_FAILURE == cnt)
|
||||
{
|
||||
parse_count = PARSE_FAILURE;
|
||||
|
|
@ -631,7 +634,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c
|
|||
c = get(istr); // pop the 'd'
|
||||
c = get(istr); // pop the delimiter
|
||||
std::string str;
|
||||
int cnt = deserialize_string_delim(istr, str, c);
|
||||
auto cnt = deserialize_string_delim(istr, str, c);
|
||||
if(PARSE_FAILURE == cnt)
|
||||
{
|
||||
parse_count = PARSE_FAILURE;
|
||||
|
|
@ -663,7 +666,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c
|
|||
|
||||
default:
|
||||
parse_count = PARSE_FAILURE;
|
||||
LL_INFOS() << "Unrecognized character while parsing: int(" << (int)c
|
||||
LL_INFOS() << "Unrecognized character while parsing: int(" << int(c)
|
||||
<< ")" << LL_ENDL;
|
||||
break;
|
||||
}
|
||||
|
|
@ -694,7 +697,7 @@ S32 LLSDNotationParser::parseMap(std::istream& istr, LLSD& map, S32 max_depth) c
|
|||
{
|
||||
putback(istr, c);
|
||||
found_name = true;
|
||||
int count = deserialize_string(istr, name, mMaxBytesLeft);
|
||||
auto count = deserialize_string(istr, name, mMaxBytesLeft);
|
||||
if(PARSE_FAILURE == count) return PARSE_FAILURE;
|
||||
account(count);
|
||||
}
|
||||
|
|
@ -776,7 +779,7 @@ S32 LLSDNotationParser::parseArray(std::istream& istr, LLSD& array, S32 max_dept
|
|||
bool LLSDNotationParser::parseString(std::istream& istr, LLSD& data) const
|
||||
{
|
||||
std::string value;
|
||||
int count = deserialize_string(istr, value, mMaxBytesLeft);
|
||||
auto count = deserialize_string(istr, value, mMaxBytesLeft);
|
||||
if(PARSE_FAILURE == count) return false;
|
||||
account(count);
|
||||
data = value;
|
||||
|
|
@ -803,13 +806,13 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const
|
|||
{
|
||||
// We probably have a valid raw binary stream. determine
|
||||
// the size, and read it.
|
||||
S32 len = strtol(buf + 2, NULL, 0);
|
||||
auto len = strtol(buf + 2, NULL, 0);
|
||||
if(mCheckLimits && (len > mMaxBytesLeft)) return false;
|
||||
std::vector<U8> value;
|
||||
if(len)
|
||||
{
|
||||
value.resize(len);
|
||||
account((int)fullread(istr, (char *)&value[0], len));
|
||||
account(fullread(istr, (char *)&value[0], len));
|
||||
}
|
||||
c = get(istr); // strip off the trailing double-quote
|
||||
data = value;
|
||||
|
|
@ -1006,7 +1009,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) con
|
|||
case '"':
|
||||
{
|
||||
std::string value;
|
||||
int cnt = deserialize_string_delim(istr, value, c);
|
||||
auto cnt = deserialize_string_delim(istr, value, c);
|
||||
if(PARSE_FAILURE == cnt)
|
||||
{
|
||||
parse_count = PARSE_FAILURE;
|
||||
|
|
@ -1093,7 +1096,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) con
|
|||
if(size > 0)
|
||||
{
|
||||
value.resize(size);
|
||||
account((int)fullread(istr, (char*)&value[0], size));
|
||||
account(fullread(istr, (char*)&value[0], size));
|
||||
}
|
||||
data = value;
|
||||
}
|
||||
|
|
@ -1107,7 +1110,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) con
|
|||
|
||||
default:
|
||||
parse_count = PARSE_FAILURE;
|
||||
LL_INFOS() << "Unrecognized character while parsing: int(" << (int)c
|
||||
LL_INFOS() << "Unrecognized character while parsing: int(" << int(c)
|
||||
<< ")" << LL_ENDL;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1141,7 +1144,7 @@ S32 LLSDBinaryParser::parseMap(std::istream& istr, LLSD& map, S32 max_depth) con
|
|||
case '\'':
|
||||
case '"':
|
||||
{
|
||||
int cnt = deserialize_string_delim(istr, name, c);
|
||||
auto cnt = deserialize_string_delim(istr, name, c);
|
||||
if(PARSE_FAILURE == cnt) return PARSE_FAILURE;
|
||||
account(cnt);
|
||||
break;
|
||||
|
|
@ -1225,7 +1228,7 @@ bool LLSDBinaryParser::parseString(
|
|||
if(size)
|
||||
{
|
||||
buf.resize(size);
|
||||
account((int)fullread(istr, &buf[0], size));
|
||||
account(fullread(istr, &buf[0], size));
|
||||
value.assign(buf.begin(), buf.end());
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1429,7 +1432,7 @@ S32 LLSDNotationFormatter::format_impl(const LLSD& data, std::ostream& ostr,
|
|||
ostr << std::uppercase;
|
||||
auto oldfill(ostr.fill('0'));
|
||||
auto oldwidth(ostr.width());
|
||||
for (int i = 0; i < buffer.size(); i++)
|
||||
for (size_t i = 0; i < buffer.size(); i++)
|
||||
{
|
||||
// have to restate setw() before every conversion
|
||||
ostr << std::setw(2) << (int) buffer[i];
|
||||
|
|
@ -1592,7 +1595,7 @@ void LLSDBinaryFormatter::formatString(
|
|||
/**
|
||||
* local functions
|
||||
*/
|
||||
int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes)
|
||||
llssize deserialize_string(std::istream& istr, std::string& value, llssize max_bytes)
|
||||
{
|
||||
int c = istr.get();
|
||||
if(istr.fail())
|
||||
|
|
@ -1602,7 +1605,7 @@ int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes)
|
|||
return LLSDParser::PARSE_FAILURE;
|
||||
}
|
||||
|
||||
int rv = LLSDParser::PARSE_FAILURE;
|
||||
llssize rv = LLSDParser::PARSE_FAILURE;
|
||||
switch(c)
|
||||
{
|
||||
case '\'':
|
||||
|
|
@ -1622,7 +1625,7 @@ int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes)
|
|||
return rv + 1; // account for the character grabbed at the top.
|
||||
}
|
||||
|
||||
int deserialize_string_delim(
|
||||
llssize deserialize_string_delim(
|
||||
std::istream& istr,
|
||||
std::string& value,
|
||||
char delim)
|
||||
|
|
@ -1632,7 +1635,7 @@ int deserialize_string_delim(
|
|||
bool found_hex = false;
|
||||
bool found_digit = false;
|
||||
U8 byte = 0;
|
||||
int count = 0;
|
||||
llssize count = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
|
@ -1647,7 +1650,7 @@ int deserialize_string_delim(
|
|||
}
|
||||
|
||||
char next_char = (char)next_byte; // Now that we know it's not EOF
|
||||
|
||||
|
||||
if(found_escape)
|
||||
{
|
||||
// next character(s) is a special sequence.
|
||||
|
|
@ -1725,16 +1728,16 @@ int deserialize_string_delim(
|
|||
return count;
|
||||
}
|
||||
|
||||
int deserialize_string_raw(
|
||||
llssize deserialize_string_raw(
|
||||
std::istream& istr,
|
||||
std::string& value,
|
||||
S32 max_bytes)
|
||||
llssize max_bytes)
|
||||
{
|
||||
int count = 0;
|
||||
llssize count = 0;
|
||||
const S32 BUF_LEN = 20;
|
||||
char buf[BUF_LEN]; /* Flawfinder: ignore */
|
||||
istr.get(buf, BUF_LEN - 1, ')');
|
||||
count += (int)istr.gcount();
|
||||
count += istr.gcount();
|
||||
int c = istr.get();
|
||||
c = istr.get();
|
||||
count += 2;
|
||||
|
|
@ -1743,13 +1746,13 @@ int deserialize_string_raw(
|
|||
// We probably have a valid raw string. determine
|
||||
// the size, and read it.
|
||||
// *FIX: This is memory inefficient.
|
||||
S32 len = strtol(buf + 1, NULL, 0);
|
||||
auto len = strtol(buf + 1, NULL, 0);
|
||||
if((max_bytes>0)&&(len>max_bytes)) return LLSDParser::PARSE_FAILURE;
|
||||
std::vector<char> buf;
|
||||
if(len)
|
||||
{
|
||||
buf.resize(len);
|
||||
count += (int)fullread(istr, (char *)&buf[0], len);
|
||||
count += fullread(istr, (char *)&buf[0], len);
|
||||
value.assign(buf.begin(), buf.end());
|
||||
}
|
||||
c = istr.get();
|
||||
|
|
@ -2038,7 +2041,7 @@ void serialize_string(const std::string& value, std::ostream& str)
|
|||
}
|
||||
}
|
||||
|
||||
int deserialize_boolean(
|
||||
llssize deserialize_boolean(
|
||||
std::istream& istr,
|
||||
LLSD& data,
|
||||
const std::string& compare,
|
||||
|
|
@ -2055,7 +2058,7 @@ int deserialize_boolean(
|
|||
// * set data to LLSD::null
|
||||
// * return LLSDParser::PARSE_FAILURE (-1)
|
||||
//
|
||||
int bytes_read = 0;
|
||||
llssize bytes_read = 0;
|
||||
std::string::size_type ii = 0;
|
||||
char c = istr.peek();
|
||||
while((++ii < compare.size())
|
||||
|
|
@ -2110,7 +2113,7 @@ std::string zip_llsd(LLSD& data)
|
|||
|
||||
U8 out[CHUNK];
|
||||
|
||||
strm.avail_in = source.size();
|
||||
strm.avail_in = narrow(source.size());
|
||||
strm.next_in = (U8*) source.data();
|
||||
U8* output = NULL;
|
||||
|
||||
|
|
@ -2128,7 +2131,9 @@ std::string zip_llsd(LLSD& data)
|
|||
{ //copy result into output
|
||||
if (strm.avail_out >= CHUNK)
|
||||
{
|
||||
free(output);
|
||||
deflateEnd(&strm);
|
||||
if(output)
|
||||
free(output);
|
||||
LL_WARNS() << "Failed to compress LLSD block." << LL_ENDL;
|
||||
return std::string();
|
||||
}
|
||||
|
|
@ -2151,7 +2156,9 @@ std::string zip_llsd(LLSD& data)
|
|||
}
|
||||
else
|
||||
{
|
||||
free(output);
|
||||
deflateEnd(&strm);
|
||||
if(output)
|
||||
free(output);
|
||||
LL_WARNS() << "Failed to compress LLSD block." << LL_ENDL;
|
||||
return std::string();
|
||||
}
|
||||
|
|
@ -2162,7 +2169,8 @@ std::string zip_llsd(LLSD& data)
|
|||
|
||||
std::string result((char*) output, size);
|
||||
deflateEnd(&strm);
|
||||
free(output);
|
||||
if(output)
|
||||
free(output);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -2172,53 +2180,66 @@ std::string zip_llsd(LLSD& data)
|
|||
// and deserializes from that copy using LLSDSerialize
|
||||
LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, S32 size)
|
||||
{
|
||||
U8* result = NULL;
|
||||
U32 cur_size = 0;
|
||||
z_stream strm;
|
||||
|
||||
const U32 CHUNK = 65536;
|
||||
|
||||
U8 *in = new(std::nothrow) U8[size];
|
||||
std::unique_ptr<U8[]> in = std::unique_ptr<U8[]>(new(std::nothrow) U8[size]);
|
||||
if (!in)
|
||||
{
|
||||
return ZR_MEM_ERROR;
|
||||
}
|
||||
is.read((char*) in, size);
|
||||
is.read((char*) in.get(), size);
|
||||
|
||||
U8 out[CHUNK];
|
||||
return unzip_llsd(data, in.get(), size);
|
||||
}
|
||||
|
||||
LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, const U8* in, S32 size)
|
||||
{
|
||||
U8* result = NULL;
|
||||
U32 cur_size = 0;
|
||||
z_stream strm;
|
||||
|
||||
constexpr U32 CHUNK = 1024 * 512;
|
||||
|
||||
static thread_local std::unique_ptr<U8[]> out;
|
||||
if (!out)
|
||||
{
|
||||
out = std::unique_ptr<U8[]>(new(std::nothrow) U8[CHUNK]);
|
||||
}
|
||||
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.avail_in = size;
|
||||
strm.next_in = in;
|
||||
strm.next_in = const_cast<U8*>(in);
|
||||
|
||||
S32 ret = inflateInit(&strm);
|
||||
|
||||
do
|
||||
{
|
||||
strm.avail_out = CHUNK;
|
||||
strm.next_out = out;
|
||||
strm.next_out = out.get();
|
||||
ret = inflate(&strm, Z_NO_FLUSH);
|
||||
if (ret == Z_STREAM_ERROR)
|
||||
{
|
||||
inflateEnd(&strm);
|
||||
free(result);
|
||||
delete [] in;
|
||||
return ZR_DATA_ERROR;
|
||||
}
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case Z_NEED_DICT:
|
||||
ret = Z_DATA_ERROR;
|
||||
case Z_DATA_ERROR:
|
||||
case Z_MEM_ERROR:
|
||||
{
|
||||
inflateEnd(&strm);
|
||||
free(result);
|
||||
return ZR_DATA_ERROR;
|
||||
}
|
||||
case Z_STREAM_ERROR:
|
||||
case Z_BUF_ERROR:
|
||||
{
|
||||
inflateEnd(&strm);
|
||||
free(result);
|
||||
return ZR_BUFFER_ERROR;
|
||||
}
|
||||
|
||||
case Z_MEM_ERROR:
|
||||
{
|
||||
inflateEnd(&strm);
|
||||
free(result);
|
||||
delete [] in;
|
||||
return ZR_MEM_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
U32 have = CHUNK-strm.avail_out;
|
||||
|
|
@ -2231,17 +2252,15 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is,
|
|||
{
|
||||
free(result);
|
||||
}
|
||||
delete[] in;
|
||||
return ZR_MEM_ERROR;
|
||||
}
|
||||
result = new_result;
|
||||
memcpy(result+cur_size, out, have);
|
||||
memcpy(result+cur_size, out.get(), have);
|
||||
cur_size += have;
|
||||
|
||||
} while (ret == Z_OK);
|
||||
} while (ret == Z_OK && ret != Z_STREAM_END);
|
||||
|
||||
inflateEnd(&strm);
|
||||
delete [] in;
|
||||
|
||||
if (ret != Z_STREAM_END)
|
||||
{
|
||||
|
|
@ -2251,37 +2270,11 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is,
|
|||
|
||||
//result now points to the decompressed LLSD block
|
||||
{
|
||||
std::istringstream istr;
|
||||
// Since we are using this for meshes, data we are dealing with tend to be large.
|
||||
// So string can potentially fail to allocate, make sure this won't cause problems
|
||||
try
|
||||
{
|
||||
std::string res_str((char*)result, cur_size);
|
||||
char* result_ptr = strip_deprecated_header((char*)result, cur_size);
|
||||
|
||||
std::string deprecated_header("<? LLSD/Binary ?>");
|
||||
|
||||
if (res_str.substr(0, deprecated_header.size()) == deprecated_header)
|
||||
{
|
||||
res_str = res_str.substr(deprecated_header.size() + 1, cur_size);
|
||||
}
|
||||
cur_size = res_str.size();
|
||||
|
||||
istr.str(res_str);
|
||||
}
|
||||
#ifdef LL_WINDOWS
|
||||
catch (std::length_error)
|
||||
{
|
||||
free(result);
|
||||
return ZR_SIZE_ERROR;
|
||||
}
|
||||
#endif
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
free(result);
|
||||
return ZR_MEM_ERROR;
|
||||
}
|
||||
|
||||
if (!LLSDSerialize::fromBinary(data, istr, cur_size, UNZIP_LLSD_MAX_DEPTH))
|
||||
boost::iostreams::stream<boost::iostreams::array_source> istrm(result_ptr, cur_size);
|
||||
|
||||
if (!LLSDSerialize::fromBinary(data, istrm, cur_size, UNZIP_LLSD_MAX_DEPTH))
|
||||
{
|
||||
free(result);
|
||||
return ZR_PARSE_ERROR;
|
||||
|
|
@ -2294,7 +2287,7 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is,
|
|||
//This unzip function will only work with a gzip header and trailer - while the contents
|
||||
//of the actual compressed data is the same for either format (gzip vs zlib ), the headers
|
||||
//and trailers are different for the formats.
|
||||
U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 size )
|
||||
U8* unzip_llsdNavMesh( bool& valid, size_t& outsize, std::istream& is, S32 size )
|
||||
{
|
||||
if (size == 0)
|
||||
{
|
||||
|
|
@ -2395,4 +2388,22 @@ U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32
|
|||
return result;
|
||||
}
|
||||
|
||||
char* strip_deprecated_header(char* in, U32& cur_size, U32* header_size)
|
||||
{
|
||||
const char* deprecated_header = "<? LLSD/Binary ?>";
|
||||
constexpr size_t deprecated_header_size = 17;
|
||||
|
||||
if (cur_size > deprecated_header_size
|
||||
&& memcmp(in, deprecated_header, deprecated_header_size) == 0)
|
||||
{
|
||||
in = in + deprecated_header_size;
|
||||
cur_size = cur_size - deprecated_header_size;
|
||||
if (header_size)
|
||||
{
|
||||
*header_size = deprecated_header_size + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public:
|
|||
* @return Returns the number of LLSD objects parsed into
|
||||
* data. Returns PARSE_FAILURE (-1) on parse failure.
|
||||
*/
|
||||
S32 parse(std::istream& istr, LLSD& data, S32 max_bytes, S32 max_depth = -1);
|
||||
S32 parse(std::istream& istr, LLSD& data, llssize max_bytes, S32 max_depth = -1);
|
||||
|
||||
/** Like parse(), but uses a different call (istream.getline()) to read by lines
|
||||
* This API is better suited for XML, where the parse cannot tell
|
||||
|
|
@ -194,7 +194,7 @@ protected:
|
|||
* Conceptually const since it only modifies mutable members.
|
||||
* @param bytes The number of bytes read.
|
||||
*/
|
||||
void account(S32 bytes) const;
|
||||
void account(llssize bytes) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
@ -205,7 +205,7 @@ protected:
|
|||
/**
|
||||
* @brief The maximum number of bytes left to be parsed.
|
||||
*/
|
||||
mutable S32 mMaxBytesLeft;
|
||||
mutable llssize mMaxBytesLeft;
|
||||
|
||||
/**
|
||||
* @brief Use line-based reading to get text
|
||||
|
|
@ -336,7 +336,7 @@ private:
|
|||
class Impl;
|
||||
Impl& impl;
|
||||
|
||||
void parsePart(const char* buf, int len);
|
||||
void parsePart(const char* buf, llssize len);
|
||||
friend class LLSDSerialize;
|
||||
};
|
||||
|
||||
|
|
@ -756,7 +756,7 @@ public:
|
|||
* @param max_bytes the maximum number of bytes to parse
|
||||
* @return Returns true if the stream appears to contain valid data
|
||||
*/
|
||||
static bool deserialize(LLSD& sd, std::istream& str, S32 max_bytes);
|
||||
static bool deserialize(LLSD& sd, std::istream& str, llssize max_bytes);
|
||||
|
||||
/*
|
||||
* Notation Methods
|
||||
|
|
@ -778,12 +778,12 @@ public:
|
|||
LLSDFormatter::EFormatterOptions(LLSDFormatter::OPTIONS_PRETTY |
|
||||
LLSDFormatter::OPTIONS_PRETTY_BINARY));
|
||||
}
|
||||
static S32 fromNotation(LLSD& sd, std::istream& str, S32 max_bytes)
|
||||
static S32 fromNotation(LLSD& sd, std::istream& str, llssize max_bytes)
|
||||
{
|
||||
LLPointer<LLSDNotationParser> p = new LLSDNotationParser;
|
||||
return p->parse(str, sd, max_bytes);
|
||||
}
|
||||
static LLSD fromNotation(std::istream& str, S32 max_bytes)
|
||||
static LLSD fromNotation(std::istream& str, llssize max_bytes)
|
||||
{
|
||||
LLPointer<LLSDNotationParser> p = new LLSDNotationParser;
|
||||
LLSD sd;
|
||||
|
|
@ -834,12 +834,12 @@ public:
|
|||
LLPointer<LLSDBinaryFormatter> f = new LLSDBinaryFormatter;
|
||||
return f->format(sd, str, LLSDFormatter::OPTIONS_NONE);
|
||||
}
|
||||
static S32 fromBinary(LLSD& sd, std::istream& str, S32 max_bytes, S32 max_depth = -1)
|
||||
static S32 fromBinary(LLSD& sd, std::istream& str, llssize max_bytes, S32 max_depth = -1)
|
||||
{
|
||||
LLPointer<LLSDBinaryParser> p = new LLSDBinaryParser;
|
||||
return p->parse(str, sd, max_bytes, max_depth);
|
||||
}
|
||||
static LLSD fromBinary(std::istream& str, S32 max_bytes, S32 max_depth = -1)
|
||||
static LLSD fromBinary(std::istream& str, llssize max_bytes, S32 max_depth = -1)
|
||||
{
|
||||
LLPointer<LLSDBinaryParser> p = new LLSDBinaryParser;
|
||||
LLSD sd;
|
||||
|
|
@ -858,14 +858,20 @@ public:
|
|||
ZR_SIZE_ERROR,
|
||||
ZR_DATA_ERROR,
|
||||
ZR_PARSE_ERROR,
|
||||
ZR_BUFFER_ERROR,
|
||||
ZR_VERSION_ERROR
|
||||
} EZipRresult;
|
||||
// return OK or reason for failure
|
||||
static EZipRresult unzip_llsd(LLSD& data, std::istream& is, S32 size);
|
||||
static EZipRresult unzip_llsd(LLSD& data, const U8* in, S32 size);
|
||||
};
|
||||
|
||||
//dirty little zip functions -- yell at davep
|
||||
LL_COMMON_API std::string zip_llsd(LLSD& data);
|
||||
|
||||
|
||||
LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size);
|
||||
LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, size_t& outsize,std::istream& is, S32 size);
|
||||
|
||||
// returns a pointer to the array or past the array if the deprecated header exists
|
||||
LL_COMMON_API char* strip_deprecated_header(char* in, U32& cur_size, U32* header_size = nullptr);
|
||||
#endif // LL_LLSDSERIALIZE_H
|
||||
|
|
|
|||
|
|
@ -196,12 +196,12 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr,
|
|||
// *FIX: memory inefficient.
|
||||
// *TODO: convert to use LLBase64
|
||||
ostr << pre << "<binary encoding=\"base64\">";
|
||||
int b64_buffer_length = apr_base64_encode_len(buffer.size());
|
||||
int b64_buffer_length = apr_base64_encode_len(narrow(buffer.size()));
|
||||
char* b64_buffer = new char[b64_buffer_length];
|
||||
b64_buffer_length = apr_base64_encode_binary(
|
||||
b64_buffer,
|
||||
&buffer[0],
|
||||
buffer.size());
|
||||
narrow(buffer.size()));
|
||||
ostr.write(b64_buffer, b64_buffer_length - 1);
|
||||
delete[] b64_buffer;
|
||||
ostr << "</binary>" << post;
|
||||
|
|
@ -260,7 +260,7 @@ public:
|
|||
S32 parse(std::istream& input, LLSD& data);
|
||||
S32 parseLines(std::istream& input, LLSD& data);
|
||||
|
||||
void parsePart(const char *buf, int len);
|
||||
void parsePart(const char *buf, llssize len);
|
||||
|
||||
void reset();
|
||||
|
||||
|
|
@ -542,7 +542,7 @@ LLSDXMLParser::Impl::findAttribute(const XML_Char* name, const XML_Char** pairs)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void LLSDXMLParser::Impl::parsePart(const char* buf, int len)
|
||||
void LLSDXMLParser::Impl::parsePart(const char* buf, llssize len)
|
||||
{
|
||||
if ( buf != NULL
|
||||
&& len > 0 )
|
||||
|
|
@ -915,7 +915,7 @@ LLSDXMLParser::~LLSDXMLParser()
|
|||
delete &impl;
|
||||
}
|
||||
|
||||
void LLSDXMLParser::parsePart(const char *buf, int len)
|
||||
void LLSDXMLParser::parsePart(const char *buf, llssize len)
|
||||
{
|
||||
impl.parsePart(buf, len);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,10 +148,9 @@ LLSD ll_binary_from_string(const LLSD& sd)
|
|||
std::vector<U8> binary_value;
|
||||
|
||||
std::string string_value = sd.asString();
|
||||
for (std::string::iterator iter = string_value.begin();
|
||||
iter != string_value.end(); ++iter)
|
||||
for (const U8 c : string_value)
|
||||
{
|
||||
binary_value.push_back(*iter);
|
||||
binary_value.push_back(c);
|
||||
}
|
||||
|
||||
binary_value.push_back('\0');
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue