Skip to content

Commit

Permalink
Merge branch 'master' into autobuild/alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
c-lipka committed Nov 25, 2016
2 parents 8ab0d99 + 38a45ef commit 7d65912
Show file tree
Hide file tree
Showing 70 changed files with 2,142 additions and 1,646 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ branches:
except:
- /^v[0-9]/

os:
- linux
- osx

language: cpp

compiler:
- gcc
- clang
matrix:
include:
- os: linux
compiler: gcc
- os: osx
compiler: clang

sudo: false

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ before_build:
(Get-Content source\base\build.h).replace('//{POV_AUTOBUILD_2}', $env:pov_autobuild_2) | Set-Content source\base\build.h
(Get-Content source\base\build.h).replace('//{POV_AUTOBUILD_3}', $env:pov_autobuild_3) | Set-Content source\base\build.h
(Get-Content source\base\build.h).replace('YOUR NAME (YOUR EMAIL)', $env:pov_authorized_by) | Set-Content source\base\build.h
(Get-Content source\base\build.h).replace('#error Please fill in BUILT_BY, then remove this line', '') | Set-Content source\base\build.h
(Get-Content source\base\build.h).replace('#error "Please fill in BUILT_BY, then remove this line"', '') | Set-Content source\base\build.h
build:
project: windows/vs10/povray.sln
Expand Down
56 changes: 53 additions & 3 deletions changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ Prior to the release of 3.7.1, the following items still need urgent attention:
New Features
------------

- A new finish parameter, `use_alpha`, has been added to suppress highlights
and reflections depending on pigment transparency.

- Array elements no longer have to be of the same type.

- Support for variable-size arrays has been added.

- A new data container, `dictionary`, has been added to support structured
storage of data.

- Pseudo-dictionaries `local` and `global` have been added, allowing to
specifically access local or global identifiers, respectively.

- A new special pigment pattern, `user_defined`, has been added to define the
pigment colour directly in terms of a set of functions.

- A new pattern, `potential`, has been added to define a pattern based on the
potential field of a blob or isosurface object.

Expand Down Expand Up @@ -86,9 +102,6 @@ New Features
assignments. The main purpose is to allow macros to return a set of values
rather than just a single one.

- `local()` and `global()` pseudo-functions have been added to specifically
refer to a local or global identifier, respectively.

- The macro syntax has been extended to allow for optional parameters.

- Light sources' distance-based fading can now be set to obey an inverse-power
Expand Down Expand Up @@ -196,16 +209,35 @@ Fixed or Mitigated Issues Reported by Static Code Analysis

Coverity Scan defects targeted deliberately:

- CID 967251: 'Constant' variable guards dead code
- CID 967254: 'Constant' variable guards dead code
- CID 967261: Logically dead code
- CID 967262: Logically dead code
- CID 967273: Explicit null dereferenced
- CID 967296: Parse Warning
- CID 967297: Parse Warning
- CID 967377: Uninitialized pointer field
- CID 967400: Uninitialized pointer field
- CID 967410: Structurally dead code
- CID 967412: Structurally dead code
- CID 1129008: Division or modulo by zero
- CID 1129016: Uninitialized pointer read
- CID 1129017: Uninitialized scalar variable
- CID 1372548: Non-virtual destructor
- CID 1372552: Unchecked return value
- CID 1372555: Operands don't affect result
- CID 1372556: Wrong operator used
- CID 1372557: Wrong operator used
- CID 1372558: Resource leak in object
- CID 1372560: Logically dead code
- CID 1372562: Non-array delete for scalars
- CID 1372566: Unchecked dynamic_cast
- CID 1372567: Unchecked dynamic_cast
- CID 1372603: Resource leak
- CID 1372604: Dereference before null check
- CID 1372605: Dereference before null check
- CID 1372606: Dereference before null check
- CID 1372607: Dereference before null check
- CID 1372608: Sizeof not portable
- CID 1372626: Uninitialized scalar variable
- CID 1372636: Uninitialized pointer field
Expand All @@ -224,6 +256,12 @@ Coverity Scan defects targeted deliberately:
- CID 1372655: Structurally dead code
- CID 1372656: Structurally dead code
- CID 1372657: Unused value
- CID 1373648: Out-of-bounds access
- CID 1373649: Free of address-of expression
- CID 1373651: Logically dead code
- CID 1373652: Dereference before null check
- CID 1373653: Write to pointer after free
- CID 1373654: Use after free

Coverity Scan defects eliminated in passing:

Expand Down Expand Up @@ -342,6 +380,8 @@ Reported via GitHub:
- #49 ("Latest version from Git won't build with MS Visual Studio 2015")
- #50 ("Make error in Ubuntu 14.04")
- #53 ("Standard include files may mess up the language version")
- #129 ("Port of FS331 - Intersection causes quadric to disappear")
- #153 ("vector list trailing comma error sor lathe sphere_sweep")

Reported via FlySpray:

