summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autobuild.xml4
-rw-r--r--indra/cmake/Python.cmake2
-rw-r--r--indra/llappearance/lltexlayer.cpp85
-rw-r--r--indra/llcorehttp/tests/test_llcorehttp_peer.py390
-rwxr-xr-xindra/newview/llviewertexlayer.cpp5
5 files changed, 198 insertions, 288 deletions
diff --git a/autobuild.xml b/autobuild.xml
index 82344ebc90..9d5a29a588 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1290,9 +1290,9 @@
<key>archive</key>
<map>
<key>hash</key>
- <string>5552d94c9ef2a21273cb1fff1446a699</string>
+ <string>84aee73ab14ec7c56e54fa17f44a06f0</string>
<key>url</key>
- <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/267407/arch/Linux/installer/llappearanceutility_source-0.1-linux-20121128.tar.bz2</string>
+ <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/267783/arch/Linux/installer/llappearanceutility_source-0.1-linux-20121206.tar.bz2</string>
</map>
<key>name</key>
<string>linux</string>
diff --git a/indra/cmake/Python.cmake b/indra/cmake/Python.cmake
index 748c8c2bec..a81c9307fc 100644
--- a/indra/cmake/Python.cmake
+++ b/indra/cmake/Python.cmake
@@ -23,7 +23,7 @@ if (WINDOWS)
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)
+ find_program(PYTHON_EXECUTABLE python PATHS /usr/bin)
if (PYTHON_EXECUTABLE)
set(PYTHONINTERP_FOUND ON)
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index a8bbbdbc06..d1edd4f095 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -145,17 +145,11 @@ BOOL LLTexLayerSetBuffer::renderTexLayerSet()
bool use_shaders = LLGLSLShader::sNoFixedFunction;
- LLGLEnable(GL_ALPHA_TEST);
-
if (use_shaders)
{
gAlphaMaskProgram.bind();
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.004f);
- }
LLVertexBuffer::unbind();
@@ -394,7 +388,6 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
LLGLSUIDefault gls_ui;
LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE);
gGL.setColorMask(true, true);
- LLGLEnable(GL_ALPHA_TEST);
// clear buffer area to ensure we don't pick up UI elements
{
@@ -404,11 +397,6 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
{
gAlphaMaskProgram.setMinimumAlpha(0.0f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.0f);
- }
-
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4f( 0.f, 0.f, 0.f, 1.f );
@@ -419,10 +407,6 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.004f);
- }
}
if (mIsVisible)
@@ -453,10 +437,6 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.0f);
- }
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4f( 0.f, 0.f, 0.f, 0.f );
@@ -469,11 +449,6 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.004f);
- }
-
}
return success;
@@ -564,7 +539,6 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
gGL.setColorMask(false, true);
gGL.setSceneBlendType(LLRender::BT_REPLACE);
- LLGLEnable(GL_ALPHA_TEST);
// (Optionally) replace alpha with a single component image from a tga file.
if (!info->mStaticAlphaFileName.empty())
@@ -591,11 +565,6 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.0f);
- }
-
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4f( 0.f, 0.f, 0.f, 1.f );
@@ -606,11 +575,6 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.004f);
- }
-
}
// (Optional) Mask out part of the baked texture with alpha masks
@@ -1118,7 +1082,6 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
//gPipeline.disableLights();
stop_glerror();
glDisable(GL_LIGHTING);
- LLGLEnable(GL_ALPHA_TEST);
stop_glerror();
bool use_shaders = LLGLSLShader::sNoFixedFunction;
@@ -1211,10 +1174,6 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.0f);
- }
}
LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode();
@@ -1232,12 +1191,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.004f);
- }
}
-
}
}
// else
@@ -1272,11 +1226,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
LLGLDisable no_alpha(GL_ALPHA_TEST);
if (use_shaders)
{
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- }
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.0f);
+ gAlphaMaskProgram.setMinimumAlpha(0.000f);
}
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1286,10 +1236,6 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.004f);
- }
}
if( alpha_mask_specified || getInfo()->mWriteAllChannels )
@@ -1378,7 +1324,6 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
gGL.flush();
bool use_shaders = LLGLSLShader::sNoFixedFunction;
- LLGLEnable(GL_ALPHA_TEST);
if( !getInfo()->mStaticImageFileName.empty() )
{
@@ -1390,11 +1335,6 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.0f);
- }
-
gGL.getTexUnit(0)->bind(tex, TRUE);
gl_rect_2d_simple_tex( width, height );
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1402,10 +1342,6 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.004f);
- }
}
else
{
@@ -1424,11 +1360,6 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.0f);
- }
-
gGL.getTexUnit(0)->bind(tex);
gl_rect_2d_simple_tex( width, height );
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1437,10 +1368,6 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.0f);
- }
}
}
}
@@ -1462,17 +1389,11 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
llassert( !mParamAlphaList.empty() );
bool use_shaders = LLGLSLShader::sNoFixedFunction;
- LLGLEnable(GL_ALPHA_TEST);
if (use_shaders)
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.0f);
- }
-
gGL.setColorMask(false, true);
@@ -1553,10 +1474,6 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.004f);
- }
LLGLSUIDefault gls_ui;
diff --git a/indra/llcorehttp/tests/test_llcorehttp_peer.py b/indra/llcorehttp/tests/test_llcorehttp_peer.py
index 3257f6924d..75a3c39ef2 100644
--- a/indra/llcorehttp/tests/test_llcorehttp_peer.py
+++ b/indra/llcorehttp/tests/test_llcorehttp_peer.py
@@ -1,200 +1,190 @@
-#!/usr/bin/env python
-"""\
-@file test_llsdmessage_peer.py
-@author Nat Goodspeed
-@date 2008-10-09
-@brief This script asynchronously runs the executable (with args) specified on
- the command line, returning its result code. While that executable is
- running, we provide dummy local services for use by C++ tests.
-
-$LicenseInfo:firstyear=2008&license=viewerlgpl$
-Second Life Viewer Source Code
-Copyright (C) 2012, Linden Research, Inc.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation;
-version 2.1 of the License only.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
-$/LicenseInfo$
-"""
-
-import os
-import sys
-import time
-import select
-import getopt
-from threading import Thread
-from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
-from SocketServer import ThreadingMixIn
-
-mydir = os.path.dirname(__file__) # expected to be .../indra/llcorehttp/tests/
-sys.path.insert(0, os.path.join(mydir, os.pardir, os.pardir, "lib", "python"))
-from indra.util.fastest_elementtree import parse as xml_parse
-from indra.base import llsd
-from testrunner import freeport, run, debug, VERBOSE
-import time
-
-_storage=None
-
-class TestHTTPRequestHandler(BaseHTTPRequestHandler):
- """This subclass of BaseHTTPRequestHandler is to receive and echo
- LLSD-flavored messages sent by the C++ LLHTTPClient.
- """
- def read(self):
- # The following logic is adapted from the library module
- # SimpleXMLRPCServer.py.
- # Get arguments by reading body of request.
- # We read this in chunks to avoid straining
- # socket.read(); around the 10 or 15Mb mark, some platforms
- # begin to have problems (bug #792570).
- try:
- size_remaining = int(self.headers["content-length"])
- except (KeyError, ValueError):
- return ""
- max_chunk_size = 10*1024*1024
- L = []
- while size_remaining:
- chunk_size = min(size_remaining, max_chunk_size)
- chunk = self.rfile.read(chunk_size)
- L.append(chunk)
- size_remaining -= len(chunk)
- return ''.join(L)
- # end of swiped read() logic
-
- def read_xml(self):
- # This approach reads the entire POST data into memory first
- return llsd.parse(self.read())
-## # This approach attempts to stream in the LLSD XML from self.rfile,
-## # assuming that the underlying XML parser reads its input file
-## # incrementally. Unfortunately I haven't been able to make it work.
-## tree = xml_parse(self.rfile)
-## debug("Finished raw parse")
-## debug("parsed XML tree %s", tree)
-## debug("parsed root node %s", tree.getroot())
-## debug("root node tag %s", tree.getroot().tag)
-## return llsd.to_python(tree.getroot())
-
- def do_HEAD(self):
- self.do_GET(withdata=False)
-
- def do_GET(self, withdata=True):
- # Of course, don't attempt to read data.
- self.answer(dict(reply="success", status=200,
- reason="Your GET operation worked"))
-
- def do_POST(self):
- # Read the provided POST data.
- # self.answer(self.read())
- self.answer(dict(reply="success", status=200,
- reason=self.read()))
-
- def do_PUT(self):
- # Read the provided PUT data.
- # self.answer(self.read())
- self.answer(dict(reply="success", status=200,
- reason=self.read()))
-
- def answer(self, data, withdata=True):
- global _storage
- debug("%s.answer(%s): self.path = %r", self.__class__.__name__, data, self.path)
- if "/sleep/" in self.path:
- time.sleep(30)
-
- if "/reflect/" in self.path:
- self.reflect_headers()
- self.send_header("X-LL-Special", "Mememememe");
- status = data.get("status", 500)
- # self.responses maps an int status to a (short, long) pair of
- # strings. We want the longer string. That's why we pass a string
- # pair to get(): the [1] will select the second string, whether it
- # came from self.responses or from our default pair.
- reason = data.get("reason",
- self.responses.get(status,
- ("fail requested",
- "Your request specified failure status %s "
- "without providing a reason" % status))[1])
- debug("fail requested: %s: %r", status, reason)
- self.send_error(status, reason)
- if "/reflect/" in self.path:
- self.reflect_headers()
- pass
- elif "test/timeout" in self.path:
- time.sleep(5.0)
- return
- elif "test/storage" in self.path:
- if "GET" == self.command:
- data = _storage
- else:
- _storage = data
- data = "ok"
- else:
- data = data.copy() # we're going to modify
- # Ensure there's a "reply" key in data, even if there wasn't before
- data["reply"] = data.get("reply", llsd.LLSD("success"))
- response = llsd.format_xml(data)
- debug("success: %s", response)
- self.send_response(200)
- self.send_header("Content-type", "application/llsd+xml")
- self.send_header("Content-Length", str(len(response)))
- self.end_headers()
-
- def reflect_headers(self):
- for name in self.headers.keys():
- # print "Header: %s: %s" % (name, self.headers[name])
- self.send_header("X-Reflect-" + name, self.headers[name])
-
- if not VERBOSE:
- # When VERBOSE is set, skip both these overrides because they exist to
- # suppress output.
-
- def log_request(self, code, size=None):
- # For present purposes, we don't want the request splattered onto
- # stderr, as it would upset devs watching the test run
- pass
-
- def log_error(self, format, *args):
- # Suppress error output as well
- pass
-
-class Server(ThreadingMixIn, HTTPServer):
- # This pernicious flag is on by default in HTTPServer. But proper
- # operation of freeport() absolutely depends on it being off.
- allow_reuse_address = False
-
-if __name__ == "__main__":
- do_valgrind = False
- path_search = False
- options, args = getopt.getopt(sys.argv[1:], "V", ["valgrind"])
- for option, value in options:
- if option == "-V" or option == "--valgrind":
- do_valgrind = True
-
- # Instantiate a Server(TestHTTPRequestHandler) on the first free port
- # in the specified port range. Doing this inline is better than in a
- # daemon thread: if it blows up here, we'll get a traceback. If it blew up
- # in some other thread, the traceback would get eaten and we'd run the
- # subject test program anyway.
- httpd, port = freeport(xrange(8000, 8020),
- lambda port: Server(('127.0.0.1', port), TestHTTPRequestHandler))
-
- # Pass the selected port number to the subject test program via the
- # environment. We don't want to impose requirements on the test program's
- # command-line parsing -- and anyway, for C++ integration tests, that's
- # performed in TUT code rather than our own.
- os.environ["LL_TEST_PORT"] = str(port)
- debug("$LL_TEST_PORT = %s", port)
- if do_valgrind:
- args = ["valgrind", "--log-file=./valgrind.log"] + args
- path_search = True
- sys.exit(run(server=Thread(name="httpd", target=httpd.serve_forever), use_path=path_search, *args))
+#!/usr/bin/env python
+"""\
+@file test_llsdmessage_peer.py
+@author Nat Goodspeed
+@date 2008-10-09
+@brief This script asynchronously runs the executable (with args) specified on
+ the command line, returning its result code. While that executable is
+ running, we provide dummy local services for use by C++ tests.
+
+$LicenseInfo:firstyear=2008&license=viewerlgpl$
+Second Life Viewer Source Code
+Copyright (C) 2012, Linden Research, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation;
+version 2.1 of the License only.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+$/LicenseInfo$
+"""
+
+import os
+import sys
+import time
+import select
+import getopt
+from threading import Thread
+from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
+from SocketServer import ThreadingMixIn
+
+mydir = os.path.dirname(__file__) # expected to be .../indra/llcorehttp/tests/
+sys.path.insert(0, os.path.join(mydir, os.pardir, os.pardir, "lib", "python"))
+from indra.util.fastest_elementtree import parse as xml_parse
+from indra.base import llsd
+from testrunner import freeport, run, debug, VERBOSE
+
+class TestHTTPRequestHandler(BaseHTTPRequestHandler):
+ """This subclass of BaseHTTPRequestHandler is to receive and echo
+ LLSD-flavored messages sent by the C++ LLHTTPClient.
+ """
+ def read(self):
+ # The following logic is adapted from the library module
+ # SimpleXMLRPCServer.py.
+ # Get arguments by reading body of request.
+ # We read this in chunks to avoid straining
+ # socket.read(); around the 10 or 15Mb mark, some platforms
+ # begin to have problems (bug #792570).
+ try:
+ size_remaining = int(self.headers["content-length"])
+ except (KeyError, ValueError):
+ return ""
+ max_chunk_size = 10*1024*1024
+ L = []
+ while size_remaining:
+ chunk_size = min(size_remaining, max_chunk_size)
+ chunk = self.rfile.read(chunk_size)
+ L.append(chunk)
+ size_remaining -= len(chunk)
+ return ''.join(L)
+ # end of swiped read() logic
+
+ def read_xml(self):
+ # This approach reads the entire POST data into memory first
+ return llsd.parse(self.read())
+## # This approach attempts to stream in the LLSD XML from self.rfile,
+## # assuming that the underlying XML parser reads its input file
+## # incrementally. Unfortunately I haven't been able to make it work.
+## tree = xml_parse(self.rfile)
+## debug("Finished raw parse")
+## debug("parsed XML tree %s", tree)
+## debug("parsed root node %s", tree.getroot())
+## debug("root node tag %s", tree.getroot().tag)
+## return llsd.to_python(tree.getroot())
+
+ def do_HEAD(self):
+ self.do_GET(withdata=False)
+
+ def do_GET(self, withdata=True):
+ # Of course, don't attempt to read data.
+ self.answer(dict(reply="success", status=200,
+ reason="Your GET operation worked"))
+
+ def do_POST(self):
+ # Read the provided POST data.
+ # self.answer(self.read())
+ self.answer(dict(reply="success", status=200,
+ reason=self.read()))
+
+ def do_PUT(self):
+ # Read the provided PUT data.
+ # self.answer(self.read())
+ self.answer(dict(reply="success", status=200,
+ reason=self.read()))
+
+ def answer(self, data, withdata=True):
+ debug("%s.answer(%s): self.path = %r", self.__class__.__name__, data, self.path)
+ if "/sleep/" in self.path:
+ time.sleep(30)
+
+ if "fail" not in self.path:
+ data = data.copy() # we're going to modify
+ # Ensure there's a "reply" key in data, even if there wasn't before
+ data["reply"] = data.get("reply", llsd.LLSD("success"))
+ response = llsd.format_xml(data)
+ debug("success: %s", response)
+ self.send_response(200)
+ if "/reflect/" in self.path:
+ self.reflect_headers()
+ self.send_header("Content-type", "application/llsd+xml")
+ self.send_header("Content-Length", str(len(response)))
+ self.send_header("X-LL-Special", "Mememememe");
+ self.end_headers()
+ if withdata:
+ self.wfile.write(response)
+ else: # fail requested
+ status = data.get("status", 500)
+ # self.responses maps an int status to a (short, long) pair of
+ # strings. We want the longer string. That's why we pass a string
+ # pair to get(): the [1] will select the second string, whether it
+ # came from self.responses or from our default pair.
+ reason = data.get("reason",
+ self.responses.get(status,
+ ("fail requested",
+ "Your request specified failure status %s "
+ "without providing a reason" % status))[1])
+ debug("fail requested: %s: %r", status, reason)
+ self.send_error(status, reason)
+ if "/reflect/" in self.path:
+ self.reflect_headers()
+ self.end_headers()
+
+ def reflect_headers(self):
+ for name in self.headers.keys():
+ # print "Header: %s: %s" % (name, self.headers[name])
+ self.send_header("X-Reflect-" + name, self.headers[name])
+
+ if not VERBOSE:
+ # When VERBOSE is set, skip both these overrides because they exist to
+ # suppress output.
+
+ def log_request(self, code, size=None):
+ # For present purposes, we don't want the request splattered onto
+ # stderr, as it would upset devs watching the test run
+ pass
+
+ def log_error(self, format, *args):
+ # Suppress error output as well
+ pass
+
+class Server(ThreadingMixIn, HTTPServer):
+ # This pernicious flag is on by default in HTTPServer. But proper
+ # operation of freeport() absolutely depends on it being off.
+ allow_reuse_address = False
+
+if __name__ == "__main__":
+ do_valgrind = False
+ path_search = False
+ options, args = getopt.getopt(sys.argv[1:], "V", ["valgrind"])
+ for option, value in options:
+ if option == "-V" or option == "--valgrind":
+ do_valgrind = True
+
+ # Instantiate a Server(TestHTTPRequestHandler) on the first free port
+ # in the specified port range. Doing this inline is better than in a
+ # daemon thread: if it blows up here, we'll get a traceback. If it blew up
+ # in some other thread, the traceback would get eaten and we'd run the
+ # subject test program anyway.
+ httpd, port = freeport(xrange(8000, 8020),
+ lambda port: Server(('127.0.0.1', port), TestHTTPRequestHandler))
+
+ # Pass the selected port number to the subject test program via the
+ # environment. We don't want to impose requirements on the test program's
+ # command-line parsing -- and anyway, for C++ integration tests, that's
+ # performed in TUT code rather than our own.
+ os.environ["LL_TEST_PORT"] = str(port)
+ debug("$LL_TEST_PORT = %s", port)
+ if do_valgrind:
+ args = ["valgrind", "--log-file=./valgrind.log"] + args
+ path_search = True
+ sys.exit(run(server=Thread(name="httpd", target=httpd.serve_forever), use_path=path_search, *args))
diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp
index cd5e781d71..f3c9921819 100755
--- a/indra/newview/llviewertexlayer.cpp
+++ b/indra/newview/llviewertexlayer.cpp
@@ -416,7 +416,10 @@ void LLViewerTexLayerSetBuffer::doUpload()
BOOL valid = FALSE;
LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;
S32 file_size = 0;
- U8* data = LLVFile::readFile(gVFS, asset_id, LLAssetType::AT_TEXTURE, &file_size);
+ LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE);
+ file_size = file.getSize();
+ U8* data = integrity_test->allocateData(file_size);
+ file.read(data, file_size);
if (data)
{
valid = integrity_test->validate(data, file_size); // integrity_test will delete 'data'