Commit c3cbdcbe authored by Ivan.Shulga's avatar Ivan.Shulga Committed by Alexander Trofimov

linux build

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@59324 954022d7-b5bf-4e40-9824-e11837661b57
parent 6e7dd51e
......@@ -24,7 +24,8 @@ DEFINES += UNICODE \
DISABLE_FILE_DOWNLOADER \
CXIMAGE_DONT_DECLARE_TCHAR \
BUILD_CONFIG_FULL_VERSION \
DONT_WRITE_EMBEDDED_FONTS
DONT_WRITE_EMBEDDED_FONTS \
CXIMAGE_DONT_DECLARE_TCHAR
INCLUDEPATH += \
/usr/include/libxml2
......
......@@ -109,8 +109,17 @@ typedef uint32_t COLORREF;
typedef void* HANDLE;
typedef void* HRGN;
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef BOOL
#define BOOL bool
//#define BOOL bool
typedef int BOOL;
#endif
#ifndef TRUE
......@@ -121,7 +130,7 @@ typedef void* HRGN;
#define FALSE false
#endif
#ifndef CXIMAGE_DONT_DECLARE_TCHAR // it brokes CString implementation
#ifndef CXIMAGE_DONT_DECLARE_TCHAR // it breaks CString implementation
#ifndef TCHAR
#define TCHAR char
#define _T
......
......@@ -3,6 +3,8 @@
* CxImage version 7.0.2 07/Feb/2011
*/
#include "../../common/File.h"
#include "ximage.h"
#if CXIMAGE_SUPPORT_JPG
......@@ -111,7 +113,12 @@ bool CxImage::Save(const TCHAR * filename, uint32_t imagetype)
#ifdef WIN32
if ((hFile=_tfopen(filename,_T("wb")))==NULL) return false; // For UNICODE support
#else
if ((hFile=fopen(filename,"wb"))==NULL) return false;
#ifdef UNICODE
std::string sFileName = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2 (filename, wcslen (filename));
if ((hFile=fopen(sFileName.c_str(),"wb"))==NULL) return false;
#else
if ((hFile=fopen(filename,"wb"))==NULL) return false;
#endif
#endif
bool bOK = Encode(hFile,imagetype);
......@@ -576,7 +583,12 @@ bool CxImage::Load(const TCHAR * filename, uint32_t imagetype)
#ifdef WIN32
if ((hFile=_tfopen(filename,_T("rb")))==NULL) return false; // For UNICODE support
#else
if ((hFile=fopen(filename,"rb"))==NULL) return false;
#ifdef UNICODE
std::string sFileName = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2 (filename, wcslen (filename));
if ((hFile=fopen(sFileName.c_str(),"rb"))==NULL) return false;
#else
if ((hFile=fopen(filename,"rb"))==NULL) return false;
#endif
#endif
bOK = Decode(hFile,imagetype);
......@@ -593,7 +605,12 @@ bool CxImage::Load(const TCHAR * filename, uint32_t imagetype)
#ifdef WIN32
if ((hFile=_tfopen(filename,_T("rb")))==NULL) return false; // For UNICODE support
#else
if ((hFile=fopen(filename,"rb"))==NULL) return false;
#ifdef UNICODE
std::string sFileName = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2 (filename, wcslen (filename));
if ((hFile=fopen(sFileName.c_str(),"rb"))==NULL) return false;
#else
if ((hFile=fopen(filename,"rb"))==NULL) return false;
#endif // #ifdef UNICODE
#endif
bOK = Decode(hFile,CXIMAGE_FORMAT_UNKNOWN);
......
......@@ -516,7 +516,7 @@ bool CxImageGIF::Encode(CxFile * fp, CxImage ** pImages, int32_t pagecount, bool
ghost.EncodeHeader(fp);
if (m_loops!=1){
ghost.SetLoops(max(0,m_loops-1));
ghost.SetLoops((std::max)(0,m_loops-1));
ghost.EncodeLoopExtension(fp);
}
......@@ -1383,10 +1383,10 @@ void CxImageGIF::GetComment(char* sz_comment_out)
////////////////////////////////////////////////////////////////////////////////
void CxImageGIF::GifMix(CxImage & imgsrc2, struct_image & imgdesc)
{
int32_t ymin = max(0,(int32_t)(GetHeight()-imgdesc.t - imgdesc.h));
int32_t ymin = (std::max)(0,(int32_t)(GetHeight()-imgdesc.t - imgdesc.h));
int32_t ymax = GetHeight()-imgdesc.t;
int32_t xmin = imgdesc.l;
int32_t xmax = min(GetWidth(), (uint32_t)(imgdesc.l + imgdesc.w));
int32_t xmax = (std::min)(GetWidth(), (uint32_t)(imgdesc.l + imgdesc.w));
int32_t ibg2= imgsrc2.GetTransIndex();
uint8_t i2;
......
......@@ -6,7 +6,11 @@
#include "ximage.h"
#if defined(_LINUX) || defined(__APPLE__)
#define _tcsnicmp(a,b,c) strcasecmp(a,b)
#ifdef UNICODE
#define _tcsnicmp(a,b,c) wcscasecmp(a,b)
#else
#define _tcsnicmp(a,b,c) strcasecmp(a,b)
#endif
#endif
////////////////////////////////////////////////////////////////////////////////
......
......@@ -31,14 +31,14 @@
#include "ximage.h"
#include "ximadef.h"
/*
#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
#endif
#ifndef max
#define max(a,b) (((a)>(b))?(a):(b))
#endif
*/
class CImageIterator
{
friend class CxImage;
......@@ -147,7 +147,7 @@ inline void CImageIterator::SetY(int32_t y)
inline void CImageIterator::SetRow(uint8_t *buf, int32_t n)
{
if (n<0) n = (int32_t)ima->GetEffWidth();
else n = min(n,(int32_t)ima->GetEffWidth());
else n = (std::min)(n,(int32_t)ima->GetEffWidth());
if ((IterImage!=NULL)&&(buf!=NULL)&&(n>0)) memcpy(IterImage,buf,n);
}
......@@ -155,7 +155,7 @@ inline void CImageIterator::SetRow(uint8_t *buf, int32_t n)
inline void CImageIterator::GetRow(uint8_t *buf, int32_t n)
{
if ((IterImage!=NULL)&&(buf!=NULL)&&(n>0))
memcpy(buf,IterImage,min(n,(int32_t)ima->GetEffWidth()));
memcpy(buf,IterImage,(std::min)(n,(int32_t)ima->GetEffWidth()));
}
/////////////////////////////////////////////////////////////////////
inline uint8_t* CImageIterator::GetRow()
......
......@@ -6,6 +6,7 @@
*/
#include "ximamng.h"
#include "../../common/File.h"
#if CXIMAGE_SUPPORT_MNG
......@@ -191,7 +192,13 @@ bool CxImageMNG::Load(const TCHAR * imageFileName){
#ifdef WIN32
if ((hFile=_tfopen(imageFileName,_T("rb")))==NULL) return false; // For UNICODE support
#else
if ((hFile=fopen(imageFileName,"rb"))==NULL) return false;
#ifdef UNICODE
std::string sFileName = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2 (imageFileName, wcslen (imageFileName));
if ((hFile=fopen(sFileName.c_str(),"rb"))==NULL) return false;
#else
if ((hFile=fopen(imageFileName,"rb"))==NULL) return false;
#endif // #ifdef UNICODE
#endif
bool bOK = Decode(hFile);
fclose(hFile);
......
......@@ -137,7 +137,7 @@ bool CxImagePNG::Decode(CxFile *hFile)
SetPaletteColor(3,255,255,255);
} else SetGrayPalette(); //<DP> needed for grayscale PNGs
int32_t nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3;
int32_t nshift = (std::max)(0,(info_ptr->bit_depth>>3)-1)<<3;
if (info_ptr->num_trans!=0){ //palette transparency
if (info_ptr->num_trans==1){
......@@ -151,7 +151,7 @@ bool CxImagePNG::Decode(CxFile *hFile)
RGBQUAD* pal=GetPalette();
if (pal){
uint32_t ip;
for (ip=0;ip<min(head.biClrUsed,(uint32_t)info_ptr->num_trans);ip++)
for (ip=0;ip<(std::min)(head.biClrUsed,(uint32_t)info_ptr->num_trans);ip++)
pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
pal[ip].rgbReserved=255;
......@@ -480,7 +480,7 @@ bool CxImagePNG::Encode(CxFile *hFile)
} } }
#endif // CXIMAGE_SUPPORT_ALPHA // <vho>
int32_t row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
int32_t row_size = (std::max)(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
info_ptr->rowbytes = row_size;
uint8_t *row_pointers = new uint8_t[row_size];
......
......@@ -11,6 +11,7 @@
*/
#include "ximaraw.h"
#include "../../common/File.h"
#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
......@@ -276,7 +277,17 @@ bool CxImageRAW::GetExifThumbnail(const TCHAR *filename, const TCHAR *outname, i
// THUMB.
if (dcr.thumb_offset != 0)
{
#ifdef _WIN32
FILE* file = fopen(outname, _T("wb"));
#else
#ifdef UNICODE
std::string sOutname = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2 (outname, wcslen (outname));
FILE* file = fopen(sOutname.c_str(), "wb");
#else
FILE* file = fopen(outname, "wb");
#endif
#endif
DCRAW* p = &dcr;
dcr_fseek(dcr.obj_, dcr.thumb_offset, SEEK_SET);
dcr.write_thumb(&dcr, file);
......
......@@ -2,6 +2,9 @@
#define __xiofile_h
#include "xfile.h"
#ifndef _WIN32
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
//#include <TCHAR.h>
#ifndef WIN32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment