Commit Graph

4853 Commits

Author SHA1 Message Date
Erik Hofman
ee4f5a5190 Disable SIMD for now as a test. 2017-02-28 12:42:48 +01:00
James Turner
141e98564c Generic string -> bool parser. 2017-02-27 23:11:05 +00:00
James Turner
72341a6de4 Adjust some messages to be developer-mode.
Still deciding how far to go with this, comments welcome.
2017-02-27 00:13:39 +00:00
Bertrand Coconnier
55ee59ac99 Flags ENABLE_GDAL and ENABLE_OPENMP are now carried over to FlightGear. 2017-02-26 16:39:48 +01:00
Peter Sadrozinski
61525c555e Disable GDAL, and compiling new terrain engine by default 2017-02-26 09:46:29 -05:00
Peter Sadrozinski
dad30b0cc2 alternative terrain engine - SGMesh utilizing pagedLOD 2017-02-25 19:17:55 -05:00
James Turner
9c9e4e86e7 Packages allows thumbnails per variant.
Change API for thumbnail access, so each variant can have a unique thumbnail alongside other data. Map existing catalog XML format to
this system.
2017-02-25 20:52:35 +00:00
James Turner
b88aa46e1c Merge /u/accek/simgear/ branch prop-strings into next
https://sourceforge.net/p/flightgear/simgear/merge-requests/32/
2017-02-25 16:36:49 +00:00
Bertrand Coconnier
10fa8a471a SGPath::set is called by SGPath::operator=(const char*p) so it needs to be unconditionnally compiled. 2017-02-25 16:02:36 +01:00
Szymon Acedański
4e875be0dd Added SGStringValueMethods property implementation
This is to be used in places where SGRawValueMethods returning .c_str()
from local strings were used, causing use-after-free later.
2017-02-25 15:02:37 +01:00
Bertrand Coconnier
23cc940743 gcc fails to catch std::ios_base::failure due to an inconsistent C++11 ABI between headers and libraries. See bug#66145 for more details (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66145). 2017-02-25 14:38:38 +01:00
Florent Rougon
4b010cc416 Minor change to simgear/io/iostreams/zlibstream_test.cxx 2017-02-25 11:30:16 +01:00
Florent Rougon
46f39d5fbd zlibstream classes: add constructors with sink semantic based on std::unique_ptr
Add an alternate constructor to each of the following classes:
ZlibAbstractIStreambuf, ZlibCompressorIStreambuf,
ZlibDecompressorIStreambuf, ZlibCompressorIStream and
ZlibDecompressorIStream. These new constructors are passed the source
std::istream wrapped inside an std::unique_ptr instead of by reference,
and store the unique_ptr object as an instance member. This ensures that
the source std::istream object is available as long as the
ZlibDecompressorIStreambuf, etc. instance is alive (which is necessary
for its getInputData() method) without any additional work for callers,
and that it is automatically destroyed afterwards.

This is particularly useful when writing functions that create and
return an object 'zobj' whose type is a subclass of
ZlibAbstractIStreambuf, when the source std::istream is only of interest
for its role of feeding data to 'zobj'. For instance:

std::unique_ptr<simgear::ZlibCompressorIStream>
myZlibCompressorIStreamProducer(std::string str)
{
  std::unique_ptr<std::istringstream> iss(new std::istringstream(str));

  return std::unique_ptr<simgear::ZlibCompressorIStream>(
    new simgear::ZlibCompressorIStream(std::move(iss))); // new ctor here
}

Callers of such a function get access to a new ZlibCompressorIStream
instance fed by an std::istringstream object ('iss'), but they don't
even have to know this detail, nor to take any measure to ensure that
'iss' lives at least as long as the ZlibCompressorIStream object. The
std::unique_ptr<std::istream> pointing to 'iss' and stored as a member
of the ZlibCompressorIStream object by its constructor automatically
takes care of this lifetime problem.
2017-02-24 22:51:21 +01:00
Florent Rougon
03515151f0 Add new test trying to read max amount with ZlibDecompressorIStreambuf::xsgetn()
New automated test for ZlibDecompressorIStreambuf::xsgetn(). xsgetn() is
called by sgetn() from the base class std::streambuf. In our case,
xsgetn() is actually defined in the base class ZlibAbstractIStreambuf
(subclass of std::streambuf), therefore this new test also applies to
ZlibCompressorIStreambuf and the two other related classes,
ZlibCompressorIStream and ZlibDecompressorIStream.

