Merge branch 'master' of git://github.com/siana/SingularityViewer
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
Mesa 3-D graphics library
|
||||
Version: 6.2
|
||||
|
||||
Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
|
||||
The GNU Library GPL is available at http://www.gnu.org/copyleft/lesser.html
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@@ -1,182 +0,0 @@
|
||||
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
|
||||
LGPL v 2.1
|
||||
|
||||
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.
|
||||
|
||||
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 an 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!
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
http://nyctergatis.com/jpeglib/
|
||||
|
||||
The license below is known as the modified BSD license, with an additional reference to the Independent JPEG Group to comply with its terms. It applies to the source code written specifically for the Palm, not to the work of the Independent JPEG Group (see the remark below).
|
||||
|
||||
Copyright (c) 2003, Yves Piguet.
|
||||
All rights reserved.
|
||||
Based on the work of the Independent JPEG Group.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Yves Piguet nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
|
||||
This copy of the libpng notices is provided for your convenience. In case of
|
||||
any discrepancy between this copy and the notices in the file png.h that is
|
||||
included in the libpng distribution, the latter shall prevail.
|
||||
|
||||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.2.35, February 14, 2009, are
|
||||
Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individual added to the list of Contributing Authors
|
||||
|
||||
Cosmin Truta
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
|
||||
Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
with the following individuals added to the list of Contributing Authors
|
||||
|
||||
Simon-Pierre Cadieux
|
||||
Eric S. Raymond
|
||||
Gilles Vollant
|
||||
|
||||
and with the following additions to the disclaimer:
|
||||
|
||||
There is no warranty against interference with your enjoyment of the
|
||||
library or against infringement. There is no warranty that our
|
||||
efforts or the library will fulfill any of your particular purposes
|
||||
or needs. This library is provided with all faults, and the entire
|
||||
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||
the user.
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-0.96,
|
||||
with the following individuals added to the list of Contributing Authors:
|
||||
|
||||
Tom Lane
|
||||
Glenn Randers-Pehrson
|
||||
Willem van Schaik
|
||||
|
||||
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||
Copyright (c) 1996, 1997 Andreas Dilger
|
||||
Distributed according to the same disclaimer and license as libpng-0.88,
|
||||
with the following individuals added to the list of Contributing Authors:
|
||||
|
||||
John Bowler
|
||||
Kevin Bracey
|
||||
Sam Bushell
|
||||
Magnus Holmgren
|
||||
Greg Roelofs
|
||||
Tom Tanner
|
||||
|
||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
||||
For the purposes of this copyright and license, "Contributing Authors"
|
||||
is defined as the following set of individuals:
|
||||
|
||||
Andreas Dilger
|
||||
Dave Martindale
|
||||
Guy Eric Schalnat
|
||||
Paul Schmidt
|
||||
Tim Wegner
|
||||
|
||||
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||
and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||
including, without limitation, the warranties of merchantability and of
|
||||
fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||
assume no liability for direct, indirect, incidental, special, exemplary,
|
||||
or consequential damages, which may result from the use of the PNG
|
||||
Reference Library, even if advised of the possibility of such damage.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
source code, or portions hereof, for any purpose, without fee, subject
|
||||
to the following restrictions:
|
||||
|
||||
1. The origin of this source code must not be misrepresented.
|
||||
|
||||
2. Altered versions must be plainly marked as such and must not
|
||||
be misrepresented as being the original source.
|
||||
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
|
||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||
fee, and encourage the use of this source code as a component to
|
||||
supporting the PNG file format in commercial products. If you use this
|
||||
source code in a product, acknowledgment is not required but would be
|
||||
appreciated.
|
||||
|
||||
|
||||
A "png_get_copyright" function is available, for convenient use in "about"
|
||||
boxes and the like:
|
||||
|
||||
printf("%s",png_get_copyright(NULL));
|
||||
|
||||
Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||
|
||||
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
|
||||
certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
February 14, 2009
|
||||
@@ -1,58 +0,0 @@
|
||||
http://www.mesa3d.org/license.html
|
||||
|
||||
License / Copyright Information
|
||||
|
||||
The Mesa distribution consists of several components. Different copyrights and licenses apply to different components. For example, GLUT is copyrighted by Mark Kilgard, some demo programs are copyrighted by SGI, some of the Mesa device drivers are copyrighted by their authors. See below for a list of Mesa's main components and the license for each.
|
||||
|
||||
The core Mesa library is licensed according to the terms of the MIT license. This allows integration with the XFree86, Xorg and DRI projects.
|
||||
|
||||
The default Mesa license is as follows:
|
||||
|
||||
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Attention, Contributors
|
||||
|
||||
When contributing to the Mesa project you must agree to the licensing terms of the component to which you're contributing. The following section lists the primary components of the Mesa distribution and their respective licenses.
|
||||
Mesa Component Licenses
|
||||
|
||||
Component Location Primary Author License
|
||||
----------------------------------------------------------------------------
|
||||
Main Mesa code src/mesa/ Brian Paul Mesa (MIT)
|
||||
|
||||
Device drivers src/mesa/drivers/* See drivers See drivers
|
||||
|
||||
Ext headers include/GL/glext.h SGI SGI Free B
|
||||
include/GL/glxext.h
|
||||
|
||||
GLUT src/glut/ Mark Kilgard Mark's copyright
|
||||
|
||||
Mesa GLU library src/glu/mesa/ Brian Paul GNU-LGPL
|
||||
|
||||
SGI GLU library src/glu/sgi/ SGI SGI Free B
|
||||
|
||||
demo programs progs/demos/ various see source files
|
||||
|
||||
X demos progs/xdemos/ Brian Paul see source files
|
||||
|
||||
SGI demos progs/samples/ SGI SGI copyright
|
||||
|
||||
RedBook demos progs/redbook/ SGI SGI copyright
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
Copyright (c) 2001, Xiphophorus
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiphophorus nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
Copyright 2002-2006 Vladimir Dyuzhev
|
||||
Copyright 2007 Denis Kononenko
|
||||
Copyright 2008 Micha? Rzechonek
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,180 +0,0 @@
|
||||
=================
|
||||
Vivox SDK License
|
||||
=================
|
||||
|
||||
RSA Data Security, Inc. MD5 Message-Digest Algorithm
|
||||
|
||||
Audio coding: Polycom<6F> Siren14TM (ITU-T Rec. G.722.1 Annex C)
|
||||
|
||||
Open Source Software Licensing
|
||||
Each open source software component utilized by this product is subject to its own copyright and licensing terms, as listed below.
|
||||
|
||||
|
||||
*************************************************************
|
||||
*************************************************************
|
||||
|
||||
/**
|
||||
* OpenAL cross platform audio library
|
||||
* Copyright (C) 1999-2000 by authors.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
* Or go to http://www.gnu.org/copyleft/lgpl.html
|
||||
*/
|
||||
|
||||
*************************************************************
|
||||
*************************************************************
|
||||
RTP code under Lesser General Public License
|
||||
|
||||
/*
|
||||
The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
|
||||
Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
|
||||
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
************************************************************
|
||||
*************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The Vovida Software License, Version 1.0
|
||||
*
|
||||
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The names "VOCAL", "Vovida Open Communication Application Library",
|
||||
* and "Vovida Open Communication Application Library (VOCAL)" must
|
||||
* not be used to endorse or promote products derived from this
|
||||
* software without prior written permission. For written
|
||||
* permission, please contact vocal@vovida.org.
|
||||
*
|
||||
* 4. Products derived from this software may not be called "VOCAL", nor
|
||||
* may "VOCAL" appear in their name, without prior written
|
||||
* permission of Vovida Networks, Inc.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
|
||||
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
|
||||
* IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
*
|
||||
* This software consists of voluntary contributions made by Vovida
|
||||
* Networks, Inc. and many individuals on behalf of Vovida Networks,
|
||||
* Inc. For more information on Vovida Networks, Inc., please see
|
||||
*
|
||||
*
|
||||
*/
|
||||
*************************************************************
|
||||
*************************************************************
|
||||
|
||||
Internet Software Consortium code
|
||||
|
||||
/* This is from the BIND 4.9.4 release, modified to compile by itself*/
|
||||
/* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
*************************************************************
|
||||
|
||||
*************************************************************
|
||||
|
||||
************************************************************
|
||||
|
||||
http://tinyxpath.sourceforge.net/
|
||||
|
||||
TinyXPath is covered by the zlib license :
|
||||
|
||||
www.sourceforge.net/projects/tinyxpath
|
||||
Copyright (c) 2002-2006 Yves Berquin (yvesb@users.sourceforge.net)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
|
||||
************************************************************
|
||||
************************************************************
|
||||
|
||||
THE FREE SOFTWARE FOUNDATION
|
||||
|
||||
Any customer may request the source code for all open source portions of this product which are covered by the Free Software Foundation's General Public License (GPL), for a period of three years from purchase. Please contact the vendor from whom you obtained this product for instructions. A fee equivalent to the cost of making the code available may be charged. Alternatively, customers may choose to download desired GPL components directly from their original vendors. Specifically, this product contains the following GPL-licensed components:
|
||||
|
||||
From Vivox:
|
||||
- Assorted software components. To request source, contact Vivox at:
|
||||
Vivox, Inc.
|
||||
Attn: customer support
|
||||
40 Speen Street Suite 402
|
||||
Framingham, MA 01701
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
'zlib' general purpose compression library version 1.1.4, March 11th, 2002
|
||||
|
||||
Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the
|
||||
use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
The origin of this software must not be misrepresented; you must not claim
|
||||
that you wrote the original software. If you use this software in a product,
|
||||
an acknowledgment in the product documentation would be appreciated but is
|
||||
not required.
|
||||
|
||||
Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly
|
||||
jloup@gzip.org
|
||||
|
||||
Mark Adler
|
||||
madler@alumni.caltech.edu
|
||||
|
||||
@@ -4,6 +4,10 @@ along with the issue identifier corresponding to the patches we've
|
||||
received from them. To see more about these contributions, visit the
|
||||
browsable version: http://wiki.secondlife.com/wiki/Source_contributions
|
||||
|
||||
Entries are related to URLs as follows:
|
||||
IMP-xxx: http://redmine.kokuaviewer.org/issues/xxx
|
||||
Everything else ([VWR|SNOW|CT|SVC|WEB]-xxx): https://jira.secondlife.com/browse/KEY-xxx
|
||||
|
||||
Able Whitman
|
||||
VWR-650
|
||||
VWR-1460
|
||||
@@ -58,12 +62,18 @@ Aimee Trescothick
|
||||
Alejandro Rosenthal
|
||||
VWR-1184
|
||||
Aleric Inglewood
|
||||
VWR-10579 (IMP-552)
|
||||
VWR-10759
|
||||
VWR-10837
|
||||
VWR-12984
|
||||
VWR-13040 (IMP-575)
|
||||
VWR-13996
|
||||
VWR-14426
|
||||
VWR-14914
|
||||
VWR-24247
|
||||
VWR-24312
|
||||
VWR-24320
|
||||
VWR-24333
|
||||
SNOW-47
|
||||
SNOW-84
|
||||
SNOW-86
|
||||
@@ -72,18 +82,37 @@ Aleric Inglewood
|
||||
SNOW-129
|
||||
SNOW-196
|
||||
SNOW-203
|
||||
SNOW-240
|
||||
SNOW-408
|
||||
SNOW-415
|
||||
SNOW-415 (IMP-576)
|
||||
SNOW-477 (IMP-577)
|
||||
SNOW-479
|
||||
SNOW-626
|
||||
SNOW-713
|
||||
SNOW-744
|
||||
SNOW-751
|
||||
SNOW-713 (IMP-692)
|
||||
SNOW-744 (IMP-578)
|
||||
SNOW-752
|
||||
SNOW-753
|
||||
SNOW-766 (IMP-553)
|
||||
SNOW-772
|
||||
SNOW-793
|
||||
SNOW-796 (IMP-581)
|
||||
SNOW-800 (IMP-556)
|
||||
SNOW-806
|
||||
IMP-429
|
||||
IMP-561
|
||||
IMP-565
|
||||
IMP-566
|
||||
IMP-567
|
||||
IMP-573
|
||||
IMP-590
|
||||
IMP-660
|
||||
IMP-661
|
||||
IMP-662
|
||||
IMP-663
|
||||
IMP-664
|
||||
IMP-670
|
||||
IMP-701
|
||||
IMP-734
|
||||
Alissa Sabre
|
||||
VWR-81
|
||||
VWR-83
|
||||
@@ -105,7 +134,7 @@ Alissa Sabre
|
||||
VWR-1351
|
||||
VWR-1353
|
||||
VWR-1410
|
||||
VWR-1843
|
||||
VWR-1843
|
||||
VWR-2116
|
||||
VWR-2826
|
||||
VWR-3290
|
||||
@@ -113,17 +142,17 @@ Alissa Sabre
|
||||
VWR-3857
|
||||
VWR-4010
|
||||
VWR-5575
|
||||
VWR-5929
|
||||
VWR-6384
|
||||
VWR-6385
|
||||
VWR-5929
|
||||
VWR-6384
|
||||
VWR-6385
|
||||
VWR-6386
|
||||
VWR-6430
|
||||
VWR-6430
|
||||
VWR-6858
|
||||
VWR-6668
|
||||
VWR-7086
|
||||
VWR-7087
|
||||
VWR-7153
|
||||
VWR-7168
|
||||
VWR-6668
|
||||
VWR-7086
|
||||
VWR-7087
|
||||
VWR-7153
|
||||
VWR-7168
|
||||
VWR-9190
|
||||
VWR-10728
|
||||
VWR-12620
|
||||
@@ -181,6 +210,7 @@ Boroondas Gupte
|
||||
SNOW-201
|
||||
SNOW-396
|
||||
SNOW-589
|
||||
SNOW-623 (IMP-554)
|
||||
SNOW-624
|
||||
VWR-233
|
||||
WEB-262
|
||||
@@ -549,7 +579,7 @@ Pf Shan
|
||||
CT-321
|
||||
princess niven
|
||||
VWR-5733
|
||||
CT-85
|
||||
CT-85
|
||||
CT-320
|
||||
CT-352
|
||||
Renault Clio
|
||||
@@ -590,6 +620,7 @@ Robin Cornelius
|
||||
VWR-11128
|
||||
VWR-12758
|
||||
VWR-12686
|
||||
VWR-12838
|
||||
Ryozu Kojima
|
||||
VWR-53
|
||||
VWR-287
|
||||
@@ -788,4 +819,3 @@ Zi Ree
|
||||
Zipherius Turas
|
||||
VWR-76
|
||||
VWR-77
|
||||
|
||||
|
||||
@@ -132,27 +132,25 @@ endif (SERVER)
|
||||
|
||||
# Configure prebuilt binary download. This must be done last so that
|
||||
# all subdirectories have a chance to list the packages they need.
|
||||
if(NOT STANDALONE)
|
||||
# We need scp for proprietary downloads.
|
||||
if(INSTALL_PROPRIETARY)
|
||||
include(FindSCP)
|
||||
endif(INSTALL_PROPRIETARY)
|
||||
# We need scp for proprietary downloads.
|
||||
if(INSTALL_PROPRIETARY)
|
||||
include(FindSCP)
|
||||
endif(INSTALL_PROPRIETARY)
|
||||
|
||||
# The use_prebuilt_binary macro in cmake/Prebuilt.cmake records
|
||||
# packages in the PREBUILT property of the 'prepare' target.
|
||||
get_property(PREBUILT_PACKAGES TARGET prepare PROPERTY PREBUILT)
|
||||
# The use_prebuilt_binary macro in cmake/Prebuilt.cmake records
|
||||
# packages in the PREBUILT property of the 'prepare' target.
|
||||
get_property(PREBUILT_PACKAGES TARGET prepare PROPERTY PREBUILT)
|
||||
|
||||
# Create a script to download the needed binaries.
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/DownloadPrebuilt.cmake.in
|
||||
${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake @ONLY)
|
||||
# Create a script to download the needed binaries.
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/DownloadPrebuilt.cmake.in
|
||||
${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake @ONLY)
|
||||
|
||||
# Drive the download script at build time. Depend on 'install.xml'
|
||||
# to aqcuire new binaries when needed.
|
||||
add_custom_command(
|
||||
COMMENT "Obtaining prebuilt binaries..."
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/prepare/prebuilt
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/../install.xml
|
||||
${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
|
||||
)
|
||||
endif(NOT STANDALONE)
|
||||
# Drive the download script at build time. Depend on 'install.xml'
|
||||
# to aqcuire new binaries when needed.
|
||||
add_custom_command(
|
||||
COMMENT "Obtaining prebuilt binaries..."
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/prepare/prebuilt
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/../install.xml
|
||||
${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
|
||||
)
|
||||
|
||||
@@ -1,296 +1,313 @@
|
||||
# -*- cmake -*-
|
||||
#
|
||||
# Compilation options shared by all Second Life components.
|
||||
|
||||
include(Variables)
|
||||
|
||||
|
||||
# Portable compilation flags.
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=1 -DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2
|
||||
"-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=1 -DNDEBUG")
|
||||
#llimage now requires this (?)
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2
|
||||
"${CMAKE_CXX_FLAGS_RELEASESSE2}")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
"-DLL_RELEASE=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=0 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1")
|
||||
|
||||
# Don't bother with a MinSizeRel build.
|
||||
|
||||
set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;ReleaseSSE2;Debug" CACHE STRING
|
||||
"Supported build types." FORCE)
|
||||
|
||||
# Platform-specific compilation flags.
|
||||
|
||||
if (WINDOWS)
|
||||
# Don't build DLLs.
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd"
|
||||
CACHE STRING "C++ compiler debug options" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP"
|
||||
CACHE STRING "C++ compiler release-with-debug options" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /arch:SSE /fp:fast"
|
||||
CACHE STRING "C++ compiler release options" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE
|
||||
"${CMAKE_C_FLAGS_RELEASE} ${LL_C_FLAGS} /O2 /Zi /MD /MP /arch:SSE /fp:fast"
|
||||
CACHE STRING "C compiler release options" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2
|
||||
"${CMAKE_CXX_FLAGS_RELEASESSE2} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /arch:SSE2 /fp:fast"
|
||||
CACHE STRING "C++ compiler release-SSE2 options" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2
|
||||
"${CMAKE_C_FLAGS_RELEASESSE2} ${LL_C_FLAGS} /O2 /Zi /MD /MP /arch:SSE2 /fp:fast"
|
||||
CACHE STRING "C compiler release-SSE2 options" FORCE)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LARGEADDRESSAWARE")
|
||||
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "")
|
||||
|
||||
add_definitions(
|
||||
/DLL_WINDOWS=1
|
||||
/DUNICODE
|
||||
/D_UNICODE
|
||||
/GS
|
||||
/TP
|
||||
/W3
|
||||
/c
|
||||
/Zc:forScope
|
||||
/nologo
|
||||
/Oy-
|
||||
)
|
||||
|
||||
if(MSVC80 OR MSVC90 OR MSVC10)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
|
||||
CACHE STRING "C++ compiler release options" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2
|
||||
"${CMAKE_CXX_FLAGS_RELEASESSE2} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
|
||||
CACHE STRING "C++ compiler release-SSE2 options" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2
|
||||
"${CMAKE_CXX_FLAGS_RELEASESSE2} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
|
||||
CACHE STRING "C compiler release-SSE2 options" FORCE)
|
||||
add_definitions(
|
||||
/Zc:wchar_t-
|
||||
)
|
||||
endif (MSVC80 OR MSVC90 OR MSVC10)
|
||||
|
||||
# Are we using the crummy Visual Studio KDU build workaround?
|
||||
if (NOT VS_DISABLE_FATAL_WARNINGS)
|
||||
add_definitions(/WX)
|
||||
endif (NOT VS_DISABLE_FATAL_WARNINGS)
|
||||
|
||||
# Various libs are compiler specific, generate some variables here we can just use
|
||||
# when we require them instead of reimplementing the test each time.
|
||||
|
||||
if (MSVC71)
|
||||
set(MSVC_DIR 7.1)
|
||||
set(MSVC_SUFFIX 71)
|
||||
elseif (MSVC80)
|
||||
set(MSVC_DIR 8.0)
|
||||
set(MSVC_SUFFIX 80)
|
||||
elseif (MSVC90)
|
||||
set(MSVC_DIR 9.0)
|
||||
set(MSVC_SUFFIX 90)
|
||||
elseif (MSVC10)
|
||||
set(MSVC_DIR 10.0)
|
||||
set(MSVC_SUFFIX 100)
|
||||
endif (MSVC71)
|
||||
|
||||
endif (WINDOWS)
|
||||
|
||||
set (GCC_EXTRA_OPTIMIZATION "-ffast-math -frounding-math")
|
||||
|
||||
if (LINUX)
|
||||
set(CMAKE_SKIP_RPATH TRUE)
|
||||
|
||||
# Here's a giant hack for Fedora 8, where we can't use
|
||||
# _FORTIFY_SOURCE if we're using a compiler older than gcc 4.1.
|
||||
|
||||
find_program(GXX g++)
|
||||
mark_as_advanced(GXX)
|
||||
|
||||
if (GXX)
|
||||
execute_process(
|
||||
COMMAND ${GXX} --version
|
||||
COMMAND sed "s/^[gc+ ]*//"
|
||||
COMMAND head -1
|
||||
OUTPUT_VARIABLE GXX_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else (GXX)
|
||||
set(GXX_VERSION x)
|
||||
endif (GXX)
|
||||
|
||||
# The quoting hack here is necessary in case we're using distcc or
|
||||
# ccache as our compiler. CMake doesn't pass the command line
|
||||
# through the shell by default, so we end up trying to run "distcc"
|
||||
# " g++" - notice the leading space. Ugh.
|
||||
|
||||
execute_process(
|
||||
COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version"
|
||||
COMMAND sed "s/^[gc+ ]*//"
|
||||
COMMAND head -1
|
||||
OUTPUT_VARIABLE CXX_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if (${GXX_VERSION} STREQUAL ${CXX_VERSION})
|
||||
add_definitions(-D_FORTIFY_SOURCE=2)
|
||||
else (${GXX_VERSION} STREQUAL ${CXX_VERSION})
|
||||
if (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat")
|
||||
add_definitions(-D_FORTIFY_SOURCE=2)
|
||||
endif (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat")
|
||||
endif (${GXX_VERSION} STREQUAL ${CXX_VERSION})
|
||||
|
||||
#Lets actualy get a numerical version of gxx's version
|
||||
STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]).*" "\\1\\2\\3" CXX_VERSION ${CXX_VERSION})
|
||||
|
||||
#gcc 4.3 and above don't like the LL boost
|
||||
if(${CXX_VERSION} GREATER 429)
|
||||
add_definitions(-Wno-parentheses)
|
||||
endif (${CXX_VERSION} GREATER 429)
|
||||
|
||||
# End of hacks.
|
||||
|
||||
add_definitions(
|
||||
-DLL_LINUX=1
|
||||
-D_REENTRANT
|
||||
-fexceptions
|
||||
-fno-math-errno
|
||||
-fno-strict-aliasing
|
||||
-fsigned-char
|
||||
-g
|
||||
-pthread
|
||||
)
|
||||
|
||||
if (SERVER)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-60")
|
||||
if (EXISTS /etc/debian_version)
|
||||
FILE(READ /etc/debian_version DEBIAN_VERSION)
|
||||
else (EXISTS /etc/debian_version)
|
||||
set(DEBIAN_VERSION "")
|
||||
endif (EXISTS /etc/debian_version)
|
||||
|
||||
if (NOT DEBIAN_VERSION STREQUAL "3.1")
|
||||
add_definitions(-DCTYPE_WORKAROUND)
|
||||
endif (NOT DEBIAN_VERSION STREQUAL "3.1")
|
||||
|
||||
if (EXISTS /usr/lib/mysql4/mysql)
|
||||
link_directories(/usr/lib/mysql4/mysql)
|
||||
endif (EXISTS /usr/lib/mysql4/mysql)
|
||||
|
||||
add_definitions(
|
||||
-msse2
|
||||
-mfpmath=sse
|
||||
)
|
||||
endif (SERVER)
|
||||
|
||||
if (VIEWER)
|
||||
add_definitions(-DAPPID=secondlife)
|
||||
add_definitions(-fvisibility=hidden)
|
||||
# don't catch SIGCHLD in our base application class for the viewer - some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The viewer doesn't need to catch SIGCHLD anyway.
|
||||
add_definitions(-DLL_IGNORE_SIGCHLD)
|
||||
if (NOT STANDALONE)
|
||||
# this stops us requiring a really recent glibc at runtime
|
||||
add_definitions(-fno-stack-protector)
|
||||
endif (NOT STANDALONE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "${CMAKE_CXX_FLAGS_RELEASESSE2} -march=pentium4 -mfpmath=sse -msse2 ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "${CMAKE_C_FLAGS_RELEASESSE2} -march=pentium4 -mfpmath=sse -msse2 "${GCC_EXTRA_OPTIMIZATIONS})
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -march=pentium4 -mfpmath=sse -msse2 ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${CMAKE_C_FLAGS_RELWITHDEBINFO} -march=pentium4 -mfpmath=sse -msse2 "${GCC_EXTRA_OPTIMIZATIONS})
|
||||
endif (VIEWER)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "-O3 ${CMAKE_CXX_FLAGS_RELEASESSE2}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "-O3 ${CMAKE_C_FLAGS_RELEASESSE2}")
|
||||
endif (LINUX)
|
||||
|
||||
|
||||
if (DARWIN)
|
||||
add_definitions(-DLL_DARWIN=1)
|
||||
set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlong-branch")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-branch")
|
||||
# NOTE: it's critical that the optimization flag is put in front.
|
||||
# NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered.
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -03 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "${CMAKE_CXX_FLAGS_RELEASESSE2} -O3 -msse2 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "${CMAKE_C_FLAGS_RELEASESSE2} -03 -msse2 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
endif (DARWIN)
|
||||
|
||||
|
||||
if (LINUX OR DARWIN)
|
||||
set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs -Wno-non-virtual-dtor -Woverloaded-virtual")
|
||||
|
||||
if (NOT GCC_DISABLE_FATAL_WARNINGS)
|
||||
set(GCC_WARNINGS "${GCC_WARNINGS} -Werror")
|
||||
endif (NOT GCC_DISABLE_FATAL_WARNINGS)
|
||||
|
||||
set(GCC_CXX_WARNINGS "${GCC_WARNINGS} -Wno-reorder")
|
||||
|
||||
set(CMAKE_C_FLAGS "${GCC_WARNINGS} ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${GCC_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
if (WORD_SIZE EQUAL 32)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
|
||||
elseif (WORD_SIZE EQUAL 64)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
|
||||
endif (WORD_SIZE EQUAL 32)
|
||||
endif (LINUX OR DARWIN)
|
||||
|
||||
|
||||
if (STANDALONE)
|
||||
add_definitions(-DLL_STANDALONE=1)
|
||||
|
||||
if (LINUX AND ${ARCH} STREQUAL "i686")
|
||||
add_definitions(-march=pentiumpro)
|
||||
endif (LINUX AND ${ARCH} STREQUAL "i686")
|
||||
|
||||
else (STANDALONE)
|
||||
set(${ARCH}_linux_INCLUDES
|
||||
ELFIO
|
||||
atk-1.0
|
||||
glib-2.0
|
||||
gstreamer-0.10
|
||||
gtk-2.0
|
||||
llfreetype2
|
||||
pango-1.0
|
||||
)
|
||||
endif (STANDALONE)
|
||||
|
||||
if(1 EQUAL 1)
|
||||
add_definitions(-DOPENSIM_RULES=1)
|
||||
endif(1 EQUAL 1)
|
||||
|
||||
if(SERVER)
|
||||
include_directories(${LIBS_PREBUILT_DIR}/include/havok)
|
||||
endif(SERVER)
|
||||
|
||||
SET( CMAKE_EXE_LINKER_FLAGS_RELEASESSE2
|
||||
"${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING
|
||||
"Flags used for linking binaries under SSE2 build."
|
||||
FORCE )
|
||||
SET( CMAKE_SHARED_LINKER_FLAGS_RELEASESSE2
|
||||
"${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" CACHE STRING
|
||||
"Flags used by the shared libraries linker under SSE2 build."
|
||||
FORCE )
|
||||
MARK_AS_ADVANCED(
|
||||
CMAKE_CXX_FLAGS_RELEASESSE2
|
||||
CMAKE_C_FLAGS_RELEASESSE2
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASESSE2
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASESSE2 )
|
||||
# -*- cmake -*-
|
||||
#
|
||||
# Compilation options shared by all Second Life components.
|
||||
|
||||
include(Variables)
|
||||
|
||||
|
||||
# Portable compilation flags.
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=1 -DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2
|
||||
"-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=1 -DNDEBUG")
|
||||
#llimage now requires this (?)
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2
|
||||
"${CMAKE_CXX_FLAGS_RELEASESSE2}")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
"-DLL_RELEASE=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=0 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1")
|
||||
|
||||
# Don't bother with a MinSizeRel build.
|
||||
|
||||
set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;ReleaseSSE2;Debug" CACHE STRING
|
||||
"Supported build types." FORCE)
|
||||
|
||||
# Platform-specific compilation flags.
|
||||
|
||||
if (WINDOWS)
|
||||
# Don't build DLLs.
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd"
|
||||
CACHE STRING "C++ compiler debug options" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP"
|
||||
CACHE STRING "C++ compiler release-with-debug options" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /arch:SSE /fp:fast"
|
||||
CACHE STRING "C++ compiler release options" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE
|
||||
"${CMAKE_C_FLAGS_RELEASE} ${LL_C_FLAGS} /O2 /Zi /MD /MP /arch:SSE /fp:fast"
|
||||
CACHE STRING "C compiler release options" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2
|
||||
"${CMAKE_CXX_FLAGS_RELEASESSE2} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /arch:SSE2 /fp:fast"
|
||||
CACHE STRING "C++ compiler release-SSE2 options" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2
|
||||
"${CMAKE_C_FLAGS_RELEASESSE2} ${LL_C_FLAGS} /O2 /Zi /MD /MP /arch:SSE2 /fp:fast"
|
||||
CACHE STRING "C compiler release-SSE2 options" FORCE)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LARGEADDRESSAWARE")
|
||||
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "")
|
||||
|
||||
add_definitions(
|
||||
/DLL_WINDOWS=1
|
||||
/DUNICODE
|
||||
/D_UNICODE
|
||||
/GS
|
||||
/TP
|
||||
/W3
|
||||
/c
|
||||
/Zc:forScope
|
||||
/nologo
|
||||
/Oy-
|
||||
)
|
||||
|
||||
if(MSVC80 OR MSVC90 OR MSVC10)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
|
||||
CACHE STRING "C++ compiler release options" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2
|
||||
"${CMAKE_CXX_FLAGS_RELEASESSE2} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
|
||||
CACHE STRING "C++ compiler release-SSE2 options" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2
|
||||
"${CMAKE_CXX_FLAGS_RELEASESSE2} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
|
||||
CACHE STRING "C compiler release-SSE2 options" FORCE)
|
||||
add_definitions(
|
||||
/Zc:wchar_t-
|
||||
)
|
||||
endif (MSVC80 OR MSVC90 OR MSVC10)
|
||||
|
||||
# Are we using the crummy Visual Studio KDU build workaround?
|
||||
if (NOT VS_DISABLE_FATAL_WARNINGS)
|
||||
add_definitions(/WX)
|
||||
endif (NOT VS_DISABLE_FATAL_WARNINGS)
|
||||
|
||||
# Various libs are compiler specific, generate some variables here we can just use
|
||||
# when we require them instead of reimplementing the test each time.
|
||||
|
||||
if (MSVC71)
|
||||
set(MSVC_DIR 7.1)
|
||||
set(MSVC_SUFFIX 71)
|
||||
elseif (MSVC80)
|
||||
set(MSVC_DIR 8.0)
|
||||
set(MSVC_SUFFIX 80)
|
||||
elseif (MSVC90)
|
||||
set(MSVC_DIR 9.0)
|
||||
set(MSVC_SUFFIX 90)
|
||||
elseif (MSVC10)
|
||||
set(MSVC_DIR 10.0)
|
||||
set(MSVC_SUFFIX 100)
|
||||
endif (MSVC71)
|
||||
|
||||
if (MSVC10)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO")
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO")
|
||||
endif(MSVC10)
|
||||
|
||||
|
||||
endif (WINDOWS)
|
||||
|
||||
set (GCC_EXTRA_OPTIMIZATION "-ffast-math -frounding-math")
|
||||
|
||||
if (LINUX)
|
||||
set(CMAKE_SKIP_RPATH TRUE)
|
||||
|
||||
# Here's a giant hack for Fedora 8, where we can't use
|
||||
# _FORTIFY_SOURCE if we're using a compiler older than gcc 4.1.
|
||||
|
||||
find_program(GXX g++)
|
||||
mark_as_advanced(GXX)
|
||||
|
||||
if (GXX)
|
||||
execute_process(
|
||||
COMMAND ${GXX} --version
|
||||
COMMAND sed "s/^[gc+ ]*//"
|
||||
COMMAND head -1
|
||||
OUTPUT_VARIABLE GXX_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else (GXX)
|
||||
set(GXX_VERSION x)
|
||||
endif (GXX)
|
||||
|
||||
# The quoting hack here is necessary in case we're using distcc or
|
||||
# ccache as our compiler. CMake doesn't pass the command line
|
||||
# through the shell by default, so we end up trying to run "distcc"
|
||||
# " g++" - notice the leading space. Ugh.
|
||||
|
||||
execute_process(
|
||||
COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version"
|
||||
COMMAND sed "s/^[gc+ ]*//"
|
||||
COMMAND head -1
|
||||
OUTPUT_VARIABLE CXX_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if (${GXX_VERSION} STREQUAL ${CXX_VERSION})
|
||||
add_definitions(-D_FORTIFY_SOURCE=2)
|
||||
else (${GXX_VERSION} STREQUAL ${CXX_VERSION})
|
||||
if (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat")
|
||||
add_definitions(-D_FORTIFY_SOURCE=2)
|
||||
endif (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat")
|
||||
endif (${GXX_VERSION} STREQUAL ${CXX_VERSION})
|
||||
|
||||
#Lets actualy get a numerical version of gxx's version
|
||||
STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]).*" "\\1\\2\\3" CXX_VERSION ${CXX_VERSION})
|
||||
|
||||
#gcc 4.3 and above don't like the LL boost
|
||||
if(${CXX_VERSION} GREATER 429)
|
||||
add_definitions(-Wno-parentheses)
|
||||
endif (${CXX_VERSION} GREATER 429)
|
||||
|
||||
# End of hacks.
|
||||
|
||||
add_definitions(
|
||||
-DLL_LINUX=1
|
||||
-D_REENTRANT
|
||||
-fexceptions
|
||||
-fno-math-errno
|
||||
-fno-strict-aliasing
|
||||
-fsigned-char
|
||||
-g
|
||||
-pthread
|
||||
)
|
||||
|
||||
if (SERVER)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-60")
|
||||
if (EXISTS /etc/debian_version)
|
||||
FILE(READ /etc/debian_version DEBIAN_VERSION)
|
||||
else (EXISTS /etc/debian_version)
|
||||
set(DEBIAN_VERSION "")
|
||||
endif (EXISTS /etc/debian_version)
|
||||
|
||||
if (NOT DEBIAN_VERSION STREQUAL "3.1")
|
||||
add_definitions(-DCTYPE_WORKAROUND)
|
||||
endif (NOT DEBIAN_VERSION STREQUAL "3.1")
|
||||
|
||||
if (EXISTS /usr/lib/mysql4/mysql)
|
||||
link_directories(/usr/lib/mysql4/mysql)
|
||||
endif (EXISTS /usr/lib/mysql4/mysql)
|
||||
|
||||
add_definitions(
|
||||
-msse2
|
||||
-mfpmath=sse
|
||||
)
|
||||
endif (SERVER)
|
||||
|
||||
if (VIEWER)
|
||||
add_definitions(-DAPPID=secondlife)
|
||||
add_definitions(-fvisibility=hidden)
|
||||
# don't catch SIGCHLD in our base application class for the viewer - some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The viewer doesn't need to catch SIGCHLD anyway.
|
||||
add_definitions(-DLL_IGNORE_SIGCHLD)
|
||||
if (NOT STANDALONE)
|
||||
# this stops us requiring a really recent glibc at runtime
|
||||
add_definitions(-fno-stack-protector)
|
||||
endif (NOT STANDALONE)
|
||||
if (${ARCH} STREQUAL "x86_64")
|
||||
add_definitions(-DLINUX64=1 -pipe)
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "${CMAKE_CXX_FLAGS_RELEASESSE2} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "${CMAKE_C_FLAGS_RELEASESSE2} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
||||
else (${ARCH} STREQUAL "x86_64")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "${CMAKE_CXX_FLAGS_RELEASESSE2} -march=pentium4 -mfpmath=sse -msse2 ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "${CMAKE_C_FLAGS_RELEASESSE2} -march=pentium4 -mfpmath=sse -msse2 "${GCC_EXTRA_OPTIMIZATIONS})
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -march=pentium4 -mfpmath=sse -msse2 ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -march=pentium4 -mfpmath=sse -msse2 "${GCC_EXTRA_OPTIMIZATIONS})
|
||||
endif (${ARCH} STREQUAL "x86_64")
|
||||
endif (VIEWER)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "-O3 ${CMAKE_CXX_FLAGS_RELEASESSE2}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "-O3 ${CMAKE_C_FLAGS_RELEASESSE2}")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
endif (LINUX)
|
||||
|
||||
|
||||
if (DARWIN)
|
||||
add_definitions(-DLL_DARWIN=1)
|
||||
set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlong-branch")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-branch")
|
||||
# NOTE: it's critical that the optimization flag is put in front.
|
||||
# NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered.
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -03 -msse3 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "${CMAKE_CXX_FLAGS_RELEASESSE2} -O3 -msse2 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "${CMAKE_C_FLAGS_RELEASESSE2} -03 -msse2 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
endif (DARWIN)
|
||||
|
||||
|
||||
if (LINUX OR DARWIN)
|
||||
set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs -Wno-non-virtual-dtor -Woverloaded-virtual")
|
||||
|
||||
if (NOT GCC_DISABLE_FATAL_WARNINGS)
|
||||
set(GCC_WARNINGS "${GCC_WARNINGS} -Werror")
|
||||
endif (NOT GCC_DISABLE_FATAL_WARNINGS)
|
||||
|
||||
set(GCC_CXX_WARNINGS "${GCC_WARNINGS} -Wno-reorder")
|
||||
|
||||
set(CMAKE_C_FLAGS "${GCC_WARNINGS} ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${GCC_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
if (WORD_SIZE EQUAL 32)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
|
||||
elseif (WORD_SIZE EQUAL 64)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
|
||||
endif (WORD_SIZE EQUAL 32)
|
||||
endif (LINUX OR DARWIN)
|
||||
|
||||
|
||||
if (STANDALONE)
|
||||
add_definitions(-DLL_STANDALONE=1)
|
||||
|
||||
if (LINUX AND ${ARCH} STREQUAL "i686")
|
||||
add_definitions(-march=pentiumpro)
|
||||
endif (LINUX AND ${ARCH} STREQUAL "i686")
|
||||
|
||||
else (STANDALONE)
|
||||
set(${ARCH}_linux_INCLUDES
|
||||
ELFIO
|
||||
atk-1.0
|
||||
glib-2.0
|
||||
gstreamer-0.10
|
||||
gtk-2.0
|
||||
llfreetype2
|
||||
pango-1.0
|
||||
)
|
||||
endif (STANDALONE)
|
||||
|
||||
if(1 EQUAL 1)
|
||||
add_definitions(-DOPENSIM_RULES=1)
|
||||
endif(1 EQUAL 1)
|
||||
|
||||
if(SERVER)
|
||||
include_directories(${LIBS_PREBUILT_DIR}/include/havok)
|
||||
endif(SERVER)
|
||||
|
||||
SET( CMAKE_EXE_LINKER_FLAGS_RELEASESSE2
|
||||
"${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING
|
||||
"Flags used for linking binaries under SSE2 build."
|
||||
FORCE )
|
||||
SET( CMAKE_SHARED_LINKER_FLAGS_RELEASESSE2
|
||||
"${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" CACHE STRING
|
||||
"Flags used by the shared libraries linker under SSE2 build."
|
||||
FORCE )
|
||||
MARK_AS_ADVANCED(
|
||||
CMAKE_CXX_FLAGS_RELEASESSE2
|
||||
CMAKE_C_FLAGS_RELEASESSE2
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASESSE2
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASESSE2 )
|
||||
|
||||
@@ -14,16 +14,18 @@ else (STANDALONE)
|
||||
use_prebuilt_binary(apr_suite)
|
||||
if (WINDOWS)
|
||||
set(APR_LIBRARIES
|
||||
debug ${ARCH_PREBUILT_DIRS_DEBUG}/apr-1.lib
|
||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/apr-1.lib
|
||||
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libapr-1.lib
|
||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.lib
|
||||
)
|
||||
set(APRICONV_LIBRARIES
|
||||
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libapriconv-1.lib
|
||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libapriconv-1.lib
|
||||
)
|
||||
# Doesn't need to link with iconv.dll
|
||||
set(APRICONV_LIBRARIES "")
|
||||
set(APRUTIL_LIBRARIES
|
||||
debug ${ARCH_PREBUILT_DIRS_DEBUG}/aprutil-1.lib
|
||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/aprutil-1.lib
|
||||
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libaprutil-1.lib ${APRICONV_LIBRARIES}
|
||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.lib ${APRICONV_LIBRARIES}
|
||||
)
|
||||
elseif (DARWIN)
|
||||
set(APR_LIBRARIES
|
||||
@@ -41,9 +43,8 @@ else (STANDALONE)
|
||||
set(APRICONV_LIBRARIES iconv)
|
||||
endif (WINDOWS)
|
||||
set(APR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/apr-1)
|
||||
set(APRUTIL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/apr-1)
|
||||
|
||||
if (LINUX AND VIEWER)
|
||||
list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES} uuid)
|
||||
list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES})
|
||||
endif (LINUX AND VIEWER)
|
||||
endif (STANDALONE)
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
|
||||
set(Boost_FIND_QUIETLY ON)
|
||||
set(Boost_FIND_REQUIRED ON)
|
||||
|
||||
if (STANDALONE)
|
||||
include(FindBoost)
|
||||
|
||||
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
|
||||
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
|
||||
set(BOOST_REGEX_LIBRARY boost_regex-mt)
|
||||
set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
|
||||
set(BOOST_SYSTEM_LIBRARY boost_system-mt)
|
||||
else (STANDALONE)
|
||||
use_prebuilt_binary(boost)
|
||||
set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
|
||||
|
||||
if (WINDOWS)
|
||||
set(BOOST_VERSION 1_45)
|
||||
|
||||
# SNOW-788
|
||||
# 00-Common.cmake alreay sets MSVC_SUFFIX to be correct for the VS we are using eg VC71, VC80, VC90 etc
|
||||
# The precompiled boost libs for VC71 use a different suffix to VS80 and VS90
|
||||
# This code should ensure the cmake rules are valid for any VS being used in future as long as the approprate
|
||||
# boost libs are avaiable - RC.
|
||||
|
||||
if (MSVC71)
|
||||
set(BOOST_OPTIM_SUFFIX mt-s)
|
||||
set(BOOST_DEBUG_SUFFIX mt-sgd)
|
||||
else (MSVC71)
|
||||
set(BOOST_OPTIM_SUFFIX mt)
|
||||
set(BOOST_DEBUG_SUFFIX mt-gd)
|
||||
endif (MSVC71)
|
||||
|
||||
set(BOOST_PROGRAM_OPTIONS_LIBRARY
|
||||
optimized libboost_program_options-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
|
||||
debug libboost_program_options-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
|
||||
set(BOOST_REGEX_LIBRARY
|
||||
optimized libboost_regex-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
|
||||
debug libboost_regex-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
|
||||
set(BOOST_SIGNALS_LIBRARY
|
||||
optimized libboost_signals-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
|
||||
debug libboost_signals-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
|
||||
|
||||
elseif (DARWIN)
|
||||
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
|
||||
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
|
||||
set(BOOST_REGEX_LIBRARY boost_regex-mt)
|
||||
set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
|
||||
set(BOOST_SYSTEM_LIBRARY boost_system-mt)
|
||||
elseif (LINUX)
|
||||
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
|
||||
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
|
||||
set(BOOST_REGEX_LIBRARY boost_regex-mt)
|
||||
set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
|
||||
set(BOOST_SYSTEM_LIBRARY boost_system-mt)
|
||||
endif (WINDOWS)
|
||||
endif (STANDALONE)
|
||||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
|
||||
set(Boost_FIND_QUIETLY ON)
|
||||
set(Boost_FIND_REQUIRED ON)
|
||||
|
||||
if (STANDALONE)
|
||||
include(FindBoost)
|
||||
|
||||
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
|
||||
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
|
||||
set(BOOST_REGEX_LIBRARY boost_regex-mt)
|
||||
set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
|
||||
set(BOOST_SYSTEM_LIBRARY boost_system-mt)
|
||||
else (STANDALONE)
|
||||
use_prebuilt_binary(boost)
|
||||
set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
|
||||
|
||||
if (WINDOWS)
|
||||
set(BOOST_VERSION 1_45)
|
||||
|
||||
# SNOW-788
|
||||
# 00-Common.cmake alreay sets MSVC_SUFFIX to be correct for the VS we are using eg VC71, VC80, VC90 etc
|
||||
# The precompiled boost libs for VC71 use a different suffix to VS80 and VS90
|
||||
# This code should ensure the cmake rules are valid for any VS being used in future as long as the approprate
|
||||
# boost libs are avaiable - RC.
|
||||
|
||||
if (MSVC71)
|
||||
set(BOOST_OPTIM_SUFFIX mt-s)
|
||||
set(BOOST_DEBUG_SUFFIX mt-sgd)
|
||||
else (MSVC71)
|
||||
set(BOOST_OPTIM_SUFFIX mt)
|
||||
set(BOOST_DEBUG_SUFFIX mt-gd)
|
||||
endif (MSVC71)
|
||||
|
||||
set(BOOST_PROGRAM_OPTIONS_LIBRARY
|
||||
optimized libboost_program_options-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
|
||||
debug libboost_program_options-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
|
||||
set(BOOST_REGEX_LIBRARY
|
||||
optimized libboost_regex-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
|
||||
debug libboost_regex-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
|
||||
set(BOOST_SIGNALS_LIBRARY
|
||||
optimized libboost_signals-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
|
||||
debug libboost_signals-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
|
||||
|
||||
elseif (DARWIN)
|
||||
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
|
||||
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
|
||||
set(BOOST_REGEX_LIBRARY boost_regex-mt)
|
||||
set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
|
||||
set(BOOST_SYSTEM_LIBRARY boost_system-mt)
|
||||
elseif (LINUX)
|
||||
set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
|
||||
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
|
||||
set(BOOST_REGEX_LIBRARY boost_regex-mt)
|
||||
set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
|
||||
set(BOOST_SYSTEM_LIBRARY boost_system-mt)
|
||||
endif (WINDOWS)
|
||||
endif (STANDALONE)
|
||||
|
||||
@@ -28,17 +28,18 @@ set(cmake_SOURCE_FILES
|
||||
FindCARes.cmake
|
||||
FindELFIO.cmake
|
||||
FindGooglePerfTools.cmake
|
||||
FindHunSpell.cmake
|
||||
FindMono.cmake
|
||||
FindMT.cmake
|
||||
FindMySQL.cmake
|
||||
FindNDOF.cmake
|
||||
FindOpenJPEG.cmake
|
||||
FindXmlRpcEpi.cmake
|
||||
FindZLIB.cmake
|
||||
FMOD.cmake
|
||||
FreeType.cmake
|
||||
GStreamer010Plugin.cmake
|
||||
GooglePerfTools.cmake
|
||||
HUNSPELL.cmake
|
||||
JPEG.cmake
|
||||
LLAddBuildTest.cmake
|
||||
LLAudio.cmake
|
||||
|
||||
@@ -1,487 +1,489 @@
|
||||
# -*- cmake -*-
|
||||
|
||||
# The copy_win_libs folder contains file lists and a script used to
|
||||
# copy dlls, exes and such needed to run the SecondLife from within
|
||||
# VisualStudio.
|
||||
|
||||
include(CMakeCopyIfDifferent)
|
||||
|
||||
set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-win32")
|
||||
set(vivox_files
|
||||
SLVoice.exe
|
||||
alut.dll
|
||||
vivoxsdk.dll
|
||||
ortp.dll
|
||||
wrap_oal.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${vivox_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Debug"
|
||||
out_targets
|
||||
${vivox_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
|
||||
set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
|
||||
set(debug_files
|
||||
libapr-1.dll
|
||||
libaprutil-1.dll
|
||||
libapriconv-1.dll
|
||||
)
|
||||
|
||||
copy_if_different(
|
||||
${debug_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Debug"
|
||||
out_targets
|
||||
${debug_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Debug config runtime files required for the plugin test mule
|
||||
set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
|
||||
set(plugintest_debug_files
|
||||
libeay32.dll
|
||||
libglib-2.0-0.dll
|
||||
libgmodule-2.0-0.dll
|
||||
libgobject-2.0-0.dll
|
||||
libgthread-2.0-0.dll
|
||||
qtcored4.dll
|
||||
qtguid4.dll
|
||||
qtnetworkd4.dll
|
||||
qtopengld4.dll
|
||||
qtwebkitd4.dll
|
||||
ssleay32.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugintest_debug_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/Debug"
|
||||
out_targets
|
||||
${plugintest_debug_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Debug config runtime files required for the plugin test mule (Qt image format plugins)
|
||||
set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug/imageformats")
|
||||
set(plugintest_debug_files
|
||||
qgifd4.dll
|
||||
qicod4.dll
|
||||
qjpegd4.dll
|
||||
qmngd4.dll
|
||||
qsvgd4.dll
|
||||
qtiffd4.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugintest_debug_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/Debug/imageformats"
|
||||
out_targets
|
||||
${plugintest_debug_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_debug_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/llplugin/imageformats"
|
||||
out_targets
|
||||
${plugintest_debug_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Release & ReleaseDebInfo config runtime files required for the plugin test mule
|
||||
set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
|
||||
set(plugintest_release_files
|
||||
libeay32.dll
|
||||
libglib-2.0-0.dll
|
||||
libgmodule-2.0-0.dll
|
||||
libgobject-2.0-0.dll
|
||||
libgthread-2.0-0.dll
|
||||
# llkdu.dll (not required for plugin test)
|
||||
qtcore4.dll
|
||||
qtgui4.dll
|
||||
qtnetwork4.dll
|
||||
qtopengl4.dll
|
||||
qtwebkit4.dll
|
||||
ssleay32.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/Release"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/ReleaseSSE2"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/RelWithDebInfo"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins)
|
||||
set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release/imageformats")
|
||||
set(plugintest_release_files
|
||||
qgif4.dll
|
||||
qico4.dll
|
||||
qjpeg4.dll
|
||||
qmng4.dll
|
||||
qsvg4.dll
|
||||
qtiff4.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/Release/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/ReleaseSSE2/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/RelWithDebInfo/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Release/llplugin/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/llplugin/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/llplugin/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Debug config runtime files required for the plugins
|
||||
set(plugins_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
|
||||
set(plugins_debug_files
|
||||
libeay32.dll
|
||||
qtcored4.dll
|
||||
qtguid4.dll
|
||||
qtnetworkd4.dll
|
||||
qtopengld4.dll
|
||||
qtwebkitd4.dll
|
||||
ssleay32.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugins_debug_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Debug/llplugin"
|
||||
out_targets
|
||||
${plugins_debug_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Release & ReleaseDebInfo config runtime files required for the plugins
|
||||
set(plugins_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
|
||||
set(plugins_release_files
|
||||
libeay32.dll
|
||||
qtcore4.dll
|
||||
qtgui4.dll
|
||||
qtnetwork4.dll
|
||||
qtopengl4.dll
|
||||
qtwebkit4.dll
|
||||
ssleay32.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugins_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Release/llplugin"
|
||||
out_targets
|
||||
${plugins_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugins_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/llplugin"
|
||||
out_targets
|
||||
${plugins_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugins_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/llplugin"
|
||||
out_targets
|
||||
${plugins_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
|
||||
set(release_files
|
||||
libtcmalloc_minimal.dll
|
||||
fmod.dll
|
||||
libapr-1.dll
|
||||
libaprutil-1.dll
|
||||
libapriconv-1.dll
|
||||
)
|
||||
|
||||
copy_if_different(
|
||||
${release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Release"
|
||||
out_targets
|
||||
${release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${vivox_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Release"
|
||||
out_targets
|
||||
${vivox_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2"
|
||||
out_targets
|
||||
${release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${vivox_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2"
|
||||
out_targets
|
||||
${vivox_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
|
||||
out_targets
|
||||
${release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${vivox_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
|
||||
out_targets
|
||||
${vivox_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
|
||||
if(EXISTS ${internal_llkdu_path})
|
||||
set(internal_llkdu_src "${CMAKE_BINARY_DIR}/llkdu/${CMAKE_CFG_INTDIR}/llkdu.dll")
|
||||
set(llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llkdu.dll")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${llkdu_dst}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${internal_llkdu_src} ${llkdu_dst}
|
||||
DEPENDS ${internal_llkdu_src}
|
||||
COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
|
||||
)
|
||||
set(all_targets ${all_targets} ${llkdu_dst})
|
||||
else(EXISTS ${internal_llkdu_path})
|
||||
if (EXISTS "${debug_src_dir}/llkdu.dll")
|
||||
set(debug_llkdu_src "${debug_src_dir}/llkdu.dll")
|
||||
set(debug_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/Debug/llkdu.dll")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${debug_llkdu_dst}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${debug_llkdu_src} ${debug_llkdu_dst}
|
||||
DEPENDS ${debug_llkdu_src}
|
||||
COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/Debug"
|
||||
)
|
||||
set(all_targets ${all_targets} ${debug_llkdu_dst})
|
||||
endif (EXISTS "${debug_src_dir}/llkdu.dll")
|
||||
|
||||
if (EXISTS "${release_src_dir}/llkdu.dll")
|
||||
set(release_llkdu_src "${release_src_dir}/llkdu.dll")
|
||||
set(release_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/Release/llkdu.dll")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${release_llkdu_dst}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${release_llkdu_dst}
|
||||
DEPENDS ${release_llkdu_src}
|
||||
COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/Release"
|
||||
)
|
||||
set(all_targets ${all_targets} ${release_llkdu_dst})
|
||||
|
||||
set(releasesse2_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/llkdu.dll")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${releasesse2_llkdu_dst}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${releasesse2_llkdu_dst}
|
||||
DEPENDS ${release_llkdu_src}
|
||||
COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2"
|
||||
)
|
||||
set(all_targets ${all_targets} ${releasesse2_llkdu_dst})
|
||||
|
||||
set(relwithdebinfo_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/llkdu.dll")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${relwithdebinfo_llkdu_dst}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${relwithdebinfo_llkdu_dst}
|
||||
DEPENDS ${release_llkdu_src}
|
||||
COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
|
||||
)
|
||||
set(all_targets ${all_targets} ${relwithdebinfo_llkdu_dst})
|
||||
endif (EXISTS "${release_src_dir}/llkdu.dll")
|
||||
|
||||
endif (EXISTS ${internal_llkdu_path})
|
||||
|
||||
# Copy MS C runtime dlls, required for packaging.
|
||||
# *TODO - Adapt this to support VC9
|
||||
if (MSVC80)
|
||||
FIND_PATH(debug_msvc8_redist_path msvcr80d.dll
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/Debug_NonRedist/x86/Microsoft.VC80.DebugCRT
|
||||
NO_DEFAULT_PATH
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(EXISTS ${debug_msvc8_redist_path})
|
||||
set(debug_msvc8_files
|
||||
msvcr80d.dll
|
||||
msvcp80d.dll
|
||||
Microsoft.VC80.DebugCRT.manifest
|
||||
)
|
||||
|
||||
copy_if_different(
|
||||
${debug_msvc8_redist_path}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Debug"
|
||||
out_targets
|
||||
${debug_msvc8_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
set(debug_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/Debug/${VIEWER_BINARY_NAME}.exe.config)
|
||||
add_custom_command(
|
||||
OUTPUT ${debug_appconfig_file}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Debug/Microsoft.VC80.DebugCRT.manifest
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SecondLifeDebug.exe.config
|
||||
${debug_appconfig_file}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Debug/Microsoft.VC80.DebugCRT.manifest
|
||||
COMMENT "Creating debug app config file"
|
||||
)
|
||||
|
||||
endif (EXISTS ${debug_msvc8_redist_path})
|
||||
|
||||
FIND_PATH(release_msvc8_redist_path msvcr80.dll
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/x86/Microsoft.VC80.CRT
|
||||
NO_DEFAULT_PATH
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(EXISTS ${release_msvc8_redist_path})
|
||||
set(release_msvc8_files
|
||||
msvcr80.dll
|
||||
msvcp80.dll
|
||||
Microsoft.VC80.CRT.manifest
|
||||
)
|
||||
|
||||
copy_if_different(
|
||||
${release_msvc8_redist_path}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Release"
|
||||
out_targets
|
||||
${release_msvc8_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${release_msvc8_redist_path}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2"
|
||||
out_targets
|
||||
${release_msvc8_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${release_msvc8_redist_path}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
|
||||
out_targets
|
||||
${release_msvc8_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
set(release_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/Release/${VIEWER_BINARY_NAME}.exe.config)
|
||||
add_custom_command(
|
||||
OUTPUT ${release_appconfig_file}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Release/Microsoft.VC80.CRT.manifest
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SecondLife.exe.config
|
||||
${release_appconfig_file}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Release/Microsoft.VC80.CRT.manifest
|
||||
COMMENT "Creating release app config file"
|
||||
)
|
||||
|
||||
set(releasesse2_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/${VIEWER_BINARY_NAME}.exe.config)
|
||||
add_custom_command(
|
||||
OUTPUT ${releasesse2_appconfig_file}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/Microsoft.VC80.CRT.manifest
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SecondLife.exe.config
|
||||
${releasesse2_appconfig_file}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/Microsoft.VC80.CRT.manifest
|
||||
COMMENT "Creating release-sse2 app config file"
|
||||
)
|
||||
|
||||
set(relwithdebinfo_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/${VIEWER_BINARY_NAME}.exe.config)
|
||||
add_custom_command(
|
||||
OUTPUT ${relwithdebinfo_appconfig_file}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SecondLife.exe.config
|
||||
${relwithdebinfo_appconfig_file}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest
|
||||
COMMENT "Creating relwithdebinfo app config file"
|
||||
)
|
||||
|
||||
endif (EXISTS ${release_msvc8_redist_path})
|
||||
endif (MSVC80)
|
||||
|
||||
add_custom_target(copy_win_libs ALL
|
||||
DEPENDS
|
||||
${all_targets}
|
||||
${release_appconfig_file}
|
||||
${releasesse2_appconfig_file}
|
||||
${relwithdebinfo_appconfig_file}
|
||||
${debug_appconfig_file}
|
||||
)
|
||||
add_dependencies(copy_win_libs prepare)
|
||||
|
||||
if(EXISTS ${internal_llkdu_path})
|
||||
add_dependencies(copy_win_libs llkdu)
|
||||
endif(EXISTS ${internal_llkdu_path})
|
||||
# -*- cmake -*-
|
||||
|
||||
# The copy_win_libs folder contains file lists and a script used to
|
||||
# copy dlls, exes and such needed to run the SecondLife from within
|
||||
# VisualStudio.
|
||||
|
||||
include(CMakeCopyIfDifferent)
|
||||
|
||||
set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-win32")
|
||||
set(vivox_files
|
||||
SLVoice.exe
|
||||
alut.dll
|
||||
vivoxsdk.dll
|
||||
ortp.dll
|
||||
wrap_oal.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${vivox_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Debug"
|
||||
out_targets
|
||||
${vivox_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
|
||||
set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
|
||||
set(debug_files
|
||||
libhunspell.dll
|
||||
libapr-1.dll
|
||||
libaprutil-1.dll
|
||||
libapriconv-1.dll
|
||||
)
|
||||
|
||||
copy_if_different(
|
||||
${debug_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Debug"
|
||||
out_targets
|
||||
${debug_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Debug config runtime files required for the plugin test mule
|
||||
set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
|
||||
set(plugintest_debug_files
|
||||
libeay32.dll
|
||||
libglib-2.0-0.dll
|
||||
libgmodule-2.0-0.dll
|
||||
libgobject-2.0-0.dll
|
||||
libgthread-2.0-0.dll
|
||||
qtcored4.dll
|
||||
qtguid4.dll
|
||||
qtnetworkd4.dll
|
||||
qtopengld4.dll
|
||||
qtwebkitd4.dll
|
||||
ssleay32.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugintest_debug_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/Debug"
|
||||
out_targets
|
||||
${plugintest_debug_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Debug config runtime files required for the plugin test mule (Qt image format plugins)
|
||||
set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug/imageformats")
|
||||
set(plugintest_debug_files
|
||||
qgifd4.dll
|
||||
qicod4.dll
|
||||
qjpegd4.dll
|
||||
qmngd4.dll
|
||||
qsvgd4.dll
|
||||
qtiffd4.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugintest_debug_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/Debug/imageformats"
|
||||
out_targets
|
||||
${plugintest_debug_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_debug_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/llplugin/imageformats"
|
||||
out_targets
|
||||
${plugintest_debug_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Release & ReleaseDebInfo config runtime files required for the plugin test mule
|
||||
set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
|
||||
set(plugintest_release_files
|
||||
libeay32.dll
|
||||
libglib-2.0-0.dll
|
||||
libgmodule-2.0-0.dll
|
||||
libgobject-2.0-0.dll
|
||||
libgthread-2.0-0.dll
|
||||
# llkdu.dll (not required for plugin test)
|
||||
qtcore4.dll
|
||||
qtgui4.dll
|
||||
qtnetwork4.dll
|
||||
qtopengl4.dll
|
||||
qtwebkit4.dll
|
||||
ssleay32.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/Release"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/ReleaseSSE2"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/RelWithDebInfo"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins)
|
||||
set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release/imageformats")
|
||||
set(plugintest_release_files
|
||||
qgif4.dll
|
||||
qico4.dll
|
||||
qjpeg4.dll
|
||||
qmng4.dll
|
||||
qsvg4.dll
|
||||
qtiff4.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/Release/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/ReleaseSSE2/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/RelWithDebInfo/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Release/llplugin/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/llplugin/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugintest_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/llplugin/imageformats"
|
||||
out_targets
|
||||
${plugintest_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Debug config runtime files required for the plugins
|
||||
set(plugins_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
|
||||
set(plugins_debug_files
|
||||
libeay32.dll
|
||||
qtcored4.dll
|
||||
qtguid4.dll
|
||||
qtnetworkd4.dll
|
||||
qtopengld4.dll
|
||||
qtwebkitd4.dll
|
||||
ssleay32.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugins_debug_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Debug/llplugin"
|
||||
out_targets
|
||||
${plugins_debug_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
# Release & ReleaseDebInfo config runtime files required for the plugins
|
||||
set(plugins_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
|
||||
set(plugins_release_files
|
||||
libeay32.dll
|
||||
qtcore4.dll
|
||||
qtgui4.dll
|
||||
qtnetwork4.dll
|
||||
qtopengl4.dll
|
||||
qtwebkit4.dll
|
||||
ssleay32.dll
|
||||
)
|
||||
copy_if_different(
|
||||
${plugins_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Release/llplugin"
|
||||
out_targets
|
||||
${plugins_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugins_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/llplugin"
|
||||
out_targets
|
||||
${plugins_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${plugins_release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/llplugin"
|
||||
out_targets
|
||||
${plugins_release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
|
||||
set(release_files
|
||||
libtcmalloc_minimal.dll
|
||||
fmod.dll
|
||||
libhunspell.dll
|
||||
libapr-1.dll
|
||||
libaprutil-1.dll
|
||||
libapriconv-1.dll
|
||||
)
|
||||
|
||||
copy_if_different(
|
||||
${release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Release"
|
||||
out_targets
|
||||
${release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${vivox_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Release"
|
||||
out_targets
|
||||
${vivox_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2"
|
||||
out_targets
|
||||
${release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${vivox_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2"
|
||||
out_targets
|
||||
${vivox_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${release_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
|
||||
out_targets
|
||||
${release_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${vivox_src_dir}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
|
||||
out_targets
|
||||
${vivox_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
|
||||
if(EXISTS ${internal_llkdu_path})
|
||||
set(internal_llkdu_src "${CMAKE_BINARY_DIR}/llkdu/${CMAKE_CFG_INTDIR}/llkdu.dll")
|
||||
set(llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llkdu.dll")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${llkdu_dst}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${internal_llkdu_src} ${llkdu_dst}
|
||||
DEPENDS ${internal_llkdu_src}
|
||||
COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
|
||||
)
|
||||
set(all_targets ${all_targets} ${llkdu_dst})
|
||||
else(EXISTS ${internal_llkdu_path})
|
||||
if (EXISTS "${debug_src_dir}/llkdu.dll")
|
||||
set(debug_llkdu_src "${debug_src_dir}/llkdu.dll")
|
||||
set(debug_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/Debug/llkdu.dll")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${debug_llkdu_dst}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${debug_llkdu_src} ${debug_llkdu_dst}
|
||||
DEPENDS ${debug_llkdu_src}
|
||||
COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/Debug"
|
||||
)
|
||||
set(all_targets ${all_targets} ${debug_llkdu_dst})
|
||||
endif (EXISTS "${debug_src_dir}/llkdu.dll")
|
||||
|
||||
if (EXISTS "${release_src_dir}/llkdu.dll")
|
||||
set(release_llkdu_src "${release_src_dir}/llkdu.dll")
|
||||
set(release_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/Release/llkdu.dll")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${release_llkdu_dst}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${release_llkdu_dst}
|
||||
DEPENDS ${release_llkdu_src}
|
||||
COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/Release"
|
||||
)
|
||||
set(all_targets ${all_targets} ${release_llkdu_dst})
|
||||
|
||||
set(releasesse2_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/llkdu.dll")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${releasesse2_llkdu_dst}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${releasesse2_llkdu_dst}
|
||||
DEPENDS ${release_llkdu_src}
|
||||
COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2"
|
||||
)
|
||||
set(all_targets ${all_targets} ${releasesse2_llkdu_dst})
|
||||
|
||||
set(relwithdebinfo_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/llkdu.dll")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${relwithdebinfo_llkdu_dst}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${relwithdebinfo_llkdu_dst}
|
||||
DEPENDS ${release_llkdu_src}
|
||||
COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
|
||||
)
|
||||
set(all_targets ${all_targets} ${relwithdebinfo_llkdu_dst})
|
||||
endif (EXISTS "${release_src_dir}/llkdu.dll")
|
||||
|
||||
endif (EXISTS ${internal_llkdu_path})
|
||||
|
||||
# Copy MS C runtime dlls, required for packaging.
|
||||
# *TODO - Adapt this to support VC9
|
||||
if (MSVC80)
|
||||
FIND_PATH(debug_msvc8_redist_path msvcr80d.dll
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/Debug_NonRedist/x86/Microsoft.VC80.DebugCRT
|
||||
NO_DEFAULT_PATH
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(EXISTS ${debug_msvc8_redist_path})
|
||||
set(debug_msvc8_files
|
||||
msvcr80d.dll
|
||||
msvcp80d.dll
|
||||
Microsoft.VC80.DebugCRT.manifest
|
||||
)
|
||||
|
||||
copy_if_different(
|
||||
${debug_msvc8_redist_path}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Debug"
|
||||
out_targets
|
||||
${debug_msvc8_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
set(debug_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/Debug/${VIEWER_BINARY_NAME}.exe.config)
|
||||
add_custom_command(
|
||||
OUTPUT ${debug_appconfig_file}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Debug/Microsoft.VC80.DebugCRT.manifest
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SecondLifeDebug.exe.config
|
||||
${debug_appconfig_file}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Debug/Microsoft.VC80.DebugCRT.manifest
|
||||
COMMENT "Creating debug app config file"
|
||||
)
|
||||
|
||||
endif (EXISTS ${debug_msvc8_redist_path})
|
||||
|
||||
FIND_PATH(release_msvc8_redist_path msvcr80.dll
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/x86/Microsoft.VC80.CRT
|
||||
NO_DEFAULT_PATH
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(EXISTS ${release_msvc8_redist_path})
|
||||
set(release_msvc8_files
|
||||
msvcr80.dll
|
||||
msvcp80.dll
|
||||
Microsoft.VC80.CRT.manifest
|
||||
)
|
||||
|
||||
copy_if_different(
|
||||
${release_msvc8_redist_path}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Release"
|
||||
out_targets
|
||||
${release_msvc8_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${release_msvc8_redist_path}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2"
|
||||
out_targets
|
||||
${release_msvc8_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
copy_if_different(
|
||||
${release_msvc8_redist_path}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
|
||||
out_targets
|
||||
${release_msvc8_files}
|
||||
)
|
||||
set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
set(release_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/Release/${VIEWER_BINARY_NAME}.exe.config)
|
||||
add_custom_command(
|
||||
OUTPUT ${release_appconfig_file}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Release/Microsoft.VC80.CRT.manifest
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SecondLife.exe.config
|
||||
${release_appconfig_file}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Release/Microsoft.VC80.CRT.manifest
|
||||
COMMENT "Creating release app config file"
|
||||
)
|
||||
|
||||
set(releasesse2_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/${VIEWER_BINARY_NAME}.exe.config)
|
||||
add_custom_command(
|
||||
OUTPUT ${releasesse2_appconfig_file}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/Microsoft.VC80.CRT.manifest
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SecondLife.exe.config
|
||||
${releasesse2_appconfig_file}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/Microsoft.VC80.CRT.manifest
|
||||
COMMENT "Creating release-sse2 app config file"
|
||||
)
|
||||
|
||||
set(relwithdebinfo_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/${VIEWER_BINARY_NAME}.exe.config)
|
||||
add_custom_command(
|
||||
OUTPUT ${relwithdebinfo_appconfig_file}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SecondLife.exe.config
|
||||
${relwithdebinfo_appconfig_file}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest
|
||||
COMMENT "Creating relwithdebinfo app config file"
|
||||
)
|
||||
|
||||
endif (EXISTS ${release_msvc8_redist_path})
|
||||
endif (MSVC80)
|
||||
|
||||
add_custom_target(copy_win_libs ALL
|
||||
DEPENDS
|
||||
${all_targets}
|
||||
${release_appconfig_file}
|
||||
${releasesse2_appconfig_file}
|
||||
${relwithdebinfo_appconfig_file}
|
||||
${debug_appconfig_file}
|
||||
)
|
||||
add_dependencies(copy_win_libs prepare)
|
||||
|
||||
if(EXISTS ${internal_llkdu_path})
|
||||
add_dependencies(copy_win_libs llkdu)
|
||||
endif(EXISTS ${internal_llkdu_path})
|
||||
|
||||
34
indra/cmake/FindHunSpell.cmake
Normal file
34
indra/cmake/FindHunSpell.cmake
Normal file
@@ -0,0 +1,34 @@
|
||||
FIND_PATH(HUNSPELL_INCLUDE_DIR hunspell.hxx
|
||||
/usr/local/include/hunspell
|
||||
/usr/local/include
|
||||
/usr/include/hunspell
|
||||
/usr/include
|
||||
)
|
||||
|
||||
SET(HUNSPELL_NAMES ${HUNSPELL_NAMES} hunspell hunspell-1.2)
|
||||
FIND_LIBRARY(HUNSPELL_LIBRARY
|
||||
NAMES ${HUNSPELL_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
)
|
||||
|
||||
IF(HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR)
|
||||
SET(HUNSPELL_LIBRARIES ${HUNSPELL_LIBRARY})
|
||||
SET(HUNSPELL_FOUND "YES")
|
||||
ELSE(HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR)
|
||||
SET(HUNSPELL_FOUND "NO")
|
||||
ENDIF(HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR)
|
||||
|
||||
IF(HUNSPELL_FOUND)
|
||||
IF(NOT HUNSPELL_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Hunspell: ${HUNSPELL_LIBRARIES}")
|
||||
ENDIF(NOT HUNSPELL_FIND_QUIETLY)
|
||||
ELSE(HUNSPELL_FOUND)
|
||||
IF(HUNSPELL_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find HunSpell library")
|
||||
ENDIF(HUNSPELL_FIND_REQUIRED)
|
||||
ENDIF(HUNSPELL_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
HUNSPELL_LIBRARY
|
||||
HUNSPELL_INCLUDE_DIR
|
||||
)
|
||||
62
indra/cmake/FindLLQtWebkit.cmake
Normal file
62
indra/cmake/FindLLQtWebkit.cmake
Normal file
@@ -0,0 +1,62 @@
|
||||
# -*- cmake -*-
|
||||
|
||||
# - Find llqtwebkit
|
||||
# Find the llqtwebkit includes and library
|
||||
# This module defines
|
||||
# LLQTWEBKIT_INCLUDE_DIR, where to find llqtwebkit.h, etc.
|
||||
# LLQTWEBKIT_LIBRARY, the llqtwebkit library with full path.
|
||||
# LLQTWEBKIT_FOUND, If false, do not try to use llqtwebkit.
|
||||
# also defined, but not for general use are
|
||||
# LLQTWEBKIT_LIBRARIES, the libraries needed to use llqtwebkit.
|
||||
# LLQTWEBKIT_LIBRARY_DIRS, where to find the llqtwebkit library.
|
||||
# LLQTWEBKIT_DEFINITIONS - You should add_definitions(${LLQTWEBKIT_DEFINITIONS})
|
||||
# before compiling code that includes llqtwebkit library files.
|
||||
|
||||
# Try to use pkg-config first.
|
||||
# This allows to have two different libllqtwebkit packages installed:
|
||||
# one for viewer 2.x and one for viewer 1.x.
|
||||
include(FindPkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
if (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
|
||||
set(_PACKAGE_ARGS libllqtwebkit>=${LLQtWebkit_FIND_VERSION} REQUIRED)
|
||||
else (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
|
||||
set(_PACKAGE_ARGS libllqtwebkit)
|
||||
endif (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
|
||||
if (NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS "2.8")
|
||||
# As virtually nobody will have a pkg-config file for this, do this check always quiet.
|
||||
# Unfortunately cmake 2.8 or higher is required for pkg_check_modules to have a 'QUIET'.
|
||||
set(_PACKAGE_ARGS ${_PACKAGE_ARGS} QUIET)
|
||||
endif ()
|
||||
pkg_check_modules(LLQTWEBKIT ${_PACKAGE_ARGS})
|
||||
endif (PKG_CONFIG_FOUND)
|
||||
set(LLQTWEBKIT_DEFINITIONS ${LLQTWEBKIT_CFLAGS_OTHER})
|
||||
|
||||
find_path(LLQTWEBKIT_INCLUDE_DIR llqtwebkit.h NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_INCLUDE_DIRS})
|
||||
|
||||
find_library(LLQTWEBKIT_LIBRARY NAMES llqtwebkit NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_LIBRARY_DIRS})
|
||||
|
||||
if (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND) # If pkg-config couldn't find it, pretend we don't have pkg-config.
|
||||
set(LLQTWEBKIT_LIBRARIES llqtwebkit)
|
||||
get_filename_component(LLQTWEBKIT_LIBRARY_DIRS ${LLQTWEBKIT_LIBRARY} PATH)
|
||||
endif (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set LLQTWEBKIT_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
LLQTWEBKIT
|
||||
DEFAULT_MSG
|
||||
LLQTWEBKIT_LIBRARY
|
||||
LLQTWEBKIT_INCLUDE_DIR
|
||||
LLQTWEBKIT_LIBRARIES
|
||||
LLQTWEBKIT_LIBRARY_DIRS
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
LLQTWEBKIT_LIBRARY
|
||||
LLQTWEBKIT_INCLUDE_DIR
|
||||
LLQTWEBKIT_LIBRARIES
|
||||
LLQTWEBKIT_LIBRARY_DIRS
|
||||
LLQTWEBKIT_DEFINITIONS
|
||||
)
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
#Find the windows manifest tool.
|
||||
|
||||
FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt
|
||||
PATHS
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin"
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin"
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin")
|
||||
IF(HAVE_MANIFEST_TOOL)
|
||||
MESSAGE(STATUS "Found Mainfest Tool. Embedding custom manifests.")
|
||||
ELSE(HAVE_MANIFEST_TOOL)
|
||||
MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.")
|
||||
ENDIF(HAVE_MANIFEST_TOOL)
|
||||
|
||||
STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
|
||||
${CMAKE_EXE_LINKER_FLAGS})
|
||||
#Find the windows manifest tool.
|
||||
if (MSVC80)
|
||||
FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt
|
||||
PATHS
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin"
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin"
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin")
|
||||
IF(HAVE_MANIFEST_TOOL)
|
||||
MESSAGE(STATUS "Found Mainfest Tool. Embedding custom manifests.")
|
||||
ELSE(HAVE_MANIFEST_TOOL)
|
||||
MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.")
|
||||
ENDIF(HAVE_MANIFEST_TOOL)
|
||||
|
||||
STRING(REPLACE "/MANIFEST " "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
|
||||
${CMAKE_EXE_LINKER_FLAGS})
|
||||
|
||||
endif (MSVC80)
|
||||
|
||||
@@ -1,50 +1,52 @@
|
||||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
|
||||
if (STANDALONE)
|
||||
include(FindGooglePerfTools)
|
||||
else (STANDALONE)
|
||||
if (LINUX OR WINDOWS)
|
||||
use_prebuilt_binary(google)
|
||||
endif (LINUX OR WINDOWS)
|
||||
if (WINDOWS)
|
||||
set(TCMALLOC_LIBRARIES libtcmalloc_minimal.lib)
|
||||
set(TCMALLOC_LINKER_FLAGS "/INCLUDE:\"__tcmalloc\"")
|
||||
endif (WINDOWS)
|
||||
if (LINUX)
|
||||
if(USE_GOOGLE_PERFTOOLS)
|
||||
set(TCMALLOC_LIBRARIES tcmalloc)
|
||||
set(STACKTRACE_LIBRARIES stacktrace)
|
||||
set(PROFILER_LIBRARIES profiler)
|
||||
else()
|
||||
set(TCMALLOC_LIBRARIES tcmalloc_minimal)
|
||||
endif()
|
||||
set(GOOGLE_PERFTOOLS_INCLUDE_DIR
|
||||
${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
|
||||
set(GOOGLE_PERFTOOLS_FOUND "YES")
|
||||
endif (LINUX)
|
||||
endif (STANDALONE)
|
||||
|
||||
#if (GOOGLE_PERFTOOLS_FOUND)
|
||||
# set(USE_GOOGLE_PERFTOOLS ON CACHE BOOL "Build with Google PerfTools support.")
|
||||
#endif (GOOGLE_PERFTOOLS_FOUND)
|
||||
|
||||
# XXX Disable temporarily, until we have compilation issues on 64-bit
|
||||
# Etch sorted.
|
||||
#set(USE_GOOGLE_PERFTOOLS OFF)
|
||||
|
||||
if (USE_GOOGLE_PERFTOOLS)
|
||||
set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1)
|
||||
include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR})
|
||||
set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES} ${STACKTRACE_LIBRARIES} ${PROFILER_LIBRARIES})
|
||||
else (USE_GOOGLE_PERFTOOLS)
|
||||
set(TCMALLOC_FLAG -ULL_USE_TCMALLOC)
|
||||
endif (USE_GOOGLE_PERFTOOLS)
|
||||
|
||||
if (NOT(DISABLE_TCMALLOC OR USE_GOOGLE_PERFTOOLS))
|
||||
message(STATUS "Building with Google TCMalloc")
|
||||
set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1_)
|
||||
include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR})
|
||||
set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES})
|
||||
set(GOOGLE_PERFTOOLS_LINKER_FLAGS ${TCMALLOC_LINKER_FLAGS})
|
||||
endif()
|
||||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
|
||||
if (STANDALONE)
|
||||
include(FindGooglePerfTools)
|
||||
else (STANDALONE)
|
||||
if (LINUX OR WINDOWS)
|
||||
use_prebuilt_binary(google)
|
||||
endif (LINUX OR WINDOWS)
|
||||
if (WINDOWS)
|
||||
set(TCMALLOC_LIBRARIES libtcmalloc_minimal.lib)
|
||||
set(TCMALLOC_LINKER_FLAGS "/INCLUDE:\"__tcmalloc\"")
|
||||
endif (WINDOWS)
|
||||
if (LINUX)
|
||||
if(USE_GOOGLE_PERFTOOLS)
|
||||
set(TCMALLOC_LIBRARIES tcmalloc)
|
||||
set(STACKTRACE_LIBRARIES stacktrace)
|
||||
set(PROFILER_LIBRARIES profiler)
|
||||
else()
|
||||
set(TCMALLOC_LIBRARIES tcmalloc_minimal)
|
||||
endif()
|
||||
set(GOOGLE_PERFTOOLS_INCLUDE_DIR
|
||||
${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
|
||||
set(GOOGLE_PERFTOOLS_FOUND "YES")
|
||||
endif (LINUX)
|
||||
endif (STANDALONE)
|
||||
|
||||
if (GOOGLE_PERFTOOLS_FOUND)
|
||||
set(USE_GOOGLE_PERFTOOLS ON CACHE BOOL "Build with Google PerfTools support.")
|
||||
else (GOOGLE_PERFTOOLS_FOUND)
|
||||
set(USE_GOOGLE_PERFTOOLS OFF)
|
||||
endif (GOOGLE_PERFTOOLS_FOUND)
|
||||
|
||||
# XXX Disable temporarily, until we have compilation issues on 64-bit
|
||||
# Etch sorted.
|
||||
#set(USE_GOOGLE_PERFTOOLS OFF)
|
||||
|
||||
if (USE_GOOGLE_PERFTOOLS)
|
||||
set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1)
|
||||
include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR})
|
||||
set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES} ${STACKTRACE_LIBRARIES} ${PROFILER_LIBRARIES})
|
||||
else (USE_GOOGLE_PERFTOOLS)
|
||||
set(TCMALLOC_FLAG -ULL_USE_TCMALLOC)
|
||||
endif (USE_GOOGLE_PERFTOOLS)
|
||||
|
||||
if (NOT(DISABLE_TCMALLOC OR USE_GOOGLE_PERFTOOLS OR STANDALONE))
|
||||
message(STATUS "Building with Google TCMalloc")
|
||||
set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1)
|
||||
include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR})
|
||||
set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES})
|
||||
set(GOOGLE_PERFTOOLS_LINKER_FLAGS ${TCMALLOC_LINKER_FLAGS})
|
||||
endif()
|
||||
|
||||
16
indra/cmake/HUNSPELL.cmake
Normal file
16
indra/cmake/HUNSPELL.cmake
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
|
||||
if (STANDALONE)
|
||||
include(FindHunSpell)
|
||||
else (STANDALONE)
|
||||
use_prebuilt_binary(hunspell)
|
||||
|
||||
set(HUNSPELL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/hunspell)
|
||||
|
||||
if (LINUX OR DARWIN)
|
||||
set(HUNSPELL_LIBRARY hunspell-1.2)
|
||||
else (LINUX OR DARWIN)
|
||||
set(HUNSPELL_LIBRARY libhunspell)
|
||||
endif (LINUX OR DARWIN)
|
||||
endif (STANDALONE)
|
||||
@@ -7,7 +7,6 @@ include(ZLIB)
|
||||
|
||||
set(LLCOMMON_INCLUDE_DIRS
|
||||
${LIBS_OPEN_DIR}/llcommon
|
||||
${APRUTIL_INCLUDE_DIR}
|
||||
${APR_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
@@ -13,11 +13,11 @@ if (STANDALONE)
|
||||
SDL_LIBRARY
|
||||
)
|
||||
else (STANDALONE)
|
||||
use_prebuilt_binary(SDL)
|
||||
if (NOT DARWIN)
|
||||
use_prebuilt_binary(mesa)
|
||||
endif (NOT DARWIN)
|
||||
if (LINUX AND VIEWER)
|
||||
use_prebuilt_binary(SDL)
|
||||
set (SDL_FOUND TRUE)
|
||||
set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/i686-linux)
|
||||
set (SDL_LIBRARY SDL)
|
||||
|
||||
@@ -8,6 +8,10 @@ if (STANDALONE)
|
||||
include(FindPNG)
|
||||
else (STANDALONE)
|
||||
use_prebuilt_binary(libpng)
|
||||
set(PNG_LIBRARIES png12)
|
||||
if (WINDOWS)
|
||||
set(PNG_LIBRARIES libpng15)
|
||||
else (WINDOWS)
|
||||
set(PNG_LIBRARIES png12)
|
||||
endif (WINDOWS)
|
||||
set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
|
||||
endif (STANDALONE)
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
# -*- cmake -*-
|
||||
|
||||
set(PYTHONINTERP_FOUND)
|
||||
|
||||
if (WINDOWS)
|
||||
# On Windows, explicitly avoid Cygwin Python.
|
||||
|
||||
find_program(PYTHON_EXECUTABLE
|
||||
NAMES python25.exe python23.exe python.exe
|
||||
NO_DEFAULT_PATH # added so that cmake does not find cygwin python
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
|
||||
|
||||
)
|
||||
elseif (EXISTS /etc/debian_version)
|
||||
# On Debian and Ubuntu, avoid Python 2.4 if possible.
|
||||
|
||||
find_program(PYTHON_EXECUTABLE python2.5 python2.3 python PATHS /usr/bin)
|
||||
|
||||
if (PYTHON_EXECUTABLE)
|
||||
set(PYTHONINTERP_FOUND ON)
|
||||
endif (PYTHON_EXECUTABLE)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
# On MAC OS X be sure to search standard locations first
|
||||
|
||||
string(REPLACE ":" ";" PATH_LIST "$ENV{PATH}")
|
||||
find_program(PYTHON_EXECUTABLE
|
||||
NAMES python python25 python24 python23
|
||||
NO_DEFAULT_PATH # Avoid searching non-standard locations first
|
||||
PATHS
|
||||
/bin
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
${PATH_LIST}
|
||||
)
|
||||
|
||||
if (PYTHON_EXECUTABLE)
|
||||
set(PYTHONINTERP_FOUND ON)
|
||||
endif (PYTHON_EXECUTABLE)
|
||||
else (WINDOWS)
|
||||
include(FindPythonInterp)
|
||||
endif (WINDOWS)
|
||||
|
||||
if (NOT PYTHON_EXECUTABLE)
|
||||
message(FATAL_ERROR "No Python interpreter found")
|
||||
endif (NOT PYTHON_EXECUTABLE)
|
||||
|
||||
mark_as_advanced(PYTHON_EXECUTABLE)
|
||||
# -*- cmake -*-
|
||||
|
||||
set(PYTHONINTERP_FOUND)
|
||||
|
||||
if (WINDOWS)
|
||||
# On Windows, explicitly avoid Cygwin Python.
|
||||
|
||||
find_program(PYTHON_EXECUTABLE
|
||||
NAMES python25.exe python23.exe python.exe
|
||||
NO_DEFAULT_PATH # added so that cmake does not find cygwin python
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
|
||||
|
||||
)
|
||||
elseif (EXISTS /etc/debian_version)
|
||||
# On Debian and Ubuntu, avoid Python 2.4 if possible.
|
||||
|
||||
find_program(PYTHON_EXECUTABLE python2.5 python2.3 python PATHS /usr/bin)
|
||||
|
||||
if (PYTHON_EXECUTABLE)
|
||||
set(PYTHONINTERP_FOUND ON)
|
||||
endif (PYTHON_EXECUTABLE)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
# On MAC OS X be sure to search standard locations first
|
||||
|
||||
string(REPLACE ":" ";" PATH_LIST "$ENV{PATH}")
|
||||
find_program(PYTHON_EXECUTABLE
|
||||
NAMES python python25 python24 python23
|
||||
NO_DEFAULT_PATH # Avoid searching non-standard locations first
|
||||
PATHS
|
||||
/bin
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
${PATH_LIST}
|
||||
)
|
||||
|
||||
if (PYTHON_EXECUTABLE)
|
||||
set(PYTHONINTERP_FOUND ON)
|
||||
endif (PYTHON_EXECUTABLE)
|
||||
else (WINDOWS)
|
||||
include(FindPythonInterp)
|
||||
endif (WINDOWS)
|
||||
|
||||
if (NOT PYTHON_EXECUTABLE)
|
||||
message(FATAL_ERROR "No Python interpreter found")
|
||||
endif (NOT PYTHON_EXECUTABLE)
|
||||
|
||||
mark_as_advanced(PYTHON_EXECUTABLE)
|
||||
|
||||
@@ -42,6 +42,7 @@ else (STANDALONE)
|
||||
gdk_pixbuf-2.0
|
||||
Xinerama
|
||||
glib-2.0
|
||||
gio-2.0
|
||||
gmodule-2.0
|
||||
gobject-2.0
|
||||
gthread-2.0
|
||||
|
||||
@@ -3,9 +3,24 @@ include(Prebuilt)
|
||||
|
||||
if (NOT STANDALONE)
|
||||
use_prebuilt_binary(vivox)
|
||||
if (LINUX)
|
||||
#use_prebuilt_binary(libuuid)
|
||||
if(LINUX)
|
||||
use_prebuilt_binary(libuuid)
|
||||
if (${ARCH} STREQUAL "x86_64")
|
||||
use_prebuilt_binary(32bitcompatibilitylibs)
|
||||
endif (${ARCH} STREQUAL "x86_64")
|
||||
use_prebuilt_binary(fontconfig)
|
||||
endif (LINUX)
|
||||
endif(LINUX)
|
||||
else (NOT STANDALONE)
|
||||
# Download there even when using standalone.
|
||||
set(STANDALONE OFF)
|
||||
use_prebuilt_binary(vivox)
|
||||
if(LINUX AND ${ARCH} STREQUAL "x86_64")
|
||||
use_prebuilt_binary(32bitcompatibilitylibs)
|
||||
endif(LINUX AND ${ARCH} STREQUAL "x86_64")
|
||||
set(STANDALONE ON)
|
||||
endif(NOT STANDALONE)
|
||||
|
||||
if (WINDOWS)
|
||||
use_prebuilt_binary(dbghelp)
|
||||
endif (WINDOWS)
|
||||
|
||||
|
||||
@@ -3,7 +3,29 @@ include(Linking)
|
||||
include(Prebuilt)
|
||||
|
||||
if (STANDALONE)
|
||||
find_package(LLQtWebkit REQUIRED)
|
||||
# The minimal version, 4.4.3, is rather arbitrary: it's the version in Debian/Lenny.
|
||||
find_package(Qt4 4.4.3 COMPONENTS QtCore QtGui QtNetwork QtOpenGL QtWebKit REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
set(QTDIR $ENV{QTDIR})
|
||||
if (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin")
|
||||
message(FATAL_ERROR "\"${QT_BINARY_DIR}\" is unequal \"${QTDIR}/bin\"; "
|
||||
"Qt is found by looking for qmake in your PATH. "
|
||||
"Please set your PATH such that 'qmake' is found in \$QTDIR/bin, "
|
||||
"or unset QTDIR if the found Qt is correct.")
|
||||
endif (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin")
|
||||
find_package(LLQtWebkit REQUIRED QUIET)
|
||||
# Add the plugins.
|
||||
set(QT_PLUGIN_LIBRARIES)
|
||||
foreach(qlibname qgif qjpeg)
|
||||
find_library(QT_PLUGIN_${qlibname} ${qlibname} PATHS ${QT_PLUGINS_DIR}/imageformats NO_DEFAULT_PATH)
|
||||
if (QT_PLUGIN_${qlibname})
|
||||
list(APPEND QT_PLUGIN_LIBRARIES ${QT_PLUGIN_${qlibname}})
|
||||
else (QT_PLUGIN_${qtlibname})
|
||||
message(FATAL_ERROR "Could not find the Qt plugin ${qlibname} in \"${QT_PLUGINS_DIR}/imageformats\"!")
|
||||
endif (QT_PLUGIN_${qlibname})
|
||||
endforeach(qlibname)
|
||||
# qjpeg depends on libjpeg
|
||||
list(APPEND QT_PLUGIN_LIBRARIES jpeg)
|
||||
set(WEBKITLIBPLUGIN OFF CACHE BOOL
|
||||
"WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.")
|
||||
else (STANDALONE)
|
||||
@@ -32,25 +54,26 @@ if (WINDOWS)
|
||||
elseif (DARWIN)
|
||||
set(WEBKIT_PLUGIN_LIBRARIES
|
||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.dylib
|
||||
debug ${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.dylib
|
||||
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libllqtwebkit.dylib
|
||||
)
|
||||
elseif (LINUX)
|
||||
if (STANDALONE)
|
||||
set(WEBKIT_PLUGIN_LIBRARIES ${LLQTWEBKIT_LIBRARY})
|
||||
else (STANDALONE)
|
||||
if (STANDALONE)
|
||||
set(WEBKIT_PLUGIN_LIBRARIES ${LLQTWEBKIT_LIBRARY} ${QT_LIBRARIES} ${QT_PLUGIN_LIBRARIES})
|
||||
else (STANDALONE)
|
||||
set(WEBKIT_PLUGIN_LIBRARIES
|
||||
llqtwebkit
|
||||
qgif
|
||||
qjpeg
|
||||
QtWebKit
|
||||
QtOpenGL
|
||||
QtNetwork
|
||||
QtGui
|
||||
QtCore
|
||||
fontconfig
|
||||
X11
|
||||
Xrender
|
||||
GL
|
||||
)
|
||||
endif (STANDALONE)
|
||||
llqtwebkit
|
||||
qgif
|
||||
qjpeg
|
||||
QtWebKit
|
||||
QtOpenGL
|
||||
QtNetwork
|
||||
QtGui
|
||||
QtCore
|
||||
jpeg
|
||||
fontconfig
|
||||
X11
|
||||
Xrender
|
||||
GL
|
||||
)
|
||||
endif (STANDALONE)
|
||||
endif (WINDOWS)
|
||||
|
||||
@@ -8,10 +8,6 @@ if (STANDALONE)
|
||||
include(FindXmlRpcEpi)
|
||||
else (STANDALONE)
|
||||
use_prebuilt_binary(xmlrpc-epi)
|
||||
if (WINDOWS)
|
||||
set(XMLRPCEPI_LIBRARIES xmlrpcepi)
|
||||
else (WINDOWS)
|
||||
set(XMLRPCEPI_LIBRARIES xmlrpc-epi)
|
||||
endif (WINDOWS)
|
||||
set(XMLRPCEPI_LIBRARIES xmlrpc-epi)
|
||||
set(XMLRPCEPI_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
|
||||
endif (STANDALONE)
|
||||
|
||||
@@ -156,6 +156,9 @@ ARGUMENTS=[
|
||||
dict(name='source',
|
||||
description='Source directory.',
|
||||
default=DEFAULT_SRCTREE),
|
||||
dict(name='standalone',
|
||||
description='Set to ON if this is a standalone build.',
|
||||
default="OFF"),
|
||||
dict(name='artwork', description='Artwork directory.', default=DEFAULT_SRCTREE),
|
||||
dict(name='touch',
|
||||
description="""File to touch when action is finished. Touch file will
|
||||
@@ -634,9 +637,9 @@ class LLManifest(object):
|
||||
is_glob = False
|
||||
|
||||
# look under each prefix for matching paths
|
||||
paths = [os.path.join(self.get_src_prefix(), src),
|
||||
paths = set([os.path.join(self.get_src_prefix(), src),
|
||||
os.path.join(self.get_artwork_prefix(), src),
|
||||
os.path.join(self.get_build_prefix(), src)]
|
||||
os.path.join(self.get_build_prefix(), src)])
|
||||
for path in paths:
|
||||
if self.wildcard_pattern.search(path):
|
||||
is_glob = True
|
||||
|
||||
@@ -723,4 +723,4 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,212 +1,218 @@
|
||||
# -*- cmake -*-
|
||||
|
||||
project(llcommon)
|
||||
|
||||
include(00-Common)
|
||||
include(LLCommon)
|
||||
include(Linking)
|
||||
|
||||
include_directories(
|
||||
${EXPAT_INCLUDE_DIRS}
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llcommon_SOURCE_FILES
|
||||
imageids.cpp
|
||||
indra_constants.cpp
|
||||
llapp.cpp
|
||||
llapr.cpp
|
||||
llassettype.cpp
|
||||
llavatarname.cpp
|
||||
llbase32.cpp
|
||||
llbase64.cpp
|
||||
llcommon.cpp
|
||||
llcommonutils.cpp
|
||||
llcrc.cpp
|
||||
llcriticaldamp.cpp
|
||||
llcursortypes.cpp
|
||||
lldate.cpp
|
||||
llerror.cpp
|
||||
llerrorthread.cpp
|
||||
llevent.cpp
|
||||
llfasttimer.cpp
|
||||
llfile.cpp
|
||||
llfindlocale.cpp
|
||||
llfixedbuffer.cpp
|
||||
llformat.cpp
|
||||
llframetimer.cpp
|
||||
llheartbeat.cpp
|
||||
llindraconfigfile.cpp
|
||||
llliveappconfig.cpp
|
||||
lllivefile.cpp
|
||||
lllog.cpp
|
||||
llmd5.cpp
|
||||
llmemory.cpp
|
||||
llmemorystream.cpp
|
||||
llmetrics.cpp
|
||||
llmortician.cpp
|
||||
lloptioninterface.cpp
|
||||
llprocesslauncher.cpp
|
||||
llprocessor.cpp
|
||||
llqueuedthread.cpp
|
||||
llrand.cpp
|
||||
llrun.cpp
|
||||
llsd.cpp
|
||||
llsdserialize.cpp
|
||||
llsdserialize_xml.cpp
|
||||
llsdutil.cpp
|
||||
llsecondlifeurls.cpp
|
||||
llstat.cpp
|
||||
llstreamtools.cpp
|
||||
llstring.cpp
|
||||
llstringtable.cpp
|
||||
llsys.cpp
|
||||
llthread.cpp
|
||||
lltimer.cpp
|
||||
lluri.cpp
|
||||
lluuid.cpp
|
||||
llworkerthread.cpp
|
||||
metaclass.cpp
|
||||
metaproperty.cpp
|
||||
reflective.cpp
|
||||
timing.cpp
|
||||
u64.cpp
|
||||
)
|
||||
|
||||
set(llcommon_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
|
||||
bitpack.h
|
||||
ctype_workaround.h
|
||||
doublelinkedlist.h
|
||||
imageids.h
|
||||
indra_constants.h
|
||||
linden_common.h
|
||||
linked_lists.h
|
||||
llagentconstants.h
|
||||
llapp.h
|
||||
llapr.h
|
||||
llassettype.h
|
||||
llassoclist.h
|
||||
llavatarconstants.h
|
||||
llavatarname.h
|
||||
llbase32.h
|
||||
llbase64.h
|
||||
llboost.h
|
||||
llchat.h
|
||||
llclickaction.h
|
||||
llcommon.h
|
||||
llcommonutils.h
|
||||
llcrc.h
|
||||
llcriticaldamp.h
|
||||
llcursortypes.h
|
||||
lldarray.h
|
||||
lldarrayptr.h
|
||||
lldate.h
|
||||
lldefs.h
|
||||
lldepthstack.h
|
||||
lldlinked.h
|
||||
lldqueueptr.h
|
||||
llendianswizzle.h
|
||||
llenum.h
|
||||
llerror.h
|
||||
llerrorcontrol.h
|
||||
llerrorlegacy.h
|
||||
llerrorthread.h
|
||||
llevent.h
|
||||
lleventemitter.h
|
||||
llextendedstatus.h
|
||||
llfasttimer.h
|
||||
llfile.h
|
||||
llfindlocale.h
|
||||
llfixedbuffer.h
|
||||
llformat.h
|
||||
llframetimer.h
|
||||
llhash.h
|
||||
llheartbeat.h
|
||||
llhttpstatuscodes.h
|
||||
llindexedqueue.h
|
||||
llindraconfigfile.h
|
||||
llkeythrottle.h
|
||||
lllinkedqueue.h
|
||||
llliveappconfig.h
|
||||
lllivefile.h
|
||||
lllocalidhashmap.h
|
||||
lllog.h
|
||||
lllslconstants.h
|
||||
llmap.h
|
||||
llmd5.h
|
||||
llmemory.h
|
||||
llmemorystream.h
|
||||
llmemtype.h
|
||||
llmetrics.h
|
||||
llmortician.h
|
||||
llnametable.h
|
||||
lloptioninterface.h
|
||||
llpreprocessor.h
|
||||
llpriqueuemap.h
|
||||
llprocesslauncher.h
|
||||
llprocessor.h
|
||||
llptrskiplist.h
|
||||
llptrskipmap.h
|
||||
llqueuedthread.h
|
||||
llrand.h
|
||||
llrun.h
|
||||
llsd.h
|
||||
llsdserialize.h
|
||||
llsdserialize_xml.h
|
||||
llsdutil.h
|
||||
llsecondlifeurls.h
|
||||
llsimplehash.h
|
||||
llskiplist.h
|
||||
llskipmap.h
|
||||
llstack.h
|
||||
llstat.h
|
||||
llstatenums.h
|
||||
llstl.h
|
||||
llstreamtools.h
|
||||
llstrider.h
|
||||
llstring.h
|
||||
llstringtable.h
|
||||
llsys.h
|
||||
llthread.h
|
||||
lltimer.h
|
||||
lluri.h
|
||||
lluuid.h
|
||||
lluuidhashmap.h
|
||||
llversionserver.h
|
||||
llversionviewer.h
|
||||
llworkerthread.h
|
||||
metaclass.h
|
||||
metaclasst.h
|
||||
metaproperty.h
|
||||
metapropertyt.h
|
||||
processor.h
|
||||
reflective.h
|
||||
reflectivet.h
|
||||
roles_constants.h
|
||||
stdenums.h
|
||||
stdtypes.h
|
||||
string_table.h
|
||||
timer.h
|
||||
timing.h
|
||||
u64.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${llcommon_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
|
||||
|
||||
add_library (llcommon ${llcommon_SOURCE_FILES})
|
||||
add_dependencies(llcommon prepare)
|
||||
target_link_libraries(
|
||||
llcommon
|
||||
${APRUTIL_LIBRARIES}
|
||||
${APR_LIBRARIES}
|
||||
${EXPAT_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${WINDOWS_LIBRARIES}
|
||||
)
|
||||
|
||||
# -*- cmake -*-
|
||||
|
||||
project(llcommon)
|
||||
|
||||
include(00-Common)
|
||||
include(LLCommon)
|
||||
include(Linking)
|
||||
|
||||
include_directories(
|
||||
${EXPAT_INCLUDE_DIRS}
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llcommon_SOURCE_FILES
|
||||
aiaprpool.cpp
|
||||
imageids.cpp
|
||||
indra_constants.cpp
|
||||
llapp.cpp
|
||||
llapr.cpp
|
||||
llassettype.cpp
|
||||
llavatarname.cpp
|
||||
llbase32.cpp
|
||||
llbase64.cpp
|
||||
llcommon.cpp
|
||||
llcommonutils.cpp
|
||||
llcrc.cpp
|
||||
llcriticaldamp.cpp
|
||||
llcursortypes.cpp
|
||||
lldate.cpp
|
||||
lldictionary.cpp
|
||||
llerror.cpp
|
||||
llerrorthread.cpp
|
||||
llevent.cpp
|
||||
llfasttimer.cpp
|
||||
llfile.cpp
|
||||
llfindlocale.cpp
|
||||
llfixedbuffer.cpp
|
||||
llformat.cpp
|
||||
llframetimer.cpp
|
||||
llheartbeat.cpp
|
||||
llindraconfigfile.cpp
|
||||
llliveappconfig.cpp
|
||||
lllivefile.cpp
|
||||
lllog.cpp
|
||||
llmd5.cpp
|
||||
llmemory.cpp
|
||||
llmemorystream.cpp
|
||||
llmetrics.cpp
|
||||
llmortician.cpp
|
||||
lloptioninterface.cpp
|
||||
llprocesslauncher.cpp
|
||||
llprocessor.cpp
|
||||
llqueuedthread.cpp
|
||||
llrand.cpp
|
||||
llrun.cpp
|
||||
llsd.cpp
|
||||
llsdserialize.cpp
|
||||
llsdserialize_xml.cpp
|
||||
llsdutil.cpp
|
||||
llsecondlifeurls.cpp
|
||||
llstat.cpp
|
||||
llstreamtools.cpp
|
||||
llstring.cpp
|
||||
llstringtable.cpp
|
||||
llsys.cpp
|
||||
llthread.cpp
|
||||
lltimer.cpp
|
||||
lluri.cpp
|
||||
lluuid.cpp
|
||||
llworkerthread.cpp
|
||||
metaclass.cpp
|
||||
metaproperty.cpp
|
||||
reflective.cpp
|
||||
timing.cpp
|
||||
u64.cpp
|
||||
)
|
||||
|
||||
set(llcommon_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
|
||||
aiaprpool.h
|
||||
aithreadsafe.h
|
||||
bitpack.h
|
||||
ctype_workaround.h
|
||||
doublelinkedlist.h
|
||||
imageids.h
|
||||
indra_constants.h
|
||||
linden_common.h
|
||||
linked_lists.h
|
||||
llagentconstants.h
|
||||
llapp.h
|
||||
llapr.h
|
||||
llassettype.h
|
||||
llassoclist.h
|
||||
llavatarconstants.h
|
||||
llavatarname.h
|
||||
llbase32.h
|
||||
llbase64.h
|
||||
llboost.h
|
||||
llchat.h
|
||||
llclickaction.h
|
||||
llcommon.h
|
||||
llcommonutils.h
|
||||
llcrc.h
|
||||
llcriticaldamp.h
|
||||
llcursortypes.h
|
||||
lldarray.h
|
||||
lldarrayptr.h
|
||||
lldate.h
|
||||
lldefs.h
|
||||
lldepthstack.h
|
||||
lldictionary.h
|
||||
lldlinked.h
|
||||
lldqueueptr.h
|
||||
llendianswizzle.h
|
||||
llenum.h
|
||||
llerror.h
|
||||
llerrorcontrol.h
|
||||
llerrorlegacy.h
|
||||
llerrorthread.h
|
||||
llevent.h
|
||||
lleventemitter.h
|
||||
llextendedstatus.h
|
||||
llfasttimer.h
|
||||
llfile.h
|
||||
llfindlocale.h
|
||||
llfixedbuffer.h
|
||||
llformat.h
|
||||
llframetimer.h
|
||||
llhash.h
|
||||
llheartbeat.h
|
||||
llhttpstatuscodes.h
|
||||
llindexedqueue.h
|
||||
llindraconfigfile.h
|
||||
llkeythrottle.h
|
||||
lllinkedqueue.h
|
||||
llliveappconfig.h
|
||||
lllivefile.h
|
||||
lllocalidhashmap.h
|
||||
lllog.h
|
||||
lllslconstants.h
|
||||
llmap.h
|
||||
llmd5.h
|
||||
llmemory.h
|
||||
llmemorystream.h
|
||||
llmemtype.h
|
||||
llmetrics.h
|
||||
llmortician.h
|
||||
llnametable.h
|
||||
lloptioninterface.h
|
||||
llpreprocessor.h
|
||||
llpriqueuemap.h
|
||||
llprocesslauncher.h
|
||||
llprocessor.h
|
||||
llptrskiplist.h
|
||||
llptrskipmap.h
|
||||
llqueuedthread.h
|
||||
llrand.h
|
||||
llrun.h
|
||||
llscopedvolatileaprpool.h
|
||||
llsd.h
|
||||
llsdserialize.h
|
||||
llsdserialize_xml.h
|
||||
llsdutil.h
|
||||
llsecondlifeurls.h
|
||||
llsimplehash.h
|
||||
llskiplist.h
|
||||
llskipmap.h
|
||||
llstack.h
|
||||
llstat.h
|
||||
llstatenums.h
|
||||
llstl.h
|
||||
llstreamtools.h
|
||||
llstrider.h
|
||||
llstring.h
|
||||
llstringtable.h
|
||||
llsys.h
|
||||
llthread.h
|
||||
lltimer.h
|
||||
lluri.h
|
||||
lluuid.h
|
||||
lluuidhashmap.h
|
||||
llversionserver.h
|
||||
llversionviewer.h
|
||||
llworkerthread.h
|
||||
metaclass.h
|
||||
metaclasst.h
|
||||
metaproperty.h
|
||||
metapropertyt.h
|
||||
processor.h
|
||||
reflective.h
|
||||
reflectivet.h
|
||||
roles_constants.h
|
||||
stdenums.h
|
||||
stdtypes.h
|
||||
string_table.h
|
||||
timer.h
|
||||
timing.h
|
||||
u64.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${llcommon_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
|
||||
|
||||
add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
|
||||
add_dependencies(llcommon prepare)
|
||||
target_link_libraries(
|
||||
llcommon
|
||||
${APRUTIL_LIBRARIES}
|
||||
${APR_LIBRARIES}
|
||||
${EXPAT_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${WINDOWS_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
198
indra/llcommon/aiaprpool.cpp
Normal file
198
indra/llcommon/aiaprpool.cpp
Normal file
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* @file aiaprpool.cpp
|
||||
*
|
||||
* Copyright (c) 2010, Aleric Inglewood.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution.
|
||||
*
|
||||
* CHANGELOG
|
||||
* and additional copyright holders.
|
||||
*
|
||||
* 04/04/2010
|
||||
* - Initial version, written by Aleric Inglewood @ SL
|
||||
*
|
||||
* 10/11/2010
|
||||
* - Changed filename, class names and license to a more
|
||||
* company-neutral format.
|
||||
* - Added APR_HAS_THREADS #if's to allow creation and destruction
|
||||
* of subpools by threads other than the parent pool owner.
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llerror.h"
|
||||
#include "aiaprpool.h"
|
||||
#include "llthread.h"
|
||||
|
||||
// Create a subpool from parent.
|
||||
void AIAPRPool::create(AIAPRPool& parent)
|
||||
{
|
||||
llassert(!mPool); // Must be non-initialized.
|
||||
mParent = &parent;
|
||||
if (!mParent) // Using the default parameter?
|
||||
{
|
||||
// By default use the root pool of the current thread.
|
||||
mParent = &AIThreadLocalData::tldata().mRootPool;
|
||||
}
|
||||
llassert(mParent->mPool); // Parent must be initialized.
|
||||
#if APR_HAS_THREADS
|
||||
// As per the documentation of APR (ie http://apr.apache.org/docs/apr/1.4/apr__pools_8h.html):
|
||||
//
|
||||
// Note that most operations on pools are not thread-safe: a single pool should only be
|
||||
// accessed by a single thread at any given time. The one exception to this rule is creating
|
||||
// a subpool of a given pool: one or more threads can safely create subpools at the same
|
||||
// time that another thread accesses the parent pool.
|
||||
//
|
||||
// In other words, it's safe for any thread to create a (sub)pool, independent of who
|
||||
// owns the parent pool.
|
||||
mOwner = apr_os_thread_current();
|
||||
#else
|
||||
mOwner = mParent->mOwner;
|
||||
llassert(apr_os_thread_equal(mOwner, apr_os_thread_current()));
|
||||
#endif
|
||||
apr_status_t const apr_pool_create_status = apr_pool_create(&mPool, mParent->mPool);
|
||||
llassert_always(apr_pool_create_status == APR_SUCCESS);
|
||||
llassert(mPool); // Initialized.
|
||||
apr_pool_cleanup_register(mPool, this, &s_plain_cleanup, &apr_pool_cleanup_null);
|
||||
}
|
||||
|
||||
// Destroy the (sub)pool, if any.
|
||||
void AIAPRPool::destroy(void)
|
||||
{
|
||||
// Only do anything if we are not already (being) destroyed.
|
||||
if (mPool)
|
||||
{
|
||||
#if !APR_HAS_THREADS
|
||||
// If we are a root pool, then every thread may destruct us: in that case
|
||||
// we have to assume that no other thread will use this pool concurrently,
|
||||
// of course. Otherwise, if we are a subpool, only the thread that owns
|
||||
// the parent may destruct us, since that is the pool that is still alive,
|
||||
// possibly being used by others and being altered here.
|
||||
llassert(!mParent || apr_os_thread_equal(mParent->mOwner, apr_os_thread_current()));
|
||||
#endif
|
||||
apr_pool_t* pool = mPool;
|
||||
mPool = NULL; // Mark that we are BEING destructed.
|
||||
apr_pool_cleanup_kill(pool, this, &s_plain_cleanup);
|
||||
apr_pool_destroy(pool);
|
||||
}
|
||||
}
|
||||
|
||||
bool AIAPRPool::parent_is_being_destructed(void)
|
||||
{
|
||||
return mParent && (!mParent->mPool || mParent->parent_is_being_destructed());
|
||||
}
|
||||
|
||||
AIAPRInitialization::AIAPRInitialization(void)
|
||||
{
|
||||
static bool apr_initialized = false;
|
||||
|
||||
if (!apr_initialized)
|
||||
{
|
||||
apr_initialize();
|
||||
}
|
||||
|
||||
apr_initialized = true;
|
||||
}
|
||||
|
||||
bool AIAPRRootPool::sCountInitialized = false;
|
||||
apr_uint32_t volatile AIAPRRootPool::sCount;
|
||||
|
||||
extern apr_thread_mutex_t* gLogMutexp;
|
||||
extern apr_thread_mutex_t* gCallStacksLogMutexp;
|
||||
|
||||
AIAPRRootPool::AIAPRRootPool(void) : AIAPRInitialization(), AIAPRPool(0)
|
||||
{
|
||||
// sCountInitialized don't need locking because when we get here there is still only a single thread.
|
||||
if (!sCountInitialized)
|
||||
{
|
||||
// Initialize the logging mutex
|
||||
apr_thread_mutex_create(&gLogMutexp, APR_THREAD_MUTEX_UNNESTED, mPool);
|
||||
apr_thread_mutex_create(&gCallStacksLogMutexp, APR_THREAD_MUTEX_UNNESTED, mPool);
|
||||
|
||||
apr_status_t status = apr_atomic_init(mPool);
|
||||
llassert_always(status == APR_SUCCESS);
|
||||
apr_atomic_set32(&sCount, 1); // Set to 1 to account for the global root pool.
|
||||
sCountInitialized = true;
|
||||
|
||||
// Initialize thread-local APR pool support.
|
||||
// Because this recursively calls AIAPRRootPool::AIAPRRootPool(void)
|
||||
// it must be done last, so that sCount is already initialized.
|
||||
AIThreadLocalData::init();
|
||||
}
|
||||
apr_atomic_inc32(&sCount);
|
||||
}
|
||||
|
||||
AIAPRRootPool::~AIAPRRootPool()
|
||||
{
|
||||
if (!apr_atomic_dec32(&sCount))
|
||||
{
|
||||
// The last pool was destructed. Cleanup remainder of APR.
|
||||
LL_INFOS("APR") << "Cleaning up APR" << LL_ENDL;
|
||||
|
||||
if (gLogMutexp)
|
||||
{
|
||||
// Clean up the logging mutex
|
||||
|
||||
// All other threads NEED to be done before we clean up APR, so this is okay.
|
||||
apr_thread_mutex_destroy(gLogMutexp);
|
||||
gLogMutexp = NULL;
|
||||
}
|
||||
if (gCallStacksLogMutexp)
|
||||
{
|
||||
// Clean up the logging mutex
|
||||
|
||||
// All other threads NEED to be done before we clean up APR, so this is okay.
|
||||
apr_thread_mutex_destroy(gCallStacksLogMutexp);
|
||||
gCallStacksLogMutexp = NULL;
|
||||
}
|
||||
|
||||
// Must destroy ALL, and therefore this last AIAPRRootPool, before terminating APR.
|
||||
static_cast<AIAPRRootPool*>(this)->destroy();
|
||||
|
||||
apr_terminate();
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
AIAPRRootPool& AIAPRRootPool::get(void)
|
||||
{
|
||||
static AIAPRRootPool global_APRpool(0); // This is what used to be gAPRPoolp.
|
||||
return global_APRpool;
|
||||
}
|
||||
|
||||
void AIVolatileAPRPool::clearVolatileAPRPool()
|
||||
{
|
||||
llassert_always(mNumActiveRef > 0);
|
||||
if (--mNumActiveRef == 0)
|
||||
{
|
||||
if (isOld())
|
||||
{
|
||||
destroy();
|
||||
mNumTotalRef = 0 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This does not actually free the memory,
|
||||
// it just allows the pool to re-use this memory for the next allocation.
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Paranoia check if the pool is jammed.
|
||||
llassert(mNumTotalRef < (FULL_VOLATILE_APR_POOL << 2)) ;
|
||||
}
|
||||
238
indra/llcommon/aiaprpool.h
Normal file
238
indra/llcommon/aiaprpool.h
Normal file
@@ -0,0 +1,238 @@
|
||||
/**
|
||||
* @file aiaprpool.h
|
||||
* @brief Implementation of AIAPRPool.
|
||||
*
|
||||
* Copyright (c) 2010, Aleric Inglewood.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution.
|
||||
*
|
||||
* CHANGELOG
|
||||
* and additional copyright holders.
|
||||
*
|
||||
* 04/04/2010
|
||||
* - Initial version, written by Aleric Inglewood @ SL
|
||||
*
|
||||
* 10/11/2010
|
||||
* - Changed filename, class names and license to a more
|
||||
* company-neutral format.
|
||||
* - Added APR_HAS_THREADS #if's to allow creation and destruction
|
||||
* of subpools by threads other than the parent pool owner.
|
||||
*/
|
||||
|
||||
#ifndef AIAPRPOOL_H
|
||||
#define AIAPRPOOL_H
|
||||
|
||||
#ifdef LL_WINDOWS
|
||||
#include <ws2tcpip.h> // Needed before including apr_portable.h
|
||||
#endif
|
||||
|
||||
#include "apr_portable.h"
|
||||
#include "apr_pools.h"
|
||||
#include "llerror.h"
|
||||
|
||||
extern void ll_init_apr();
|
||||
|
||||
/**
|
||||
* @brief A wrapper around the APR memory pool API.
|
||||
*
|
||||
* Usage of this class should be restricted to passing it to libapr-1 function calls that need it.
|
||||
*
|
||||
*/
|
||||
class LL_COMMON_API AIAPRPool
|
||||
{
|
||||
protected:
|
||||
apr_pool_t* mPool; //!< Pointer to the underlaying pool. NULL if not initialized.
|
||||
AIAPRPool* mParent; //!< Pointer to the parent pool, if any. Only valid when mPool is non-zero.
|
||||
apr_os_thread_t mOwner; //!< The thread that owns this memory pool. Only valid when mPool is non-zero.
|
||||
|
||||
public:
|
||||
//! Construct an uninitialized (destructed) pool.
|
||||
AIAPRPool(void) : mPool(NULL) { }
|
||||
|
||||
//! Construct a subpool from an existing pool.
|
||||
// This is not a copy-constructor, this class doesn't have one!
|
||||
AIAPRPool(AIAPRPool& parent) : mPool(NULL) { create(parent); }
|
||||
|
||||
//! Destruct the memory pool (free all of it's subpools and allocated memory).
|
||||
~AIAPRPool() { destroy(); }
|
||||
|
||||
protected:
|
||||
// Create a pool that is allocated from the Operating System. Only used by AIAPRRootPool.
|
||||
AIAPRPool(int) : mPool(NULL), mParent(NULL), mOwner(apr_os_thread_current())
|
||||
{
|
||||
apr_status_t const apr_pool_create_status = apr_pool_create(&mPool, NULL);
|
||||
llassert_always(apr_pool_create_status == APR_SUCCESS);
|
||||
llassert(mPool);
|
||||
apr_pool_cleanup_register(mPool, this, &s_plain_cleanup, &apr_pool_cleanup_null);
|
||||
}
|
||||
|
||||
public:
|
||||
//! Create a subpool from parent. May only be called for an uninitialized/destroyed pool.
|
||||
// The default parameter causes the root pool of the current thread to be used.
|
||||
void create(AIAPRPool& parent = *static_cast<AIAPRPool*>(NULL));
|
||||
|
||||
//! Destroy the (sub)pool, if any.
|
||||
void destroy(void);
|
||||
|
||||
// Use some safebool idiom (http://www.artima.com/cppsource/safebool.html) rather than operator bool.
|
||||
typedef apr_pool_t* const AIAPRPool::* const bool_type;
|
||||
//! Return true if the pool is initialized.
|
||||
operator bool_type() const { return mPool ? &AIAPRPool::mPool : 0; }
|
||||
|
||||
// Painful, but we have to either provide access to this, or wrap
|
||||
// every APR function call that needs a apr_pool_t* to be passed.
|
||||
// NEVER destroy a pool that is returned by this function!
|
||||
apr_pool_t* operator()(void) const
|
||||
{
|
||||
llassert(mPool);
|
||||
llassert(apr_os_thread_equal(mOwner, apr_os_thread_current()));
|
||||
return mPool;
|
||||
}
|
||||
|
||||
// Free all memory without destructing the pool.
|
||||
void clear(void)
|
||||
{
|
||||
llassert(mPool);
|
||||
llassert(apr_os_thread_equal(mOwner, apr_os_thread_current()));
|
||||
apr_pool_clear(mPool);
|
||||
}
|
||||
|
||||
// These methods would make this class 'complete' (as wrapper around the libapr
|
||||
// pool functions), but we don't use memory pools in the viewer (only when
|
||||
// we are forced to pass one to a libapr call), so don't define them in order
|
||||
// not to encourage people to use them.
|
||||
#if 0
|
||||
void* palloc(size_t size)
|
||||
{
|
||||
llassert(mPool);
|
||||
llassert(apr_os_thread_equal(mOwner, apr_os_thread_current()));
|
||||
return apr_palloc(mPool, size);
|
||||
}
|
||||
void* pcalloc(size_t size)
|
||||
{
|
||||
llassert(mPool);
|
||||
llassert(apr_os_thread_equal(mOwner, apr_os_thread_current()));
|
||||
return apr_pcalloc(mPool, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
bool parent_is_being_destructed(void);
|
||||
static apr_status_t s_plain_cleanup(void* userdata) { return static_cast<AIAPRPool*>(userdata)->plain_cleanup(); }
|
||||
|
||||
apr_status_t plain_cleanup(void)
|
||||
{
|
||||
if (mPool && // We are not being destructed,
|
||||
parent_is_being_destructed()) // but our parent is.
|
||||
// This means the pool is being destructed recursively by libapr
|
||||
// because one of it's parents is being destructed.
|
||||
{
|
||||
mPool = NULL; // Stop destroy() from destructing the pool again.
|
||||
}
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
};
|
||||
|
||||
class AIAPRInitialization
|
||||
{
|
||||
public:
|
||||
AIAPRInitialization(void);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Root memory pool (allocates memory from the operating system).
|
||||
*
|
||||
* This class should only be used by AIThreadLocalData and AIThreadSafeSimpleDCRootPool_pbase
|
||||
* (and LLMutexRootPool when APR_HAS_THREADS isn't defined).
|
||||
*/
|
||||
class LL_COMMON_API AIAPRRootPool : public AIAPRInitialization, public AIAPRPool
|
||||
{
|
||||
private:
|
||||
friend class AIThreadLocalData;
|
||||
friend class AIThreadSafeSimpleDCRootPool_pbase;
|
||||
#if !APR_HAS_THREADS
|
||||
friend class LLMutexRootPool;
|
||||
#endif
|
||||
//! Construct a root memory pool.
|
||||
// Should only be used by AIThreadLocalData and AIThreadSafeSimpleDCRootPool_pbase.
|
||||
AIAPRRootPool(void);
|
||||
~AIAPRRootPool();
|
||||
|
||||
private:
|
||||
// Keep track of how many root pools exist and when the last one is destructed.
|
||||
static bool sCountInitialized;
|
||||
static apr_uint32_t volatile sCount;
|
||||
|
||||
public:
|
||||
// Return a global root pool that is independent of AIThreadLocalData.
|
||||
// Normally you should not use this. Only use for early initialization
|
||||
// (before main) and deinitialization (after main).
|
||||
static AIAPRRootPool& get(void);
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
void grab_ownership(void)
|
||||
{
|
||||
// You need a patched libapr to use this.
|
||||
// See http://web.archiveorange.com/archive/v/5XO9y2zoxUOMt6Gmi1OI
|
||||
apr_pool_owner_set(mPool);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Used for constructing the Special Global Root Pool (returned by AIAPRRootPool::get).
|
||||
// It is the same as the default constructor but omits to increment sCount. As a result,
|
||||
// we must be sure that at least one other AIAPRRootPool is created before termination
|
||||
// of the application (which is the case: we create one AIAPRRootPool per thread).
|
||||
AIAPRRootPool(int) : AIAPRInitialization(), AIAPRPool(0) { }
|
||||
};
|
||||
|
||||
//! Volatile memory pool
|
||||
//
|
||||
// 'Volatile' APR memory pool which normally only clears memory,
|
||||
// and does not destroy the pool (the same pool is reused) for
|
||||
// greater efficiency. However, as a safe guard the apr pool
|
||||
// is destructed every FULL_VOLATILE_APR_POOL uses to allow
|
||||
// the system memory to be allocated more efficiently and not
|
||||
// get scattered through RAM.
|
||||
//
|
||||
class LL_COMMON_API AIVolatileAPRPool : protected AIAPRPool
|
||||
{
|
||||
public:
|
||||
AIVolatileAPRPool(void) : mNumActiveRef(0), mNumTotalRef(0) { }
|
||||
|
||||
apr_pool_t* getVolatileAPRPool(void)
|
||||
{
|
||||
if (!mPool) create();
|
||||
++mNumActiveRef;
|
||||
++mNumTotalRef;
|
||||
return AIAPRPool::operator()();
|
||||
}
|
||||
void clearVolatileAPRPool(void);
|
||||
|
||||
bool isOld(void) const { return mNumTotalRef > FULL_VOLATILE_APR_POOL; }
|
||||
bool isUnused() const { return mNumActiveRef == 0; }
|
||||
|
||||
private:
|
||||
S32 mNumActiveRef; // Number of active uses of the pool.
|
||||
S32 mNumTotalRef; // Number of total uses of the pool since last creation.
|
||||
|
||||
// Maximum number of references to AIVolatileAPRPool until the pool is recreated.
|
||||
static S32 const FULL_VOLATILE_APR_POOL = 1024;
|
||||
};
|
||||
|
||||
#endif // AIAPRPOOL_H
|
||||
519
indra/llcommon/aithreadsafe.h
Normal file
519
indra/llcommon/aithreadsafe.h
Normal file
@@ -0,0 +1,519 @@
|
||||
/**
|
||||
* @file aithreadsafe.h
|
||||
* @brief Implementation of AIThreadSafe, AIReadAccessConst, AIReadAccess and AIWriteAccess.
|
||||
*
|
||||
* Copyright (c) 2010, Aleric Inglewood.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution.
|
||||
*
|
||||
* CHANGELOG
|
||||
* and additional copyright holders.
|
||||
*
|
||||
* 31/03/2010
|
||||
* Initial version, written by Aleric Inglewood @ SL
|
||||
*/
|
||||
|
||||
#ifndef AITHREADSAFE_H
|
||||
#define AITHREADSAFE_H
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "llthread.h"
|
||||
#include "llerror.h"
|
||||
|
||||
// g++ 4.2.x (and before?) have the bug that when you try to pass a temporary
|
||||
// to a function taking a const reference, it still calls the copy constructor.
|
||||
// Define this to hack around that.
|
||||
#define AI_NEED_ACCESS_CC (defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ < 3)) || (__GNUC__ < 4)))
|
||||
|
||||
template<typename T> struct AIReadAccessConst;
|
||||
template<typename T> struct AIReadAccess;
|
||||
template<typename T> struct AIWriteAccess;
|
||||
template<typename T> struct AIAccess;
|
||||
|
||||
template<typename T>
|
||||
class AIThreadSafeBits
|
||||
{
|
||||
private:
|
||||
// AIThreadSafe is a wrapper around an instance of T.
|
||||
// Because T might not have a default constructor, it is constructed
|
||||
// 'in place', with placement new, in the memory reserved here.
|
||||
//
|
||||
// Make sure that the memory that T will be placed in is properly
|
||||
// aligned by using an array of long's.
|
||||
long mMemory[(sizeof(T) + sizeof(long) - 1) / sizeof(long)];
|
||||
|
||||
public:
|
||||
// The wrapped objects are constructed in-place with placement new *outside*
|
||||
// of this object (by AITHREADSAFE macro(s) or derived classes).
|
||||
// However, we are responsible for the destruction of the wrapped object.
|
||||
~AIThreadSafeBits() { ptr()->~T(); }
|
||||
|
||||
// Only for use by AITHREADSAFE, see below.
|
||||
void* memory() const { return const_cast<long*>(&mMemory[0]); }
|
||||
|
||||
protected:
|
||||
// Accessors.
|
||||
T const* ptr() const { return reinterpret_cast<T const*>(mMemory); }
|
||||
T* ptr() { return reinterpret_cast<T*>(mMemory); }
|
||||
|
||||
#if AI_NEED_ACCESS_CC
|
||||
int mAccessCopyCount;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A wrapper class for objects that need to be accessed by more than one thread, allowing concurrent readers.
|
||||
*
|
||||
* Use AITHREADSAFE to define instances of any type, and use AIReadAccessConst,
|
||||
* AIReadAccess and AIWriteAccess to get access to the instance.
|
||||
*
|
||||
* For example,
|
||||
*
|
||||
* <code>
|
||||
* class Foo { public: Foo(int, int); };
|
||||
*
|
||||
* AITHREADSAFE(Foo, foo, (2, 3));
|
||||
*
|
||||
* AIReadAccess<Foo> foo_r(foo);
|
||||
* // Use foo_r-> for read access.
|
||||
*
|
||||
* AIWriteAccess<Foo> foo_w(foo);
|
||||
* // Use foo_w-> for write access.
|
||||
* </code>
|
||||
*
|
||||
* If <code>foo</code> is constant, you have to use <code>AIReadAccessConst<Foo></code>.
|
||||
*
|
||||
* It is possible to pass access objects to a function that
|
||||
* downgrades the access, for example:
|
||||
*
|
||||
* <code>
|
||||
* void readfunc(AIReadAccess const& access);
|
||||
*
|
||||
* AIWriteAccess<Foo> foo_w(foo);
|
||||
* readfunc(foo_w); // readfunc will perform read access to foo_w.
|
||||
* </code>
|
||||
*
|
||||
* If <code>AIReadAccess</code> is non-const, you can upgrade the access by creating
|
||||
* an <code>AIWriteAccess</code> object from it. For example:
|
||||
*
|
||||
* <code>
|
||||
* AIWriteAccess<Foo> foo_w(foo_r);
|
||||
* </code>
|
||||
*
|
||||
* This API is Robust(tm). If you try anything that could result in problems,
|
||||
* it simply won't compile. The only mistake you can still easily make is
|
||||
* to obtain write access to an object when it is not needed, or to unlock
|
||||
* an object in between accesses while the state of the object should be
|
||||
* preserved. For example:
|
||||
*
|
||||
* <code>
|
||||
* // This resets foo to point to the first file and then returns that.
|
||||
* std::string filename = AIWriteAccess<Foo>(foo)->get_first_filename();
|
||||
*
|
||||
* // WRONG! The state between calling get_first_filename and get_next_filename should be preserved!
|
||||
*
|
||||
* AIWriteAccess<Foo> foo_w(foo); // Wrong. The code below only needs read-access.
|
||||
* while (!filename.empty())
|
||||
* {
|
||||
* something(filename);
|
||||
* filename = foo_w->next_filename();
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* Correct would be
|
||||
*
|
||||
* <code>
|
||||
* AIReadAccess<Foo> foo_r(foo);
|
||||
* std::string filename = AIWriteAccess<Foo>(foo_r)->get_first_filename();
|
||||
* while (!filename.empty())
|
||||
* {
|
||||
* something(filename);
|
||||
* filename = foo_r->next_filename();
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
template<typename T>
|
||||
class AIThreadSafe : public AIThreadSafeBits<T>
|
||||
{
|
||||
protected:
|
||||
// Only these may access the object (through ptr()).
|
||||
friend struct AIReadAccessConst<T>;
|
||||
friend struct AIReadAccess<T>;
|
||||
friend struct AIWriteAccess<T>;
|
||||
|
||||
// Locking control.
|
||||
AIRWLock mRWLock;
|
||||
|
||||
// For use by AIThreadSafeDC
|
||||
AIThreadSafe(void) { }
|
||||
AIThreadSafe(AIAPRPool& parent) : mRWLock(parent) { }
|
||||
|
||||
public:
|
||||
// Only for use by AITHREADSAFE, see below.
|
||||
AIThreadSafe(T* object) { llassert(object == AIThreadSafeBits<T>::ptr()); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Instantiate an static, global or local object of a given type wrapped in AIThreadSafe, using an arbitrary constructor.
|
||||
*
|
||||
* For example, instead of doing
|
||||
*
|
||||
* <code>
|
||||
* Foo foo(x, y);
|
||||
* static Bar bar;
|
||||
* </code>
|
||||
*
|
||||
* One can instantiate a thread-safe instance with
|
||||
*
|
||||
* <code>
|
||||
* AITHREADSAFE(Foo, foo, (x, y));
|
||||
* static AITHREADSAFE(Bar, bar, );
|
||||
* </code>
|
||||
*
|
||||
* Note: This macro does not allow to allocate such object on the heap.
|
||||
* If that is needed, have a look at AIThreadSafeDC.
|
||||
*/
|
||||
#define AITHREADSAFE(type, var, paramlist) AIThreadSafe<type> var(new (var.memory()) type paramlist)
|
||||
|
||||
/**
|
||||
* @brief A wrapper class for objects that need to be accessed by more than one thread.
|
||||
*
|
||||
* This class is the same as an AIThreadSafe wrapper, except that it can only
|
||||
* be used for default constructed objects.
|
||||
*
|
||||
* For example, instead of
|
||||
*
|
||||
* <code>
|
||||
* Foo foo;
|
||||
* </code>
|
||||
*
|
||||
* One would use
|
||||
*
|
||||
* <code>
|
||||
* AIThreadSafeDC<Foo> foo;
|
||||
* </code>
|
||||
*
|
||||
* The advantage over AITHREADSAFE is that this object can be allocated with
|
||||
* new on the heap. For example:
|
||||
*
|
||||
* <code>
|
||||
* AIThreadSafeDC<Foo>* ptr = new AIThreadSafeDC<Foo>;
|
||||
* </code>
|
||||
*
|
||||
* which is not possible with AITHREADSAFE.
|
||||
*/
|
||||
template<typename T>
|
||||
class AIThreadSafeDC : public AIThreadSafe<T>
|
||||
{
|
||||
public:
|
||||
// Construct a wrapper around a default constructed object.
|
||||
AIThreadSafeDC(void) { new (AIThreadSafe<T>::ptr()) T; }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Read lock object and provide read access.
|
||||
*/
|
||||
template<typename T>
|
||||
struct AIReadAccessConst
|
||||
{
|
||||
//! Internal enum for the lock-type of the AI*Access object.
|
||||
enum state_type
|
||||
{
|
||||
readlocked, //!< A AIReadAccessConst or AIReadAccess.
|
||||
read2writelocked, //!< A AIWriteAccess constructed from a AIReadAccess.
|
||||
writelocked, //!< A AIWriteAccess constructed from a AIThreadSafe.
|
||||
write2writelocked //!< A AIWriteAccess constructed from (the AIReadAccess base class of) a AIWriteAccess.
|
||||
};
|
||||
|
||||
//! Construct a AIReadAccessConst from a constant AIThreadSafe.
|
||||
AIReadAccessConst(AIThreadSafe<T> const& wrapper)
|
||||
: mWrapper(const_cast<AIThreadSafe<T>&>(wrapper)),
|
||||
mState(readlocked)
|
||||
{
|
||||
mWrapper.mRWLock.rdlock();
|
||||
#if AI_NEED_ACCESS_CC
|
||||
mWrapper.mAccessCopyCount = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Destruct the AI*Access object.
|
||||
// These should never be dynamically allocated, so there is no need to make this virtual.
|
||||
~AIReadAccessConst()
|
||||
{
|
||||
#if AI_NEED_ACCESS_CC
|
||||
if (--(this->mWrapper.mAccessCopyCount) > 0) return;
|
||||
#endif
|
||||
if (mState == readlocked)
|
||||
mWrapper.mRWLock.rdunlock();
|
||||
else if (mState == writelocked)
|
||||
mWrapper.mRWLock.wrunlock();
|
||||
else if (mState == read2writelocked)
|
||||
mWrapper.mRWLock.wr2rdlock();
|
||||
}
|
||||
|
||||
//! Access the underlaying object for read access.
|
||||
T const* operator->() const { return mWrapper.ptr(); }
|
||||
|
||||
//! Access the underlaying object for read access.
|
||||
T const& operator*() const { return *mWrapper.ptr(); }
|
||||
|
||||
protected:
|
||||
//! Constructor used by AIReadAccess.
|
||||
AIReadAccessConst(AIThreadSafe<T>& wrapper, state_type state)
|
||||
: mWrapper(wrapper), mState(state) { }
|
||||
|
||||
AIThreadSafe<T>& mWrapper; //!< Reference to the object that we provide access to.
|
||||
state_type const mState; //!< The lock state that mWrapper is in.
|
||||
|
||||
#if !AI_NEED_ACCESS_CC
|
||||
private:
|
||||
// Disallow copy constructing directly.
|
||||
AIReadAccessConst(AIReadAccessConst const&);
|
||||
#else
|
||||
public:
|
||||
AIReadAccessConst(AIReadAccessConst const& orig) : mWrapper(orig.mWrapper), mState(orig.mState) { mWrapper.mAccessCopyCount++; }
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Read lock object and provide read access, with possible promotion to write access.
|
||||
*/
|
||||
template<typename T>
|
||||
struct AIReadAccess : public AIReadAccessConst<T>
|
||||
{
|
||||
typedef typename AIReadAccessConst<T>::state_type state_type;
|
||||
using AIReadAccessConst<T>::readlocked;
|
||||
|
||||
//! Construct a AIReadAccess from a non-constant AIThreadSafe.
|
||||
AIReadAccess(AIThreadSafe<T>& wrapper) : AIReadAccessConst<T>(wrapper, readlocked) { this->mWrapper.mRWLock.rdlock(); }
|
||||
|
||||
protected:
|
||||
//! Constructor used by AIWriteAccess.
|
||||
AIReadAccess(AIThreadSafe<T>& wrapper, state_type state) : AIReadAccessConst<T>(wrapper, state) { }
|
||||
|
||||
friend struct AIWriteAccess<T>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Write lock object and provide read/write access.
|
||||
*/
|
||||
template<typename T>
|
||||
struct AIWriteAccess : public AIReadAccess<T>
|
||||
{
|
||||
using AIReadAccessConst<T>::readlocked;
|
||||
using AIReadAccessConst<T>::read2writelocked;
|
||||
using AIReadAccessConst<T>::writelocked;
|
||||
using AIReadAccessConst<T>::write2writelocked;
|
||||
|
||||
//! Construct a AIWriteAccess from a non-constant AIThreadSafe.
|
||||
AIWriteAccess(AIThreadSafe<T>& wrapper) : AIReadAccess<T>(wrapper, writelocked) { this->mWrapper.mRWLock.wrlock();}
|
||||
|
||||
//! Promote read access to write access.
|
||||
explicit AIWriteAccess(AIReadAccess<T>& access)
|
||||
: AIReadAccess<T>(access.mWrapper, (access.mState == readlocked) ? read2writelocked : write2writelocked)
|
||||
{
|
||||
if (this->mState == read2writelocked)
|
||||
{
|
||||
this->mWrapper.mRWLock.rd2wrlock();
|
||||
}
|
||||
}
|
||||
|
||||
//! Access the underlaying object for (read and) write access.
|
||||
T* operator->() const { return this->mWrapper.ptr(); }
|
||||
|
||||
//! Access the underlaying object for (read and) write access.
|
||||
T& operator*() const { return *this->mWrapper.ptr(); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A wrapper class for objects that need to be accessed by more than one thread.
|
||||
*
|
||||
* Use AITHREADSAFESIMPLE to define instances of any type, and use AIAccess
|
||||
* to get access to the instance.
|
||||
*
|
||||
* For example,
|
||||
*
|
||||
* <code>
|
||||
* class Foo { public: Foo(int, int); };
|
||||
*
|
||||
* AITHREADSAFESIMPLE(Foo, foo, (2, 3));
|
||||
*
|
||||
* AIAccess<Foo> foo_w(foo);
|
||||
* // Use foo_w-> for read and write access.
|
||||
*
|
||||
* See also AIThreadSafe
|
||||
*/
|
||||
template<typename T>
|
||||
class AIThreadSafeSimple : public AIThreadSafeBits<T>
|
||||
{
|
||||
protected:
|
||||
// Only this one may access the object (through ptr()).
|
||||
friend struct AIAccess<T>;
|
||||
|
||||
// Locking control.
|
||||
LLMutex mMutex;
|
||||
|
||||
// For use by AIThreadSafeSimpleDC
|
||||
AIThreadSafeSimple(void) { }
|
||||
AIThreadSafeSimple(AIAPRPool& parent) : mMutex(parent) { }
|
||||
|
||||
public:
|
||||
// Only for use by AITHREADSAFESIMPLE, see below.
|
||||
AIThreadSafeSimple(T* object) { llassert(object == AIThreadSafeBits<T>::ptr()); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Instantiate an static, global or local object of a given type wrapped in AIThreadSafeSimple, using an arbitrary constructor.
|
||||
*
|
||||
* For example, instead of doing
|
||||
*
|
||||
* <code>
|
||||
* Foo foo(x, y);
|
||||
* static Bar bar;
|
||||
* </code>
|
||||
*
|
||||
* One can instantiate a thread-safe instance with
|
||||
*
|
||||
* <code>
|
||||
* AITHREADSAFESIMPLE(Foo, foo, (x, y));
|
||||
* static AITHREADSAFESIMPLE(Bar, bar, );
|
||||
* </code>
|
||||
*
|
||||
* Note: This macro does not allow to allocate such object on the heap.
|
||||
* If that is needed, have a look at AIThreadSafeSimpleDC.
|
||||
*/
|
||||
#define AITHREADSAFESIMPLE(type, var, paramlist) AIThreadSafeSimple<type> var(new (var.memory()) type paramlist)
|
||||
|
||||
/**
|
||||
* @brief A wrapper class for objects that need to be accessed by more than one thread.
|
||||
*
|
||||
* This class is the same as an AIThreadSafeSimple wrapper, except that it can only
|
||||
* be used for default constructed objects.
|
||||
*
|
||||
* For example, instead of
|
||||
*
|
||||
* <code>
|
||||
* Foo foo;
|
||||
* </code>
|
||||
*
|
||||
* One would use
|
||||
*
|
||||
* <code>
|
||||
* AIThreadSafeSimpleDC<Foo> foo;
|
||||
* </code>
|
||||
*
|
||||
* The advantage over AITHREADSAFESIMPLE is that this object can be allocated with
|
||||
* new on the heap. For example:
|
||||
*
|
||||
* <code>
|
||||
* AIThreadSafeSimpleDC<Foo>* ptr = new AIThreadSafeSimpleDC<Foo>;
|
||||
* </code>
|
||||
*
|
||||
* which is not possible with AITHREADSAFESIMPLE.
|
||||
*/
|
||||
template<typename T>
|
||||
class AIThreadSafeSimpleDC : public AIThreadSafeSimple<T>
|
||||
{
|
||||
public:
|
||||
// Construct a wrapper around a default constructed object.
|
||||
AIThreadSafeSimpleDC(void) { new (AIThreadSafeSimple<T>::ptr()) T; }
|
||||
|
||||
protected:
|
||||
// For use by AIThreadSafeSimpleDCRootPool
|
||||
AIThreadSafeSimpleDC(AIAPRPool& parent) : AIThreadSafeSimple<T>(parent) { new (AIThreadSafeSimple<T>::ptr()) T; }
|
||||
};
|
||||
|
||||
// Helper class for AIThreadSafeSimpleDCRootPool to assure initialization of
|
||||
// the root pool before constructing AIThreadSafeSimpleDC.
|
||||
class AIThreadSafeSimpleDCRootPool_pbase
|
||||
{
|
||||
protected:
|
||||
AIAPRRootPool mRootPool;
|
||||
|
||||
private:
|
||||
template<typename T> friend class AIThreadSafeSimpleDCRootPool;
|
||||
AIThreadSafeSimpleDCRootPool_pbase(void) { }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A wrapper class for objects that need to be accessed by more than one thread.
|
||||
*
|
||||
* The same as AIThreadSafeSimpleDC except that this class creates its own AIAPRRootPool
|
||||
* for the internally used mutexes and condition, instead of using the current threads
|
||||
* root pool. The advantage of this is that it can be used for objects that need to
|
||||
* be accessed from the destructors of global objects (after main). The disadvantage
|
||||
* is that it's less efficient to use your own root pool, therefore it's use should be
|
||||
* restricted to those cases where it is absolutely necessary.
|
||||
*/
|
||||
template<typename T>
|
||||
class AIThreadSafeSimpleDCRootPool : private AIThreadSafeSimpleDCRootPool_pbase, public AIThreadSafeSimpleDC<T>
|
||||
{
|
||||
public:
|
||||
// Construct a wrapper around a default constructed object, using memory allocated
|
||||
// from the operating system for the internal APR objects (mutexes and conditional),
|
||||
// as opposed to allocated from the current threads root pool.
|
||||
AIThreadSafeSimpleDCRootPool(void) :
|
||||
AIThreadSafeSimpleDCRootPool_pbase(),
|
||||
AIThreadSafeSimpleDC<T>(mRootPool) { }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Write lock object and provide read/write access.
|
||||
*/
|
||||
template<typename T>
|
||||
struct AIAccess
|
||||
{
|
||||
//! Construct a AIAccess from a non-constant AIThreadSafeSimple.
|
||||
AIAccess(AIThreadSafeSimple<T>& wrapper) : mWrapper(wrapper)
|
||||
{
|
||||
this->mWrapper.mMutex.lock();
|
||||
#if AI_NEED_ACCESS_CC
|
||||
this->mWrapper.mAccessCopyCount = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Access the underlaying object for (read and) write access.
|
||||
T* operator->() const { return this->mWrapper.ptr(); }
|
||||
|
||||
//! Access the underlaying object for (read and) write access.
|
||||
T& operator*() const { return *this->mWrapper.ptr(); }
|
||||
|
||||
~AIAccess()
|
||||
{
|
||||
#if AI_NEED_ACCESS_CC
|
||||
if (--(this->mWrapper.mAccessCopyCount) > 0) return;
|
||||
#endif
|
||||
this->mWrapper.mMutex.unlock();
|
||||
}
|
||||
|
||||
protected:
|
||||
AIThreadSafeSimple<T>& mWrapper; //!< Reference to the object that we provide access to.
|
||||
|
||||
#if !AI_NEED_ACCESS_CC
|
||||
private:
|
||||
// Disallow copy constructing directly.
|
||||
AIAccess(AIAccess const&);
|
||||
#else
|
||||
public:
|
||||
AIAccess(AIAccess const& orig) : mWrapper(orig.mWrapper) { this->mWrapper.mAccessCopyCount++; }
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -95,7 +95,6 @@ LLAppChildCallback LLApp::sDefaultChildCallback = NULL;
|
||||
LLApp::LLApp() : mThreadErrorp(NULL)
|
||||
{
|
||||
commonCtor();
|
||||
startErrorThread();
|
||||
}
|
||||
|
||||
void LLApp::commonCtor()
|
||||
@@ -123,13 +122,8 @@ void LLApp::commonCtor()
|
||||
mOptions.append(sd);
|
||||
}
|
||||
|
||||
// Make sure we clean up APR when we exit
|
||||
// Don't need to do this if we're cleaning up APR in the destructor
|
||||
//atexit(ll_cleanup_apr);
|
||||
|
||||
// Set the application to this instance.
|
||||
sApplication = this;
|
||||
|
||||
}
|
||||
|
||||
LLApp::LLApp(LLErrorThread *error_thread) :
|
||||
|
||||
@@ -256,9 +256,12 @@ protected:
|
||||
*/
|
||||
void stepFrame();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @ brief This method is called once as soon as logging is initialized.
|
||||
*/
|
||||
void startErrorThread();
|
||||
|
||||
|
||||
private:
|
||||
void setupErrorHandling(); // Do platform-specific error-handling setup (signals, structured exceptions)
|
||||
static void runErrorHandler(); // run shortly after we detect an error, ran in the relatively robust context of the LLErrorThread - preferred.
|
||||
static void runSyncErrorHandler(); // run IMMEDIATELY when we get an error, ran in the context of the faulting thread.
|
||||
|
||||
@@ -34,219 +34,7 @@
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llapr.h"
|
||||
|
||||
apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool
|
||||
apr_thread_mutex_t *gLogMutexp = NULL;
|
||||
apr_thread_mutex_t *gCallStacksLogMutexp = NULL;
|
||||
|
||||
const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool
|
||||
|
||||
void ll_init_apr()
|
||||
{
|
||||
if (!gAPRPoolp)
|
||||
{
|
||||
// Initialize APR and create the global pool
|
||||
apr_initialize();
|
||||
apr_pool_create(&gAPRPoolp, NULL);
|
||||
|
||||
// Initialize the logging mutex
|
||||
apr_thread_mutex_create(&gLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp);
|
||||
apr_thread_mutex_create(&gCallStacksLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp);
|
||||
|
||||
// Initialize thread-local APR pool support.
|
||||
LLVolatileAPRPool::initLocalAPRFilePool();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ll_cleanup_apr()
|
||||
{
|
||||
LL_INFOS("APR") << "Cleaning up APR" << LL_ENDL;
|
||||
|
||||
if (gLogMutexp)
|
||||
{
|
||||
// Clean up the logging mutex
|
||||
|
||||
// All other threads NEED to be done before we clean up APR, so this is okay.
|
||||
apr_thread_mutex_destroy(gLogMutexp);
|
||||
gLogMutexp = NULL;
|
||||
}
|
||||
if (gCallStacksLogMutexp)
|
||||
{
|
||||
// Clean up the logging mutex
|
||||
|
||||
// All other threads NEED to be done before we clean up APR, so this is okay.
|
||||
apr_thread_mutex_destroy(gCallStacksLogMutexp);
|
||||
gCallStacksLogMutexp = NULL;
|
||||
}
|
||||
if (gAPRPoolp)
|
||||
{
|
||||
apr_pool_destroy(gAPRPoolp);
|
||||
gAPRPoolp = NULL;
|
||||
}
|
||||
apr_terminate();
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//LLAPRPool
|
||||
//
|
||||
LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag)
|
||||
: mParent(parent),
|
||||
mReleasePoolFlag(releasePoolFlag),
|
||||
mMaxSize(size),
|
||||
mPool(NULL)
|
||||
{
|
||||
createAPRPool() ;
|
||||
}
|
||||
|
||||
LLAPRPool::~LLAPRPool()
|
||||
{
|
||||
releaseAPRPool() ;
|
||||
}
|
||||
|
||||
void LLAPRPool::createAPRPool()
|
||||
{
|
||||
if(mPool)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
mStatus = apr_pool_create(&mPool, mParent);
|
||||
ll_apr_warn_status(mStatus) ;
|
||||
|
||||
if(mMaxSize > 0) //size is the number of blocks (which is usually 4K), NOT bytes.
|
||||
{
|
||||
apr_allocator_t *allocator = apr_pool_allocator_get(mPool);
|
||||
if (allocator)
|
||||
{
|
||||
apr_allocator_max_free_set(allocator, mMaxSize) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLAPRPool::releaseAPRPool()
|
||||
{
|
||||
if(!mPool)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
if(!mParent || mReleasePoolFlag)
|
||||
{
|
||||
apr_pool_destroy(mPool) ;
|
||||
mPool = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
apr_pool_t* LLAPRPool::getAPRPool()
|
||||
{
|
||||
if(!mPool)
|
||||
{
|
||||
createAPRPool() ;
|
||||
}
|
||||
|
||||
return mPool ;
|
||||
}
|
||||
LLVolatileAPRPool::LLVolatileAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag)
|
||||
: LLAPRPool(parent, size, releasePoolFlag)
|
||||
{
|
||||
mNumActiveRef = 0 ;
|
||||
mNumTotalRef = 0 ;
|
||||
}
|
||||
|
||||
apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool()
|
||||
{
|
||||
mNumTotalRef++ ;
|
||||
mNumActiveRef++ ;
|
||||
return getAPRPool() ;
|
||||
}
|
||||
|
||||
void LLVolatileAPRPool::clearVolatileAPRPool()
|
||||
{
|
||||
if(mNumActiveRef > 0)
|
||||
{
|
||||
mNumActiveRef--;
|
||||
if(mNumActiveRef < 1)
|
||||
{
|
||||
if(isFull())
|
||||
{
|
||||
mNumTotalRef = 0 ;
|
||||
|
||||
//destroy the apr_pool.
|
||||
releaseAPRPool() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
//This does not actually free the memory,
|
||||
//it just allows the pool to re-use this memory for the next allocation.
|
||||
apr_pool_clear(mPool) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
llassert_always(mNumActiveRef > 0) ;
|
||||
}
|
||||
|
||||
//paranoia check if the pool is jammed.
|
||||
//will remove the check before going to release.
|
||||
llassert_always(mNumTotalRef < (FULL_VOLATILE_APR_POOL << 2)) ;
|
||||
}
|
||||
|
||||
BOOL LLVolatileAPRPool::isFull()
|
||||
{
|
||||
return mNumTotalRef > FULL_VOLATILE_APR_POOL ;
|
||||
}
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
// This allows the use of llassert(is_main_thread()) to assure the current thread is the main thread.
|
||||
static void* gIsMainThread;
|
||||
bool is_main_thread() { return gIsMainThread == LLVolatileAPRPool::getLocalAPRFilePool(); }
|
||||
#endif
|
||||
|
||||
// The thread private handle to access the LocalAPRFilePool.
|
||||
apr_threadkey_t* LLVolatileAPRPool::sLocalAPRFilePoolKey;
|
||||
|
||||
// This should be called exactly once, before the first call to createLocalAPRFilePool.
|
||||
// static
|
||||
void LLVolatileAPRPool::initLocalAPRFilePool()
|
||||
{
|
||||
apr_status_t status = apr_threadkey_private_create(&sLocalAPRFilePoolKey, &destroyLocalAPRFilePool, gAPRPoolp);
|
||||
ll_apr_assert_status(status); // Or out of memory, or system-imposed limit on the
|
||||
// total number of keys per process {PTHREAD_KEYS_MAX}
|
||||
// has been exceeded.
|
||||
// Create the thread-local pool for the main thread (this function is called by the main thread).
|
||||
createLocalAPRFilePool();
|
||||
#ifdef SHOW_ASSERT
|
||||
gIsMainThread = getLocalAPRFilePool();
|
||||
#endif
|
||||
}
|
||||
|
||||
// This should be called once for every thread, before it uses getLocalAPRFilePool.
|
||||
// static
|
||||
void LLVolatileAPRPool::createLocalAPRFilePool()
|
||||
{
|
||||
void* thread_local_data = new LLVolatileAPRPool;
|
||||
apr_status_t status = apr_threadkey_private_set(thread_local_data, sLocalAPRFilePoolKey);
|
||||
llassert_always(status == APR_SUCCESS);
|
||||
}
|
||||
|
||||
// This is called once for every thread when the thread is destructed.
|
||||
// static
|
||||
void LLVolatileAPRPool::destroyLocalAPRFilePool(void* thread_local_data)
|
||||
{
|
||||
delete reinterpret_cast<LLVolatileAPRPool*>(thread_local_data);
|
||||
}
|
||||
|
||||
// static
|
||||
LLVolatileAPRPool* LLVolatileAPRPool::getLocalAPRFilePool()
|
||||
{
|
||||
void* thread_local_data;
|
||||
apr_status_t status = apr_threadkey_private_get(&thread_local_data, sLocalAPRFilePoolKey);
|
||||
llassert_always(status == APR_SUCCESS);
|
||||
return reinterpret_cast<LLVolatileAPRPool*>(thread_local_data);
|
||||
}
|
||||
#include "llscopedvolatileaprpool.h"
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
@@ -309,13 +97,15 @@ void ll_apr_assert_status(apr_status_t status)
|
||||
//
|
||||
LLAPRFile::LLAPRFile()
|
||||
: mFile(NULL),
|
||||
mCurrentFilePoolp(NULL)
|
||||
mVolatileFilePoolp(NULL),
|
||||
mRegularFilePoolp(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
LLAPRFile::LLAPRFile(const std::string& filename, apr_int32_t flags, access_t access_type)
|
||||
: mFile(NULL),
|
||||
mCurrentFilePoolp(NULL)
|
||||
mVolatileFilePoolp(NULL),
|
||||
mRegularFilePoolp(NULL)
|
||||
{
|
||||
open(filename, flags, access_type);
|
||||
}
|
||||
@@ -334,10 +124,16 @@ apr_status_t LLAPRFile::close()
|
||||
mFile = NULL ;
|
||||
}
|
||||
|
||||
if(mCurrentFilePoolp)
|
||||
if (mVolatileFilePoolp)
|
||||
{
|
||||
mCurrentFilePoolp->clearVolatileAPRPool() ;
|
||||
mCurrentFilePoolp = NULL ;
|
||||
mVolatileFilePoolp->clearVolatileAPRPool() ;
|
||||
mVolatileFilePoolp = NULL ;
|
||||
}
|
||||
|
||||
if (mRegularFilePoolp)
|
||||
{
|
||||
delete mRegularFilePoolp;
|
||||
mRegularFilePoolp = NULL;
|
||||
}
|
||||
|
||||
return ret ;
|
||||
@@ -346,25 +142,28 @@ apr_status_t LLAPRFile::close()
|
||||
apr_status_t LLAPRFile::open(std::string const& filename, apr_int32_t flags, access_t access_type, S32* sizep)
|
||||
{
|
||||
llassert_always(!mFile);
|
||||
llassert_always(!mCurrentFilePoolp);
|
||||
llassert_always(!mVolatileFilePoolp && !mRegularFilePoolp);
|
||||
|
||||
// Access the pool and increment it's reference count.
|
||||
// The reference count of LLVolatileAPRPool objects will be decremented
|
||||
// again in LLAPRFile::close by calling mCurrentFilePoolp->clearVolatileAPRPool().
|
||||
apr_pool_t* pool;
|
||||
if (access_type == local)
|
||||
apr_status_t status;
|
||||
{
|
||||
// Use a "volatile" thread-local pool.
|
||||
mCurrentFilePoolp = LLVolatileAPRPool::getLocalAPRFilePool();
|
||||
pool = mCurrentFilePoolp->getVolatileAPRPool();
|
||||
apr_pool_t* apr_file_open_pool;
|
||||
if (access_type == local)
|
||||
{
|
||||
// Use a "volatile" thread-local pool.
|
||||
mVolatileFilePoolp = &AIThreadLocalData::tldata().mVolatileAPRPool;
|
||||
// Access the pool and increment it's reference count.
|
||||
// The reference count of AIVolatileAPRPool objects will be decremented
|
||||
// again in LLAPRFile::close by calling mVolatileFilePoolp->clearVolatileAPRPool().
|
||||
apr_file_open_pool = mVolatileFilePoolp->getVolatileAPRPool();
|
||||
}
|
||||
else
|
||||
{
|
||||
mRegularFilePoolp = new AIAPRPool(AIThreadLocalData::tldata().mRootPool);
|
||||
apr_file_open_pool = (*mRegularFilePoolp)();
|
||||
}
|
||||
status = apr_file_open(&mFile, filename.c_str(), flags, APR_OS_DEFAULT, apr_file_open_pool);
|
||||
}
|
||||
else
|
||||
{
|
||||
llassert(is_main_thread());
|
||||
pool = gAPRPoolp;
|
||||
}
|
||||
apr_status_t s = apr_file_open(&mFile, filename.c_str(), flags, APR_OS_DEFAULT, pool);
|
||||
if (s != APR_SUCCESS || !mFile)
|
||||
if (status != APR_SUCCESS || !mFile)
|
||||
{
|
||||
mFile = NULL ;
|
||||
close() ;
|
||||
@@ -372,7 +171,7 @@ apr_status_t LLAPRFile::open(std::string const& filename, apr_int32_t flags, acc
|
||||
{
|
||||
*sizep = 0;
|
||||
}
|
||||
return s;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (sizep)
|
||||
@@ -389,7 +188,7 @@ apr_status_t LLAPRFile::open(std::string const& filename, apr_int32_t flags, acc
|
||||
*sizep = file_size;
|
||||
}
|
||||
|
||||
return s;
|
||||
return status;
|
||||
}
|
||||
|
||||
// File I/O
|
||||
@@ -449,17 +248,6 @@ S32 LLAPRFile::seek(apr_seek_where_t where, S32 offset)
|
||||
//static components of LLAPRFile
|
||||
//
|
||||
|
||||
// Used in the static functions below.
|
||||
class LLScopedVolatileAPRFilePool {
|
||||
private:
|
||||
LLVolatileAPRPool* mPool;
|
||||
apr_pool_t* apr_pool;
|
||||
public:
|
||||
LLScopedVolatileAPRFilePool() : mPool(LLVolatileAPRPool::getLocalAPRFilePool()), apr_pool(mPool->getVolatileAPRPool()) { }
|
||||
~LLScopedVolatileAPRFilePool() { mPool->clearVolatileAPRPool(); }
|
||||
operator apr_pool_t*() const { return apr_pool; }
|
||||
};
|
||||
|
||||
//static
|
||||
S32 LLAPRFile::seek(apr_file_t* file_handle, apr_seek_where_t where, S32 offset)
|
||||
{
|
||||
@@ -496,7 +284,7 @@ S32 LLAPRFile::seek(apr_file_t* file_handle, apr_seek_where_t where, S32 offset)
|
||||
S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes)
|
||||
{
|
||||
apr_file_t* file_handle;
|
||||
LLScopedVolatileAPRFilePool pool;
|
||||
LLScopedVolatileAPRPool pool;
|
||||
apr_status_t s = apr_file_open(&file_handle, filename.c_str(), APR_READ|APR_BINARY, APR_OS_DEFAULT, pool);
|
||||
if (s != APR_SUCCESS || !file_handle)
|
||||
{
|
||||
@@ -548,7 +336,7 @@ S32 LLAPRFile::writeEx(const std::string& filename, void *buf, S32 offset, S32 n
|
||||
}
|
||||
|
||||
apr_file_t* file_handle;
|
||||
LLScopedVolatileAPRFilePool pool;
|
||||
LLScopedVolatileAPRPool pool;
|
||||
apr_status_t s = apr_file_open(&file_handle, filename.c_str(), flags, APR_OS_DEFAULT, pool);
|
||||
if (s != APR_SUCCESS || !file_handle)
|
||||
{
|
||||
@@ -593,7 +381,7 @@ bool LLAPRFile::remove(const std::string& filename)
|
||||
{
|
||||
apr_status_t s;
|
||||
|
||||
LLScopedVolatileAPRFilePool pool;
|
||||
LLScopedVolatileAPRPool pool;
|
||||
s = apr_file_remove(filename.c_str(), pool);
|
||||
|
||||
if (s != APR_SUCCESS)
|
||||
@@ -613,7 +401,7 @@ bool LLAPRFile::rename(const std::string& filename, const std::string& newname)
|
||||
{
|
||||
apr_status_t s;
|
||||
|
||||
LLScopedVolatileAPRFilePool pool;
|
||||
LLScopedVolatileAPRPool pool;
|
||||
s = apr_file_rename(filename.c_str(), newname.c_str(), pool);
|
||||
|
||||
if (s != APR_SUCCESS)
|
||||
@@ -631,7 +419,7 @@ bool LLAPRFile::isExist(const std::string& filename, apr_int32_t flags)
|
||||
apr_file_t* file_handle;
|
||||
apr_status_t s;
|
||||
|
||||
LLScopedVolatileAPRFilePool pool;
|
||||
LLScopedVolatileAPRPool pool;
|
||||
s = apr_file_open(&file_handle, filename.c_str(), flags, APR_OS_DEFAULT, pool);
|
||||
|
||||
if (s != APR_SUCCESS || !file_handle)
|
||||
@@ -652,7 +440,7 @@ S32 LLAPRFile::size(const std::string& filename)
|
||||
apr_finfo_t info;
|
||||
apr_status_t s;
|
||||
|
||||
LLScopedVolatileAPRFilePool pool;
|
||||
LLScopedVolatileAPRPool pool;
|
||||
s = apr_file_open(&file_handle, filename.c_str(), APR_READ, APR_OS_DEFAULT, pool);
|
||||
|
||||
if (s != APR_SUCCESS || !file_handle)
|
||||
@@ -681,7 +469,7 @@ bool LLAPRFile::makeDir(const std::string& dirname)
|
||||
{
|
||||
apr_status_t s;
|
||||
|
||||
LLScopedVolatileAPRFilePool pool;
|
||||
LLScopedVolatileAPRPool pool;
|
||||
s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, pool);
|
||||
|
||||
if (s != APR_SUCCESS)
|
||||
@@ -698,7 +486,7 @@ bool LLAPRFile::removeDir(const std::string& dirname)
|
||||
{
|
||||
apr_status_t s;
|
||||
|
||||
LLScopedVolatileAPRFilePool pool;
|
||||
LLScopedVolatileAPRPool pool;
|
||||
s = apr_file_remove(dirname.c_str(), pool);
|
||||
|
||||
if (s != APR_SUCCESS)
|
||||
|
||||
@@ -48,73 +48,8 @@
|
||||
#include "apr_atomic.h"
|
||||
#include "llstring.h"
|
||||
|
||||
extern LL_COMMON_API apr_thread_mutex_t* gLogMutexp;
|
||||
|
||||
/**
|
||||
* @brief initialize the common apr constructs -- apr itself, the
|
||||
* global pool, and a mutex.
|
||||
*/
|
||||
void LL_COMMON_API ll_init_apr();
|
||||
|
||||
/**
|
||||
* @brief Cleanup those common apr constructs.
|
||||
*/
|
||||
void LL_COMMON_API ll_cleanup_apr();
|
||||
|
||||
//
|
||||
//LL apr_pool
|
||||
//manage apr_pool_t, destroy allocated apr_pool in the destruction function.
|
||||
//
|
||||
class LL_COMMON_API LLAPRPool
|
||||
{
|
||||
public:
|
||||
LLAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE) ;
|
||||
~LLAPRPool() ;
|
||||
|
||||
apr_pool_t* getAPRPool() ;
|
||||
apr_status_t getStatus() {return mStatus ; }
|
||||
|
||||
protected:
|
||||
void releaseAPRPool() ;
|
||||
void createAPRPool() ;
|
||||
|
||||
protected:
|
||||
apr_pool_t* mPool ; //pointing to an apr_pool
|
||||
apr_pool_t* mParent ; //parent pool
|
||||
apr_size_t mMaxSize ; //max size of mPool, mPool should return memory to system if allocated memory beyond this limit. However it seems not to work.
|
||||
apr_status_t mStatus ; //status when creating the pool
|
||||
BOOL mReleasePoolFlag ; //if set, mPool is destroyed when LLAPRPool is deleted. default value is true.
|
||||
};
|
||||
|
||||
//
|
||||
//volatile LL apr_pool
|
||||
//which clears memory automatically.
|
||||
//so it can not hold static data or data after memory is cleared
|
||||
//
|
||||
class LL_COMMON_API LLVolatileAPRPool : protected LLAPRPool
|
||||
{
|
||||
public:
|
||||
LLVolatileAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE);
|
||||
~LLVolatileAPRPool(){}
|
||||
|
||||
apr_pool_t* getVolatileAPRPool() ;
|
||||
|
||||
void clearVolatileAPRPool() ;
|
||||
|
||||
BOOL isFull() ;
|
||||
BOOL isEmpty() {return !mNumActiveRef ;}
|
||||
|
||||
static void initLocalAPRFilePool();
|
||||
static void createLocalAPRFilePool();
|
||||
static void destroyLocalAPRFilePool(void* thread_local_data);
|
||||
static LLVolatileAPRPool* getLocalAPRFilePool();
|
||||
|
||||
private:
|
||||
S32 mNumActiveRef ; //number of active pointers pointing to the apr_pool.
|
||||
S32 mNumTotalRef ; //number of total pointers pointing to the apr_pool since last creating.
|
||||
|
||||
static apr_threadkey_t* sLocalAPRFilePoolKey;
|
||||
} ;
|
||||
class AIAPRPool;
|
||||
class AIVolatileAPRPool;
|
||||
|
||||
/**
|
||||
* @class LLScopedLock
|
||||
@@ -205,7 +140,8 @@ class LL_COMMON_API LLAPRFile : boost::noncopyable
|
||||
// make this non copyable since a copy closes the file
|
||||
private:
|
||||
apr_file_t* mFile ;
|
||||
LLVolatileAPRPool *mCurrentFilePoolp ; //currently in use apr_pool, could be one of them: sAPRFilePoolp, or a temp pool.
|
||||
AIVolatileAPRPool* mVolatileFilePoolp; // (Thread local) APR pool currently in use.
|
||||
AIAPRPool* mRegularFilePoolp; // ...or a regular pool.
|
||||
|
||||
public:
|
||||
enum access_t {
|
||||
@@ -260,6 +196,4 @@ bool LL_COMMON_API ll_apr_warn_status(apr_status_t status);
|
||||
|
||||
void LL_COMMON_API ll_apr_assert_status(apr_status_t status);
|
||||
|
||||
extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool
|
||||
|
||||
#endif // LL_LLAPR_H
|
||||
|
||||
@@ -34,18 +34,10 @@
|
||||
#include "llcommon.h"
|
||||
#include "llthread.h"
|
||||
|
||||
//static
|
||||
BOOL LLCommon::sAprInitialized = FALSE;
|
||||
|
||||
//static
|
||||
void LLCommon::initClass()
|
||||
{
|
||||
LLMemory::initClass();
|
||||
if (!sAprInitialized)
|
||||
{
|
||||
ll_init_apr();
|
||||
sAprInitialized = TRUE;
|
||||
}
|
||||
LLTimer::initClass();
|
||||
LLThreadSafeRefCount::initThreadSafeRefCount();
|
||||
// LLWorkerThread::initClass();
|
||||
@@ -59,10 +51,5 @@ void LLCommon::cleanupClass()
|
||||
// LLWorkerThread::cleanupClass();
|
||||
LLThreadSafeRefCount::cleanupThreadSafeRefCount();
|
||||
LLTimer::cleanupClass();
|
||||
if (sAprInitialized)
|
||||
{
|
||||
ll_cleanup_apr();
|
||||
sAprInitialized = FALSE;
|
||||
}
|
||||
LLMemory::cleanupClass();
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@ class LL_COMMON_API LLCommon
|
||||
public:
|
||||
static void initClass();
|
||||
static void cleanupClass();
|
||||
private:
|
||||
static BOOL sAprInitialized;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
54
indra/llcommon/lldictionary.cpp
Normal file
54
indra/llcommon/lldictionary.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @file lldictionary.cpp
|
||||
* @brief Lldictionary class header file
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lldictionary.h"
|
||||
|
||||
#include "llstring.h"
|
||||
|
||||
// Define in .cpp file to prevent header include of llstring.h
|
||||
LLDictionaryEntry::LLDictionaryEntry(const std::string &name)
|
||||
: mName(name)
|
||||
{
|
||||
mNameCapitalized = mName;
|
||||
LLStringUtil::replaceChar(mNameCapitalized, '-', ' ');
|
||||
LLStringUtil::replaceChar(mNameCapitalized, '_', ' ');
|
||||
for (U32 i=0; i < mNameCapitalized.size(); i++)
|
||||
{
|
||||
if (i == 0 || mNameCapitalized[i-1] == ' ') // don't change ordering of this statement or crash
|
||||
{
|
||||
mNameCapitalized[i] = toupper(mNameCapitalized[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
103
indra/llcommon/lldictionary.h
Normal file
103
indra/llcommon/lldictionary.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @file lldictionary.h
|
||||
* @brief Lldictionary class header file
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LL_LLDICTIONARY_H
|
||||
#define LL_LLDICTIONARY_H
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
struct LL_COMMON_API LLDictionaryEntry
|
||||
{
|
||||
LLDictionaryEntry(const std::string &name);
|
||||
virtual ~LLDictionaryEntry() {}
|
||||
const std::string mName;
|
||||
std::string mNameCapitalized;
|
||||
};
|
||||
|
||||
template <class Index, class Entry>
|
||||
class LLDictionary : public std::map<Index, Entry *>
|
||||
{
|
||||
public:
|
||||
typedef std::map<Index, Entry *> map_t;
|
||||
typedef typename map_t::iterator iterator_t;
|
||||
typedef typename map_t::const_iterator const_iterator_t;
|
||||
|
||||
LLDictionary() {}
|
||||
virtual ~LLDictionary()
|
||||
{
|
||||
for (iterator_t iter = map_t::begin(); iter != map_t::end(); ++iter)
|
||||
delete (iter->second);
|
||||
}
|
||||
|
||||
const Entry *lookup(Index index) const
|
||||
{
|
||||
const_iterator_t dictionary_iter = map_t::find(index);
|
||||
if (dictionary_iter == map_t::end()) return NULL;
|
||||
return dictionary_iter->second;
|
||||
}
|
||||
const Index lookup(const std::string &name) const
|
||||
{
|
||||
for (const_iterator_t dictionary_iter = map_t::begin();
|
||||
dictionary_iter != map_t::end();
|
||||
dictionary_iter++)
|
||||
{
|
||||
const Entry *entry = dictionary_iter->second;
|
||||
if (entry->mName == name)
|
||||
{
|
||||
return dictionary_iter->first;
|
||||
}
|
||||
}
|
||||
return notFound();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual Index notFound() const
|
||||
{
|
||||
// default is to assert
|
||||
// don't assert -- makes it impossible to work on mesh-development and viewer-development simultaneously
|
||||
// -- davep 2010.10.29
|
||||
//llassert(false);
|
||||
return Index(-1);
|
||||
}
|
||||
void addEntry(Index index, Entry *entry)
|
||||
{
|
||||
if (lookup(index))
|
||||
{
|
||||
llerrs << "Dictionary entry already added (attempted to add duplicate entry)" << llendl;
|
||||
}
|
||||
(*this)[index] = entry;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // LL_LLDICTIONARY_H
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "llsdserialize.h"
|
||||
#include "llstl.h"
|
||||
#include "lltimer.h"
|
||||
#include "aithreadsafe.h"
|
||||
|
||||
extern apr_thread_mutex_t* gCallStacksLogMutexp;
|
||||
|
||||
@@ -357,12 +358,15 @@ namespace
|
||||
void addCallSite(LLError::CallSite&);
|
||||
void invalidateCallSites();
|
||||
|
||||
static Globals& get();
|
||||
static AIThreadSafeSimple<Globals>& get();
|
||||
// return the one instance of the globals
|
||||
|
||||
private:
|
||||
CallSiteVector callSites;
|
||||
|
||||
friend class AIThreadSafeSimpleDC<Globals>; // Calls constructor.
|
||||
friend class AIThreadSafeSimple<Globals>; // Calls destructor.
|
||||
|
||||
Globals()
|
||||
: messageStreamInUse(false)
|
||||
{ }
|
||||
@@ -386,7 +390,7 @@ namespace
|
||||
callSites.clear();
|
||||
}
|
||||
|
||||
Globals& Globals::get()
|
||||
AIThreadSafeSimple<Globals>& Globals::get()
|
||||
{
|
||||
/* This pattern, of returning a reference to a static function
|
||||
variable, is to ensure that this global is constructed before
|
||||
@@ -394,8 +398,8 @@ namespace
|
||||
is.
|
||||
See C++ FAQ Lite, sections 10.12 through 10.14
|
||||
*/
|
||||
static Globals* globals = new Globals;
|
||||
return *globals;
|
||||
static AIThreadSafeSimpleDCRootPool<Globals>* ts_globals_ptr = new AIThreadSafeSimpleDCRootPool<Globals>;
|
||||
return *ts_globals_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,13 +428,16 @@ namespace LLError
|
||||
|
||||
int shouldLogCallCounter;
|
||||
|
||||
static Settings& get();
|
||||
static AIThreadSafeSimple<Settings>& get();
|
||||
|
||||
static void reset();
|
||||
static Settings* saveAndReset();
|
||||
static void restore(Settings*);
|
||||
static AIThreadSafeSimple<Settings>* saveAndReset();
|
||||
static void restore(AIThreadSafeSimple<Settings>*);
|
||||
|
||||
private:
|
||||
friend class AIThreadSafeBits<Settings>; // Calls destructor.
|
||||
friend class AIThreadSafeSimpleDC<Settings>; // Calls constructor.
|
||||
|
||||
Settings()
|
||||
: printLocation(false),
|
||||
defaultLevel(LLError::LEVEL_DEBUG),
|
||||
@@ -446,53 +453,42 @@ namespace LLError
|
||||
for_each(recorders.begin(), recorders.end(),
|
||||
DeletePointer());
|
||||
}
|
||||
|
||||
static Settings*& getPtr();
|
||||
|
||||
static AIThreadSafeSimple<Settings>* sSettings;
|
||||
};
|
||||
|
||||
// Pointer to current AIThreadSafeSimple<Settings> object if any (NULL otherwise).
|
||||
AIThreadSafeSimple<Settings>* Settings::sSettings;
|
||||
|
||||
Settings& Settings::get()
|
||||
AIThreadSafeSimple<Settings>& Settings::get()
|
||||
{
|
||||
Settings* p = getPtr();
|
||||
if (!p)
|
||||
if (!sSettings)
|
||||
{
|
||||
reset();
|
||||
p = getPtr();
|
||||
}
|
||||
return *p;
|
||||
return *sSettings;
|
||||
}
|
||||
|
||||
void Settings::reset()
|
||||
{
|
||||
Globals::get().invalidateCallSites();
|
||||
|
||||
Settings*& p = getPtr();
|
||||
delete p;
|
||||
p = new Settings();
|
||||
AIAccess<Globals>(Globals::get())->invalidateCallSites();
|
||||
delete sSettings;
|
||||
sSettings = new AIThreadSafeSimpleDC<Settings>;
|
||||
}
|
||||
|
||||
Settings* Settings::saveAndReset()
|
||||
AIThreadSafeSimple<Settings>* Settings::saveAndReset()
|
||||
{
|
||||
Globals::get().invalidateCallSites();
|
||||
|
||||
Settings*& p = getPtr();
|
||||
Settings* originalSettings = p;
|
||||
p = new Settings();
|
||||
AIAccess<Globals>(Globals::get())->invalidateCallSites();
|
||||
AIThreadSafeSimple<Settings>* originalSettings = sSettings;
|
||||
sSettings = new AIThreadSafeSimpleDC<Settings>;
|
||||
return originalSettings;
|
||||
}
|
||||
|
||||
void Settings::restore(Settings* originalSettings)
|
||||
void Settings::restore(AIThreadSafeSimple<Settings>* originalSettings)
|
||||
{
|
||||
Globals::get().invalidateCallSites();
|
||||
|
||||
Settings*& p = getPtr();
|
||||
delete p;
|
||||
p = originalSettings;
|
||||
}
|
||||
|
||||
Settings*& Settings::getPtr()
|
||||
{
|
||||
static Settings* currentSettings = NULL;
|
||||
return currentSettings;
|
||||
AIAccess<Globals>(Globals::get())->invalidateCallSites();
|
||||
delete sSettings;
|
||||
sSettings = originalSettings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,68 +592,64 @@ namespace LLError
|
||||
commonInit(dir);
|
||||
}
|
||||
|
||||
void setPrintLocation(AIAccess<Settings> const& settings_w, bool print)
|
||||
{
|
||||
settings_w->printLocation = print;
|
||||
}
|
||||
|
||||
void setPrintLocation(bool print)
|
||||
{
|
||||
Settings& s = Settings::get();
|
||||
s.printLocation = print;
|
||||
setPrintLocation(AIAccess<Settings>(Settings::get()), print);
|
||||
}
|
||||
|
||||
void setFatalFunction(const FatalFunction& f)
|
||||
{
|
||||
Settings& s = Settings::get();
|
||||
s.crashFunction = f;
|
||||
AIAccess<Settings>(Settings::get())->crashFunction = f;
|
||||
}
|
||||
|
||||
FatalFunction getFatalFunction()
|
||||
{
|
||||
Settings& s = Settings::get();
|
||||
return s.crashFunction;
|
||||
return AIAccess<Settings>(Settings::get())->crashFunction;
|
||||
}
|
||||
|
||||
void setTimeFunction(TimeFunction f)
|
||||
{
|
||||
Settings& s = Settings::get();
|
||||
s.timeFunction = f;
|
||||
AIAccess<Settings>(Settings::get())->timeFunction = f;
|
||||
}
|
||||
|
||||
void setDefaultLevel(AIAccess<Settings> const& settings_w, ELevel level)
|
||||
{
|
||||
AIAccess<Globals>(Globals::get())->invalidateCallSites();
|
||||
settings_w->defaultLevel = level;
|
||||
}
|
||||
|
||||
void setDefaultLevel(ELevel level)
|
||||
{
|
||||
Globals& g = Globals::get();
|
||||
Settings& s = Settings::get();
|
||||
g.invalidateCallSites();
|
||||
s.defaultLevel = level;
|
||||
setDefaultLevel(AIAccess<Settings>(Settings::get()), level);
|
||||
}
|
||||
|
||||
void setFunctionLevel(const std::string& function_name, ELevel level)
|
||||
{
|
||||
Globals& g = Globals::get();
|
||||
Settings& s = Settings::get();
|
||||
g.invalidateCallSites();
|
||||
s.functionLevelMap[function_name] = level;
|
||||
AIAccess<Globals>(Globals::get())->invalidateCallSites();
|
||||
AIAccess<Settings>(Settings::get())->functionLevelMap[function_name] = level;
|
||||
}
|
||||
|
||||
void setClassLevel(const std::string& class_name, ELevel level)
|
||||
{
|
||||
Globals& g = Globals::get();
|
||||
Settings& s = Settings::get();
|
||||
g.invalidateCallSites();
|
||||
s.classLevelMap[class_name] = level;
|
||||
AIAccess<Globals>(Globals::get())->invalidateCallSites();
|
||||
AIAccess<Settings>(Settings::get())->classLevelMap[class_name] = level;
|
||||
}
|
||||
|
||||
void setFileLevel(const std::string& file_name, ELevel level)
|
||||
{
|
||||
Globals& g = Globals::get();
|
||||
Settings& s = Settings::get();
|
||||
g.invalidateCallSites();
|
||||
s.fileLevelMap[file_name] = level;
|
||||
AIAccess<Globals>(Globals::get())->invalidateCallSites();
|
||||
AIAccess<Settings>(Settings::get())->fileLevelMap[file_name] = level;
|
||||
}
|
||||
|
||||
void setTagLevel(const std::string& tag_name, ELevel level)
|
||||
{
|
||||
Globals& g = Globals::get();
|
||||
Settings& s = Settings::get();
|
||||
g.invalidateCallSites();
|
||||
s.tagLevelMap[tag_name] = level;
|
||||
AIAccess<Globals>(Globals::get())->invalidateCallSites();
|
||||
AIAccess<Settings>(Settings::get())->tagLevelMap[tag_name] = level;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -701,18 +693,16 @@ namespace LLError
|
||||
{
|
||||
void configure(const LLSD& config)
|
||||
{
|
||||
Globals& g = Globals::get();
|
||||
Settings& s = Settings::get();
|
||||
AIAccess<Settings> settings_w(Settings::get());
|
||||
AIAccess<Globals>(Globals::get())->invalidateCallSites();
|
||||
settings_w->functionLevelMap.clear();
|
||||
settings_w->classLevelMap.clear();
|
||||
settings_w->fileLevelMap.clear();
|
||||
settings_w->tagLevelMap.clear();
|
||||
settings_w->uniqueLogMessages.clear();
|
||||
|
||||
g.invalidateCallSites();
|
||||
s.functionLevelMap.clear();
|
||||
s.classLevelMap.clear();
|
||||
s.fileLevelMap.clear();
|
||||
s.tagLevelMap.clear();
|
||||
s.uniqueLogMessages.clear();
|
||||
|
||||
setPrintLocation(config["print-location"]);
|
||||
setDefaultLevel(decodeLevel(config["default-level"]));
|
||||
setPrintLocation(settings_w, config["print-location"]);
|
||||
setDefaultLevel(settings_w, decodeLevel(config["default-level"]));
|
||||
|
||||
LLSD sets = config["settings"];
|
||||
LLSD::array_const_iterator a, end;
|
||||
@@ -722,10 +712,10 @@ namespace LLError
|
||||
|
||||
ELevel level = decodeLevel(entry["level"]);
|
||||
|
||||
setLevels(s.functionLevelMap, entry["functions"], level);
|
||||
setLevels(s.classLevelMap, entry["classes"], level);
|
||||
setLevels(s.fileLevelMap, entry["files"], level);
|
||||
setLevels(s.tagLevelMap, entry["tags"], level);
|
||||
setLevels(settings_w->functionLevelMap, entry["functions"], level);
|
||||
setLevels(settings_w->classLevelMap, entry["classes"], level);
|
||||
setLevels(settings_w->fileLevelMap, entry["files"], level);
|
||||
setLevels(settings_w->tagLevelMap, entry["tags"], level);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -742,26 +732,34 @@ namespace LLError
|
||||
|
||||
|
||||
|
||||
void addRecorder(Recorder* recorder)
|
||||
void addRecorder(AIAccess<Settings> const& settings_w, Recorder* recorder)
|
||||
{
|
||||
if (recorder == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Settings& s = Settings::get();
|
||||
s.recorders.push_back(recorder);
|
||||
settings_w->recorders.push_back(recorder);
|
||||
}
|
||||
|
||||
void addRecorder(Recorder* recorder)
|
||||
{
|
||||
addRecorder(AIAccess<Settings>(Settings::get()), recorder);
|
||||
}
|
||||
|
||||
void removeRecorder(AIAccess<Settings> const& settings_w, Recorder* recorder)
|
||||
{
|
||||
if (recorder == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
settings_w->recorders.erase(
|
||||
std::remove(settings_w->recorders.begin(), settings_w->recorders.end(), recorder),
|
||||
settings_w->recorders.end());
|
||||
}
|
||||
|
||||
void removeRecorder(Recorder* recorder)
|
||||
{
|
||||
if (recorder == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Settings& s = Settings::get();
|
||||
s.recorders.erase(
|
||||
std::remove(s.recorders.begin(), s.recorders.end(), recorder),
|
||||
s.recorders.end());
|
||||
removeRecorder(AIAccess<Settings>(Settings::get()), recorder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -769,12 +767,12 @@ namespace LLError
|
||||
{
|
||||
void logToFile(const std::string& file_name)
|
||||
{
|
||||
LLError::Settings& s = LLError::Settings::get();
|
||||
AIAccess<Settings> settings_w(Settings::get());
|
||||
|
||||
removeRecorder(s.fileRecorder);
|
||||
delete s.fileRecorder;
|
||||
s.fileRecorder = NULL;
|
||||
s.fileRecorderFileName.clear();
|
||||
removeRecorder(settings_w, settings_w->fileRecorder);
|
||||
delete settings_w->fileRecorder;
|
||||
settings_w->fileRecorder = NULL;
|
||||
settings_w->fileRecorderFileName.clear();
|
||||
|
||||
if (file_name.empty())
|
||||
{
|
||||
@@ -788,54 +786,51 @@ namespace LLError
|
||||
return;
|
||||
}
|
||||
|
||||
s.fileRecorderFileName = file_name;
|
||||
s.fileRecorder = f;
|
||||
addRecorder(f);
|
||||
settings_w->fileRecorderFileName = file_name;
|
||||
settings_w->fileRecorder = f;
|
||||
addRecorder(settings_w, f);
|
||||
}
|
||||
|
||||
void logToFixedBuffer(LLLineBuffer* fixedBuffer)
|
||||
{
|
||||
LLError::Settings& s = LLError::Settings::get();
|
||||
AIAccess<Settings> settings_w(Settings::get());
|
||||
|
||||
removeRecorder(s.fixedBufferRecorder);
|
||||
delete s.fixedBufferRecorder;
|
||||
s.fixedBufferRecorder = NULL;
|
||||
removeRecorder(settings_w, settings_w->fixedBufferRecorder);
|
||||
delete settings_w->fixedBufferRecorder;
|
||||
settings_w->fixedBufferRecorder = NULL;
|
||||
|
||||
if (!fixedBuffer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s.fixedBufferRecorder = new RecordToFixedBuffer(fixedBuffer);
|
||||
addRecorder(s.fixedBufferRecorder);
|
||||
settings_w->fixedBufferRecorder = new RecordToFixedBuffer(fixedBuffer);
|
||||
addRecorder(settings_w, settings_w->fixedBufferRecorder);
|
||||
}
|
||||
|
||||
std::string logFileName()
|
||||
{
|
||||
LLError::Settings& s = LLError::Settings::get();
|
||||
return s.fileRecorderFileName;
|
||||
return AIAccess<Settings>(Settings::get())->fileRecorderFileName;
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
void writeToRecorders(LLError::ELevel level, const std::string& message)
|
||||
void writeToRecorders(AIAccess<LLError::Settings> const& settings_w, LLError::ELevel level, const std::string& message)
|
||||
{
|
||||
LLError::Settings& s = LLError::Settings::get();
|
||||
|
||||
std::string messageWithTime;
|
||||
|
||||
for (Recorders::const_iterator i = s.recorders.begin();
|
||||
i != s.recorders.end();
|
||||
|
||||
for (Recorders::const_iterator i = settings_w->recorders.begin();
|
||||
i != settings_w->recorders.end();
|
||||
++i)
|
||||
{
|
||||
LLError::Recorder* r = *i;
|
||||
|
||||
if (r->wantsTime() && s.timeFunction != NULL)
|
||||
if (r->wantsTime() && settings_w->timeFunction != NULL)
|
||||
{
|
||||
if (messageWithTime.empty())
|
||||
{
|
||||
messageWithTime = s.timeFunction() + " " + message;
|
||||
messageWithTime = settings_w->timeFunction() + " " + message;
|
||||
}
|
||||
|
||||
r->recordMessage(level, messageWithTime);
|
||||
@@ -877,6 +872,9 @@ You get:
|
||||
|
||||
*/
|
||||
|
||||
apr_thread_mutex_t* gLogMutexp;
|
||||
apr_thread_mutex_t* gCallStacksLogMutexp;
|
||||
|
||||
namespace {
|
||||
bool checkLevelMap(const LevelMap& map, const std::string& key,
|
||||
LLError::ELevel& level)
|
||||
@@ -952,10 +950,9 @@ namespace LLError
|
||||
return false;
|
||||
}
|
||||
|
||||
Globals& g = Globals::get();
|
||||
Settings& s = Settings::get();
|
||||
AIAccess<Settings> settings_w(Settings::get());
|
||||
|
||||
s.shouldLogCallCounter += 1;
|
||||
settings_w->shouldLogCallCounter += 1;
|
||||
|
||||
std::string class_name = className(site.mClassInfo);
|
||||
std::string function_name = functionName(site.mFunction);
|
||||
@@ -964,20 +961,20 @@ namespace LLError
|
||||
function_name = class_name + "::" + function_name;
|
||||
}
|
||||
|
||||
ELevel compareLevel = s.defaultLevel;
|
||||
ELevel compareLevel = settings_w->defaultLevel;
|
||||
|
||||
// The most specific match found will be used as the log level,
|
||||
// since the computation short circuits.
|
||||
// So, in increasing order of importance:
|
||||
// Default < Broad Tag < File < Class < Function < Narrow Tag
|
||||
((site.mNarrowTag != NULL) ? checkLevelMap(s.tagLevelMap, site.mNarrowTag, compareLevel) : false)
|
||||
|| checkLevelMap(s.functionLevelMap, function_name, compareLevel)
|
||||
|| checkLevelMap(s.classLevelMap, class_name, compareLevel)
|
||||
|| checkLevelMap(s.fileLevelMap, abbreviateFile(site.mFile), compareLevel)
|
||||
|| ((site.mBroadTag != NULL) ? checkLevelMap(s.tagLevelMap, site.mBroadTag, compareLevel) : false);
|
||||
((site.mNarrowTag != NULL) ? checkLevelMap(settings_w->tagLevelMap, site.mNarrowTag, compareLevel) : false)
|
||||
|| checkLevelMap(settings_w->functionLevelMap, function_name, compareLevel)
|
||||
|| checkLevelMap(settings_w->classLevelMap, class_name, compareLevel)
|
||||
|| checkLevelMap(settings_w->fileLevelMap, abbreviateFile(site.mFile), compareLevel)
|
||||
|| ((site.mBroadTag != NULL) ? checkLevelMap(settings_w->tagLevelMap, site.mBroadTag, compareLevel) : false);
|
||||
|
||||
site.mCached = true;
|
||||
g.addCallSite(site);
|
||||
AIAccess<Globals>(Globals::get())->addCallSite(site);
|
||||
return site.mShouldLog = site.mLevel >= compareLevel;
|
||||
}
|
||||
|
||||
@@ -987,16 +984,16 @@ namespace LLError
|
||||
LogLock lock;
|
||||
if (lock.ok())
|
||||
{
|
||||
Globals& g = Globals::get();
|
||||
AIAccess<Globals> globals(Globals::get());
|
||||
|
||||
if (!g.messageStreamInUse)
|
||||
if (!globals->messageStreamInUse)
|
||||
{
|
||||
g.messageStreamInUse = true;
|
||||
return &g.messageStream;
|
||||
globals->messageStreamInUse = true;
|
||||
return &globals->messageStream; // Returns pointer to member of unlocked object, apparently "protected" by having set globals->messageStreamInUse.
|
||||
}
|
||||
}
|
||||
|
||||
return new std::ostringstream;
|
||||
return new std::ostringstream; // Holy memory leak.
|
||||
}
|
||||
|
||||
void Log::flush(std::ostringstream* out, char* message)
|
||||
@@ -1017,12 +1014,12 @@ namespace LLError
|
||||
message[127] = '\0' ;
|
||||
}
|
||||
|
||||
Globals& g = Globals::get();
|
||||
if (out == &g.messageStream)
|
||||
AIAccess<Globals> globals(Globals::get());
|
||||
if (out == &globals->messageStream)
|
||||
{
|
||||
g.messageStream.clear();
|
||||
g.messageStream.str("");
|
||||
g.messageStreamInUse = false;
|
||||
globals->messageStream.clear();
|
||||
globals->messageStream.str("");
|
||||
globals->messageStreamInUse = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1039,28 +1036,31 @@ namespace LLError
|
||||
return;
|
||||
}
|
||||
|
||||
Globals& g = Globals::get();
|
||||
Settings& s = Settings::get();
|
||||
|
||||
std::string message = out->str();
|
||||
if (out == &g.messageStream)
|
||||
|
||||
{
|
||||
g.messageStream.clear();
|
||||
g.messageStream.str("");
|
||||
g.messageStreamInUse = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete out;
|
||||
AIAccess<Globals> globals(Globals::get());
|
||||
if (out == &globals->messageStream)
|
||||
{
|
||||
globals->messageStream.clear();
|
||||
globals->messageStream.str("");
|
||||
globals->messageStreamInUse = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete out;
|
||||
}
|
||||
}
|
||||
|
||||
AIAccess<Settings> settings_w(Settings::get());
|
||||
|
||||
if (site.mLevel == LEVEL_ERROR)
|
||||
{
|
||||
std::ostringstream fatalMessage;
|
||||
fatalMessage << abbreviateFile(site.mFile)
|
||||
<< "(" << site.mLine << ") : error";
|
||||
|
||||
writeToRecorders(site.mLevel, fatalMessage.str());
|
||||
writeToRecorders(settings_w, site.mLevel, fatalMessage.str());
|
||||
}
|
||||
|
||||
|
||||
@@ -1075,7 +1075,7 @@ namespace LLError
|
||||
default: prefix << "XXX: "; break;
|
||||
};
|
||||
|
||||
if (s.printLocation)
|
||||
if (settings_w->printLocation)
|
||||
{
|
||||
prefix << abbreviateFile(site.mFile)
|
||||
<< "(" << site.mLine << ") : ";
|
||||
@@ -1093,8 +1093,8 @@ namespace LLError
|
||||
|
||||
if (site.mPrintOnce)
|
||||
{
|
||||
std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message);
|
||||
if (messageIter != s.uniqueLogMessages.end())
|
||||
std::map<std::string, unsigned int>::iterator messageIter = settings_w->uniqueLogMessages.find(message);
|
||||
if (messageIter != settings_w->uniqueLogMessages.end())
|
||||
{
|
||||
messageIter->second++;
|
||||
unsigned int num_messages = messageIter->second;
|
||||
@@ -1110,14 +1110,14 @@ namespace LLError
|
||||
else
|
||||
{
|
||||
prefix << "ONCE: ";
|
||||
s.uniqueLogMessages[message] = 1;
|
||||
settings_w->uniqueLogMessages[message] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (site.mPrintOnce)
|
||||
{
|
||||
std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message);
|
||||
if (messageIter != s.uniqueLogMessages.end())
|
||||
std::map<std::string, unsigned int>::iterator messageIter = settings_w->uniqueLogMessages.find(message);
|
||||
if (messageIter != settings_w->uniqueLogMessages.end())
|
||||
{
|
||||
messageIter->second++;
|
||||
unsigned int num_messages = messageIter->second;
|
||||
@@ -1133,18 +1133,18 @@ namespace LLError
|
||||
else
|
||||
{
|
||||
prefix << "ONCE: ";
|
||||
s.uniqueLogMessages[message] = 1;
|
||||
settings_w->uniqueLogMessages[message] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
prefix << message;
|
||||
message = prefix.str();
|
||||
|
||||
writeToRecorders(site.mLevel, message);
|
||||
writeToRecorders(settings_w, site.mLevel, message);
|
||||
|
||||
if (site.mLevel == LEVEL_ERROR && s.crashFunction)
|
||||
if (site.mLevel == LEVEL_ERROR && settings_w->crashFunction)
|
||||
{
|
||||
s.crashFunction(message);
|
||||
settings_w->crashFunction(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1154,14 +1154,16 @@ namespace LLError
|
||||
|
||||
namespace LLError
|
||||
{
|
||||
Settings* saveAndResetSettings()
|
||||
class ThreadSafeSettings { };
|
||||
|
||||
ThreadSafeSettings* saveAndResetSettings()
|
||||
{
|
||||
return Settings::saveAndReset();
|
||||
return reinterpret_cast<ThreadSafeSettings*>(Settings::saveAndReset());
|
||||
}
|
||||
|
||||
void restoreSettings(Settings* s)
|
||||
void restoreSettings(ThreadSafeSettings* s)
|
||||
{
|
||||
return Settings::restore(s);
|
||||
Settings::restore(reinterpret_cast<AIThreadSafeSimple<Settings>*>(s));
|
||||
}
|
||||
|
||||
std::string removePrefix(std::string& s, const std::string& p)
|
||||
@@ -1207,8 +1209,7 @@ namespace LLError
|
||||
|
||||
int shouldLogCallCount()
|
||||
{
|
||||
Settings& s = Settings::get();
|
||||
return s.shouldLogCallCounter;
|
||||
return AIAccess<Settings>(Settings::get())->shouldLogCallCounter;
|
||||
}
|
||||
|
||||
#if LL_WINDOWS
|
||||
|
||||
@@ -303,7 +303,7 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
|
||||
*/
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
extern bool is_main_thread();
|
||||
extern LL_COMMON_API bool is_main_thread();
|
||||
#endif
|
||||
|
||||
#endif // LL_LLERROR_H
|
||||
|
||||
@@ -167,9 +167,9 @@ namespace LLError
|
||||
Utilities for use by the unit tests of LLError itself.
|
||||
*/
|
||||
|
||||
class Settings;
|
||||
LL_COMMON_API Settings* saveAndResetSettings();
|
||||
LL_COMMON_API void restoreSettings(Settings *);
|
||||
class ThreadSafeSettings;
|
||||
LL_COMMON_API ThreadSafeSettings* saveAndResetSettings();
|
||||
LL_COMMON_API void restoreSettings(ThreadSafeSettings *);
|
||||
|
||||
LL_COMMON_API std::string abbreviateFile(const std::string& filePath);
|
||||
LL_COMMON_API int shouldLogCallCount();
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
// common messaging components
|
||||
FTM_PUMP,
|
||||
FTM_CURL,
|
||||
FTM_PUMPIO,
|
||||
|
||||
// common simulation components
|
||||
FTM_UPDATE_ANIMATION,
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
|
||||
LLFixedBuffer::LLFixedBuffer(const U32 max_lines)
|
||||
: LLLineBuffer(),
|
||||
mMaxLines(max_lines),
|
||||
mMutex(NULL)
|
||||
mMaxLines(max_lines)
|
||||
{
|
||||
mTimer.reset();
|
||||
}
|
||||
|
||||
@@ -1,185 +1,170 @@
|
||||
/**
|
||||
* @file llpreprocessor.h
|
||||
* @brief This file should be included in all Linden Lab files and
|
||||
* should only contain special preprocessor directives
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LLPREPROCESSOR_H
|
||||
#define LLPREPROCESSOR_H
|
||||
|
||||
// Figure out endianness of platform
|
||||
#ifdef LL_LINUX
|
||||
#define __ENABLE_WSTRING
|
||||
#include <endian.h>
|
||||
#endif // LL_LINUX
|
||||
|
||||
#if LL_SOLARIS
|
||||
# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported.
|
||||
# define LL_BIG_ENDIAN 1
|
||||
# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed
|
||||
# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API
|
||||
# endif
|
||||
# include <sys/isa_defs.h> // ensure we know which end is up
|
||||
#endif // LL_SOLARIS
|
||||
|
||||
#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386)))
|
||||
#define LL_LITTLE_ENDIAN 1
|
||||
#else
|
||||
#define LL_BIG_ENDIAN 1
|
||||
#endif
|
||||
|
||||
|
||||
// Per-compiler switches
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define LL_FORCE_INLINE inline __attribute__((always_inline))
|
||||
#else
|
||||
#define LL_FORCE_INLINE __forceinline
|
||||
#endif
|
||||
|
||||
// Mark-up expressions with branch prediction hints. Do NOT use
|
||||
// this with reckless abandon - it's an obfuscating micro-optimization
|
||||
// outside of inner loops or other places where you are OVERWHELMINGLY
|
||||
// sure which way an expression almost-always evaluates.
|
||||
#if __GNUC__ >= 3
|
||||
# define LL_LIKELY(EXPR) __builtin_expect (!!(EXPR), true)
|
||||
# define LL_UNLIKELY(EXPR) __builtin_expect (!!(EXPR), false)
|
||||
#else
|
||||
# define LL_LIKELY(EXPR) (EXPR)
|
||||
# define LL_UNLIKELY(EXPR) (EXPR)
|
||||
#endif
|
||||
|
||||
|
||||
// Figure out differences between compilers
|
||||
#if defined(__GNUC__)
|
||||
#define GCC_VERSION (__GNUC__ * 10000 \
|
||||
+ __GNUC_MINOR__ * 100 \
|
||||
+ __GNUC_PATCHLEVEL__)
|
||||
#ifndef LL_GNUC
|
||||
#define LL_GNUC 1
|
||||
#endif
|
||||
#elif defined(__MSVC_VER__) || defined(_MSC_VER)
|
||||
#ifndef LL_MSVC
|
||||
#define LL_MSVC 1
|
||||
#endif
|
||||
#if _MSC_VER < 1400
|
||||
#define LL_MSVC7 //Visual C++ 2003 or earlier
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Deal with minor differences on Unixy OSes.
|
||||
#if LL_DARWIN || LL_LINUX
|
||||
// Different name, same functionality.
|
||||
#define stricmp strcasecmp
|
||||
#define strnicmp strncasecmp
|
||||
|
||||
// Not sure why this is different, but...
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH PATH_MAX
|
||||
#endif // not MAX_PATH
|
||||
|
||||
#endif
|
||||
|
||||
// Static linking with apr on windows needs to be declared.
|
||||
#ifdef LL_WINDOWS
|
||||
#ifndef APR_DECLARE_STATIC
|
||||
#define APR_DECLARE_STATIC // For APR on Windows
|
||||
#endif
|
||||
#ifndef APU_DECLARE_STATIC
|
||||
#define APU_DECLARE_STATIC // For APR util on Windows
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Deal with the differeneces on Windows
|
||||
#if defined(LL_WINDOWS)
|
||||
#define BOOST_REGEX_NO_LIB 1
|
||||
#define CURL_STATICLIB 1
|
||||
#ifndef XML_STATIC
|
||||
#define XML_STATIC
|
||||
#endif
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
// Deal with VC6 problems
|
||||
#if LL_MSVC
|
||||
#pragma warning( 3 : 4701 ) // "local variable used without being initialized" Treat this as level 3, not level 4.
|
||||
#pragma warning( 3 : 4702 ) // "unreachable code" Treat this as level 3, not level 4.
|
||||
#pragma warning( 3 : 4189 ) // "local variable initialized but not referenced" Treat this as level 3, not level 4.
|
||||
//#pragma warning( 3 : 4018 ) // "signed/unsigned mismatch" Treat this as level 3, not level 4.
|
||||
#pragma warning( 3 : 4263 ) // 'function' : member function does not override any base class virtual member function
|
||||
#pragma warning( 3 : 4264 ) // "'virtual_function' : no override available for virtual member function from base 'class'; function is hidden"
|
||||
#pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual"
|
||||
#pragma warning( 3 : 4266 ) // 'function' : no override available for virtual member function from base 'type'; function is hidden
|
||||
#pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored
|
||||
#pragma warning( disable : 4284 ) // silly MS warning deep inside their <map> include file
|
||||
#pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation.
|
||||
#pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
#pragma warning( disable : 4996 ) // warning: deprecated
|
||||
|
||||
// Linker optimization with "extern template" generates these warnings
|
||||
#pragma warning( disable : 4231 ) // nonstandard extension used : 'extern' before template explicit instantiation
|
||||
#pragma warning( disable : 4506 ) // no definition for inline function
|
||||
|
||||
// level 4 warnings that we need to disable:
|
||||
#pragma warning (disable : 4100) // unreferenced formal parameter
|
||||
#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) )
|
||||
#pragma warning (disable : 4244) // possible loss of data on conversions
|
||||
#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template
|
||||
#pragma warning (disable : 4512) // assignment operator could not be generated
|
||||
#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) )
|
||||
|
||||
#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
|
||||
#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
|
||||
#endif // LL_MSVC
|
||||
|
||||
#if LL_WINDOWS
|
||||
#define LL_DLLEXPORT __declspec(dllexport)
|
||||
#define LL_DLLIMPORT __declspec(dllimport)
|
||||
#elif LL_LINUX
|
||||
#define LL_DLLEXPORT __attribute__ ((visibility("default")))
|
||||
#define LL_DLLIMPORT
|
||||
#else
|
||||
#define LL_DLLEXPORT
|
||||
#define LL_DLLIMPORT
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
/*
|
||||
#ifdef llcommon_EXPORTS
|
||||
// Compiling llcommon (shared)
|
||||
#define LL_COMMON_API LL_DLLEXPORT
|
||||
#else // llcommon_EXPORTS
|
||||
// Using llcommon (shared)
|
||||
#define LL_COMMON_API LL_DLLIMPORT
|
||||
#endif // llcommon_EXPORTS
|
||||
*/
|
||||
|
||||
//I hate DLLs -SG
|
||||
#define LL_COMMON_API
|
||||
|
||||
#endif // not LL_LINDEN_PREPROCESSOR_H
|
||||
/**
|
||||
* @file llpreprocessor.h
|
||||
* @brief This file should be included in all Linden Lab files and
|
||||
* should only contain special preprocessor directives
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LLPREPROCESSOR_H
|
||||
#define LLPREPROCESSOR_H
|
||||
|
||||
// Figure out endianness of platform
|
||||
#ifdef LL_LINUX
|
||||
#define __ENABLE_WSTRING
|
||||
#include <endian.h>
|
||||
#endif // LL_LINUX
|
||||
|
||||
#if LL_SOLARIS
|
||||
# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported.
|
||||
# define LL_BIG_ENDIAN 1
|
||||
# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed
|
||||
# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API
|
||||
# endif
|
||||
# include <sys/isa_defs.h> // ensure we know which end is up
|
||||
#endif // LL_SOLARIS
|
||||
|
||||
#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386)))
|
||||
#define LL_LITTLE_ENDIAN 1
|
||||
#else
|
||||
#define LL_BIG_ENDIAN 1
|
||||
#endif
|
||||
|
||||
|
||||
// Per-compiler switches
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define LL_FORCE_INLINE inline __attribute__((always_inline))
|
||||
#else
|
||||
#define LL_FORCE_INLINE __forceinline
|
||||
#endif
|
||||
|
||||
// Mark-up expressions with branch prediction hints. Do NOT use
|
||||
// this with reckless abandon - it's an obfuscating micro-optimization
|
||||
// outside of inner loops or other places where you are OVERWHELMINGLY
|
||||
// sure which way an expression almost-always evaluates.
|
||||
#if __GNUC__ >= 3
|
||||
# define LL_LIKELY(EXPR) __builtin_expect (!!(EXPR), true)
|
||||
# define LL_UNLIKELY(EXPR) __builtin_expect (!!(EXPR), false)
|
||||
#else
|
||||
# define LL_LIKELY(EXPR) (EXPR)
|
||||
# define LL_UNLIKELY(EXPR) (EXPR)
|
||||
#endif
|
||||
|
||||
|
||||
// Figure out differences between compilers
|
||||
#if defined(__GNUC__)
|
||||
#define GCC_VERSION (__GNUC__ * 10000 \
|
||||
+ __GNUC_MINOR__ * 100 \
|
||||
+ __GNUC_PATCHLEVEL__)
|
||||
#ifndef LL_GNUC
|
||||
#define LL_GNUC 1
|
||||
#endif
|
||||
#elif defined(__MSVC_VER__) || defined(_MSC_VER)
|
||||
#ifndef LL_MSVC
|
||||
#define LL_MSVC 1
|
||||
#endif
|
||||
#if _MSC_VER < 1400
|
||||
#define LL_MSVC7 //Visual C++ 2003 or earlier
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Deal with minor differences on Unixy OSes.
|
||||
#if LL_DARWIN || LL_LINUX
|
||||
// Different name, same functionality.
|
||||
#define stricmp strcasecmp
|
||||
#define strnicmp strncasecmp
|
||||
|
||||
// Not sure why this is different, but...
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH PATH_MAX
|
||||
#endif // not MAX_PATH
|
||||
|
||||
#endif
|
||||
|
||||
// Deal with the differences on Windows
|
||||
#if defined(LL_WINDOWS)
|
||||
#define BOOST_REGEX_NO_LIB 1
|
||||
#define CURL_STATICLIB 1
|
||||
#ifndef XML_STATIC
|
||||
#define XML_STATIC
|
||||
#endif
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
// Deal with VC6 problems
|
||||
#if LL_MSVC
|
||||
#pragma warning( 3 : 4701 ) // "local variable used without being initialized" Treat this as level 3, not level 4.
|
||||
#pragma warning( 3 : 4702 ) // "unreachable code" Treat this as level 3, not level 4.
|
||||
#pragma warning( 3 : 4189 ) // "local variable initialized but not referenced" Treat this as level 3, not level 4.
|
||||
//#pragma warning( 3 : 4018 ) // "signed/unsigned mismatch" Treat this as level 3, not level 4.
|
||||
#pragma warning( 3 : 4263 ) // 'function' : member function does not override any base class virtual member function
|
||||
#pragma warning( 3 : 4264 ) // "'virtual_function' : no override available for virtual member function from base 'class'; function is hidden"
|
||||
#pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual"
|
||||
#pragma warning( 3 : 4266 ) // 'function' : no override available for virtual member function from base 'type'; function is hidden
|
||||
#pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored
|
||||
#pragma warning( disable : 4284 ) // silly MS warning deep inside their <map> include file
|
||||
#pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation.
|
||||
#pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
#pragma warning( disable : 4996 ) // warning: deprecated
|
||||
|
||||
// Linker optimization with "extern template" generates these warnings
|
||||
#pragma warning( disable : 4231 ) // nonstandard extension used : 'extern' before template explicit instantiation
|
||||
#pragma warning( disable : 4506 ) // no definition for inline function
|
||||
|
||||
// level 4 warnings that we need to disable:
|
||||
#pragma warning (disable : 4100) // unreferenced formal parameter
|
||||
#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) )
|
||||
#pragma warning (disable : 4244) // possible loss of data on conversions
|
||||
#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template
|
||||
#pragma warning (disable : 4512) // assignment operator could not be generated
|
||||
#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) )
|
||||
|
||||
#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
|
||||
#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
|
||||
#endif // LL_MSVC
|
||||
|
||||
#if LL_WINDOWS
|
||||
#define LL_DLLEXPORT __declspec(dllexport)
|
||||
#define LL_DLLIMPORT __declspec(dllimport)
|
||||
#elif LL_LINUX
|
||||
#define LL_DLLEXPORT __attribute__ ((visibility("default")))
|
||||
#define LL_DLLIMPORT
|
||||
#else
|
||||
#define LL_DLLEXPORT
|
||||
#define LL_DLLIMPORT
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
#ifdef llcommon_EXPORTS
|
||||
// Compiling llcommon (shared)
|
||||
#define LL_COMMON_API LL_DLLEXPORT
|
||||
#else // llcommon_EXPORTS
|
||||
// Using llcommon (shared)
|
||||
#define LL_COMMON_API LL_DLLIMPORT
|
||||
#endif // llcommon_EXPORTS
|
||||
|
||||
#endif // not LL_LINDEN_PREPROCESSOR_H
|
||||
|
||||
58
indra/llcommon/llscopedvolatileaprpool.h
Normal file
58
indra/llcommon/llscopedvolatileaprpool.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @file llscopedvolatileaprpool.h
|
||||
* @brief Implementation of LLScopedVolatileAPRPool
|
||||
*
|
||||
* $LicenseInfo:firstyear=2010&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLSCOPEDVOLATILEAPRPOOL_H
|
||||
#define LL_LLSCOPEDVOLATILEAPRPOOL_H
|
||||
|
||||
#include "llthread.h"
|
||||
|
||||
//! Scoped volatile memory pool.
|
||||
//
|
||||
// As the AIVolatileAPRPool should never keep allocations very
|
||||
// long, it's most common use is for allocations with a lifetime
|
||||
// equal to it's scope.
|
||||
//
|
||||
// This is a convenience class that makes just a little easier to type.
|
||||
//
|
||||
class LLScopedVolatileAPRPool
|
||||
{
|
||||
private:
|
||||
AIVolatileAPRPool& mPool;
|
||||
apr_pool_t* mScopedAPRpool;
|
||||
public:
|
||||
LLScopedVolatileAPRPool() : mPool(AIThreadLocalData::tldata().mVolatileAPRPool), mScopedAPRpool(mPool.getVolatileAPRPool()) { }
|
||||
~LLScopedVolatileAPRPool() { mPool.clearVolatileAPRPool(); }
|
||||
// Only use this to pass the pointer to a libapr-1 function that requires it.
|
||||
operator apr_pool_t*() const { return mScopedAPRpool; }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
#if LL_LINUX || LL_SOLARIS
|
||||
#include <wctype.h>
|
||||
@@ -212,7 +213,7 @@ public:
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Static Utility functions that operate on std::strings
|
||||
|
||||
static std::basic_string<T> null;
|
||||
static std::basic_string<T> const null;
|
||||
|
||||
typedef std::map<LLFormatMapString, LLFormatMapString> format_map_t;
|
||||
static S32 format(std::basic_string<T>& s, const format_map_t& fmt_map);
|
||||
@@ -303,7 +304,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
template<class T> std::basic_string<T> LLStringUtilBase<T>::null;
|
||||
template<class T> std::basic_string<T> const LLStringUtilBase<T>::null;
|
||||
|
||||
typedef LLStringUtilBase<char> LLStringUtil;
|
||||
typedef LLStringUtilBase<llwchar> LLWStringUtil;
|
||||
|
||||
@@ -74,7 +74,7 @@ extern int errno;
|
||||
|
||||
|
||||
static const S32 CPUINFO_BUFFER_SIZE = 16383;
|
||||
LLCPUInfo gSysCPU;
|
||||
LL_COMMON_API LLCPUInfo gSysCPU;
|
||||
|
||||
#if LL_WINDOWS
|
||||
#ifndef DLLVERSIONINFO
|
||||
|
||||
@@ -72,8 +72,8 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
|
||||
// Set thread state to running
|
||||
threadp->mStatus = RUNNING;
|
||||
|
||||
// Create a thread local APRFile pool.
|
||||
LLVolatileAPRPool::createLocalAPRFilePool();
|
||||
// Create a thread local data.
|
||||
AIThreadLocalData::create(threadp);
|
||||
|
||||
// Run the user supplied function
|
||||
threadp->run();
|
||||
@@ -87,24 +87,14 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
|
||||
}
|
||||
|
||||
|
||||
LLThread::LLThread(const std::string& name, apr_pool_t *poolp) :
|
||||
LLThread::LLThread(std::string const& name) :
|
||||
mPaused(FALSE),
|
||||
mName(name),
|
||||
mAPRThreadp(NULL),
|
||||
mStatus(STOPPED)
|
||||
mStatus(STOPPED),
|
||||
mThreadLocalData(NULL)
|
||||
{
|
||||
// Thread creation probably CAN be paranoid about APR being initialized, if necessary
|
||||
if (poolp)
|
||||
{
|
||||
mIsLocalPool = FALSE;
|
||||
mAPRPoolp = poolp;
|
||||
}
|
||||
else
|
||||
{
|
||||
mIsLocalPool = TRUE;
|
||||
apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread
|
||||
}
|
||||
mRunCondition = new LLCondition(mAPRPoolp);
|
||||
mRunCondition = new LLCondition;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,24 +137,18 @@ void LLThread::shutdown()
|
||||
if (!isStopped())
|
||||
{
|
||||
// This thread just wouldn't stop, even though we gave it time
|
||||
llwarns << "LLThread::~LLThread() exiting thread before clean exit!" << llendl;
|
||||
llwarns << "LLThread::shutdown() exiting thread before clean exit!" << llendl;
|
||||
return;
|
||||
}
|
||||
mAPRThreadp = NULL;
|
||||
}
|
||||
|
||||
delete mRunCondition;
|
||||
|
||||
if (mIsLocalPool)
|
||||
{
|
||||
apr_pool_destroy(mAPRPoolp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLThread::start()
|
||||
{
|
||||
apr_thread_create(&mAPRThreadp, NULL, staticRun, (void *)this, mAPRPoolp);
|
||||
apr_thread_create(&mAPRThreadp, NULL, staticRun, (void *)this, tldata().mRootPool());
|
||||
|
||||
// We won't bother joining
|
||||
apr_thread_detach(mAPRThreadp);
|
||||
@@ -265,38 +249,72 @@ void LLThread::wakeLocked()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
// This allows the use of llassert(is_main_thread()) to assure the current thread is the main thread.
|
||||
static apr_os_thread_t main_thread_id;
|
||||
LL_COMMON_API bool is_main_thread() { return apr_os_thread_equal(main_thread_id, apr_os_thread_current()); }
|
||||
#endif
|
||||
|
||||
// The thread private handle to access the AIThreadLocalData instance.
|
||||
apr_threadkey_t* AIThreadLocalData::sThreadLocalDataKey;
|
||||
|
||||
//static
|
||||
void AIThreadLocalData::init(void)
|
||||
{
|
||||
// Only do this once.
|
||||
if (sThreadLocalDataKey)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
apr_status_t status = apr_threadkey_private_create(&sThreadLocalDataKey, &AIThreadLocalData::destroy, AIAPRRootPool::get()());
|
||||
ll_apr_assert_status(status); // Or out of memory, or system-imposed limit on the
|
||||
// total number of keys per process {PTHREAD_KEYS_MAX}
|
||||
// has been exceeded.
|
||||
|
||||
// Create the thread-local data for the main thread (this function is called by the main thread).
|
||||
AIThreadLocalData::create(NULL);
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
// This function is called by the main thread.
|
||||
main_thread_id = apr_os_thread_current();
|
||||
#endif
|
||||
}
|
||||
|
||||
// This is called once for every thread when the thread is destructed.
|
||||
//static
|
||||
void AIThreadLocalData::destroy(void* thread_local_data)
|
||||
{
|
||||
delete reinterpret_cast<AIThreadLocalData*>(thread_local_data);
|
||||
}
|
||||
|
||||
//static
|
||||
void AIThreadLocalData::create(LLThread* threadp)
|
||||
{
|
||||
AIThreadLocalData* new_tld = new AIThreadLocalData;
|
||||
if (threadp)
|
||||
{
|
||||
threadp->mThreadLocalData = new_tld;
|
||||
}
|
||||
apr_status_t status = apr_threadkey_private_set(new_tld, sThreadLocalDataKey);
|
||||
llassert_always(status == APR_SUCCESS);
|
||||
}
|
||||
|
||||
//static
|
||||
AIThreadLocalData& AIThreadLocalData::tldata(void)
|
||||
{
|
||||
if (!sThreadLocalDataKey)
|
||||
AIThreadLocalData::init();
|
||||
|
||||
void* data;
|
||||
apr_status_t status = apr_threadkey_private_get(&data, sThreadLocalDataKey);
|
||||
llassert_always(status == APR_SUCCESS);
|
||||
return *static_cast<AIThreadLocalData*>(data);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
LLMutex::LLMutex(apr_pool_t *poolp) :
|
||||
mAPRMutexp(NULL)
|
||||
{
|
||||
//if (poolp)
|
||||
//{
|
||||
// mIsLocalPool = FALSE;
|
||||
// mAPRPoolp = poolp;
|
||||
//}
|
||||
//else
|
||||
{
|
||||
mIsLocalPool = TRUE;
|
||||
apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread
|
||||
}
|
||||
apr_thread_mutex_create(&mAPRMutexp, APR_THREAD_MUTEX_UNNESTED, mAPRPoolp);
|
||||
}
|
||||
|
||||
LLMutex::~LLMutex()
|
||||
{
|
||||
#if _DEBUG
|
||||
llassert(!isLocked()); // better not be locked!
|
||||
#endif
|
||||
apr_thread_mutex_destroy(mAPRMutexp);
|
||||
mAPRMutexp = NULL;
|
||||
if (mIsLocalPool)
|
||||
{
|
||||
apr_pool_destroy(mAPRPoolp);
|
||||
}
|
||||
}
|
||||
|
||||
bool LLMutex::isLocked()
|
||||
bool LLMutexBase::isLocked()
|
||||
{
|
||||
if (!tryLock())
|
||||
{
|
||||
@@ -308,12 +326,9 @@ bool LLMutex::isLocked()
|
||||
|
||||
//============================================================================
|
||||
|
||||
LLCondition::LLCondition(apr_pool_t *poolp) :
|
||||
LLMutex(poolp)
|
||||
LLCondition::LLCondition(AIAPRPool& parent) : LLMutex(parent)
|
||||
{
|
||||
// base class (LLMutex) has already ensured that mAPRPoolp is set up.
|
||||
|
||||
apr_thread_cond_create(&mAPRCondp, mAPRPoolp);
|
||||
apr_thread_cond_create(&mAPRCondp, mPool());
|
||||
}
|
||||
|
||||
LLCondition::~LLCondition()
|
||||
@@ -349,7 +364,7 @@ void LLThreadSafeRefCount::initThreadSafeRefCount()
|
||||
{
|
||||
if (!sMutex)
|
||||
{
|
||||
sMutex = new LLMutex(0);
|
||||
sMutex = new LLMutex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,11 +38,32 @@
|
||||
#include "llmemory.h"
|
||||
|
||||
#include "apr_thread_cond.h"
|
||||
#include "aiaprpool.h"
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
extern LL_COMMON_API bool is_main_thread(void);
|
||||
#endif
|
||||
|
||||
class LLThread;
|
||||
class LLMutex;
|
||||
class LLCondition;
|
||||
|
||||
class LL_COMMON_API AIThreadLocalData
|
||||
{
|
||||
private:
|
||||
static apr_threadkey_t* sThreadLocalDataKey;
|
||||
|
||||
public:
|
||||
// Thread-local memory pool.
|
||||
AIAPRRootPool mRootPool;
|
||||
AIVolatileAPRPool mVolatileAPRPool;
|
||||
|
||||
static void init(void);
|
||||
static void destroy(void* thread_local_data);
|
||||
static void create(LLThread* pthread);
|
||||
static AIThreadLocalData& tldata(void);
|
||||
};
|
||||
|
||||
class LL_COMMON_API LLThread
|
||||
{
|
||||
public:
|
||||
@@ -53,7 +74,7 @@ public:
|
||||
QUITTING= 2 // Someone wants this thread to quit
|
||||
} EThreadStatus;
|
||||
|
||||
LLThread(const std::string& name, apr_pool_t *poolp = NULL);
|
||||
LLThread(std::string const& name);
|
||||
virtual ~LLThread(); // Warning! You almost NEVER want to destroy a thread unless it's in the STOPPED state.
|
||||
virtual void shutdown(); // stops the thread
|
||||
|
||||
@@ -82,7 +103,8 @@ public:
|
||||
// this kicks off the apr thread
|
||||
void start(void);
|
||||
|
||||
apr_pool_t *getAPRPool() { return mAPRPoolp; }
|
||||
// Return thread-local data for the current thread.
|
||||
static AIThreadLocalData& tldata(void) { return AIThreadLocalData::tldata(); }
|
||||
|
||||
private:
|
||||
BOOL mPaused;
|
||||
@@ -95,10 +117,11 @@ protected:
|
||||
LLCondition* mRunCondition;
|
||||
|
||||
apr_thread_t *mAPRThreadp;
|
||||
apr_pool_t *mAPRPoolp;
|
||||
BOOL mIsLocalPool;
|
||||
EThreadStatus mStatus;
|
||||
|
||||
friend void AIThreadLocalData::create(LLThread* threadp);
|
||||
AIThreadLocalData* mThreadLocalData;
|
||||
|
||||
void setQuitting();
|
||||
|
||||
// virtual function overridden by subclass -- this will be called when the thread runs
|
||||
@@ -125,12 +148,9 @@ protected:
|
||||
|
||||
//============================================================================
|
||||
|
||||
class LL_COMMON_API LLMutex
|
||||
class LL_COMMON_API LLMutexBase
|
||||
{
|
||||
public:
|
||||
LLMutex(apr_pool_t *apr_poolp); // NULL pool constructs a new pool for the mutex
|
||||
~LLMutex();
|
||||
|
||||
void lock() { apr_thread_mutex_lock(mAPRMutexp); }
|
||||
void unlock() { apr_thread_mutex_unlock(mAPRMutexp); }
|
||||
// Returns true if lock was obtained successfully.
|
||||
@@ -139,16 +159,60 @@ public:
|
||||
bool isLocked(); // non-blocking, but does do a lock/unlock so not free
|
||||
|
||||
protected:
|
||||
apr_thread_mutex_t *mAPRMutexp;
|
||||
apr_pool_t *mAPRPoolp;
|
||||
BOOL mIsLocalPool;
|
||||
// mAPRMutexp is initialized and uninitialized in the derived class.
|
||||
apr_thread_mutex_t* mAPRMutexp;
|
||||
};
|
||||
|
||||
class LL_COMMON_API LLMutex : public LLMutexBase
|
||||
{
|
||||
public:
|
||||
LLMutex(AIAPRPool& parent = LLThread::tldata().mRootPool) : mPool(parent)
|
||||
{
|
||||
apr_thread_mutex_create(&mAPRMutexp, APR_THREAD_MUTEX_UNNESTED, mPool());
|
||||
}
|
||||
~LLMutex()
|
||||
{
|
||||
llassert(!isLocked()); // better not be locked!
|
||||
apr_thread_mutex_destroy(mAPRMutexp);
|
||||
mAPRMutexp = NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
AIAPRPool mPool;
|
||||
};
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
// No need to use a root pool in this case.
|
||||
typedef LLMutex LLMutexRootPool;
|
||||
#else // APR_HAS_THREADS
|
||||
class LL_COMMON_API LLMutexRootPool : public LLMutexBase
|
||||
{
|
||||
public:
|
||||
LLMutexRootPool(void)
|
||||
{
|
||||
apr_thread_mutex_create(&mAPRMutexp, APR_THREAD_MUTEX_UNNESTED, mRootPool());
|
||||
}
|
||||
~LLMutexRootPool()
|
||||
{
|
||||
#if APR_POOL_DEBUG
|
||||
// It is allowed to destruct root pools from a different thread.
|
||||
mRootPool.grab_ownership();
|
||||
#endif
|
||||
llassert(!isLocked()); // better not be locked!
|
||||
apr_thread_mutex_destroy(mAPRMutexp);
|
||||
mAPRMutexp = NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
AIAPRRootPool mRootPool;
|
||||
};
|
||||
#endif // APR_HAS_THREADS
|
||||
|
||||
// Actually a condition/mutex pair (since each condition needs to be associated with a mutex).
|
||||
class LL_COMMON_API LLCondition : public LLMutex
|
||||
{
|
||||
public:
|
||||
LLCondition(apr_pool_t *apr_poolp); // Defaults to global pool, could use the thread pool as well.
|
||||
LLCondition(AIAPRPool& parent = LLThread::tldata().mRootPool);
|
||||
~LLCondition();
|
||||
|
||||
void wait(); // blocks
|
||||
@@ -162,7 +226,7 @@ protected:
|
||||
class LL_COMMON_API LLMutexLock
|
||||
{
|
||||
public:
|
||||
LLMutexLock(LLMutex* mutex)
|
||||
LLMutexLock(LLMutexBase* mutex)
|
||||
{
|
||||
mMutex = mutex;
|
||||
mMutex->lock();
|
||||
@@ -172,7 +236,102 @@ public:
|
||||
mMutex->unlock();
|
||||
}
|
||||
private:
|
||||
LLMutex* mMutex;
|
||||
LLMutexBase* mMutex;
|
||||
};
|
||||
|
||||
class AIRWLock
|
||||
{
|
||||
public:
|
||||
AIRWLock(AIAPRPool& parent = LLThread::tldata().mRootPool) :
|
||||
mWriterWaitingMutex(parent), mNoHoldersCondition(parent), mHoldersCount(0), mWriterIsWaiting(false) { }
|
||||
|
||||
private:
|
||||
LLMutex mWriterWaitingMutex; //!< This mutex is locked while some writer is waiting for access.
|
||||
LLCondition mNoHoldersCondition; //!< Access control for mHoldersCount. Condition true when there are no more holders.
|
||||
int mHoldersCount; //!< Number of readers or -1 if a writer locked this object.
|
||||
// This is volatile because we read it outside the critical area of mWriterWaitingMutex, at [1].
|
||||
// That means that other threads can change it while we are already in the (inlined) function rdlock.
|
||||
// Without volatile, the following assembly would fail:
|
||||
// register x = mWriterIsWaiting;
|
||||
// /* some thread changes mWriterIsWaiting */
|
||||
// if (x ...
|
||||
// However, because the function is fuzzy to begin with (we don't mind that this race
|
||||
// condition exists) it would work fine without volatile. So, basically it's just here
|
||||
// out of principle ;). -- Aleric
|
||||
bool volatile mWriterIsWaiting; //!< True when there is a writer waiting for write access.
|
||||
|
||||
public:
|
||||
void rdlock(bool high_priority = false)
|
||||
{
|
||||
// Give a writer a higher priority (kinda fuzzy).
|
||||
if (mWriterIsWaiting && !high_priority) // [1] If there is a writer interested,
|
||||
{
|
||||
mWriterWaitingMutex.lock(); // [2] then give it precedence and wait here.
|
||||
// If we get here then the writer got it's access; mHoldersCount == -1.
|
||||
mWriterWaitingMutex.unlock();
|
||||
}
|
||||
mNoHoldersCondition.lock(); // [3] Get exclusive access to mHoldersCount.
|
||||
while (mHoldersCount == -1) // [4]
|
||||
{
|
||||
mNoHoldersCondition.wait(); // [5] Wait till mHoldersCount is (or just was) 0.
|
||||
}
|
||||
++mHoldersCount; // One more reader.
|
||||
mNoHoldersCondition.unlock(); // Release lock on mHoldersCount.
|
||||
}
|
||||
void rdunlock(void)
|
||||
{
|
||||
mNoHoldersCondition.lock(); // Get exclusive access to mHoldersCount.
|
||||
if (--mHoldersCount == 0) // Was this the last reader?
|
||||
{
|
||||
mNoHoldersCondition.signal(); // Tell waiting threads, see [5], [6] and [7].
|
||||
}
|
||||
mNoHoldersCondition.unlock(); // Release lock on mHoldersCount.
|
||||
}
|
||||
void wrlock(void)
|
||||
{
|
||||
mWriterWaitingMutex.lock(); // Block new readers, see [2],
|
||||
mWriterIsWaiting = true; // from this moment on, see [1].
|
||||
mNoHoldersCondition.lock(); // Get exclusive access to mHoldersCount.
|
||||
while (mHoldersCount != 0) // Other readers or writers have this lock?
|
||||
{
|
||||
mNoHoldersCondition.wait(); // [6] Wait till mHoldersCount is (or just was) 0.
|
||||
}
|
||||
mWriterIsWaiting = false; // Stop checking the lock for new readers, see [1].
|
||||
mWriterWaitingMutex.unlock(); // Release blocked readers, they will still hang at [3].
|
||||
mHoldersCount = -1; // We are a writer now (will cause a hang at [5], see [4]).
|
||||
mNoHoldersCondition.unlock(); // Release lock on mHolders (readers go from [3] to [5]).
|
||||
}
|
||||
void wrunlock(void)
|
||||
{
|
||||
mNoHoldersCondition.lock(); // Get exclusive access to mHoldersCount.
|
||||
mHoldersCount = 0; // We have no writer anymore.
|
||||
mNoHoldersCondition.signal(); // Tell waiting threads, see [5], [6] and [7].
|
||||
mNoHoldersCondition.unlock(); // Release lock on mHoldersCount.
|
||||
}
|
||||
void rd2wrlock(void)
|
||||
{
|
||||
mNoHoldersCondition.lock(); // Get exclusive access to mHoldersCount. Blocks new readers at [3].
|
||||
if (--mHoldersCount > 0) // Any other reads left?
|
||||
{
|
||||
mWriterWaitingMutex.lock(); // Block new readers, see [2],
|
||||
mWriterIsWaiting = true; // from this moment on, see [1].
|
||||
while (mHoldersCount != 0) // Other readers (still) have this lock?
|
||||
{
|
||||
mNoHoldersCondition.wait(); // [7] Wait till mHoldersCount is (or just was) 0.
|
||||
}
|
||||
mWriterIsWaiting = false; // Stop checking the lock for new readers, see [1].
|
||||
mWriterWaitingMutex.unlock(); // Release blocked readers, they will still hang at [3].
|
||||
}
|
||||
mHoldersCount = -1; // We are a writer now (will cause a hang at [5], see [4]).
|
||||
mNoHoldersCondition.unlock(); // Release lock on mHolders (readers go from [3] to [5]).
|
||||
}
|
||||
void wr2rdlock(void)
|
||||
{
|
||||
mNoHoldersCondition.lock(); // Get exclusive access to mHoldersCount.
|
||||
mHoldersCount = 1; // Turn writer into a reader.
|
||||
mNoHoldersCondition.signal(); // Tell waiting readers, see [5].
|
||||
mNoHoldersCondition.unlock(); // Release lock on mHoldersCount.
|
||||
}
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
@@ -187,7 +346,6 @@ void LLThread::unlockData()
|
||||
mRunCondition->unlock();
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
|
||||
// see llmemory.h for LLPointer<> definition
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
/**
|
||||
* @file llversionviewer.h
|
||||
* @brief
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLVERSIONVIEWER_H
|
||||
#define LL_LLVERSIONVIEWER_H
|
||||
|
||||
const S32 LL_VERSION_MAJOR = 1;
|
||||
const S32 LL_VERSION_MINOR = 5;
|
||||
const S32 LL_VERSION_PATCH = 6;
|
||||
const S32 LL_VERSION_BUILD = 1;
|
||||
|
||||
const char * const LL_CHANNEL = "Singularity";
|
||||
|
||||
#if LL_DARWIN
|
||||
const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.snowglobe.viewer";
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/**
|
||||
* @file llversionviewer.h
|
||||
* @brief
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLVERSIONVIEWER_H
|
||||
#define LL_LLVERSIONVIEWER_H
|
||||
|
||||
const S32 LL_VERSION_MAJOR = 1;
|
||||
const S32 LL_VERSION_MINOR = 5;
|
||||
const S32 LL_VERSION_PATCH = 7;
|
||||
const S32 LL_VERSION_BUILD = 1;
|
||||
|
||||
const char * const LL_CHANNEL = "Singularity";
|
||||
|
||||
#if LL_DARWIN
|
||||
const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.snowglobe.viewer";
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
LLWorkerThread::LLWorkerThread(const std::string& name, bool threaded) :
|
||||
LLQueuedThread(name, threaded)
|
||||
{
|
||||
mDeleteMutex = new LLMutex(NULL);
|
||||
mDeleteMutex = new LLMutex;
|
||||
}
|
||||
|
||||
LLWorkerThread::~LLWorkerThread()
|
||||
@@ -205,7 +205,6 @@ LLWorkerClass::LLWorkerClass(LLWorkerThread* workerthread, const std::string& na
|
||||
mRequestPriority(LLWorkerThread::PRIORITY_NORMAL),
|
||||
mWorkerClassName(name),
|
||||
mRequestHandle(LLWorkerThread::nullHandle()),
|
||||
mMutex(NULL),
|
||||
mWorkFlags(0)
|
||||
{
|
||||
if (!mWorkerThread)
|
||||
|
||||
@@ -200,7 +200,7 @@ protected:
|
||||
U32 mRequestPriority; // last priority set
|
||||
|
||||
private:
|
||||
LLMutex mMutex;
|
||||
LLMutexRootPool mMutex; // Use LLMutexRootPool since this object is created and destructed by multiple threads.
|
||||
LLAtomicU32 mWorkFlags;
|
||||
};
|
||||
|
||||
|
||||
3
indra/llcrashlogger/llcrashlogger.cpp
Executable file → Normal file
3
indra/llcrashlogger/llcrashlogger.cpp
Executable file → Normal file
@@ -387,8 +387,7 @@ bool LLCrashLogger::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
gServicePump = new LLPumpIO(gAPRPoolp);
|
||||
gServicePump->prime(gAPRPoolp);
|
||||
gServicePump = new LLPumpIO;
|
||||
LLHTTPClient::setPump(*gServicePump);
|
||||
|
||||
//If we've opened the crash logger, assume we can delete the marker file if it exists
|
||||
|
||||
0
indra/llcrashlogger/llcrashlogger.h
Executable file → Normal file
0
indra/llcrashlogger/llcrashlogger.h
Executable file → Normal file
@@ -57,7 +57,7 @@ LLMutex* LLImage::sMutex = NULL;
|
||||
//static
|
||||
void LLImage::initClass()
|
||||
{
|
||||
sMutex = new LLMutex(NULL);
|
||||
sMutex = new LLMutex;
|
||||
LLImageJ2C::openDSO();
|
||||
}
|
||||
|
||||
@@ -248,16 +248,17 @@ U8* LLImageBase::allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 si
|
||||
|
||||
S32 LLImageRaw::sGlobalRawMemory = 0;
|
||||
S32 LLImageRaw::sRawImageCount = 0;
|
||||
S32 LLImageRaw::sRawImageCachedCount = 0;
|
||||
|
||||
LLImageRaw::LLImageRaw()
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
mMemType = LLMemType::MTYPE_IMAGERAW;
|
||||
++sRawImageCount;
|
||||
}
|
||||
|
||||
LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
mMemType = LLMemType::MTYPE_IMAGERAW;
|
||||
llassert( S32(width) * S32(height) * S32(components) <= MAX_IMAGE_DATA_SIZE );
|
||||
@@ -266,7 +267,7 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
|
||||
}
|
||||
|
||||
LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components)
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
mMemType = LLMemType::MTYPE_IMAGERAW;
|
||||
if(allocateDataSize(width, height, components) && data)
|
||||
@@ -277,7 +278,7 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components)
|
||||
}
|
||||
|
||||
LLImageRaw::LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only)
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
createFromFile(filename, j2c_lowest_mip_only);
|
||||
}
|
||||
@@ -288,6 +289,7 @@ LLImageRaw::~LLImageRaw()
|
||||
// NOT LLImageRaw::deleteData()
|
||||
deleteData();
|
||||
--sRawImageCount;
|
||||
setInCache(false);
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
||||
@@ -243,6 +243,24 @@ protected:
|
||||
public:
|
||||
static S32 sGlobalRawMemory;
|
||||
static S32 sRawImageCount;
|
||||
|
||||
static S32 sRawImageCachedCount;
|
||||
S32 mCacheEntries;
|
||||
void setInCache(bool in_cache)
|
||||
{
|
||||
if(in_cache)
|
||||
{
|
||||
if(!mCacheEntries)
|
||||
sRawImageCachedCount++;
|
||||
mCacheEntries++;
|
||||
}
|
||||
else if(mCacheEntries)
|
||||
{
|
||||
mCacheEntries--;
|
||||
if(!mCacheEntries)
|
||||
sRawImageCachedCount--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Compressed representation of image.
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "apr_dso.h"
|
||||
|
||||
#include "lldir.h"
|
||||
#include "../llxml/llcontrol.h"
|
||||
#include "llimagej2c.h"
|
||||
#include "llmemtype.h"
|
||||
|
||||
@@ -46,7 +47,7 @@ typedef const char* (*EngineInfoLLImageJ2CFunction)();
|
||||
CreateLLImageJ2CFunction j2cimpl_create_func;
|
||||
DestroyLLImageJ2CFunction j2cimpl_destroy_func;
|
||||
EngineInfoLLImageJ2CFunction j2cimpl_engineinfo_func;
|
||||
apr_pool_t *j2cimpl_dso_memory_pool;
|
||||
AIAPRPool j2cimpl_dso_memory_pool;
|
||||
apr_dso_handle_t *j2cimpl_dso_handle;
|
||||
|
||||
//Declare the prototype for theses functions here, their functionality
|
||||
@@ -81,13 +82,12 @@ void LLImageJ2C::openDSO()
|
||||
gDirUtilp->getExecutableDir());
|
||||
|
||||
j2cimpl_dso_handle = NULL;
|
||||
j2cimpl_dso_memory_pool = NULL;
|
||||
j2cimpl_dso_memory_pool.create();
|
||||
|
||||
//attempt to load the shared library
|
||||
apr_pool_create(&j2cimpl_dso_memory_pool, NULL);
|
||||
rv = apr_dso_load(&j2cimpl_dso_handle,
|
||||
dso_path.c_str(),
|
||||
j2cimpl_dso_memory_pool);
|
||||
j2cimpl_dso_memory_pool());
|
||||
|
||||
//now, check for success
|
||||
if ( rv == APR_SUCCESS )
|
||||
@@ -151,11 +151,7 @@ void LLImageJ2C::openDSO()
|
||||
j2cimpl_dso_handle = NULL;
|
||||
}
|
||||
|
||||
if ( j2cimpl_dso_memory_pool )
|
||||
{
|
||||
apr_pool_destroy(j2cimpl_dso_memory_pool);
|
||||
j2cimpl_dso_memory_pool = NULL;
|
||||
}
|
||||
j2cimpl_dso_memory_pool.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +159,7 @@ void LLImageJ2C::openDSO()
|
||||
void LLImageJ2C::closeDSO()
|
||||
{
|
||||
if ( j2cimpl_dso_handle ) apr_dso_unload(j2cimpl_dso_handle);
|
||||
if (j2cimpl_dso_memory_pool) apr_pool_destroy(j2cimpl_dso_memory_pool);
|
||||
j2cimpl_dso_memory_pool.destroy();
|
||||
}
|
||||
|
||||
//static
|
||||
@@ -382,6 +378,12 @@ S32 LLImageJ2C::calcHeaderSize()
|
||||
// to load discard_level (including header and higher discard levels)
|
||||
S32 LLImageJ2C::calcDataSize(S32 discard_level)
|
||||
{
|
||||
static const LLCachedControl<bool> legacy_size("SianaLegacyJ2CSize", false);
|
||||
|
||||
if (legacy_size) {
|
||||
return calcDataSizeJ2C(getWidth(), getHeight(), getComponents(), discard_level, mRate);
|
||||
}
|
||||
|
||||
discard_level = llclamp(discard_level, 0, MAX_DISCARD_LEVEL);
|
||||
|
||||
if ( mAreaUsedForDataSizeCalcs != (getHeight() * getWidth())
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
#include <csetjmp>
|
||||
|
||||
#include "llimage.h"
|
||||
|
||||
extern "C" {
|
||||
#ifdef LL_STANDALONE
|
||||
# include <jpeglib.h>
|
||||
@@ -45,8 +47,6 @@ extern "C" {
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "llimage.h"
|
||||
|
||||
class LLImageJPEG : public LLImageFormatted
|
||||
{
|
||||
protected:
|
||||
|
||||
@@ -131,6 +131,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time)
|
||||
if (! pngWrapper.writePng(raw_image, getData()))
|
||||
{
|
||||
setLastError(pngWrapper.getErrorMessage());
|
||||
deleteData();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -138,6 +139,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time)
|
||||
if(!reallocateData(pngWrapper.getFinalSize())) //Shrink. Returns NULL on failure.
|
||||
{
|
||||
setLastError("LLImagePNG::encode failed reallocateData");
|
||||
deleteData();
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -41,20 +41,13 @@
|
||||
LLImageDecodeThread::LLImageDecodeThread(bool threaded)
|
||||
: LLQueuedThread("imagedecode", threaded)
|
||||
{
|
||||
mCreationMutex = new LLMutex(getAPRPool());
|
||||
}
|
||||
|
||||
//virtual
|
||||
LLImageDecodeThread::~LLImageDecodeThread()
|
||||
{
|
||||
delete mCreationMutex ;
|
||||
}
|
||||
|
||||
// MAIN THREAD
|
||||
// virtual
|
||||
S32 LLImageDecodeThread::update(U32 max_time_ms)
|
||||
{
|
||||
LLMutexLock lock(mCreationMutex);
|
||||
LLMutexLock lock(&mCreationMutex);
|
||||
for (creation_list_t::iterator iter = mCreationList.begin();
|
||||
iter != mCreationList.end(); ++iter)
|
||||
{
|
||||
@@ -77,7 +70,7 @@ S32 LLImageDecodeThread::update(U32 max_time_ms)
|
||||
LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage(LLImageFormatted* image,
|
||||
U32 priority, S32 discard, BOOL needs_aux, Responder* responder)
|
||||
{
|
||||
LLMutexLock lock(mCreationMutex);
|
||||
LLMutexLock lock(&mCreationMutex);
|
||||
handle_t handle = generateHandle();
|
||||
mCreationList.push_back(creation_info(handle, image, priority, discard, needs_aux, responder));
|
||||
return handle;
|
||||
@@ -87,7 +80,7 @@ LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage(LLImageFormatted*
|
||||
// Returns the size of the mutex guarded list as an indication of sanity
|
||||
S32 LLImageDecodeThread::tut_size()
|
||||
{
|
||||
LLMutexLock lock(mCreationMutex);
|
||||
LLMutexLock lock(&mCreationMutex);
|
||||
S32 res = mCreationList.size();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -78,8 +78,6 @@ public:
|
||||
|
||||
public:
|
||||
LLImageDecodeThread(bool threaded = true);
|
||||
virtual ~LLImageDecodeThread();
|
||||
|
||||
handle_t decodeImage(LLImageFormatted* image,
|
||||
U32 priority, S32 discard, BOOL needs_aux,
|
||||
Responder* responder);
|
||||
@@ -103,7 +101,7 @@ private:
|
||||
};
|
||||
typedef std::list<creation_info> creation_list_t;
|
||||
creation_list_t mCreationList;
|
||||
LLMutex* mCreationMutex;
|
||||
LLMutex mCreationMutex;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -213,7 +213,7 @@ void LLPngWrapper::normalizeImage()
|
||||
}
|
||||
if (mColorType == PNG_COLOR_TYPE_GRAY && mBitDepth < 8)
|
||||
{
|
||||
png_set_gray_1_2_4_to_8(mReadPngPtr);
|
||||
png_set_expand_gray_1_2_4_to_8(mReadPngPtr);
|
||||
}
|
||||
if (mColorType == PNG_COLOR_TYPE_GRAY
|
||||
|| mColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
@@ -354,7 +354,7 @@ void LLPngWrapper::releaseResources()
|
||||
{
|
||||
if (mReadPngPtr || mReadInfoPtr)
|
||||
{
|
||||
png_destroy_read_struct(&mReadPngPtr, &mReadInfoPtr, png_infopp_NULL);
|
||||
png_destroy_read_struct(&mReadPngPtr, &mReadInfoPtr, NULL);
|
||||
mReadPngPtr = NULL;
|
||||
mReadInfoPtr = NULL;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,11 @@
|
||||
#ifndef LL_LLPNGWRAPPER_H
|
||||
#define LL_LLPNGWRAPPER_H
|
||||
|
||||
#if LL_WINDOWS
|
||||
#include "libpng15/png.h"
|
||||
#else
|
||||
#include "libpng12/png.h"
|
||||
#endif
|
||||
#include "llimage.h"
|
||||
|
||||
class LLPngWrapper
|
||||
|
||||
@@ -19,6 +19,7 @@ set(llinventory_SOURCE_FILES
|
||||
llcategory.cpp
|
||||
lleconomy.cpp
|
||||
llinventory.cpp
|
||||
llinventorydefines.cpp
|
||||
llinventorytype.cpp
|
||||
lllandmark.cpp
|
||||
llnotecard.cpp
|
||||
@@ -35,6 +36,7 @@ set(llinventory_HEADER_FILES
|
||||
llcategory.h
|
||||
lleconomy.h
|
||||
llinventory.h
|
||||
llinventorydefines.h
|
||||
llinventorytype.h
|
||||
lllandmark.h
|
||||
llnotecard.h
|
||||
|
||||
@@ -64,34 +64,27 @@ static const std::string INV_CREATION_DATE_LABEL("created_at");
|
||||
// key used by agent-inventory-service
|
||||
static const std::string INV_ASSET_TYPE_LABEL_WS("type_default");
|
||||
static const std::string INV_FOLDER_ID_LABEL_WS("category_id");
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Local function declarations, constants, enums, and typedefs
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
const U8 TASK_INVENTORY_ITEM_KEY = 0;
|
||||
const U8 TASK_INVENTORY_ASSET_KEY = 1;
|
||||
|
||||
const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
|
||||
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Class LLInventoryObject
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLInventoryObject::LLInventoryObject(
|
||||
const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
LLAssetType::EType type,
|
||||
const std::string& name) :
|
||||
LLInventoryObject::LLInventoryObject(const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
LLAssetType::EType type,
|
||||
const std::string& name) :
|
||||
mUUID(uuid),
|
||||
mParentUUID(parent_uuid),
|
||||
mType(type),
|
||||
mName(name)
|
||||
{
|
||||
LLStringUtil::replaceNonstandardASCII(mName, ' ');
|
||||
LLStringUtil::replaceChar(mName, '|', ' ');
|
||||
LLStringUtil::trim(mName);
|
||||
LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN);
|
||||
correctInventoryName(mName);
|
||||
}
|
||||
|
||||
LLInventoryObject::LLInventoryObject() :
|
||||
@@ -99,7 +92,7 @@ LLInventoryObject::LLInventoryObject() :
|
||||
{
|
||||
}
|
||||
|
||||
LLInventoryObject::~LLInventoryObject( void )
|
||||
LLInventoryObject::~LLInventoryObject()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -158,12 +151,8 @@ void LLInventoryObject::setUUID(const LLUUID& new_uuid)
|
||||
void LLInventoryObject::rename(const std::string& n)
|
||||
{
|
||||
std::string new_name(n);
|
||||
LLStringUtil::replaceNonstandardASCII(new_name, ' ');
|
||||
LLStringUtil::replaceChar(new_name, '|', ' ');
|
||||
LLStringUtil::trim(new_name);
|
||||
LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN);
|
||||
|
||||
if( new_name != mName )
|
||||
correctInventoryName(new_name);
|
||||
if( !new_name.empty() && new_name != mName )
|
||||
{
|
||||
mName = new_name;
|
||||
}
|
||||
@@ -224,10 +213,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
|
||||
" %254s %254[^|]",
|
||||
keyword, valuestr);
|
||||
mName.assign(valuestr);
|
||||
LLStringUtil::replaceNonstandardASCII(mName, ' ');
|
||||
LLStringUtil::replaceChar(mName, '|', ' ');
|
||||
LLStringUtil::trim(mName);
|
||||
LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN);
|
||||
correctInventoryName(mName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -287,23 +273,31 @@ void LLInventoryObject::updateServer(BOOL) const
|
||||
llwarns << "LLInventoryObject::updateServer() called. Doesn't do anything." << llendl;
|
||||
}
|
||||
|
||||
inline
|
||||
void LLInventoryObject::correctInventoryName(std::string& name)
|
||||
{
|
||||
LLStringUtil::replaceNonstandardASCII(name, ' ');
|
||||
LLStringUtil::replaceChar(name, '|', ' ');
|
||||
LLStringUtil::trim(name);
|
||||
LLStringUtil::truncate(name, DB_INV_ITEM_NAME_STR_LEN);
|
||||
}
|
||||
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Class LLInventoryItem
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLInventoryItem::LLInventoryItem(
|
||||
const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
const LLPermissions& permissions,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
LLInventoryType::EType inv_type,
|
||||
const std::string& name,
|
||||
const std::string& desc,
|
||||
const LLSaleInfo& sale_info,
|
||||
U32 flags,
|
||||
S32 creation_date_utc) :
|
||||
LLInventoryItem::LLInventoryItem(const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
const LLPermissions& permissions,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
LLInventoryType::EType inv_type,
|
||||
const std::string& name,
|
||||
const std::string& desc,
|
||||
const LLSaleInfo& sale_info,
|
||||
U32 flags,
|
||||
S32 creation_date_utc) :
|
||||
LLInventoryObject(uuid, parent_uuid, type, name),
|
||||
mPermissions(permissions),
|
||||
mAssetUUID(asset_uuid),
|
||||
@@ -315,6 +309,7 @@ LLInventoryItem::LLInventoryItem(
|
||||
{
|
||||
LLStringUtil::replaceNonstandardASCII(mDescription, ' ');
|
||||
LLStringUtil::replaceChar(mDescription, '|', ' ');
|
||||
mPermissions.initMasks(inv_type);
|
||||
}
|
||||
|
||||
LLInventoryItem::LLInventoryItem() :
|
||||
@@ -446,6 +441,9 @@ void LLInventoryItem::setDescription(const std::string& d)
|
||||
void LLInventoryItem::setPermissions(const LLPermissions& perm)
|
||||
{
|
||||
mPermissions = perm;
|
||||
|
||||
// Override permissions to unrestricted if this is a landmark
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
}
|
||||
|
||||
void LLInventoryItem::setInventoryType(LLInventoryType::EType inv_type)
|
||||
@@ -463,6 +461,46 @@ void LLInventoryItem::setCreationDate(time_t creation_date_utc)
|
||||
mCreationDate = creation_date_utc;
|
||||
}
|
||||
|
||||
// Currently only used in the Viewer to handle calling cards
|
||||
// where the creator is actually used to store the target.
|
||||
void LLInventoryItem::setCreator(const LLUUID& creator)
|
||||
{
|
||||
mPermissions.setCreator(creator);
|
||||
}
|
||||
|
||||
void LLInventoryItem::accumulatePermissionSlamBits(const LLInventoryItem& old_item)
|
||||
{
|
||||
// Remove any pre-existing II_FLAGS_PERM_OVERWRITE_MASK flags
|
||||
// because we now detect when they should be set.
|
||||
setFlags( old_item.getFlags() | (getFlags() & ~(LLInventoryItemFlags::II_FLAGS_PERM_OVERWRITE_MASK)) );
|
||||
|
||||
// Enforce the PERM_OVERWRITE flags for any masks that are different
|
||||
// but only for AT_OBJECT's since that is the only asset type that can
|
||||
// exist in-world (instead of only in-inventory or in-object-contents).
|
||||
if (LLAssetType::AT_OBJECT == getType())
|
||||
{
|
||||
LLPermissions old_permissions = old_item.getPermissions();
|
||||
U32 flags_to_be_set = 0;
|
||||
if(old_permissions.getMaskNextOwner() != getPermissions().getMaskNextOwner())
|
||||
{
|
||||
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
|
||||
}
|
||||
if(old_permissions.getMaskEveryone() != getPermissions().getMaskEveryone())
|
||||
{
|
||||
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
|
||||
}
|
||||
if(old_permissions.getMaskGroup() != getPermissions().getMaskGroup())
|
||||
{
|
||||
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
|
||||
}
|
||||
LLSaleInfo old_sale_info = old_item.getSaleInfo();
|
||||
if(old_sale_info != getSaleInfo())
|
||||
{
|
||||
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE;
|
||||
}
|
||||
setFlags(getFlags() | flags_to_be_set);
|
||||
}
|
||||
}
|
||||
|
||||
const LLSaleInfo& LLInventoryItem::getSaleInfo() const
|
||||
{
|
||||
@@ -517,6 +555,7 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32
|
||||
mType = static_cast<LLAssetType::EType>(type);
|
||||
msg->getS8(block, "InvType", type, block_num);
|
||||
mInventoryType = static_cast<LLInventoryType::EType>(type);
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
|
||||
msg->getU32Fast(block, _PREHASH_Flags, mFlags, block_num);
|
||||
|
||||
@@ -707,6 +746,9 @@ BOOL LLInventoryItem::importFile(LLFILE* fp)
|
||||
lldebugs << "Resetting inventory type for " << mUUID << llendl;
|
||||
mInventoryType = LLInventoryType::defaultForAssetType(mType);
|
||||
}
|
||||
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -746,8 +788,8 @@ BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const
|
||||
fprintf(fp, "\t\tasset_id\t%s\n", uuid_str.c_str());
|
||||
}
|
||||
fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
|
||||
const char* inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(inv_type_str) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str);
|
||||
const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(!inv_type_str.empty()) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str.c_str());
|
||||
fprintf(fp, "\t\tflags\t%08x\n", mFlags);
|
||||
mSaleInfo.exportFile(fp);
|
||||
fprintf(fp, "\t\tname\t%s|\n", mName.c_str());
|
||||
@@ -910,6 +952,9 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
|
||||
lldebugs << "Resetting inventory type for " << mUUID << llendl;
|
||||
mInventoryType = LLInventoryType::defaultForAssetType(mType);
|
||||
}
|
||||
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -949,8 +994,8 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
|
||||
output_stream << "\t\tasset_id\t" << uuid_str << "\n";
|
||||
}
|
||||
output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n";
|
||||
const char* inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(inv_type_str)
|
||||
const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(!inv_type_str.empty())
|
||||
output_stream << "\t\tinv_type\t" << inv_type_str << "\n";
|
||||
std::string buffer;
|
||||
buffer = llformat( "\t\tflags\t%08x\n", mFlags);
|
||||
@@ -966,6 +1011,12 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
|
||||
LLSD LLInventoryItem::asLLSD() const
|
||||
{
|
||||
LLSD sd = LLSD();
|
||||
asLLSD(sd);
|
||||
return sd;
|
||||
}
|
||||
|
||||
void LLInventoryItem::asLLSD( LLSD& sd ) const
|
||||
{
|
||||
sd[INV_ITEM_ID_LABEL] = mUUID;
|
||||
sd[INV_PARENT_ID_LABEL] = mParentUUID;
|
||||
sd[INV_PERMISSIONS_LABEL] = ll_create_sd_from_permissions(mPermissions);
|
||||
@@ -986,8 +1037,8 @@ LLSD LLInventoryItem::asLLSD() const
|
||||
}
|
||||
sd[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType);
|
||||
sd[INV_INVENTORY_TYPE_LABEL] = mInventoryType;
|
||||
const char* inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(inv_type_str)
|
||||
const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(!inv_type_str.empty())
|
||||
{
|
||||
sd[INV_INVENTORY_TYPE_LABEL] = inv_type_str;
|
||||
}
|
||||
@@ -997,11 +1048,9 @@ LLSD LLInventoryItem::asLLSD() const
|
||||
sd[INV_NAME_LABEL] = mName;
|
||||
sd[INV_DESC_LABEL] = mDescription;
|
||||
sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate;
|
||||
|
||||
return sd;
|
||||
}
|
||||
|
||||
bool LLInventoryItem::fromLLSD(LLSD& sd)
|
||||
bool LLInventoryItem::fromLLSD(const LLSD& sd)
|
||||
{
|
||||
mInventoryType = LLInventoryType::IT_NONE;
|
||||
mAssetUUID.setNull();
|
||||
@@ -1128,6 +1177,8 @@ bool LLInventoryItem::fromLLSD(LLSD& sd)
|
||||
mInventoryType = LLInventoryType::defaultForAssetType(mType);
|
||||
}
|
||||
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
|
||||
return true;
|
||||
fail:
|
||||
return false;
|
||||
@@ -1294,23 +1345,19 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
|
||||
// Early exit on an empty binary bucket.
|
||||
if (bin_bucket_size <= 1) return;
|
||||
|
||||
// Convert the bin_bucket into a string.
|
||||
char* item_buffer = new char[bin_bucket_size+1];
|
||||
if ((item_buffer != NULL) && (bin_bucket != NULL))
|
||||
if (NULL == bin_bucket)
|
||||
{
|
||||
memcpy(item_buffer, bin_bucket, bin_bucket_size); /* Flawfinder: ignore */
|
||||
}
|
||||
else
|
||||
{
|
||||
llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
|
||||
delete[] item_buffer;
|
||||
llerrs << "unpackBinaryBucket failed. bin_bucket is NULL." << llendl;
|
||||
return;
|
||||
}
|
||||
item_buffer[bin_bucket_size] = '\0';
|
||||
std::string str(item_buffer);
|
||||
|
||||
lldebugs << "item buffer: " << item_buffer << llendl;
|
||||
delete[] item_buffer;
|
||||
// Convert the bin_bucket into a string.
|
||||
std::vector<char> item_buffer(bin_bucket_size+1);
|
||||
memcpy(&item_buffer[0], bin_bucket, bin_bucket_size); /* Flawfinder: ignore */
|
||||
item_buffer[bin_bucket_size] = '\0';
|
||||
std::string str(&item_buffer[0]);
|
||||
|
||||
lldebugs << "item buffer: " << str << llendl;
|
||||
|
||||
// Tokenize the string.
|
||||
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
|
||||
@@ -1385,11 +1432,10 @@ BOOL item_date_sort( LLInventoryItem* a, LLInventoryItem* b )
|
||||
/// Class LLInventoryCategory
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLInventoryCategory::LLInventoryCategory(
|
||||
const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
LLAssetType::EType preferred_type,
|
||||
const std::string& name) :
|
||||
LLInventoryCategory::LLInventoryCategory(const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
LLAssetType::EType preferred_type,
|
||||
const std::string& name) :
|
||||
LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name),
|
||||
mPreferredType(preferred_type)
|
||||
{
|
||||
@@ -1451,7 +1497,7 @@ void LLInventoryCategory::packMessage(LLMessageSystem* msg) const
|
||||
msg->addStringFast(_PREHASH_Name, mName);
|
||||
}
|
||||
|
||||
bool LLInventoryCategory::fromLLSD(LLSD& sd)
|
||||
bool LLInventoryCategory::fromLLSD(const LLSD& sd)
|
||||
{
|
||||
std::string w;
|
||||
|
||||
|
||||
@@ -33,180 +33,107 @@
|
||||
#ifndef LL_LLINVENTORY_H
|
||||
#define LL_LLINVENTORY_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "llassetstorage.h"
|
||||
#include "lldarray.h"
|
||||
#include "llinventorytype.h"
|
||||
#include "llinventorydefines.h"
|
||||
#include "llmemtype.h"
|
||||
#include "llpermissions.h"
|
||||
#include "llsaleinfo.h"
|
||||
#include "llsd.h"
|
||||
#include "lluuid.h"
|
||||
#include "llxmlnode.h"
|
||||
|
||||
// consts for Key field in the task inventory update message
|
||||
extern const U8 TASK_INVENTORY_ITEM_KEY;
|
||||
extern const U8 TASK_INVENTORY_ASSET_KEY;
|
||||
|
||||
// anonymous enumeration to specify a max inventory buffer size for
|
||||
// use in packBinaryBucket()
|
||||
enum
|
||||
{
|
||||
MAX_INVENTORY_BUFFER_SIZE = 1024
|
||||
};
|
||||
|
||||
|
||||
class LLMessageSystem;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Class LLInventoryObject
|
||||
//
|
||||
// This is the base class for inventory objects that handles the
|
||||
// common code between items and categories. The 'mParentUUID' member
|
||||
// means the parent category since all inventory objects except each
|
||||
// user's root category are in some category. Each user's root
|
||||
// category will have mParentUUID==LLUUID::null.
|
||||
// Base class for anything in the user's inventory. Handles the common code
|
||||
// between items and categories.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
class LLMessageSystem;
|
||||
|
||||
class LLInventoryObject : public LLRefCount
|
||||
{
|
||||
protected:
|
||||
LLUUID mUUID;
|
||||
LLUUID mParentUUID;
|
||||
LLAssetType::EType mType;
|
||||
std::string mName;
|
||||
public:
|
||||
typedef std::list<LLPointer<LLInventoryObject> > object_list_t;
|
||||
|
||||
protected:
|
||||
virtual ~LLInventoryObject( void );
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
|
||||
LLInventoryObject(const LLUUID& uuid, const LLUUID& parent_uuid,
|
||||
LLAssetType::EType type, const std::string& name);
|
||||
LLInventoryObject();
|
||||
LLInventoryObject(const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
LLAssetType::EType type,
|
||||
const std::string& name);
|
||||
void copyObject(const LLInventoryObject* other); // LLRefCount requires custom copy
|
||||
protected:
|
||||
virtual ~LLInventoryObject();
|
||||
|
||||
// accessors
|
||||
virtual const LLUUID& getUUID() const;
|
||||
//--------------------------------------------------------------------
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual const LLUUID& getUUID() const; // inventoryID that this item points to
|
||||
virtual const LLUUID& getLinkedUUID() const; // inventoryID that this item points to, else this item's inventoryID
|
||||
const LLUUID& getParentUUID() const;
|
||||
virtual const LLUUID& getLinkedUUID() const; // get the inventoryID that this item points to, else this item's inventoryID
|
||||
virtual const std::string& getName() const;
|
||||
virtual LLAssetType::EType getType() const;
|
||||
LLAssetType::EType getActualType() const; // bypasses indirection for linked items
|
||||
BOOL getIsLinkType() const;
|
||||
// mutators - will not call updateServer();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Mutators
|
||||
// Will not call updateServer
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void setUUID(const LLUUID& new_uuid);
|
||||
virtual void rename(const std::string& new_name);
|
||||
void setParent(const LLUUID& new_parent);
|
||||
void setType(LLAssetType::EType type);
|
||||
|
||||
// file support - implemented here so that a minimal information
|
||||
// set can be transmitted between simulator and viewer.
|
||||
// virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
private:
|
||||
// in place correction for inventory name string
|
||||
void correctInventoryName(std::string& name);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// File Support
|
||||
// Implemented here so that a minimal information set can be transmitted
|
||||
// between simulator and viewer.
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
// virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
virtual BOOL importLegacyStream(std::istream& input_stream);
|
||||
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
// virtual methods
|
||||
virtual void removeFromServer();
|
||||
virtual void updateParentOnServer(BOOL) const;
|
||||
virtual void updateServer(BOOL) const;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Member Variables
|
||||
//--------------------------------------------------------------------
|
||||
protected:
|
||||
LLUUID mUUID;
|
||||
LLUUID mParentUUID; // Parent category. Root categories have LLUUID::NULL.
|
||||
LLAssetType::EType mType;
|
||||
std::string mName;
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Class LLInventoryItem
|
||||
//
|
||||
// An inventory item represents something that the current user has in
|
||||
// their inventory.
|
||||
// An item in the current user's inventory.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
class LLInventoryItem : public LLInventoryObject
|
||||
{
|
||||
public:
|
||||
typedef LLDynamicArray<LLPointer<LLInventoryItem> > item_array_t;
|
||||
|
||||
protected:
|
||||
LLPermissions mPermissions;
|
||||
LLUUID mAssetUUID;
|
||||
std::string mDescription;
|
||||
LLSaleInfo mSaleInfo;
|
||||
LLInventoryType::EType mInventoryType;
|
||||
U32 mFlags;
|
||||
time_t mCreationDate; // seconds from 1/1/1970, UTC
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Anonymous enumeration for specifying the inventory item flags.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
// The shared flags at the top are shared among all inventory
|
||||
// types. After that section, all values of flags are type
|
||||
// dependent. The shared flags will start at 2^30 and work
|
||||
// down while item type specific flags will start at 2^0 and
|
||||
// work up.
|
||||
II_FLAGS_NONE = 0,
|
||||
|
||||
|
||||
//
|
||||
// Shared flags
|
||||
//
|
||||
//
|
||||
|
||||
// This value means that the asset has only one reference in
|
||||
// the system. If the inventory item is deleted, or the asset
|
||||
// id updated, then we can remove the old reference.
|
||||
II_FLAGS_SHARED_SINGLE_REFERENCE = 0x40000000,
|
||||
|
||||
|
||||
//
|
||||
// Landmark flags
|
||||
//
|
||||
II_FLAGS_LANDMARK_VISITED = 1,
|
||||
|
||||
//
|
||||
// Object flags
|
||||
//
|
||||
|
||||
// flag to indicate that object permissions should have next
|
||||
// owner perm be more restrictive on rez. We bump this into
|
||||
// the second byte of the flags since the low byte is used to
|
||||
// track attachment points.
|
||||
II_FLAGS_OBJECT_SLAM_PERM = 0x100,
|
||||
|
||||
// flag to indicate that the object sale information has been changed.
|
||||
II_FLAGS_OBJECT_SLAM_SALE = 0x1000,
|
||||
|
||||
// These flags specify which permissions masks to overwrite
|
||||
// upon rez. Normally, if no permissions slam (above) or
|
||||
// overwrite flags are set, the asset's permissions are
|
||||
// used and the inventory's permissions are ignored. If
|
||||
// any of these flags are set, the inventory's permissions
|
||||
// take precedence.
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_BASE = 0x010000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER = 0x020000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP = 0x040000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE = 0x080000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER = 0x100000,
|
||||
|
||||
// flag to indicate whether an object that is returned is composed
|
||||
// of muiltiple items or not.
|
||||
II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS = 0x200000,
|
||||
|
||||
//
|
||||
// wearables use the low order byte of flags to store the
|
||||
// EWearableType enumeration found in newview/llwearable.h
|
||||
//
|
||||
II_FLAGS_WEARABLES_MASK = 0xff,
|
||||
};
|
||||
|
||||
protected:
|
||||
~LLInventoryItem(); // ref counted
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
|
||||
LLInventoryItem(const LLUUID& uuid,
|
||||
@@ -226,13 +153,19 @@ public:
|
||||
// is prohibited
|
||||
LLInventoryItem(const LLInventoryItem* other);
|
||||
virtual void copyItem(const LLInventoryItem* other); // LLRefCount requires custom copy
|
||||
|
||||
// As a constructor alternative, the clone() method works like a
|
||||
void generateUUID() { mUUID.generate(); }
|
||||
|
||||
// As a constructor alternative, the clone() method works like a
|
||||
// copy constructor, but gens a new UUID.
|
||||
// It is up to the caller to delete (unref) the item.
|
||||
virtual void cloneItem(LLPointer<LLInventoryItem>& newitem) const;
|
||||
protected:
|
||||
~LLInventoryItem(); // ref counted
|
||||
|
||||
// accessors
|
||||
//--------------------------------------------------------------------
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual const LLUUID& getLinkedUUID() const;
|
||||
virtual const LLPermissions& getPermissions() const;
|
||||
virtual const LLUUID& getCreatorUUID() const;
|
||||
@@ -244,8 +177,12 @@ public:
|
||||
virtual time_t getCreationDate() const;
|
||||
virtual U32 getCRC32() const; // really more of a checksum.
|
||||
|
||||
// mutators - will not call updateServer(), and will never fail
|
||||
// (though it may correct to sane values)
|
||||
//--------------------------------------------------------------------
|
||||
// Mutators
|
||||
// Will not call updateServer and will never fail
|
||||
// (though it may correct to sane values)
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void setAssetUUID(const LLUUID& asset_id);
|
||||
void setDescription(const std::string& new_desc);
|
||||
void setSaleInfo(const LLSaleInfo& sale_info);
|
||||
@@ -253,34 +190,56 @@ public:
|
||||
void setInventoryType(LLInventoryType::EType inv_type);
|
||||
void setFlags(U32 flags);
|
||||
void setCreationDate(time_t creation_date_utc);
|
||||
void setCreator(const LLUUID& creator); // only used for calling cards
|
||||
|
||||
// Put this inventory item onto the current outgoing mesage. It
|
||||
// assumes you have already called nextBlock().
|
||||
// Check for changes in permissions masks and sale info
|
||||
// and set the corresponding bits in mFlags.
|
||||
void accumulatePermissionSlamBits(const LLInventoryItem& old_item);
|
||||
|
||||
// Put this inventory item onto the current outgoing mesage.
|
||||
// Assumes you have already called nextBlock().
|
||||
virtual void packMessage(LLMessageSystem* msg) const;
|
||||
|
||||
// unpack returns TRUE if the inventory item came through the
|
||||
// network ok. It uses a simple crc check which is defeatable, but
|
||||
// we want to detect network mangling somehow.
|
||||
virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
|
||||
// file support
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// File Support
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
virtual BOOL importLegacyStream(std::istream& input_stream);
|
||||
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
virtual LLXMLNode *exportFileXML(BOOL include_asset_key = TRUE) const;
|
||||
BOOL importXML(LLXMLNode* node);
|
||||
|
||||
// helper functions
|
||||
//--------------------------------------------------------------------
|
||||
// Helper Functions
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
// Pack all information needed to reconstruct this item into the given binary bucket.
|
||||
|
||||
// pack all information needed to reconstruct this item into the given binary bucket.
|
||||
// perm_override is optional
|
||||
S32 packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override = NULL) const;
|
||||
void unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size);
|
||||
LLSD asLLSD() const;
|
||||
bool fromLLSD(LLSD& sd);
|
||||
void asLLSD( LLSD& sd ) const;
|
||||
bool fromLLSD(const LLSD& sd);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Member Variables
|
||||
//--------------------------------------------------------------------
|
||||
protected:
|
||||
LLPermissions mPermissions;
|
||||
LLUUID mAssetUUID;
|
||||
std::string mDescription;
|
||||
LLSaleInfo mSaleInfo;
|
||||
LLInventoryType::EType mInventoryType;
|
||||
U32 mFlags;
|
||||
time_t mCreationDate; // seconds from 1/1/1970, UTC
|
||||
};
|
||||
|
||||
BOOL item_dictionary_sort(LLInventoryItem* a,LLInventoryItem* b);
|
||||
@@ -300,9 +259,9 @@ class LLInventoryCategory : public LLInventoryObject
|
||||
public:
|
||||
typedef LLDynamicArray<LLPointer<LLInventoryCategory> > cat_array_t;
|
||||
|
||||
protected:
|
||||
~LLInventoryCategory();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
|
||||
LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid,
|
||||
@@ -311,29 +270,39 @@ public:
|
||||
LLInventoryCategory();
|
||||
LLInventoryCategory(const LLInventoryCategory* other);
|
||||
void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy
|
||||
protected:
|
||||
~LLInventoryCategory();
|
||||
|
||||
// accessors and mutators
|
||||
//--------------------------------------------------------------------
|
||||
// Accessors And Mutators
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLAssetType::EType getPreferredType() const;
|
||||
void setPreferredType(LLAssetType::EType type);
|
||||
// For messaging system support
|
||||
LLSD asLLSD() const;
|
||||
bool fromLLSD(const LLSD& sd);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Messaging
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual void packMessage(LLMessageSystem* msg) const;
|
||||
virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
|
||||
|
||||
LLSD asLLSD() const;
|
||||
bool fromLLSD(LLSD& sd);
|
||||
|
||||
// file support
|
||||
//--------------------------------------------------------------------
|
||||
// File Support
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
virtual BOOL importLegacyStream(std::istream& input_stream);
|
||||
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Member Variables
|
||||
//--------------------------------------------------------------------
|
||||
protected:
|
||||
// The type of asset that this category was "meant" to hold
|
||||
// (although it may in fact hold any type).
|
||||
LLAssetType::EType mPreferredType;
|
||||
|
||||
LLAssetType::EType mPreferredType; // Type that this category was "meant" to hold (although it may hold any type).
|
||||
};
|
||||
|
||||
|
||||
@@ -404,8 +373,8 @@ struct SetNotForSale
|
||||
if(LLAssetType::AT_OBJECT == item->getType())
|
||||
{
|
||||
U32 flags = item->getFlags();
|
||||
flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
|
||||
flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
|
||||
flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
|
||||
flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
|
||||
item->setFlags(flags);
|
||||
}
|
||||
|
||||
|
||||
38
indra/llinventory/llinventorydefines.cpp
Normal file
38
indra/llinventory/llinventorydefines.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file llinventorydefines.cpp
|
||||
* @brief Implementation of the inventory defines.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llinventorydefines.h"
|
||||
|
||||
const U8 TASK_INVENTORY_ITEM_KEY = 0;
|
||||
const U8 TASK_INVENTORY_ASSET_KEY = 1;
|
||||
107
indra/llinventory/llinventorydefines.h
Normal file
107
indra/llinventory/llinventorydefines.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* @file llinventorydefines.h
|
||||
* @brief LLInventoryDefines
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LL_LLINVENTORYDEFINES_H
|
||||
#define LL_LLINVENTORYDEFINES_H
|
||||
|
||||
// Consts for "key" field in the task inventory update message
|
||||
extern const U8 TASK_INVENTORY_ITEM_KEY;
|
||||
extern const U8 TASK_INVENTORY_ASSET_KEY;
|
||||
|
||||
// Max inventory buffer size (for use in packBinaryBucket)
|
||||
enum
|
||||
{
|
||||
MAX_INVENTORY_BUFFER_SIZE = 1024
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Inventory item flags enums
|
||||
// The shared flags at the top are shared among all inventory
|
||||
// types. After that section, all values of flags are type
|
||||
// dependent. The shared flags will start at 2^30 and work
|
||||
// down while item type specific flags will start at 2^0 and work up.
|
||||
//--------------------------------------------------------------------
|
||||
class LLInventoryItemFlags
|
||||
{
|
||||
public:
|
||||
enum EType
|
||||
{
|
||||
II_FLAGS_NONE = 0,
|
||||
|
||||
II_FLAGS_SHARED_SINGLE_REFERENCE = 0x40000000,
|
||||
// The asset has only one reference in the system. If the
|
||||
// inventory item is deleted, or the assetid updated, then we
|
||||
// can remove the old reference.
|
||||
|
||||
II_FLAGS_LANDMARK_VISITED = 1,
|
||||
|
||||
II_FLAGS_OBJECT_SLAM_PERM = 0x100,
|
||||
// Object permissions should have next owner perm be more
|
||||
// restrictive on rez. We bump this into the second byte of the
|
||||
// flags since the low byte is used to track attachment points.
|
||||
|
||||
II_FLAGS_OBJECT_SLAM_SALE = 0x1000,
|
||||
// The object sale information has been changed.
|
||||
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_BASE = 0x010000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER = 0x020000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP = 0x040000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE = 0x080000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER = 0x100000,
|
||||
// Specify which permissions masks to overwrite
|
||||
// upon rez. Normally, if no permissions slam (above) or
|
||||
// overwrite flags are set, the asset's permissions are
|
||||
// used and the inventory's permissions are ignored. If
|
||||
// any of these flags are set, the inventory's permissions
|
||||
// take precedence.
|
||||
|
||||
II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS = 0x200000,
|
||||
// Whether a returned object is composed of multiple items.
|
||||
|
||||
II_FLAGS_WEARABLES_MASK = 0xff,
|
||||
// Wearables use the low order byte of flags to store the
|
||||
// LLWearableType::EType enumeration found in newview/llwearable.h
|
||||
|
||||
II_FLAGS_PERM_OVERWRITE_MASK = (II_FLAGS_OBJECT_SLAM_PERM |
|
||||
II_FLAGS_OBJECT_SLAM_SALE |
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_BASE |
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER |
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP |
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE |
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER),
|
||||
// These bits need to be cleared whenever the asset_id is updated
|
||||
// on a pre-existing inventory item (DEV-28098 and DEV-30997)
|
||||
};
|
||||
};
|
||||
|
||||
#endif // LL_LLINVENTORYDEFINES_H
|
||||
@@ -33,66 +33,64 @@
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llinventorytype.h"
|
||||
#include "lldictionary.h"
|
||||
#include "llmemory.h"
|
||||
|
||||
static const std::string empty_string;
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Class LLInventoryType
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
// Unlike asset type names, not limited to 8 characters.
|
||||
// Need not match asset type names.
|
||||
static const char* INVENTORY_TYPE_NAMES[LLInventoryType::IT_COUNT] =
|
||||
{
|
||||
"texture", // 0
|
||||
"sound",
|
||||
"callcard",
|
||||
"landmark",
|
||||
NULL,
|
||||
NULL, // 5
|
||||
"object",
|
||||
"notecard",
|
||||
"category",
|
||||
"root",
|
||||
"script", // 10
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"snapshot", // 15
|
||||
NULL,
|
||||
"attach",
|
||||
"wearable",
|
||||
"animation",
|
||||
"gesture", // 20
|
||||
struct InventoryEntry : public LLDictionaryEntry
|
||||
{
|
||||
InventoryEntry(const std::string &name, // unlike asset type names, not limited to 8 characters; need not match asset type names
|
||||
const std::string &human_name, // for decoding to human readable form; put any and as many printable characters you want in each one.
|
||||
int num_asset_types = 0, ...)
|
||||
:
|
||||
LLDictionaryEntry(name),
|
||||
mHumanName(human_name)
|
||||
{
|
||||
va_list argp;
|
||||
va_start(argp, num_asset_types);
|
||||
// Read in local textures
|
||||
for (U8 i=0; i < num_asset_types; i++)
|
||||
{
|
||||
LLAssetType::EType t = (LLAssetType::EType)va_arg(argp,int);
|
||||
mAssetTypes.push_back(t);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string mHumanName;
|
||||
typedef std::vector<LLAssetType::EType> asset_vec_t;
|
||||
asset_vec_t mAssetTypes;
|
||||
};
|
||||
|
||||
// This table is meant for decoding to human readable form. Put any
|
||||
// and as many printable characters you want in each one.
|
||||
// See also LLAssetType::mAssetTypeHumanNames
|
||||
static const char* INVENTORY_TYPE_HUMAN_NAMES[LLInventoryType::IT_COUNT] =
|
||||
{
|
||||
"texture", // 0
|
||||
"sound",
|
||||
"calling card",
|
||||
"landmark",
|
||||
NULL,
|
||||
NULL, // 5
|
||||
"object",
|
||||
"note card",
|
||||
"folder",
|
||||
"root",
|
||||
"script", // 10
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"snapshot", // 15
|
||||
NULL,
|
||||
"attachment",
|
||||
"wearable",
|
||||
"animation",
|
||||
"gesture", // 20
|
||||
class LLInventoryDictionary : public LLSingleton<LLInventoryDictionary>,
|
||||
public LLDictionary<LLInventoryType::EType, InventoryEntry>
|
||||
{
|
||||
public:
|
||||
LLInventoryDictionary();
|
||||
};
|
||||
|
||||
LLInventoryDictionary::LLInventoryDictionary()
|
||||
{
|
||||
addEntry(LLInventoryType::IT_TEXTURE, new InventoryEntry("texture", "texture", 1, LLAssetType::AT_TEXTURE));
|
||||
addEntry(LLInventoryType::IT_SOUND, new InventoryEntry("sound", "sound", 1, LLAssetType::AT_SOUND));
|
||||
addEntry(LLInventoryType::IT_CALLINGCARD, new InventoryEntry("callcard", "calling card", 1, LLAssetType::AT_CALLINGCARD));
|
||||
addEntry(LLInventoryType::IT_LANDMARK, new InventoryEntry("landmark", "landmark", 1, LLAssetType::AT_LANDMARK));
|
||||
addEntry(LLInventoryType::IT_OBJECT, new InventoryEntry("object", "object", 1, LLAssetType::AT_OBJECT));
|
||||
addEntry(LLInventoryType::IT_NOTECARD, new InventoryEntry("notecard", "note card", 1, LLAssetType::AT_NOTECARD));
|
||||
addEntry(LLInventoryType::IT_CATEGORY, new InventoryEntry("category", "folder" ));
|
||||
addEntry(LLInventoryType::IT_ROOT_CATEGORY, new InventoryEntry("root", "root" ));
|
||||
addEntry(LLInventoryType::IT_LSL, new InventoryEntry("script", "script", 2, LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE));
|
||||
addEntry(LLInventoryType::IT_SNAPSHOT, new InventoryEntry("snapshot", "snapshot", 1, LLAssetType::AT_TEXTURE));
|
||||
addEntry(LLInventoryType::IT_ATTACHMENT, new InventoryEntry("attach", "attachment", 1, LLAssetType::AT_OBJECT));
|
||||
addEntry(LLInventoryType::IT_WEARABLE, new InventoryEntry("wearable", "wearable", 2, LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART));
|
||||
addEntry(LLInventoryType::IT_ANIMATION, new InventoryEntry("animation", "animation", 1, LLAssetType::AT_ANIMATION));
|
||||
addEntry(LLInventoryType::IT_GESTURE, new InventoryEntry("gesture", "gesture", 1, LLAssetType::AT_GESTURE));
|
||||
}
|
||||
|
||||
|
||||
// Maps asset types to the default inventory type for that kind of asset.
|
||||
// Thus, "Lost and Found" is a "Category"
|
||||
static const LLInventoryType::EType
|
||||
@@ -149,74 +147,28 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
|
||||
LLInventoryType::IT_NONE // AT_MY_OUTFITS
|
||||
};
|
||||
|
||||
static const int MAX_POSSIBLE_ASSET_TYPES = 2;
|
||||
static const LLAssetType::EType
|
||||
INVENTORY_TO_ASSET_TYPE[LLInventoryType::IT_COUNT][MAX_POSSIBLE_ASSET_TYPES] =
|
||||
{
|
||||
{ LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_TEXTURE
|
||||
{ LLAssetType::AT_SOUND, LLAssetType::AT_NONE }, // IT_SOUND
|
||||
{ LLAssetType::AT_CALLINGCARD, LLAssetType::AT_NONE }, // IT_CALLINGCARD
|
||||
{ LLAssetType::AT_LANDMARK, LLAssetType::AT_NONE }, // IT_LANDMARK
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_OBJECT
|
||||
{ LLAssetType::AT_NOTECARD, LLAssetType::AT_NONE }, // IT_NOTECARD
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_CATEGORY
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_ROOT_CATEGORY
|
||||
{ LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE }, // IT_LSL
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_SNAPSHOT
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_ATTACHMENT
|
||||
{ LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART }, // IT_WEARABLE
|
||||
{ LLAssetType::AT_ANIMATION, LLAssetType::AT_NONE }, // IT_ANIMATION
|
||||
{ LLAssetType::AT_GESTURE, LLAssetType::AT_NONE }, // IT_GESTURE
|
||||
};
|
||||
|
||||
// static
|
||||
const char* LLInventoryType::lookup(EType type)
|
||||
const std::string &LLInventoryType::lookup(EType type)
|
||||
{
|
||||
if((type >= 0) && (type < IT_COUNT))
|
||||
{
|
||||
return INVENTORY_TYPE_NAMES[S32(type)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
const InventoryEntry *entry = LLInventoryDictionary::getInstance()->lookup(type);
|
||||
if (!entry) return empty_string;
|
||||
return entry->mName;
|
||||
}
|
||||
|
||||
// static
|
||||
LLInventoryType::EType LLInventoryType::lookup(const std::string& name)
|
||||
{
|
||||
for(S32 i = 0; i < IT_COUNT; ++i)
|
||||
{
|
||||
if((INVENTORY_TYPE_NAMES[i])
|
||||
&& (name == INVENTORY_TYPE_NAMES[i]))
|
||||
{
|
||||
// match
|
||||
return (EType)i;
|
||||
}
|
||||
}
|
||||
return IT_NONE;
|
||||
return LLInventoryDictionary::getInstance()->lookup(name);
|
||||
}
|
||||
|
||||
// XUI:translate
|
||||
// translation from a type to a human readable form.
|
||||
// static
|
||||
const char* LLInventoryType::lookupHumanReadable(EType type)
|
||||
const std::string &LLInventoryType::lookupHumanReadable(EType type)
|
||||
{
|
||||
if((type >= 0) && (type < IT_COUNT))
|
||||
{
|
||||
return INVENTORY_TYPE_HUMAN_NAMES[S32(type)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
const InventoryEntry *entry = LLInventoryDictionary::getInstance()->lookup(type);
|
||||
if (!entry) return empty_string;
|
||||
return entry->mHumanName;
|
||||
}
|
||||
|
||||
// return the default inventory for the given asset type.
|
||||
@@ -233,21 +185,40 @@ LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType a
|
||||
}
|
||||
}
|
||||
|
||||
bool inventory_and_asset_types_match(
|
||||
LLInventoryType::EType inventory_type,
|
||||
LLAssetType::EType asset_type)
|
||||
|
||||
// add any types that we don't want the user to be able to change permissions on.
|
||||
// static
|
||||
bool LLInventoryType::cannotRestrictPermissions(LLInventoryType::EType type)
|
||||
{
|
||||
bool rv = false;
|
||||
if((inventory_type >= 0) && (inventory_type < LLInventoryType::IT_COUNT))
|
||||
switch(type)
|
||||
{
|
||||
for(S32 i = 0; i < MAX_POSSIBLE_ASSET_TYPES; ++i)
|
||||
case IT_CALLINGCARD:
|
||||
case IT_LANDMARK:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool inventory_and_asset_types_match(LLInventoryType::EType inventory_type,
|
||||
LLAssetType::EType asset_type)
|
||||
{
|
||||
// Links can be of any inventory type.
|
||||
if (LLAssetType::lookupIsLinkType(asset_type))
|
||||
return true;
|
||||
|
||||
const InventoryEntry *entry = LLInventoryDictionary::getInstance()->lookup(inventory_type);
|
||||
if (!entry) return false;
|
||||
|
||||
for (InventoryEntry::asset_vec_t::const_iterator iter = entry->mAssetTypes.begin();
|
||||
iter != entry->mAssetTypes.end();
|
||||
iter++)
|
||||
{
|
||||
const LLAssetType::EType type = (*iter);
|
||||
if(type == asset_type)
|
||||
{
|
||||
if(INVENTORY_TO_ASSET_TYPE[inventory_type][i] == asset_type)
|
||||
{
|
||||
rv = true;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -74,14 +74,16 @@ public:
|
||||
|
||||
// machine transation between type and strings
|
||||
static EType lookup(const std::string& name);
|
||||
static const char* lookup(EType type);
|
||||
|
||||
static const std::string &lookup(EType type);
|
||||
// translation from a type to a human readable form.
|
||||
static const char* lookupHumanReadable(EType type);
|
||||
static const std::string &lookupHumanReadable(EType type);
|
||||
|
||||
// return the default inventory for the given asset type.
|
||||
static EType defaultForAssetType(LLAssetType::EType asset_type);
|
||||
|
||||
// true if this type cannot have restricted permissions.
|
||||
static bool cannotRestrictPermissions(EType type);
|
||||
|
||||
private:
|
||||
// don't instantiate or derive one of these objects
|
||||
LLInventoryType( void );
|
||||
@@ -91,8 +93,7 @@ private:
|
||||
// helper function which returns true if inventory type and asset type
|
||||
// are potentially compatible. For example, an attachment must be an
|
||||
// object, but a wearable can be a bodypart or clothing asset.
|
||||
bool inventory_and_asset_types_match(
|
||||
LLInventoryType::EType inventory_type,
|
||||
LLAssetType::EType asset_type);
|
||||
bool inventory_and_asset_types_match(LLInventoryType::EType inventory_type,
|
||||
LLAssetType::EType asset_type);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
std::pair<LLUUID, U64> LLLandmark::mLocalRegion;
|
||||
LLLandmark::region_map_t LLLandmark::mRegions;
|
||||
LLLandmark::region_callback_t LLLandmark::mRegionCallback;
|
||||
LLLandmark::region_callback_map_t LLLandmark::sRegionCallbackMap;
|
||||
|
||||
LLLandmark::LLLandmark() :
|
||||
mGlobalPositionKnown(false)
|
||||
@@ -177,7 +177,7 @@ void LLLandmark::requestRegionHandle(
|
||||
LLMessageSystem* msg,
|
||||
const LLHost& upstream_host,
|
||||
const LLUUID& region_id,
|
||||
LLRegionHandleCallback* callback)
|
||||
region_handle_callback_t callback)
|
||||
{
|
||||
if(region_id.isNull())
|
||||
{
|
||||
@@ -186,7 +186,7 @@ void LLLandmark::requestRegionHandle(
|
||||
if(callback)
|
||||
{
|
||||
const U64 U64_ZERO = 0;
|
||||
callback->dataReady(region_id, U64_ZERO);
|
||||
callback(region_id, U64_ZERO);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -196,7 +196,7 @@ void LLLandmark::requestRegionHandle(
|
||||
lldebugs << "requestRegionHandle: local" << llendl;
|
||||
if(callback)
|
||||
{
|
||||
callback->dataReady(region_id, mLocalRegion.second);
|
||||
callback(region_id, mLocalRegion.second);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -207,8 +207,8 @@ void LLLandmark::requestRegionHandle(
|
||||
lldebugs << "requestRegionHandle: upstream" << llendl;
|
||||
if(callback)
|
||||
{
|
||||
region_callback_t::value_type vt(region_id, callback);
|
||||
mRegionCallback.insert(vt);
|
||||
region_callback_map_t::value_type vt(region_id, callback);
|
||||
sRegionCallbackMap.insert(vt);
|
||||
}
|
||||
lldebugs << "Landmark requesting information about: "
|
||||
<< region_id << llendl;
|
||||
@@ -221,7 +221,7 @@ void LLLandmark::requestRegionHandle(
|
||||
{
|
||||
// we have the answer locally - just call the callack.
|
||||
lldebugs << "requestRegionHandle: ready" << llendl;
|
||||
callback->dataReady(region_id, (*it).second.mRegionHandle);
|
||||
callback(region_id, (*it).second.mRegionHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,11 +259,11 @@ void LLLandmark::processRegionIDAndHandle(LLMessageSystem* msg, void**)
|
||||
#endif
|
||||
|
||||
// make all the callbacks here.
|
||||
region_callback_t::iterator it;
|
||||
while((it = mRegionCallback.find(region_id)) != mRegionCallback.end())
|
||||
region_callback_map_t::iterator it;
|
||||
while((it = sRegionCallbackMap.find(region_id)) != sRegionCallbackMap.end())
|
||||
{
|
||||
(*it).second->dataReady(region_id, info.mRegionHandle);
|
||||
mRegionCallback.erase(it);
|
||||
(*it).second(region_id, info.mRegionHandle);
|
||||
sRegionCallbackMap.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#define LL_LLLANDMARK_H
|
||||
|
||||
#include <map>
|
||||
#include <boost/function.hpp>
|
||||
#include "llframetimer.h"
|
||||
#include "lluuid.h"
|
||||
#include "v3dmath.h"
|
||||
@@ -42,24 +43,12 @@
|
||||
class LLMessageSystem;
|
||||
class LLHost;
|
||||
|
||||
// virutal base class used for calling back interested parties when a
|
||||
// region handle comes back.
|
||||
class LLRegionHandleCallback
|
||||
{
|
||||
public:
|
||||
LLRegionHandleCallback() {}
|
||||
virtual ~LLRegionHandleCallback() {}
|
||||
virtual bool dataReady(
|
||||
const LLUUID& region_id,
|
||||
const U64& region_handle)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLLandmark
|
||||
{
|
||||
public:
|
||||
// for calling back interested parties when a region handle comes back.
|
||||
typedef boost::function<void(const LLUUID& region_id, const U64& region_handle)> region_handle_callback_t;
|
||||
|
||||
~LLLandmark() {}
|
||||
|
||||
// returns true if the position is known.
|
||||
@@ -90,7 +79,7 @@ public:
|
||||
LLMessageSystem* msg,
|
||||
const LLHost& upstream_host,
|
||||
const LLUUID& region_id,
|
||||
LLRegionHandleCallback* callback);
|
||||
region_handle_callback_t callback);
|
||||
|
||||
// Call this method to create a lookup for this region. This
|
||||
// simplifies a lot of the code.
|
||||
@@ -118,8 +107,8 @@ private:
|
||||
static std::pair<LLUUID, U64> mLocalRegion;
|
||||
typedef std::map<LLUUID, CacheInfo> region_map_t;
|
||||
static region_map_t mRegions;
|
||||
typedef std::multimap<LLUUID, LLRegionHandleCallback*> region_callback_t;
|
||||
static region_callback_t mRegionCallback;
|
||||
typedef std::multimap<LLUUID, region_handle_callback_t> region_callback_map_t;
|
||||
static region_callback_map_t sRegionCallbackMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
#include "llstreamtools.h"
|
||||
|
||||
LLNotecard::LLNotecard(S32 max_text)
|
||||
: mMaxText(max_text)
|
||||
: mMaxText(max_text),
|
||||
mVersion(0),
|
||||
mEmbeddedVersion(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -203,7 +205,7 @@ bool LLNotecard::importStream(std::istream& str)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(text_len > mMaxText)
|
||||
if(text_len > mMaxText || text_len < 0)
|
||||
{
|
||||
llwarns << "Invalid Linden text length: " << text_len << llendl;
|
||||
return FALSE;
|
||||
|
||||
@@ -79,23 +79,25 @@ static const std::string PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] =
|
||||
"shopping",
|
||||
"stage",
|
||||
"other",
|
||||
"rental"
|
||||
};
|
||||
static const std::string PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] =
|
||||
{
|
||||
"None",
|
||||
"Linden Location",
|
||||
"Adult",
|
||||
"Arts & Culture",
|
||||
"Arts and Culture",
|
||||
"Business",
|
||||
"Educational",
|
||||
"Gaming",
|
||||
"Hangout",
|
||||
"Newcomer Friendly",
|
||||
"Parks & Nature",
|
||||
"Parks and Nature",
|
||||
"Residential",
|
||||
"Shopping",
|
||||
"Stage",
|
||||
"Other",
|
||||
"Rental",
|
||||
"Any", // valid string for parcel searches
|
||||
};
|
||||
|
||||
@@ -690,8 +692,8 @@ void LLParcel::packMessage(LLSD& msg)
|
||||
msg["auto_scale"] = getMediaAutoScale();
|
||||
msg["media_loop"] = getMediaLoop();
|
||||
msg["media_current_url"] = getMediaCurrentURL();
|
||||
msg["obscure_media"] = FALSE; // OBSOLETE - no longer used
|
||||
msg["obscure_music"] = FALSE; // OBSOLETE - no longer used
|
||||
msg["obscure_media"] = false; // OBSOLETE - no longer used
|
||||
msg["obscure_music"] = false; // OBSOLETE - no longer used
|
||||
msg["media_id"] = getMediaID();
|
||||
msg["media_allow_navigate"] = getMediaAllowNavigate();
|
||||
msg["media_prevent_camera_zoom"] = getMediaPreventCameraZoom();
|
||||
|
||||
@@ -170,6 +170,7 @@ public:
|
||||
C_SHOPPING,
|
||||
C_STAGE,
|
||||
C_OTHER,
|
||||
C_RENTAL,
|
||||
C_COUNT,
|
||||
C_ANY = -1 // only useful in queries
|
||||
};
|
||||
@@ -534,7 +535,7 @@ public:
|
||||
|
||||
static bool isAgentBlockedFromParcel(LLParcel* parcelp,
|
||||
const LLUUID& agent_id,
|
||||
const std::vector<LLUUID>& group_ids,
|
||||
const uuid_vec_t& group_ids,
|
||||
const BOOL is_agent_identified,
|
||||
const BOOL is_agent_transacted,
|
||||
const BOOL is_agent_ageverified);
|
||||
|
||||
@@ -83,6 +83,17 @@ void LLPermissions::initMasks(PermissionMask base, PermissionMask owner,
|
||||
fix();
|
||||
}
|
||||
|
||||
// ! BACKWARDS COMPATIBILITY ! Override masks for inventory types that
|
||||
// no longer can have restricted permissions. This takes care of previous
|
||||
// version landmarks that could have had no copy/mod/transfer bits set.
|
||||
void LLPermissions::initMasks(LLInventoryType::EType type)
|
||||
{
|
||||
if (LLInventoryType::cannotRestrictPermissions(type))
|
||||
{
|
||||
initMasks(PERM_ALL, PERM_ALL, PERM_ALL, PERM_ALL, PERM_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLPermissions::getOwnership(LLUUID& owner_id, BOOL& is_group_owned) const
|
||||
{
|
||||
if(mOwner.notNull())
|
||||
@@ -277,6 +288,17 @@ BOOL LLPermissions::setOwnerAndGroup(
|
||||
return allowed;
|
||||
}
|
||||
|
||||
//Fix for DEV-33917, last owner isn't used much and has little impact on
|
||||
//permissions so it's reasonably safe to do this, however, for now,
|
||||
//limiting the functionality of this routine to objects which are
|
||||
//group owned.
|
||||
void LLPermissions::setLastOwner(const LLUUID& last_owner)
|
||||
{
|
||||
if (isGroupOwned())
|
||||
mLastOwner = last_owner;
|
||||
}
|
||||
|
||||
|
||||
// only call this if you know what you're doing
|
||||
// there are usually perm-bit consequences when the
|
||||
// ownerhsip changes
|
||||
@@ -457,7 +479,7 @@ BOOL LLPermissions::setNextOwnerBits(const LLUUID& agent, const LLUUID& group, B
|
||||
return ownership;
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowOperationBy(PermissionBit op, const LLUUID& requester, const LLUUID& group) const
|
||||
bool LLPermissions::allowOperationBy(PermissionBit op, const LLUUID& requester, const LLUUID& group) const
|
||||
{
|
||||
if(requester.isNull())
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "lluuid.h"
|
||||
#include "llxmlnode.h"
|
||||
#include "reflective.h"
|
||||
#include "llinventorytype.h"
|
||||
|
||||
// prototypes
|
||||
class LLMessageSystem;
|
||||
@@ -129,6 +130,8 @@ public:
|
||||
void initMasks(PermissionMask base, PermissionMask owner,
|
||||
PermissionMask everyone, PermissionMask group,
|
||||
PermissionMask next);
|
||||
// adjust permissions based on inventory type.
|
||||
void initMasks(LLInventoryType::EType type);
|
||||
|
||||
//
|
||||
// ACCESSORS
|
||||
@@ -229,6 +232,9 @@ public:
|
||||
// ownerhsip changes
|
||||
void yesReallySetOwner(const LLUUID& owner, bool group_owned);
|
||||
|
||||
// Last owner doesn't have much in the way of permissions so it's
|
||||
//not too dangerous to do this.
|
||||
void setLastOwner(const LLUUID& last_owner);
|
||||
// saves last owner, sets owner to uuid null, sets group
|
||||
// owned. group_id must be the group of the object (that's who it
|
||||
// is being deeded to) and the object must be group
|
||||
@@ -249,7 +255,11 @@ public:
|
||||
BOOL setGroupBits( const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits);
|
||||
BOOL setEveryoneBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits);
|
||||
BOOL setNextOwnerBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits);
|
||||
|
||||
|
||||
// This is currently only used in the Viewer to handle calling cards
|
||||
// where the creator is actually used to store the target. Use with care.
|
||||
void setCreator(const LLUUID& creator) { mCreator = creator; }
|
||||
|
||||
//
|
||||
// METHODS
|
||||
//
|
||||
@@ -261,18 +271,18 @@ public:
|
||||
// They also return true if the object isn't owned, or the
|
||||
// requesting agent is a system agent. See llpermissionsflags.h
|
||||
// for bits.
|
||||
BOOL allowOperationBy(PermissionBit op, const LLUUID& agent, const LLUUID& group = LLUUID::null) const;
|
||||
bool allowOperationBy(PermissionBit op, const LLUUID& agent, const LLUUID& group = LLUUID::null) const;
|
||||
|
||||
inline BOOL allowModifyBy(const LLUUID &agent_id) const;
|
||||
inline BOOL allowCopyBy(const LLUUID& agent_id) const;
|
||||
inline BOOL allowMoveBy(const LLUUID& agent_id) const;
|
||||
inline BOOL allowModifyBy(const LLUUID &agent_id, const LLUUID& group) const;
|
||||
inline BOOL allowCopyBy(const LLUUID& agent_id, const LLUUID& group) const;
|
||||
inline BOOL allowMoveBy(const LLUUID &agent_id, const LLUUID &group) const;
|
||||
inline bool allowModifyBy(const LLUUID &agent_id) const;
|
||||
inline bool allowCopyBy(const LLUUID& agent_id) const;
|
||||
inline bool allowMoveBy(const LLUUID& agent_id) const;
|
||||
inline bool allowModifyBy(const LLUUID &agent_id, const LLUUID& group) const;
|
||||
inline bool allowCopyBy(const LLUUID& agent_id, const LLUUID& group) const;
|
||||
inline bool allowMoveBy(const LLUUID &agent_id, const LLUUID &group) const;
|
||||
|
||||
// This somewhat specialized function is meant for testing if the
|
||||
// current owner is allowed to transfer to the specified agent id.
|
||||
inline BOOL allowTransferTo(const LLUUID &agent_id) const;
|
||||
inline bool allowTransferTo(const LLUUID &agent_id) const;
|
||||
|
||||
//
|
||||
// DEPRECATED.
|
||||
@@ -328,38 +338,38 @@ public:
|
||||
};
|
||||
|
||||
// Inlines
|
||||
BOOL LLPermissions::allowModifyBy(const LLUUID& agent, const LLUUID& group) const
|
||||
bool LLPermissions::allowModifyBy(const LLUUID& agent, const LLUUID& group) const
|
||||
{
|
||||
return allowOperationBy(PERM_MODIFY, agent, group);
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowCopyBy(const LLUUID& agent, const LLUUID& group) const
|
||||
bool LLPermissions::allowCopyBy(const LLUUID& agent, const LLUUID& group) const
|
||||
{
|
||||
return allowOperationBy(PERM_COPY, agent, group);
|
||||
}
|
||||
|
||||
|
||||
BOOL LLPermissions::allowMoveBy(const LLUUID& agent, const LLUUID& group) const
|
||||
bool LLPermissions::allowMoveBy(const LLUUID& agent, const LLUUID& group) const
|
||||
{
|
||||
return allowOperationBy(PERM_MOVE, agent, group);
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowModifyBy(const LLUUID& agent) const
|
||||
bool LLPermissions::allowModifyBy(const LLUUID& agent) const
|
||||
{
|
||||
return allowOperationBy(PERM_MODIFY, agent, LLUUID::null);
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowCopyBy(const LLUUID& agent) const
|
||||
bool LLPermissions::allowCopyBy(const LLUUID& agent) const
|
||||
{
|
||||
return allowOperationBy(PERM_COPY, agent, LLUUID::null);
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowMoveBy(const LLUUID& agent) const
|
||||
bool LLPermissions::allowMoveBy(const LLUUID& agent) const
|
||||
{
|
||||
return allowOperationBy(PERM_MOVE, agent, LLUUID::null);
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowTransferTo(const LLUUID &agent_id) const
|
||||
bool LLPermissions::allowTransferTo(const LLUUID &agent_id) const
|
||||
{
|
||||
if (mIsGroupOwned)
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@ LLSD LLSaleInfo::asLLSD() const
|
||||
return sd;
|
||||
}
|
||||
|
||||
bool LLSaleInfo::fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask)
|
||||
bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask)
|
||||
{
|
||||
const char *w;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
BOOL exportLegacyStream(std::ostream& output_stream) const;
|
||||
LLSD asLLSD() const;
|
||||
operator LLSD() const { return asLLSD(); }
|
||||
bool fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask);
|
||||
bool fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask);
|
||||
BOOL importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask);
|
||||
|
||||
LLXMLNode *exportFileXML() const;
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
// Money transaction failure codes
|
||||
const U8 TRANS_FAIL_SIMULATOR_TIMEOUT = 1;
|
||||
const U8 TRANS_FAIL_DATASERVER_TIMEOUT = 2;
|
||||
const U8 TRANS_FAIL_APPLICATION = 3;
|
||||
|
||||
// Codes up to 999 for error conditions
|
||||
const S32 TRANS_NULL = 0;
|
||||
@@ -68,6 +69,11 @@ const S32 TRANS_PARCEL_DIR_FEE = 2003;
|
||||
const S32 TRANS_GROUP_TAX = 2004; // Taxes incurred as part of group membership
|
||||
const S32 TRANS_CLASSIFIED_RENEW = 2005;
|
||||
|
||||
// Codes 2100-2999 reserved for recurring billing services
|
||||
// New codes can be created through an admin interface so may not
|
||||
// automatically end up in the list below :-(
|
||||
// So make sure you check the transaction_description table
|
||||
const S32 TRANS_RECURRING_GENERIC = 2100;
|
||||
// Codes 3000-3999 reserved for inventory transactions
|
||||
const S32 TRANS_GIVE_INVENTORY = 3000;
|
||||
|
||||
@@ -83,6 +89,12 @@ const S32 TRANS_DWELL_BONUS = 5007;
|
||||
const S32 TRANS_PAY_OBJECT = 5008;
|
||||
const S32 TRANS_OBJECT_PAYS = 5009;
|
||||
|
||||
// Codes 5100-5999 reserved for recurring billing transfers between users
|
||||
// New codes can be created through an admin interface so may not
|
||||
// automatically end up in the list below :-(
|
||||
// So make sure you check the transaction_description table
|
||||
const S32 TRANS_RECURRING_GENERIC_USER = 5100;
|
||||
|
||||
// Codes 6000-6999 reserved for group transactions
|
||||
//const S32 TRANS_GROUP_JOIN = 6000; //reserved for future use
|
||||
const S32 TRANS_GROUP_LAND_DEED = 6001;
|
||||
|
||||
@@ -3391,7 +3391,8 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
|
||||
std::vector<S32> &segments,
|
||||
const LLVector3& obj_cam_vec,
|
||||
const LLMatrix4& mat,
|
||||
const LLMatrix3& norm_mat)
|
||||
const LLMatrix3& norm_mat,
|
||||
S32 face_mask)
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_VOLUME);
|
||||
|
||||
@@ -3399,12 +3400,17 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
|
||||
normals.clear();
|
||||
segments.clear();
|
||||
|
||||
S32 cur_index = 0;
|
||||
//for each face
|
||||
for (face_list_t::iterator iter = mVolumeFaces.begin();
|
||||
iter != mVolumeFaces.end(); ++iter)
|
||||
{
|
||||
const LLVolumeFace& face = *iter;
|
||||
|
||||
if (!(face_mask & (0x1 << cur_index++)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (face.mTypeMask & (LLVolumeFace::CAP_MASK)) {
|
||||
|
||||
}
|
||||
|
||||
@@ -909,7 +909,8 @@ public:
|
||||
std::vector<S32> &segments,
|
||||
const LLVector3& view_vec,
|
||||
const LLMatrix4& mat,
|
||||
const LLMatrix3& norm_mat);
|
||||
const LLMatrix3& norm_mat,
|
||||
S32 face_index);
|
||||
|
||||
//get the face index of the face that intersects with the given line segment at the point
|
||||
//closest to start. Moves end to the point of intersection. Returns -1 if no intersection.
|
||||
|
||||
@@ -55,7 +55,7 @@ LLVolumeMgr::LLVolumeMgr()
|
||||
{
|
||||
// the LLMutex magic interferes with easy unit testing,
|
||||
// so you now must manually call useMutex() to use it
|
||||
//mDataMutex = new LLMutex(gAPRPoolp);
|
||||
//mDataMutex = new LLMutex;
|
||||
}
|
||||
|
||||
LLVolumeMgr::~LLVolumeMgr()
|
||||
@@ -222,7 +222,7 @@ void LLVolumeMgr::useMutex()
|
||||
{
|
||||
if (!mDataMutex)
|
||||
{
|
||||
mDataMutex = new LLMutex(gAPRPoolp);
|
||||
mDataMutex = new LLMutex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "llapr.h"
|
||||
#define CARES_STATICLIB
|
||||
#include "llares.h"
|
||||
#include "llscopedvolatileaprpool.h"
|
||||
|
||||
#if defined(LL_WINDOWS)
|
||||
# define ns_c_in 1
|
||||
@@ -467,11 +468,6 @@ void LLAres::search(const std::string &query, LLResType type,
|
||||
|
||||
bool LLAres::process(U64 timeout)
|
||||
{
|
||||
if (!gAPRPoolp)
|
||||
{
|
||||
ll_init_apr();
|
||||
}
|
||||
|
||||
ares_socket_t socks[ARES_GETSOCK_MAXNUM];
|
||||
apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM];
|
||||
apr_int32_t nsds = 0;
|
||||
@@ -485,10 +481,7 @@ bool LLAres::process(U64 timeout)
|
||||
return nsds > 0;
|
||||
}
|
||||
|
||||
apr_status_t status;
|
||||
LLAPRPool pool;
|
||||
status = pool.getStatus() ;
|
||||
ll_apr_assert_status(status);
|
||||
LLScopedVolatileAPRPool scoped_pool;
|
||||
|
||||
for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++)
|
||||
{
|
||||
@@ -505,7 +498,7 @@ bool LLAres::process(U64 timeout)
|
||||
|
||||
apr_socket_t *aprSock = NULL;
|
||||
|
||||
status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], pool.getAPRPool());
|
||||
apr_status_t status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], scoped_pool);
|
||||
if (status != APR_SUCCESS)
|
||||
{
|
||||
ll_apr_warn_status(status);
|
||||
@@ -514,7 +507,7 @@ bool LLAres::process(U64 timeout)
|
||||
|
||||
aprFds[nactive].desc.s = aprSock;
|
||||
aprFds[nactive].desc_type = APR_POLL_SOCKET;
|
||||
aprFds[nactive].p = pool.getAPRPool();
|
||||
aprFds[nactive].p = scoped_pool;
|
||||
aprFds[nactive].rtnevents = 0;
|
||||
aprFds[nactive].client_data = &socks[i];
|
||||
|
||||
@@ -523,7 +516,7 @@ bool LLAres::process(U64 timeout)
|
||||
|
||||
if (nactive > 0)
|
||||
{
|
||||
status = apr_poll(aprFds, nactive, &nsds, timeout);
|
||||
apr_status_t status = apr_poll(aprFds, nactive, &nsds, timeout);
|
||||
|
||||
if (status != APR_SUCCESS && status != APR_TIMEUP)
|
||||
{
|
||||
|
||||
@@ -334,14 +334,14 @@ void LLAvatarNameCache::processName(const LLUUID& agent_id,
|
||||
{
|
||||
if (add_to_cache)
|
||||
{
|
||||
// sCache[agent_id] = av_name;
|
||||
// [SL:KB] - Patch: Agent-DisplayNames | Checked: 2010-12-28 (Catznip-2.4.0h) | Added: Catznip-2.4.0h
|
||||
// Don't replace existing entries with dummies
|
||||
cache_t::iterator itName = (av_name.mIsDummy) ? sCache.find(agent_id) : sCache.end();
|
||||
if (sCache.end() != itName)
|
||||
itName->second.mExpires = av_name.mExpires;
|
||||
else
|
||||
sCache[agent_id] = av_name;
|
||||
// sCache[agent_id] = av_name;
|
||||
// [SL:KB] - Patch: Agent-DisplayNames | Checked: 2010-12-28 (Catznip-2.4.0h) | Added: Catznip-2.4.0h
|
||||
// Don't replace existing entries with dummies
|
||||
cache_t::iterator itName = (av_name.mIsDummy) ? sCache.find(agent_id) : sCache.end();
|
||||
if (sCache.end() != itName)
|
||||
itName->second.mExpires = av_name.mExpires;
|
||||
else
|
||||
sCache[agent_id] = av_name;
|
||||
// [/SL:KB]
|
||||
}
|
||||
|
||||
@@ -562,14 +562,13 @@ void LLAvatarNameCache::idle()
|
||||
bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id)
|
||||
{
|
||||
const F64 PENDING_TIMEOUT_SECS = 5.0 * 60.0;
|
||||
F64 now = LLFrameTimer::getTotalSeconds();
|
||||
F64 expire_time = now - PENDING_TIMEOUT_SECS;
|
||||
|
||||
pending_queue_t::const_iterator it = sPendingQueue.find(agent_id);
|
||||
if (it != sPendingQueue.end())
|
||||
{
|
||||
bool request_expired = (it->second < expire_time);
|
||||
return !request_expired;
|
||||
// in the list of requests in flight, retry if too old
|
||||
F64 expire_time = LLFrameTimer::getTotalSeconds() - PENDING_TIMEOUT_SECS;
|
||||
return it->second > expire_time;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -578,14 +577,16 @@ void LLAvatarNameCache::eraseExpired()
|
||||
{
|
||||
F64 now = LLFrameTimer::getTotalSeconds();
|
||||
cache_t::iterator it = sCache.begin();
|
||||
while (it != sCache.end())
|
||||
for (cache_t::iterator it = sCache.begin(); it != sCache.end();)
|
||||
{
|
||||
cache_t::iterator cur = it;
|
||||
++it;
|
||||
const LLAvatarName& av_name = cur->second;
|
||||
const LLAvatarName& av_name = it->second;
|
||||
if (av_name.mExpires < now)
|
||||
{
|
||||
sCache.erase(cur);
|
||||
sCache.erase(it++);
|
||||
}
|
||||
else
|
||||
{
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1082,7 +1082,7 @@ void LLCurl::initClass()
|
||||
S32 mutex_count = CRYPTO_num_locks();
|
||||
for (S32 i=0; i<mutex_count; i++)
|
||||
{
|
||||
sSSLMutex.push_back(new LLMutex(NULL));
|
||||
sSSLMutex.push_back(new LLMutex);
|
||||
}
|
||||
CRYPTO_set_id_callback(&LLCurl::ssl_thread_id);
|
||||
CRYPTO_set_locking_callback(&LLCurl::ssl_locking_callback);
|
||||
|
||||
@@ -960,13 +960,9 @@ private:
|
||||
|
||||
|
||||
// static
|
||||
LLHTTPNode& LLIOHTTPServer::create(
|
||||
apr_pool_t* pool, LLPumpIO& pump, U16 port)
|
||||
LLHTTPNode& LLIOHTTPServer::create(LLPumpIO& pump, U16 port)
|
||||
{
|
||||
LLSocket::ptr_t socket = LLSocket::create(
|
||||
pool,
|
||||
LLSocket::STREAM_TCP,
|
||||
port);
|
||||
LLSocket::ptr_t socket = LLSocket::create(LLSocket::STREAM_TCP, port);
|
||||
if(!socket)
|
||||
{
|
||||
llerrs << "Unable to initialize socket" << llendl;
|
||||
@@ -975,7 +971,7 @@ LLHTTPNode& LLIOHTTPServer::create(
|
||||
LLHTTPResponseFactory* factory = new LLHTTPResponseFactory;
|
||||
boost::shared_ptr<LLChainIOFactory> factory_ptr(factory);
|
||||
|
||||
LLIOServerSocket* server = new LLIOServerSocket(pool, socket, factory_ptr);
|
||||
LLIOServerSocket* server = new LLIOServerSocket(socket, factory_ptr);
|
||||
|
||||
LLPumpIO::chain_t chain;
|
||||
chain.push_back(LLIOPipe::ptr_t(server));
|
||||
|
||||
@@ -56,7 +56,7 @@ class LLIOHTTPServer
|
||||
public:
|
||||
typedef void (*timing_callback_t)(const char* hashed_name, F32 time, void* data);
|
||||
|
||||
static LLHTTPNode& create(apr_pool_t* pool, LLPumpIO& pump, U16 port);
|
||||
static LLHTTPNode& create(LLPumpIO& pump, U16 port);
|
||||
/**< Creates an HTTP wire server on the pump for the given TCP port.
|
||||
*
|
||||
* Returns the root node of the new server. Add LLHTTPNode instances
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "llhost.h"
|
||||
#include "llmemtype.h"
|
||||
#include "llpumpio.h"
|
||||
#include "llthread.h"
|
||||
|
||||
//
|
||||
// constants
|
||||
@@ -104,51 +105,31 @@ void ll_debug_socket(const char* msg, apr_socket_t* apr_sock)
|
||||
///
|
||||
|
||||
// static
|
||||
LLSocket::ptr_t LLSocket::create(apr_pool_t* pool, EType type, U16 port)
|
||||
LLSocket::ptr_t LLSocket::create(EType type, U16 port)
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_IO_TCP);
|
||||
LLSocket::ptr_t rv;
|
||||
apr_socket_t* socket = NULL;
|
||||
apr_pool_t* new_pool = NULL;
|
||||
apr_status_t status = APR_EGENERAL;
|
||||
|
||||
// create a pool for the socket
|
||||
status = apr_pool_create(&new_pool, pool);
|
||||
if(ll_apr_warn_status(status))
|
||||
{
|
||||
if(new_pool) apr_pool_destroy(new_pool);
|
||||
return rv;
|
||||
}
|
||||
LLSocket::ptr_t rv(new LLSocket);
|
||||
|
||||
if(STREAM_TCP == type)
|
||||
{
|
||||
status = apr_socket_create(
|
||||
&socket,
|
||||
APR_INET,
|
||||
SOCK_STREAM,
|
||||
APR_PROTO_TCP,
|
||||
new_pool);
|
||||
status = apr_socket_create(&rv->mSocket, APR_INET, SOCK_STREAM, APR_PROTO_TCP, rv->mPool());
|
||||
}
|
||||
else if(DATAGRAM_UDP == type)
|
||||
{
|
||||
status = apr_socket_create(
|
||||
&socket,
|
||||
APR_INET,
|
||||
SOCK_DGRAM,
|
||||
APR_PROTO_UDP,
|
||||
new_pool);
|
||||
status = apr_socket_create(&rv->mSocket, APR_INET, SOCK_DGRAM, APR_PROTO_UDP, rv->mPool());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(new_pool) apr_pool_destroy(new_pool);
|
||||
rv.reset();
|
||||
return rv;
|
||||
}
|
||||
if(ll_apr_warn_status(status))
|
||||
{
|
||||
if(new_pool) apr_pool_destroy(new_pool);
|
||||
rv->mSocket = NULL;
|
||||
rv.reset();
|
||||
return rv;
|
||||
}
|
||||
rv = ptr_t(new LLSocket(socket, new_pool));
|
||||
if(port > 0)
|
||||
{
|
||||
apr_sockaddr_t* sa = NULL;
|
||||
@@ -158,7 +139,7 @@ LLSocket::ptr_t LLSocket::create(apr_pool_t* pool, EType type, U16 port)
|
||||
APR_UNSPEC,
|
||||
port,
|
||||
0,
|
||||
new_pool);
|
||||
rv->mPool());
|
||||
if(ll_apr_warn_status(status))
|
||||
{
|
||||
rv.reset();
|
||||
@@ -166,8 +147,8 @@ LLSocket::ptr_t LLSocket::create(apr_pool_t* pool, EType type, U16 port)
|
||||
}
|
||||
// This allows us to reuse the address on quick down/up. This
|
||||
// is unlikely to create problems.
|
||||
ll_apr_warn_status(apr_socket_opt_set(socket, APR_SO_REUSEADDR, 1));
|
||||
status = apr_socket_bind(socket, sa);
|
||||
ll_apr_warn_status(apr_socket_opt_set(rv->mSocket, APR_SO_REUSEADDR, 1));
|
||||
status = apr_socket_bind(rv->mSocket, sa);
|
||||
if(ll_apr_warn_status(status))
|
||||
{
|
||||
rv.reset();
|
||||
@@ -181,7 +162,7 @@ LLSocket::ptr_t LLSocket::create(apr_pool_t* pool, EType type, U16 port)
|
||||
// to keep a queue of incoming connections for ACCEPT.
|
||||
lldebugs << "Setting listen state for socket." << llendl;
|
||||
status = apr_socket_listen(
|
||||
socket,
|
||||
rv->mSocket,
|
||||
LL_DEFAULT_LISTEN_BACKLOG);
|
||||
if(ll_apr_warn_status(status))
|
||||
{
|
||||
@@ -202,21 +183,28 @@ LLSocket::ptr_t LLSocket::create(apr_pool_t* pool, EType type, U16 port)
|
||||
}
|
||||
|
||||
// static
|
||||
LLSocket::ptr_t LLSocket::create(apr_socket_t* socket, apr_pool_t* pool)
|
||||
LLSocket::ptr_t LLSocket::create(apr_status_t& status, LLSocket::ptr_t& listen_socket)
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_IO_TCP);
|
||||
LLSocket::ptr_t rv;
|
||||
if(!socket)
|
||||
if (!listen_socket->getSocket())
|
||||
{
|
||||
status = APR_ENOSOCKET;
|
||||
return LLSocket::ptr_t();
|
||||
}
|
||||
LLSocket::ptr_t rv(new LLSocket);
|
||||
lldebugs << "accepting socket" << llendl;
|
||||
status = apr_socket_accept(&rv->mSocket, listen_socket->getSocket(), rv->mPool());
|
||||
if (status != APR_SUCCESS)
|
||||
{
|
||||
rv->mSocket = NULL;
|
||||
rv.reset();
|
||||
return rv;
|
||||
}
|
||||
rv = ptr_t(new LLSocket(socket, pool));
|
||||
rv->mPort = PORT_EPHEMERAL;
|
||||
rv->setOptions();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
bool LLSocket::blockingConnect(const LLHost& host)
|
||||
{
|
||||
if(!mSocket) return false;
|
||||
@@ -229,7 +217,7 @@ bool LLSocket::blockingConnect(const LLHost& host)
|
||||
APR_UNSPEC,
|
||||
host.getPort(),
|
||||
0,
|
||||
mPool)))
|
||||
mPool())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -240,13 +228,11 @@ bool LLSocket::blockingConnect(const LLHost& host)
|
||||
return true;
|
||||
}
|
||||
|
||||
LLSocket::LLSocket(apr_socket_t* socket, apr_pool_t* pool) :
|
||||
mSocket(socket),
|
||||
mPool(pool),
|
||||
LLSocket::LLSocket() :
|
||||
mSocket(NULL),
|
||||
mPool(LLThread::tldata().mRootPool),
|
||||
mPort(PORT_INVALID)
|
||||
{
|
||||
ll_debug_socket("Constructing wholely formed socket", mSocket);
|
||||
LLMemType m1(LLMemType::MTYPE_IO_TCP);
|
||||
}
|
||||
|
||||
LLSocket::~LLSocket()
|
||||
@@ -258,10 +244,6 @@ LLSocket::~LLSocket()
|
||||
ll_debug_socket("Destroying socket", mSocket);
|
||||
apr_socket_close(mSocket);
|
||||
}
|
||||
if(mPool)
|
||||
{
|
||||
apr_pool_destroy(mPool);
|
||||
}
|
||||
}
|
||||
|
||||
void LLSocket::setOptions()
|
||||
@@ -522,10 +504,8 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
|
||||
///
|
||||
|
||||
LLIOServerSocket::LLIOServerSocket(
|
||||
apr_pool_t* pool,
|
||||
LLIOServerSocket::socket_t listener,
|
||||
factory_t factory) :
|
||||
mPool(pool),
|
||||
mListenSocket(listener),
|
||||
mReactor(factory),
|
||||
mInitialized(false),
|
||||
@@ -585,21 +565,15 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
|
||||
lldebugs << "accepting socket" << llendl;
|
||||
|
||||
PUMP_DEBUG;
|
||||
apr_pool_t* new_pool = NULL;
|
||||
apr_status_t status = apr_pool_create(&new_pool, mPool);
|
||||
apr_socket_t* socket = NULL;
|
||||
status = apr_socket_accept(
|
||||
&socket,
|
||||
mListenSocket->getSocket(),
|
||||
new_pool);
|
||||
LLSocket::ptr_t llsocket(LLSocket::create(socket, new_pool));
|
||||
apr_status_t status;
|
||||
LLSocket::ptr_t llsocket(LLSocket::create(status, mListenSocket));
|
||||
//EStatus rv = STATUS_ERROR;
|
||||
if(llsocket)
|
||||
if(llsocket && status == APR_SUCCESS)
|
||||
{
|
||||
PUMP_DEBUG;
|
||||
|
||||
apr_sockaddr_t* remote_addr;
|
||||
apr_socket_addr_get(&remote_addr, APR_REMOTE, socket);
|
||||
apr_socket_addr_get(&remote_addr, APR_REMOTE, llsocket->getSocket());
|
||||
|
||||
char* remote_host_string;
|
||||
apr_sockaddr_ip_get(&remote_host_string, remote_addr);
|
||||
@@ -614,7 +588,6 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
|
||||
{
|
||||
chain.push_back(LLIOPipe::ptr_t(new LLIOSocketWriter(llsocket)));
|
||||
pump->addChain(chain, mResponseTimeout);
|
||||
status = STATUS_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -623,7 +596,8 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "Unable to create linden socket." << llendl;
|
||||
char buf[256];
|
||||
llwarns << "Unable to accept linden socket: " << apr_strerror(status, buf, sizeof(buf)) << llendl;
|
||||
}
|
||||
|
||||
PUMP_DEBUG;
|
||||
@@ -636,11 +610,10 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
|
||||
#if 0
|
||||
LLIODataSocket::LLIODataSocket(
|
||||
U16 suggested_port,
|
||||
U16 start_discovery_port,
|
||||
apr_pool_t* pool) :
|
||||
U16 start_discovery_port) :
|
||||
mSocket(NULL)
|
||||
{
|
||||
if(!pool || (PORT_INVALID == suggested_port)) return;
|
||||
if(PORT_INVALID == suggested_port) return;
|
||||
if(ll_apr_warn_status(apr_socket_create(&mSocket, APR_INET, SOCK_DGRAM, APR_PROTO_UDP, pool))) return;
|
||||
apr_sockaddr_t* sa = NULL;
|
||||
if(ll_apr_warn_status(apr_sockaddr_info_get(&sa, APR_ANYADDR, APR_UNSPEC, suggested_port, 0, pool))) return;
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
*/
|
||||
|
||||
#include "lliopipe.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "llchainio.h"
|
||||
|
||||
@@ -94,34 +93,22 @@ public:
|
||||
* socket. If you intend the socket to be known to external
|
||||
* clients without prior port notification, do not use
|
||||
* PORT_EPHEMERAL.
|
||||
* @param pool The apr pool to use. A child pool will be created
|
||||
* and associated with the socket.
|
||||
* @param type The type of socket to create
|
||||
* @param port The port for the socket
|
||||
* @return A valid socket shared pointer if the call worked.
|
||||
*/
|
||||
static ptr_t create(
|
||||
apr_pool_t* pool,
|
||||
EType type,
|
||||
U16 port = PORT_EPHEMERAL);
|
||||
|
||||
/**
|
||||
* @brief Create a LLSocket when you already have an apr socket.
|
||||
* @brief Create a LLSocket by accepting a connection from a listen socket.
|
||||
*
|
||||
* This method assumes an ephemeral port. This is typically used
|
||||
* by calls which spawn a socket such as a call to
|
||||
* <code>accept()</code> as in the server socket. This call should
|
||||
* not fail if you have a valid apr socket.
|
||||
* Because of the nature of how accept() works, you are expected
|
||||
* to create a new pool for the socket, use that pool for the
|
||||
* accept, and pass it in here where it will be bound with the
|
||||
* socket and destroyed at the same time.
|
||||
* @param socket The apr socket to use
|
||||
* @param pool The pool used to create the socket. *NOTE: The pool
|
||||
* passed in will be DESTROYED.
|
||||
* @param status Output. Status of the accept if a valid listen socket was passed.
|
||||
* @param listen_socket The listen socket to use.
|
||||
* @return A valid socket shared pointer if the call worked.
|
||||
*/
|
||||
static ptr_t create(apr_socket_t* socket, apr_pool_t* pool);
|
||||
static ptr_t create(apr_status_t& status, ptr_t& listen_socket);
|
||||
|
||||
/**
|
||||
* @brief Perform a blocking connect to a host. Do not use in production.
|
||||
@@ -156,7 +143,7 @@ protected:
|
||||
* @brief Protected constructor since should only make sockets
|
||||
* with one of the two <code>create()</code> calls.
|
||||
*/
|
||||
LLSocket(apr_socket_t* socket, apr_pool_t* pool);
|
||||
LLSocket(void);
|
||||
|
||||
/**
|
||||
* @brief Set default socket options.
|
||||
@@ -173,8 +160,8 @@ protected:
|
||||
// The apr socket.
|
||||
apr_socket_t* mSocket;
|
||||
|
||||
// our memory pool
|
||||
apr_pool_t* mPool;
|
||||
// Our memory pool.
|
||||
AIAPRPool mPool;
|
||||
|
||||
// The port if we know it.
|
||||
U16 mPort;
|
||||
@@ -299,7 +286,7 @@ class LLIOServerSocket : public LLIOPipe
|
||||
public:
|
||||
typedef LLSocket::ptr_t socket_t;
|
||||
typedef boost::shared_ptr<LLChainIOFactory> factory_t;
|
||||
LLIOServerSocket(apr_pool_t* pool, socket_t listener, factory_t reactor);
|
||||
LLIOServerSocket(socket_t listener, factory_t reactor);
|
||||
virtual ~LLIOServerSocket();
|
||||
|
||||
/**
|
||||
@@ -331,7 +318,6 @@ protected:
|
||||
//@}
|
||||
|
||||
protected:
|
||||
apr_pool_t* mPool;
|
||||
socket_t mListenSocket;
|
||||
factory_t mReactor;
|
||||
bool mInitialized;
|
||||
@@ -365,8 +351,7 @@ public:
|
||||
*/
|
||||
LLIODataSocket(
|
||||
U16 suggested_port,
|
||||
U16 start_discovery_port,
|
||||
apr_pool_t* pool);
|
||||
U16 start_discovery_port);
|
||||
virtual ~LLIODataSocket();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "llstring.h"
|
||||
#include "lluuid.h"
|
||||
#include "net.h"
|
||||
#include "aiaprpool.h"
|
||||
|
||||
//
|
||||
// constants
|
||||
@@ -63,7 +64,7 @@
|
||||
const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE = 4096;
|
||||
|
||||
static bool gMailEnabled = true;
|
||||
static apr_pool_t* gMailPool;
|
||||
static AIAPRPool gMailPool;
|
||||
static apr_sockaddr_t* gSockAddr;
|
||||
static apr_socket_t* gMailSocket;
|
||||
|
||||
@@ -88,7 +89,7 @@ bool connect_smtp()
|
||||
gSockAddr->sa.sin.sin_family,
|
||||
SOCK_STREAM,
|
||||
APR_PROTO_TCP,
|
||||
gMailPool);
|
||||
gMailPool());
|
||||
if(ll_apr_warn_status(status)) return false;
|
||||
status = apr_socket_connect(gMailSocket, gSockAddr);
|
||||
if(ll_apr_warn_status(status))
|
||||
@@ -145,19 +146,19 @@ BOOL LLMail::send(
|
||||
}
|
||||
|
||||
// static
|
||||
void LLMail::init(const std::string& hostname, apr_pool_t* pool)
|
||||
void LLMail::init(const std::string& hostname)
|
||||
{
|
||||
gMailSocket = NULL;
|
||||
if(hostname.empty() || !pool)
|
||||
if (hostname.empty())
|
||||
{
|
||||
gMailPool = NULL;
|
||||
gSockAddr = NULL;
|
||||
gMailPool.destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
gMailPool = pool;
|
||||
gMailPool.create();
|
||||
|
||||
// collect all the information into a socaddr sturcture. the
|
||||
// Collect all the information into a sockaddr structure. the
|
||||
// documentation is a bit unclear, but I either have to
|
||||
// specify APR_UNSPEC or not specify any flags. I am not sure
|
||||
// which option is better.
|
||||
@@ -167,7 +168,7 @@ void LLMail::init(const std::string& hostname, apr_pool_t* pool)
|
||||
APR_UNSPEC,
|
||||
25,
|
||||
APR_IPV4_ADDR_OK,
|
||||
gMailPool);
|
||||
gMailPool());
|
||||
ll_apr_warn_status(status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,15 +33,13 @@
|
||||
#ifndef LL_LLMAIL_H
|
||||
#define LL_LLMAIL_H
|
||||
|
||||
typedef struct apr_pool_t apr_pool_t;
|
||||
|
||||
#include "llsd.h"
|
||||
|
||||
class LLMail
|
||||
{
|
||||
public:
|
||||
// if hostname is NULL, then the host is resolved as 'mail'
|
||||
static void init(const std::string& hostname, apr_pool_t* pool);
|
||||
static void init(const std::string& hostname);
|
||||
|
||||
// Allow all email transmission to be disabled/enabled.
|
||||
static void enable(bool mail_enabled);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user