Expand All @@ -354,9 +394,15 @@ Reported via FlySpray:
- FS#316 ("inverse keyword does not work properly with fractals")
- FS#317 ("problem with +D option at specific output file dimensions")
- FS#318 ("method 3 (default) scattering media is too bright & causes artifacts when nested")
- FS#331 ("Intersection causes quadric to disappear")
- FS#336 ("#fopen w/o OPEN_TYPE crash povray (segfault)")

Reported via the Newsgroups:

- <[email protected]>
(2002-01-21, povray.beta-test, "<1, 0, 0> + 1*t")
Inconsistency in automatic scalar-to-vector promotion.

- <[email protected]>
(2014-08-12, povray.binaries.images, "unexplained")
Precision issue led to `<1,1,1>.grey` not evaluating to 1 on sone systems.
Expand Down Expand Up @@ -414,6 +460,10 @@ Reported via the Newsgroups:
(2016-08-17, povray.binaries.scene-files, "Wrong normal direction on triangle{ }s")
Bug in flat trianges that could cause interior_texture to show on the wrong side.

- <[email protected]>
(2016-10-20, povray.programming, "Re: solving polynomials")
Misplaced `break` in polynomial solving code.

Reported via Windows Crash Reports:

- crash report #???, dump file #988
Expand Down
2 changes: 1 addition & 1 deletion platform/unix/syspovtimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void Delay(unsigned int msec)
POV_ASSERT(msec < 1000); // On some systems, usleep() does not support sleeping for 1 second or more.
usleep (msec * (useconds_t)1000);
#else
#error Bad compile-time configuration.
#error "Bad compile-time configuration."
#endif
}

Expand Down
8 changes: 6 additions & 2 deletions source-doc/compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ General Presumptions

While POV-Ray is being developed with portability high in mind, the C++ standard allows for some degrees of freedom that
we consider too exotic to cater to. We therefore presume all compilers and runtime environments to adhere to the
following additional restrictions:
following restrictions:

- **Char Size**: The `char` data type is currently presumed to be exactly 8 bits wide.

Expand All @@ -19,7 +19,11 @@ following additional restrictions:
separator, in include directives.

- **Integer Division**: Integer division is presumed to round towards zero. This also implies that the remainder (as
computed by the modulus operator `%`) is negative (or zero) if the dividend and divisor have different sign.
computed by the modulus operator `%`) is negative (or zero) if the dividend and divisor have different signs.

Failure to meet the above restrictions will cause in undefined behaviour.

Further restrictions may apply, but shall prompt a compile-time error if not satisfied.


POVMS Additional Restrictions
Expand Down
4 changes: 4 additions & 0 deletions source-doc/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ Miscellaneous Coding Rules
- **Locale**: Do not tamper with the C locale (i.e. do not call `setlocale` or any other function doing the same job),
as plenty of code in POV-Ray relies on it remaining set to the default.

- **Optimization**: Do not over-optimize your code. While we do want POV-Ray to be fast, we also want it to be
reasonably maintainable, and modern compilers generally do a good enough job at automatic optimization that you can
focus on keeping your code robust and easy to understand.


Code Documentation
==================
Expand Down
2 changes: 1 addition & 1 deletion source/base/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
/// Specifies the person or organization responsible for this build.
/// @attention Please set this to your real name, and/or include a working email or website address to contact you.
#define BUILT_BY "YOUR NAME (YOUR EMAIL)"
#error Please fill in BUILT_BY, then remove this line
#error "Please fill in BUILT_BY, then remove this line"
#endif

#endif // POVRAY_BASE_BUILD_H
2 changes: 1 addition & 1 deletion source/base/colour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace pov_base

#else

#error TODO!
#error "TODO!"

#endif

Expand Down
4 changes: 2 additions & 2 deletions source/base/colour.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ class GenericRGBColour
mColour[BLUE] = col.mColour[2];
}
#else
#error TODO!
#error "TODO!"
#endif
};

Expand Down Expand Up @@ -1736,7 +1736,7 @@ class GenericColour
mColour[2] = col.blue();
}
#else
#error TODO!
#error "TODO!"
#endif
};

Expand Down
3 changes: 1 addition & 2 deletions source/base/image/gif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ Image *Read (IStream *file, const Image::ReadOptions& options, bool IsPOTFile)
{
case EOF:
throw POV_EXCEPTION(kFileDataErr, "Unexpected EOF reading GIF file");
finished = true;
break ;
break;

case ';': /* End of the GIF dataset. */
finished = true;
Expand Down
1 change: 1 addition & 0 deletions source/base/image/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3254,6 +3254,7 @@ class FileBackedPixelContainer
throw POV_EXCEPTION(kFileDataErr, "Intermediate image storage backing file read failed.");
m_CurrentBlock = block;
}
POV_IMAGE_ASSERT (m_Blocksize != 0);
memcpy(&pixel, m_Buffer[(y * (POV_LONG)(m_Width) + x) % m_Blocksize], sizeof(pixel));
}
#if 0
Expand Down
28 changes: 23 additions & 5 deletions source/base/mathutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ inline T wrap(T val, T upperLimit)