This test asks [x]sgetn() the largest possible amount of chars every
time it is called, i.e., the largest value that can be represented by
std::streamsize. This exercises the code in interesting ways due to the
various types involved (zlib's uInt, std::size_t and std::streamsize,
which have various sizes depending on the platform).
2017-02-24 22:51:21 +01:00
Florent Rougon
8cd723d91b Fix build errors in zlibstream*.cxx, re-enable their compilation
Compilation of these files was disabled in commit
e21ad4b5c1.

Fix build errors and warnings:

  - Ambiguous template parameters for std::min();

  - No appropriate default constructor available for
    std::basic_istream<char,std::char_traits<char>> (the std::istream
    subclasses didn't explicitly call the std::istream constructor,
    which requires an argument). This is presumably exactly the reason
    why sg_gzifstream is declared like this:

      class sg_gzifstream : private gzifstream_base, public std::istream

    where gzifstream_base is an empty shell for a stream buffer object:

      struct gzifstream_base
      {
          gzifstream_base() {}

          gzfilebuf gzbuf;
      };

    This ensures that the stream buffer object (gzbuf) is initialized
    before std::istream's constructor is called. I solved this problem
    in a different way, hopefully easier to understand, and requiring
    neither an additional class nor multiple inheritance: first, we
    initialize the std::istream base with a nullptr as the
    std::streambuf * argument (this is valid C++11), then in the
    constructor bodies for ZlibCompressorIStream and
    ZlibDecompressorIStream, we call std::istream::rdbuf() to attach the
    std::istream instance to the now-initialized stream buffer object.

  - Possible truncation of constant value on 32 bits systems (this was
    in zlibMaxChunkSize() which is now removed, see below).

Type-related improvements:

  - Remove zlibMaxChunkSize() and zlibMaxChunk: in C++, one can simply
    use std::numeric_limits<uInt>::max()---most of the code in
    zlibMaxChunkSize() was there only to find this value via a zlib
    function call.

  - Add helper function templates zlibChunk() and clipCast().

  - Split preparation of the putback area out of
    ZlibAbstractIStreambuf::xsgetn() to a new utility method:
    xsgetn_preparePutbackArea().

  - More rigorous type handling in zlibstream_test.cxx.

    Some precautions are necessary because the IOStreams API uses
    std::streamsize in many places (e.g., the return value of
    std::istream::gcount()), but functions such as the following
    std::string constructor:

      std::string(const char* s, std::size_t n);

    work with std::size_t instead. Since these types are different and
    opaque, this requires some care!
2017-02-24 22:51:21 +01:00
Torsten Dreyer
6f2943ed9a disable service test for now 2017-02-23 18:34:48 +01:00
Torsten Dreyer
e509fc3f5d Prepare for terrasync/https 2017-02-23 16:35:29 +01:00
James Turner
707d9e12cf Fix issues with package upgrades on Windows. 2017-02-23 13:26:02 +00:00
Automatic Release Builder
9840302931 new version: 2017.2.0 2017-02-20 18:52:12 +01:00
Automatic Release Builder
983047982f new version: 2017.1.1 2017-02-20 18:52:12 +01:00
James Turner
f977be5fe4 Concept for developer log messages. 2017-02-14 18:27:40 -08:00
Florent Rougon
e21ad4b5c1 Disable building of zlibstream.cxx for now
It is unclear to me how to correctly fix some of the remaining build
errors obtained on jenkins, therefore I am disabling it from the build
for now.
2017-02-12 23:55:03 +01:00
Florent Rougon
619055f544 Attempt at fixing build errors for simgear/io/iostreams/zlibstream.cxx
Apparently (on Jenkins), std::unordered_map doesn't like enums as keys.
Too bad, this made the code more compact...
2017-02-12 22:22:08 +01:00
Florent Rougon
c9611fc45b Add stream buffers and std::istream subclasses to deal with zlib compression
Add:
 - two stream buffer classes (ZlibCompressorIStreambuf and
   ZlibDecompressorIStreambuf), both based on the same abstract class:
   ZlibAbstractIStreambuf;
 - two std::istream subclasses (ZlibCompressorIStream and
   ZlibDecompressorIStream), each creating and using the corresponding
   stream buffer class from the previous item.

