Merge pull request #1466 from jaredmulconry/issue_1330

Eliminated warnings when building the project with clang
pull/1469/head
Kim Kulling 2017-10-01 20:03:30 +02:00 committed by GitHub
commit c202d43d8f
4 changed files with 35 additions and 14 deletions

View File

@ -204,9 +204,11 @@ ELSEIF(MSVC)
# enable multi-core compilation with MSVC # enable multi-core compilation with MSVC
add_compile_options(/MP) add_compile_options(/MP)
ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -fPIC -Wall -Wno-long-long -pedantic -std=c++11" ) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -fPIC -Wall -Wno-long-long -std=c++11" )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
ELSEIF( CMAKE_COMPILER_IS_MINGW ) ELSEIF( CMAKE_COMPILER_IS_MINGW )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" ) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -std=c++11" )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
ADD_DEFINITIONS( -U__STRICT_ANSI__ ) ADD_DEFINITIONS( -U__STRICT_ANSI__ )
ENDIF() ENDIF()

View File

@ -216,8 +216,8 @@ namespace pmx
void PmxMaterial::Read(std::istream *stream, PmxSetting *setting) void PmxMaterial::Read(std::istream *stream, PmxSetting *setting)
{ {
this->material_name = std::move(ReadString(stream, setting->encoding)); this->material_name = ReadString(stream, setting->encoding);
this->material_english_name = std::move(ReadString(stream, setting->encoding)); this->material_english_name = ReadString(stream, setting->encoding);
stream->read((char*) this->diffuse, sizeof(float) * 4); stream->read((char*) this->diffuse, sizeof(float) * 4);
stream->read((char*) this->specular, sizeof(float) * 3); stream->read((char*) this->specular, sizeof(float) * 3);
stream->read((char*) &this->specularlity, sizeof(float)); stream->read((char*) &this->specularlity, sizeof(float));
@ -236,7 +236,7 @@ namespace pmx
else { else {
this->toon_texture_index = ReadIndex(stream, setting->texture_index_size); this->toon_texture_index = ReadIndex(stream, setting->texture_index_size);
} }
this->memo = std::move(ReadString(stream, setting->encoding)); this->memo = ReadString(stream, setting->encoding);
stream->read((char*) &this->index_count, sizeof(int)); stream->read((char*) &this->index_count, sizeof(int));
} }
@ -253,8 +253,8 @@ namespace pmx
void PmxBone::Read(std::istream *stream, PmxSetting *setting) void PmxBone::Read(std::istream *stream, PmxSetting *setting)
{ {
this->bone_name = std::move(ReadString(stream, setting->encoding)); this->bone_name = ReadString(stream, setting->encoding);
this->bone_english_name = std::move(ReadString(stream, setting->encoding)); this->bone_english_name = ReadString(stream, setting->encoding);
stream->read((char*) this->position, sizeof(float) * 3); stream->read((char*) this->position, sizeof(float) * 3);
this->parent_index = ReadIndex(stream, setting->bone_index_size); this->parent_index = ReadIndex(stream, setting->bone_index_size);
stream->read((char*) &this->level, sizeof(int)); stream->read((char*) &this->level, sizeof(int));
@ -528,10 +528,10 @@ namespace pmx
this->setting.Read(stream); this->setting.Read(stream);
// モデル情報 // モデル情報
this->model_name = std::move(ReadString(stream, setting.encoding)); this->model_name = ReadString(stream, setting.encoding);
this->model_english_name = std::move(ReadString(stream, setting.encoding)); this->model_english_name = ReadString(stream, setting.encoding);
this->model_comment = std::move(ReadString(stream, setting.encoding)); this->model_comment = ReadString(stream, setting.encoding);
this->model_english_comment = std::move(ReadString(stream, setting.encoding)); this->model_english_comment = ReadString(stream, setting.encoding);
// 頂点 // 頂点
stream->read((char*) &vertex_count, sizeof(int)); stream->read((char*) &vertex_count, sizeof(int));

View File

@ -232,7 +232,9 @@ namespace glTF
case ComponentType_UNSIGNED_BYTE: case ComponentType_UNSIGNED_BYTE:
return 1; return 1;
default: default:
throw DeadlyImportError("GLTF: Unsupported Component Type "+t); std::string err = "GLTF: Unsupported Component Type ";
err += t;
throw DeadlyImportError(err);
} }
} }

View File

@ -608,10 +608,16 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
/* we check the magic */ /* we check the magic */
if (err==UNZ_OK) if (err==UNZ_OK)
{
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
{
err=UNZ_ERRNO; err=UNZ_ERRNO;
}
else if (uMagic!=0x02014b50) else if (uMagic!=0x02014b50)
{
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
}
}
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK) if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
@ -688,18 +694,21 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
uSizeRead = extraFieldBufferSize; uSizeRead = extraFieldBufferSize;
if (lSeek!=0) if (lSeek!=0)
{
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0; lSeek=0;
else else
err=UNZ_ERRNO; err=UNZ_ERRNO;
}
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead) if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO; err=UNZ_ERRNO;
lSeek += file_info.size_file_extra - uSizeRead; lSeek += file_info.size_file_extra - uSizeRead;
} }
else else
{
lSeek+=file_info.size_file_extra; lSeek+=file_info.size_file_extra;
}
if ((err==UNZ_OK) && (szComment!=NULL)) if ((err==UNZ_OK) && (szComment!=NULL))
{ {
@ -710,20 +719,26 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
uSizeRead = file_info.size_file_comment; uSizeRead = file_info.size_file_comment;
} }
else else
{
uSizeRead = commentBufferSize; uSizeRead = commentBufferSize;
}
if (lSeek!=0) if (lSeek!=0)
{
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0; lSeek=0;
else else
err=UNZ_ERRNO; err=UNZ_ERRNO;
}
if ((file_info.size_file_comment>0) && (commentBufferSize>0)) if ((file_info.size_file_comment>0) && (commentBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead) if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO; err=UNZ_ERRNO;
lSeek+=file_info.size_file_comment - uSizeRead; lSeek+=file_info.size_file_comment - uSizeRead;
} }
else else
{
lSeek+=file_info.size_file_comment; lSeek+=file_info.size_file_comment;
}
if ((err==UNZ_OK) && (pfile_info!=NULL)) if ((err==UNZ_OK) && (pfile_info!=NULL))
*pfile_info=file_info; *pfile_info=file_info;
@ -977,10 +992,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
if (err==UNZ_OK) if (err==UNZ_OK)
{
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
else if (uMagic!=0x04034b50) else if (uMagic!=0x04034b50)
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
}
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
@ -1239,7 +1256,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
if ((pfile_in_zip_read_info->read_buffer == NULL)) if (pfile_in_zip_read_info->read_buffer == NULL)
return UNZ_END_OF_LIST_OF_FILE; return UNZ_END_OF_LIST_OF_FILE;
if (len==0) if (len==0)
return 0; return 0;