Sha256: 21ab0dbfa94004855fc28b15022809cf85f97ba4344e775d7dccf0e6c32bbafe

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

// File: lzham_assert.cpp
// See Copyright Notice and license at the end of include/lzham.h
#include "lzham_core.h"

static bool g_fail_exceptions;
static bool g_exit_on_failure = true;

void lzham_enable_fail_exceptions(bool enabled)
{
   g_fail_exceptions = enabled;
}

void lzham_assert(const char* pExp, const char* pFile, unsigned line)
{
   char buf[512];

   sprintf_s(buf, sizeof(buf), "%s(%u): Assertion failed: \"%s\"\n", pFile, line, pExp);

   lzham_output_debug_string(buf);

   printf("%s", buf);

   if (lzham_is_debugger_present())
      lzham_debug_break();
}

void lzham_fail(const char* pExp, const char* pFile, unsigned line)
{
   char buf[512];

   sprintf_s(buf, sizeof(buf), "%s(%u): Failure: \"%s\"\n", pFile, line, pExp);

   lzham_output_debug_string(buf);

   printf("%s", buf);

   if (lzham_is_debugger_present())
      lzham_debug_break();

#if LZHAM_USE_WIN32_API
   if (g_fail_exceptions)
      RaiseException(LZHAM_FAIL_EXCEPTION_CODE, 0, 0, NULL);
   else
#endif
   if (g_exit_on_failure)
      exit(EXIT_FAILURE);
}

void lzham_trace(const char* pFmt, va_list args)
{
   if (lzham_is_debugger_present())
   {
      char buf[512];
      vsprintf_s(buf, sizeof(buf), pFmt, args);

      lzham_output_debug_string(buf);
   }
};

void lzham_trace(const char* pFmt, ...)
{
   va_list args;
   va_start(args, pFmt);
   lzham_trace(pFmt, args);
   va_end(args);
};

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
extlzham-0.0.1.PROTOTYPE3-x86-mingw32 contrib/lzham/lzhamdecomp/lzham_assert.cpp
extlzham-0.0.1.PROTOTYPE3 contrib/lzham/lzhamdecomp/lzham_assert.cpp
extlzham-0.0.1.PROTOTYPE2 contrib/lzham/lzhamdecomp/lzham_assert.cpp
extlzham-0.0.1.PROTOTYPE contrib/lzham/lzhamdecomp/lzham_assert.cpp
extlzham-0.0.1.PROTOTYPE-x86-mingw32 contrib/lzham/lzhamdecomp/lzham_assert.cpp