Suppress VC2013 warnings.

Update AppVeyor script.
This commit is contained in:
Syoyo Fujita
2016-04-19 13:11:55 +09:00
parent f4695de408
commit a55247574c
6 changed files with 40 additions and 41 deletions

View File

@@ -1,12 +1,7 @@
version: 0.9.{build} version: 0.9.{build}
# scripts that runs after repo cloning.
install:
- vcsetup.bat
platform: x64 platform: x64
configuration: Release
build: build_script:
parallel: true - cd tests
project: TinyObjLoaderSolution.sln - vcbuild.bat

View File

@@ -1,18 +0,0 @@
# build.ninja
cc = clang
cxx = clang++
cflags = -Werror -Weverything
cxxflags = -Werror -Weverything
#cflags = -O2
#cxxflags = -O2
rule compile
command = $cxx $cxxflags -c $in -o $out
rule link
command = $cxx $in -o $out
build loader_example.o: compile loader_example.cc
build loader_example: link loader_example.o
default loader_example

View File

@@ -32,7 +32,7 @@ cflags = {
cxxflags = { cxxflags = {
"gnu" : [ "-O2", "-g" ] "gnu" : [ "-O2", "-g" ]
, "msvc" : [ "/O2" ] , "msvc" : [ "/O2", "/W4", "/EHsc"]
, "clang" : [ "-O2", "-g", "-fsanitize=address" ] , "clang" : [ "-O2", "-g", "-fsanitize=address" ]
} }

View File

@@ -300,6 +300,29 @@ TEST_CASE("cornell_box", "[Loader]") {
REQUIRE(true == TestLoadObj("../models/cornell_box.obj", gMtlBasePath)); REQUIRE(true == TestLoadObj("../models/cornell_box.obj", gMtlBasePath));
} }
TEST_CASE("catmark_torus_creases0", "[Loader]") {
tinyobj::attrib_t attrib;
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string err;
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "../models/catmark_torus_creases0.obj", gMtlBasePath, /*triangulate*/false);
if (!err.empty()) {
std::cerr << err << std::endl;
}
REQUIRE(true == ret);
REQUIRE(1 == shapes.size());
REQUIRE(8 == shapes[0].mesh.tags.size());
}
TEST_CASE("stream_load", "[Stream]") {
REQUIRE(true == TestStreamLoadObj());
}
#if 0 #if 0
int int
main( main(

View File

@@ -1,3 +1,4 @@
chcp 437 chcp 437
python kuroga.py config-msvc.py
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64 call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
ninja ninja

View File

@@ -236,15 +236,6 @@ struct tag_sizes {
int num_strings; int num_strings;
}; };
// for std::map
static inline bool operator<(const vertex_index &a, const vertex_index &b) {
if (a.v_idx != b.v_idx) return (a.v_idx < b.v_idx);
if (a.vn_idx != b.vn_idx) return (a.vn_idx < b.vn_idx);
if (a.vt_idx != b.vt_idx) return (a.vt_idx < b.vt_idx);
return false;
}
struct obj_shape { struct obj_shape {
std::vector<float> v; std::vector<float> v;
std::vector<float> vn; std::vector<float> vn;
@@ -346,11 +337,13 @@ static bool tryParseDouble(const char *s, const char *s_end, double *result) {
} }
// Read the integer part. // Read the integer part.
while ((end_not_reached = (curr != s_end)) && IS_DIGIT(*curr)) { end_not_reached = (curr != s_end);
while (end_not_reached && IS_DIGIT(*curr)) {
mantissa *= 10; mantissa *= 10;
mantissa += static_cast<int>(*curr - 0x30); mantissa += static_cast<int>(*curr - 0x30);
curr++; curr++;
read++; read++;
end_not_reached = (curr != s_end);
} }
// We must make sure we actually got something. // We must make sure we actually got something.
@@ -362,11 +355,13 @@ static bool tryParseDouble(const char *s, const char *s_end, double *result) {
if (*curr == '.') { if (*curr == '.') {
curr++; curr++;
read = 1; read = 1;
while ((end_not_reached = (curr != s_end)) && IS_DIGIT(*curr)) { end_not_reached = (curr != s_end);
while (end_not_reached && IS_DIGIT(*curr)) {
// NOTE: Don't use powf here, it will absolutely murder precision. // NOTE: Don't use powf here, it will absolutely murder precision.
mantissa += static_cast<int>(*curr - 0x30) * pow(10.0, -read); mantissa += static_cast<int>(*curr - 0x30) * pow(10.0, -read);
read++; read++;
curr++; curr++;
end_not_reached = (curr != s_end);
} }
} else if (*curr == 'e' || *curr == 'E') { } else if (*curr == 'e' || *curr == 'E') {
} else { } else {
@@ -379,7 +374,8 @@ static bool tryParseDouble(const char *s, const char *s_end, double *result) {
if (*curr == 'e' || *curr == 'E') { if (*curr == 'e' || *curr == 'E') {
curr++; curr++;
// Figure out if a sign is present and if it is. // Figure out if a sign is present and if it is.
if ((end_not_reached = (curr != s_end)) && (*curr == '+' || *curr == '-')) { end_not_reached = (curr != s_end);
if (end_not_reached && (*curr == '+' || *curr == '-')) {
exp_sign = *curr; exp_sign = *curr;
curr++; curr++;
} else if (IS_DIGIT(*curr)) { /* Pass through. */ } else if (IS_DIGIT(*curr)) { /* Pass through. */
@@ -389,11 +385,13 @@ static bool tryParseDouble(const char *s, const char *s_end, double *result) {
} }
read = 0; read = 0;
while ((end_not_reached = (curr != s_end)) && IS_DIGIT(*curr)) { end_not_reached = (curr != s_end);
while (end_not_reached && IS_DIGIT(*curr)) {
exponent *= 10; exponent *= 10;
exponent += static_cast<int>(*curr - 0x30); exponent += static_cast<int>(*curr - 0x30);
curr++; curr++;
read++; read++;
end_not_reached = (curr != s_end);
} }
exponent *= (exp_sign == '+' ? 1 : -1); exponent *= (exp_sign == '+' ? 1 : -1);
if (read == 0) goto fail; if (read == 0) goto fail;
@@ -493,7 +491,7 @@ static vertex_index parseTriple(const char **token, int vsize, int vnsize,
// Parse raw triples: i, i/j/k, i//k, i/j // Parse raw triples: i, i/j/k, i//k, i/j
static vertex_index parseRawTriple(const char **token) { static vertex_index parseRawTriple(const char **token) {
vertex_index vi(-2147483648); // 0x80000000 = -2147483648 = invalid vertex_index vi(static_cast<int>(0x80000000)); // 0x80000000 = -2147483648 = invalid
vi.v_idx = atoi((*token)); vi.v_idx = atoi((*token));
(*token) += strcspn((*token), "/ \t\r"); (*token) += strcspn((*token), "/ \t\r");