Skip to content

Commit

Permalink
Merge pull request assimp#3518 from Biswa96/add-msvc-check
Browse files Browse the repository at this point in the history
Check _MSC_VER for MSVC specific pragma directives.
  • Loading branch information
kimkulling authored Dec 11, 2020
2 parents 80bb8ab + a2adef8 commit 3d49d06
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 19 deletions.
14 changes: 9 additions & 5 deletions code/AssetLib/Assjson/cencode.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ For details, see http://sourceforge.net/projects/libb64

const int CHARS_PER_LINE = 72;

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#endif // _MSC_VER

void base64_init_encodestate(base64_encodestate* state_in)
{
Expand All @@ -33,9 +35,9 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
char* codechar = code_out;
char result;
char fragment;

result = state_in->result;

switch (state_in->step)
{
while (1)
Expand Down Expand Up @@ -74,7 +76,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
*codechar++ = base64_encode_value(result);
result = (fragment & 0x03f) >> 0;
*codechar++ = base64_encode_value(result);

++(state_in->stepcount);
if (state_in->stepcount == CHARS_PER_LINE/4)
{
Expand All @@ -90,7 +92,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
{
char* codechar = code_out;

switch (state_in->step)
{
case step_B:
Expand All @@ -106,8 +108,10 @@ int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
break;
}
*codechar++ = '\n';

return (int)(codechar - code_out);
}

#ifdef _MSC_VER
#pragma warning(pop)
#endif // _MSC_VER
8 changes: 4 additions & 4 deletions contrib/Open3DGC/o3dgcSC3DMCDecoder.inl
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ THE SOFTWARE.
#include "o3dgcArithmeticCodec.h"
#include "o3dgcTimer.h"

#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning( disable : 4456)
#endif // _WIN32
#endif // _MSC_VER

//#define DEBUG_VERBOSE

Expand Down Expand Up @@ -852,9 +852,9 @@ namespace o3dgc
}
} // namespace o3dgc

#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning( pop )
#endif // _WIN32
#endif // _MSC_VER

#endif // O3DGC_SC3DMC_DECODER_INL

Expand Down
8 changes: 4 additions & 4 deletions contrib/Open3DGC/o3dgcSC3DMCEncoder.inl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ THE SOFTWARE.

//#define DEBUG_VERBOSE

#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4456)
#endif // _WIN32
#endif // _MSC_VER

namespace o3dgc
{
Expand Down Expand Up @@ -927,9 +927,9 @@ namespace o3dgc
}
} // namespace o3dgc

#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning(pop)
#endif // _WIN32
#endif // _MSC_VER

#endif // O3DGC_SC3DMC_ENCODER_INL

Expand Down
2 changes: 2 additions & 0 deletions contrib/Open3DGC/o3dgcTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ THE SOFTWARE.

#ifdef _WIN32
/* Thank you, Microsoft, for file WinDef.h with min/max redefinition. */
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
#elif __APPLE__
#include <mach/clock.h>
Expand Down
4 changes: 4 additions & 0 deletions contrib/zip/src/zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
/* Win32, DOS, MSVC, MSVS */
#include <direct.h>

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4706)
#endif // _MSC_VER

#define MKDIR(DIRNAME) _mkdir(DIRNAME)
#define STRCLONE(STR) ((STR) ? _strdup(STR) : NULL)
Expand Down Expand Up @@ -968,4 +970,6 @@ int zip_extract(const char *zipname, const char *dir,
return status;
}

#ifdef _MSC_VER
#pragma warning(pop)
#endif // _MSC_VER
12 changes: 6 additions & 6 deletions include/assimp/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma GCC system_header
#endif

#ifdef _WIN32
#ifdef _MSC_VER
#pragma warning(disable : 4351)
#endif // _WIN32
#endif // _MSC_VER

#include <assimp/aabb.h>
#include <assimp/types.h>
Expand Down Expand Up @@ -458,8 +458,8 @@ struct aiAnimMesh {
*/
unsigned int mNumVertices;

/**
* Weight of the AnimMesh.
/**
* Weight of the AnimMesh.
*/
float mWeight;

Expand Down Expand Up @@ -713,8 +713,8 @@ struct aiMesh {
* Note! Currently only works with Collada loader.*/
C_STRUCT aiAnimMesh **mAnimMeshes;

/**
* Method of morphing when animeshes are specified.
/**
* Method of morphing when animeshes are specified.
*/
unsigned int mMethod;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@
#include <dxgiformat.h>
#include <assert.h>

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif // _MSC_VER

#include <wincodec.h>

#ifdef _MSC_VER
#pragma warning(pop)
#endif // _MSC_VER

#include <memory>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@

#include <d3d11.h>

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif // _MSC_VER

#include <stdint.h>

#ifdef _MSC_VER
#pragma warning(pop)
#endif // _MSC_VER

HRESULT CreateWICTextureFromMemory(_In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
#include "UTFConverter.h"
#include "SafeRelease.hpp"

#ifdef _MSC_VER
#pragma comment (lib, "d3d11.lib")
#pragma comment (lib, "Dxgi.lib")
#pragma comment(lib,"d3dcompiler.lib")
#pragma comment (lib, "dxguid.lib")
#endif // _MSC_VER

using namespace DirectX;
using namespace AssimpSamples::SharedCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@
#include <GL/gl.h>
#include <GL/glu.h>

#ifdef _MSC_VER
#pragma warning(disable: 4100) // Disable warning 'unreferenced formal parameter'
#endif // _MSC_VER

#define STB_IMAGE_IMPLEMENTATION
#include "contrib/stb_image/stb_image.h"

#ifdef _MSC_VER
#pragma warning(default: 4100) // Enable warning 'unreferenced formal parameter'
#endif // _MSC_VER

#include <fstream>

Expand Down

0 comments on commit 3d49d06

Please sign in to comment.