All these allow one to work with RFC 1950 and RFC 1952 compression
formats, respectively known as the zlib and gzip formats.

These classes are *input* streaming classes, which means they can
efficiently handle arbitrary amounts of data without using any disk
space nor increasing amounts of memory, and allow "client code" to pull
exactly as much data as it wants at any given time, resuming later when
it is ready to handle the next chunk.

See comments in simgear/io/iostreams/zlibstream.hxx for more details.
2017-02-12 21:18:52 +01:00
Florent Rougon
79f869a7f3 Move IOStreams-related files to simgear/io/iostreams; rename zfstream.[ch]xx to gzfstream.[ch]xx
- Rename zfstream.cxx (resp. zfstream.hxx) to gzfstream.cxx (resp.
  gzfstream.hxx)

  This is because these files only deal with the gzip format (RFC 1952),
  while zlib can actually read and write two slightly different formats:
  this one and the "ZLIB Compressed Data Format" (RFC 1950). Since I am
  going to add std::streambuf and std::istream subclasses able to deal
  with both formats (and supporting data sources that are general
  std::istream instances, not just files), this renaming will make
  things a bit clearer, I hope.

- Add new folder simgear/io/iostreams and move the following files to
  this folder:

    simgear/misc/gzcontainerfile.cxx
    simgear/misc/gzcontainerfile.hxx
    simgear/misc/gzfstream.cxx
    simgear/misc/gzfstream.hxx
    simgear/misc/sgstream.cxx
    simgear/misc/sgstream.hxx
    simgear/misc/sgstream_test.cxx

- Adapt other files accordingly (mainly #includes and CMakeLists.txt
  files).
2017-02-12 21:18:52 +01:00
Torsten Dreyer
1b8dfb2bef Accept time token for .dirindex files
print the timestamp on log-level "info"
2017-02-12 17:39:12 +01:00
Richard Harrison
143a47482b Change the log level of the "failed to load sound buffer" as it shouldn't be a popup because within my interpreation it is not within the definition of what POPUP should be used for. 2017-02-11 13:34:01 +01:00
James Turner
a28cf0f860 Additional SGPath test for remove + rename.
Trying to track down failure to update aircraft on Windows.
2017-02-09 18:48:05 +00:00
James Turner
d9f4d7373f SGFile uses wide-string APIs on Windows. 2017-02-07 16:15:14 +00:00
James Turner
c3f48c7261 Use sg_ofstream in one more place. 2017-02-07 16:05:06 +00:00
James Turner
48b7b70e23 BinObj code uses wide-strings on Windows. 2017-02-07 16:05:06 +00:00
James Turner
b93b362e2f Fix wide-string support for wav-file reader. 2017-02-07 16:05:06 +00:00
Bertrand Coconnier
2082b18e2e Export the symbol ENABLE_SIMD for FG to build with the same setting. 2017-02-07 00:02:39 +01:00
Erik Hofman
7f65e7f905 We need to copy the matrix before altering it's contents: Fix a SGMathTest failure 2017-02-03 15:07:35 +01:00
Erik Hofman
3417ca7e49 Add a linear-interpolation function 2017-02-02 11:35:11 +01:00
Richard Senior
6334c30eb6 Allow empty reason string in validation of HTTP response.
HTTP/1.0 and HTTP/1.1 allow the reason string to be empty.
Some servers produce empty reason strings on success,
e.g. "HTTP/1.1 200 ", which throws a "bad HTTP response"
exception.