// wrap signed integer value into the range [0..upperLimit);
// (this is equivalent to the modulus operator for positive values, but not for negative ones)
template<typename T>
inline T wrapInt(T val, T upperLimit)
template<typename T1, typename T2>
inline T2 wrapInt(T1 val, T2 upperLimit)
{
T tempVal = val % upperLimit;
T1 tempVal = val % upperLimit;

if (tempVal < T(0))
if (tempVal < T1(0))
{
// For negative values, the modulus operator may return a value in the range [1-upperLimit..-1];
// transpose such results into the range [1..upperLimit-1].
Expand All @@ -135,7 +135,25 @@ inline T wrapInt(T val, T upperLimit)
// sanity check; this should never kick in, unless wrapInt() has an implementation error.
POV_MATHUTIL_ASSERT((tempVal >= 0) && (tempVal < upperLimit));

return tempVal;
return (T2)tempVal;
}

// wrap signed integer value into the range [0..upperLimit);
// (this is equivalent to the modulus assignment operator for positive values, but not for negative ones)
template<typename T1, typename T2>
inline void setWrapInt(T1 val, T2 upperLimit)
{
val %= upperLimit;

if (val < T1(0))
{
// For negative values, the modulus operator may return a value in the range [1-upperLimit..-1];
// transpose such results into the range [1..upperLimit-1].
val += upperLimit;
}

// sanity check; this should never kick in, unless wrapInt() has an implementation error.
POV_MATHUTIL_ASSERT((val >= 0) && (val < upperLimit));
}

// round up/down to a multiple of some value
Expand Down
2 changes: 1 addition & 1 deletion source/base/path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void Path::ParsePathString(const UCS2String& p)
// Such an implementation should reside in `platform/foo/syspovpath.cpp`.

#ifdef POV_PATH_SEPARATOR_2
#error The portable implementation of ParsePathString does not support alternative path separator characters.
#error "The portable implementation of ParsePathString does not support alternative path separator characters."
#endif

bool Path::ParsePathString (UCS2String& volume, vector<UCS2String>& dirnames, UCS2String& filename, const UCS2String& path)
Expand Down
2 changes: 1 addition & 1 deletion source/base/textstreambuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void TextStreamBuffer::printfile(FILE *file, POV_LONG lines)
if((stopposset == true) && (stoppos == ((POV_LONG)(ftell(file)) - 1))) // only if walking backwards stop at initial position
break;

// count newlines in file and replace newlines with system specific newline charcater
// count newlines in file and replace newlines with system specific newline character
if((chr == 10) || (chr == 13))
{
chr = fgetc(file);
Expand Down
21 changes: 0 additions & 21 deletions source/base/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,27 +271,6 @@ struct POVRect
unsigned int GetHeight() const { return (bottom - top + 1); }
};

class GenericSetting
{
public:
explicit GenericSetting(bool set = false): set(set) {}
void Unset() { set = false; }
bool isSet() const { return set; }
protected:
bool set;
};

class FloatSetting : public GenericSetting
{
public:
explicit FloatSetting(double data = 0.0, bool set = false): data(data), GenericSetting(set) {}
double operator=(double b) { data = b; set = true; return data; }
operator double() const { return data; }
double operator()(double def) const { if (set) return data; else return def; }
private:
double data;
};

enum StringEncoding
{
kStringEncoding_ASCII = 0,
Expand Down
2 changes: 1 addition & 1 deletion source/base/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#define OFFICIAL_VERSION_STRING "3.7.1"
#define OFFICIAL_VERSION_NUMBER 371

#define POV_RAY_PRERELEASE "alpha.8826150"
#define POV_RAY_PRERELEASE "alpha.8889454"

#if (POV_RAY_IS_AUTOBUILD == 1) && ((POV_RAY_IS_OFFICIAL == 1) || (POV_RAY_IS_SEMI_OFFICIAL == 1))
#ifdef POV_RAY_PRERELEASE
Expand Down
2 changes: 1 addition & 1 deletion source/core/bounding/boundingbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ bool sort_and_split(BBOX_TREE **Root, BBOX_TREE **&Finite, size_t *numOfFiniteOb
// For debugging only.
// TODO MESSAGE Debug_Info("Reallocing Finite to %d\n", maxfinitecount);
Finite = reinterpret_cast<BBOX_TREE **>(POV_REALLOC(Finite, maxfinitecount * sizeof(BBOX_TREE *), "bounding boxes"));
delete[] areaCache;
delete[] *areaCache;
*areaCache = new BBoxScalar[maxfinitecount];
}

Expand Down
2 changes: 1 addition & 1 deletion source/core/colour/spectral.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class SpectralBand
#if (NUM_COLOUR_CHANNELS == 3)
return (GetHueIntegral(wavelength+bandwidth/2) - GetHueIntegral(wavelength-bandwidth/2)) * (SPECTRAL_BANDWIDTH/bandwidth);
#else
#error TODO!
#error "TODO!"
#endif
}

Expand Down
Loading

0 comments on commit 7d65912

Please sign in to comment.