Skip to content
2 changes: 2 additions & 0 deletions common/include/guiddef.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ typedef struct _GUID {
EXTERN_C const GUID FAR name
#endif // INITGUID

#if _MSC_VER < 1900
#define DEFINE_OLEGUID(name, l, w1, w2) DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
#endif

#ifndef _GUIDDEF_H_
#define _GUIDDEF_H_
Expand Down
6 changes: 4 additions & 2 deletions image/decode/segdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ static U32 _FORCEINLINE _load4(void* pv)
v |= ((U32)((U16 *) pv)[1]) << 16;
return _byteswap_ulong(v);
#else // _M_IA64
return _byteswap_ulong(*(U32*)pv);
U32 v;
memcpy(&v, pv, sizeof(U32));
return _byteswap_ulong(v);
#endif // _M_IA64
#endif // _BIG__ENDIAN_
}
Expand Down Expand Up @@ -959,7 +961,7 @@ Int DecodeMacroblockLowpass (CWMImageStrCodec * pSC, CCodingContext *pContext,
pCoeffs[k] += getBits (pIO, iModelBits);
}
else if (pCoeffs[k] < 0) {
pCoeffs[k] <<= iModelBits;
pCoeffs[k] = (int) (((unsigned) pCoeffs[k]) << iModelBits);
pCoeffs[k] -= getBits (pIO, iModelBits);
}
#endif // WIN32
Expand Down
4 changes: 3 additions & 1 deletion image/encode/strenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,10 @@ Int StrIOEncInit(CWMImageStrCodec* pSC)
pSC->ppTempFile[i] = (char *)malloc(FILENAME_MAX * sizeof(char));
if(pSC->ppTempFile[i] == NULL) return ICERR_ERROR;

if ((pFilename = tmpnam(NULL)) == NULL)
char tmpnambuf[] = {'f', 'i', 'l', 'e', 'X', 'X', 'X', 'X', 'X', 'X', '\0'};
if (mkstemp(tmpnambuf) == -1)
return ICERR_ERROR;
pFilename = tmpnambuf;
strcpy(pSC->ppTempFile[i], pFilename);
#endif
if(CreateWS_File(pSC->ppWStream + i, pFilename, "w+b") != ICERR_OK) return ICERR_ERROR;
Expand Down
4 changes: 3 additions & 1 deletion image/sys/adapthuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include "strcodec.h"

#include <limits.h>

#ifdef MEM_TRACE
#define TRACE_MALLOC 1
#define TRACE_NEW 0
Expand Down Expand Up @@ -459,7 +461,7 @@ Void AdaptDiscriminant (CAdaptiveHuffman *pAdHuff)
assert (t < gMaxTables[iSym]);

//pAdHuff->m_iDiscriminant >>= 1;
pAdHuff->m_iLowerBound = (t == 0) ? (-1 << 31) : -THRESHOLD;
pAdHuff->m_iLowerBound = (t == 0) ? INT_MIN : -THRESHOLD;
pAdHuff->m_iUpperBound = (t == gMaxTables[iSym] - 1) ? (1 << 30) : THRESHOLD;

switch (iSym) {
Expand Down
21 changes: 4 additions & 17 deletions image/sys/ansi.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
//*@@@---@@@@******************************************************************
#pragma once

#include <stdint.h>

//================================
// bitio functions
//================================
Expand All @@ -42,20 +44,5 @@
//================================
// common defines
//================================
#define FORCE_INLINE
#define CDECL
#if __LP64__
#define UINTPTR_T unsigned long long
#define INTPTR_T long long
#else
#define UINTPTR_T unsigned int
#define INTPTR_T int
#endif


//================================
// quantization optimization
//================================
//#define RECIP_QUANT_OPT


#define UINTPTR_T uintptr_t
#define INTPTR_T intptr_t
1 change: 0 additions & 1 deletion image/sys/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
//*@@@---@@@@******************************************************************

#include "strcodec.h"
// #include "xplatform_image.h"

#ifdef MEM_TRACE
#define TRACE_MALLOC 1
Expand Down
6 changes: 5 additions & 1 deletion image/sys/strcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ ERR detach_SB(SimpleBitIO* pSB)
#ifdef _BIG__ENDIAN_
#define _byteswap_ulong(x) (x)
#else // _BIG__ENDIAN_
#if _MSC_VER < 1924
U32 _byteswap_ulong(U32 bits)
{
U32 r = (bits & 0xffu) << 24;
Expand All @@ -680,6 +681,7 @@ U32 _byteswap_ulong(U32 bits)

return r;
}
#endif // _MSC_VER
#endif // _BIG__ENDIAN_
#endif

Expand All @@ -694,7 +696,9 @@ U32 load4BE(void* pv)
v |= ((U32)((U16 *) pv)[1]) << 16;
return _byteswap_ulong(v);
#else // _M_IA64
return _byteswap_ulong(*(U32*)pv);
U32 v;
memcpy(&v, pv, sizeof(U32));
return _byteswap_ulong(v);
#endif // _M_IA64
#endif // _BIG__ENDIAN_
}
Expand Down
3 changes: 1 addition & 2 deletions image/sys/strcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