From the specification:
    "Reason-Phrase  = *<TEXT, excluding CR, LF>"

From notational conventions:
    "*(element) allows any number, including zero"

References:
www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2
www.w3.org/Protocols/HTTP/1.0/spec.html
www.w3.org/Protocols/rfc2616/rfc2616-sec6.html
2017-02-01 10:23:10 +00:00
Erik Hofman
c87dff7e8f More code cleanups ans fix a Clang problem. And disable AVX for good, I don't have time for this crap anymore: it looks like a hardware or compielr bug 2017-01-31 00:04:01 +01:00
Erik Hofman
332f76f34d Last code cleanups and more explicit constructors 2017-01-30 18:25:42 +01:00
Erik Hofman
3387f3d084 Switch to c++11 alignas instead of our own hacks 2017-01-30 16:00:29 +01:00
Erik Hofman
bd421c381c Also make AVX available for simd4x4 2017-01-30 12:53:52 +01:00
Erik Hofman
0cce949837 Fix the last bug that prevented AVX from working properly. Hopefully this fixes all other SIMD related problems too 2017-01-30 12:25:51 +01:00
James Turner
ed3ba67925 Logging system buffers startup messages.
This allows adding log callbacks easier during startup, without 
missing the initial messages, which might be very important.
2017-01-30 07:43:35 +01:00
Erik Hofman
866f85064a Fix a mistake 2017-01-30 00:18:36 +01:00
Erik Hofman
9215c530b3 Explicit declaration of more constructors to make sure the laste lane of simd4_t<T,3> and the last two lanes of simd4_t<T,2> remain zero 2017-01-29 15:26:34 +01:00
James Turner
a6437f4e96 More SGPropertyNode::getPositions tests. 2017-01-28 15:37:41 +00:00
James Turner
5bd7be6ed1 Check for file permissions via SGPath. 2017-01-28 15:37:41 +00:00
Florent Rougon
d9cc3738b9 Improve sgstream_test.cxx
- Create "testfile" in a temporary directory (and make sure the temp dir
  and the file it contains are both removed when the test program exits).

- Use test macros such as SG_CHECK_EQUAL() instead of by-hand checks and
  "return EXIT_FAILURE" statements.

- Use sg_ofstream instead of plain std::ostream. This simplifies things
  a tiny bit, because one SGPath instance is enough to create both the
  sg_ofstream instance and the sg_gzifstream instance used afterwards to
  reread the created file.

- Don't call (sg_)ofstream::close() at the end of the block the instance
  is declared in: this is entirely unnecessary, since sg_ofstream
  derives from std::ofstream, which is automatically close()d when
  destroyed (RAII behavior).
2017-01-26 16:58:20 +01:00
Erik Hofman
edec5bbc01 There is still a segmenttion fault issue with the AVX code, disable it until this is sorted out 2017-01-26 14:46:36 +01:00
Florent Rougon
6a2d86c526 Small improvements for simgear::Dir
- Add method simgear::Dir::isNull(), analogous to SGPath::isNull().

- Make sure that simgear::Dir::tempDir() returns a null simgear::Dir
  instance when creation of the directory failed (so far, this was only
  the case on systems where HAVE_MKDTEMP is defined).

- Use simgear::strutils::error_string() instead of strerror() (the
  latter is not guaranteed to be thread-safe).

- Make sure <cerrno> is #included, regardless of the platform.

- Add automated tests for isNull(), setRemoveOnDestroy() and tempDir().
2017-01-26 12:41:59 +01:00
Stuart Buchanan
6c64e9b36c Add scenery-path-suffix support to terrasync
Remove /sim/rendering/building-mesh as it is
redundant.

Add check that objects are in the correct bounding
box of the containing STG file.
2017-01-21 22:19:38 +00:00