#include "windowsmediaphoto.h"
#include "common.h"
// #include "xplatform_image.h"

// added for Xcode PK universal binary
#ifdef __ppc__
Expand Down Expand Up @@ -64,7 +63,7 @@

#ifndef UNREFERENCED_PARAMETER
#define UNREFERENCED_PARAMETER(P) { (P) = (P); }
#endif UNREFERENCED_PARAMETER
#endif // UNREFERENCED_PARAMETER

#ifdef UNDER_CE
#define PLATFORM_WCE
Expand Down
84 changes: 0 additions & 84 deletions image/sys/xplatform_image.h

This file was deleted.

6 changes: 0 additions & 6 deletions image/x86/x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,3 @@
#define INTPTR_T intptr_t


//================================
// quantization optimization
//================================
#define RECIP_QUANT_OPT


1 change: 1 addition & 0 deletions jxrgluelib/JXRGlueJxr.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
//
//*@@@---@@@@******************************************************************
#include <limits.h>
#include <wchar.h>
#include <JXRGlue.h>


Expand Down
2 changes: 1 addition & 1 deletion jxrtestlib/JXRTestHdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//*@@@---@@@@******************************************************************
#ifndef ANSI
#define _CRT_SECURE_NO_WARNINGS
#endif ANSI
#endif // ANSI

#include <stdlib.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion jxrtestlib/JXRTestPnm.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//*@@@---@@@@******************************************************************
#ifndef ANSI
#define _CRT_SECURE_NO_WARNINGS
#endif ANSI
#endif // ANSI

#include <stdlib.h>

Expand Down
18 changes: 18 additions & 0 deletions jxrtestlib/JXRTestYUV.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ ERR PKImageEncode_WritePixels_IYUV(

if(pY == NULL || pU == NULL || pV == NULL)
{
free(pY);
free(pU);
free(pV);
return ICERR_ERROR;
}

Expand Down Expand Up @@ -198,6 +201,9 @@ ERR PKImageEncode_WritePixels_YUV422(

if(pY == NULL || pU == NULL || pV == NULL)
{
free(pY);
free(pU);
free(pV);
return ICERR_ERROR;
}
//YYUV
Expand Down Expand Up @@ -273,6 +279,9 @@ ERR PKImageEncode_WritePixels_YUV444(

if(pY == NULL || pU == NULL || pV == NULL)
{
free(pY);
free(pU);
free(pV);
return ICERR_ERROR;
}

Expand Down Expand Up @@ -491,6 +500,9 @@ ERR PKImageDecode_Copy_IYUV(

if(pY == NULL || pU == NULL || pV == NULL)
{
free(pY);
free(pU);
free(pV);
return ICERR_ERROR;
}

Expand Down Expand Up @@ -564,6 +576,9 @@ ERR PKImageDecode_Copy_YUV422(

if(pY == NULL || pU == NULL || pV == NULL)
{
free(pY);
free(pU);
free(pV);
return ICERR_ERROR;
}

Expand Down Expand Up @@ -635,6 +650,9 @@ ERR PKImageDecode_Copy_YUV444(

if(pY == NULL || pU == NULL || pV == NULL)
{
free(pY);
free(pU);
free(pV);
return ICERR_ERROR;
}

Expand Down