From 0b049c3ea601a7ea6dc441db73af7a5bd75c834a Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Wed, 7 Oct 2015 22:50:48 +0800 Subject: Make the compiler happy. Add some makefiles. --- extensions/makefile | 13 +++++++++++++ extensions/smanim.cpp | 1 + extensions/smbmfont.cpp | 2 ++ extensions/smdatapack.cpp | 18 +++++++++++------- 4 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 extensions/makefile (limited to 'extensions') diff --git a/extensions/makefile b/extensions/makefile new file mode 100644 index 0000000..4c6b3fe --- /dev/null +++ b/extensions/makefile @@ -0,0 +1,13 @@ +CC= g++ +CXXFLAGS= -c -std=c++11 -Wall -I../include -I/usr/include/freetype2 + +all: objects archive clean + +objects: + $(CC) *.cpp $(CXXFLAGS) +archive: + $(AR) rcs libsmeltext.a *.o +clean: + if ( test smanim.o ); then rm *.o; fi +clean-all: clean + rm *.a \ No newline at end of file diff --git a/extensions/smanim.cpp b/extensions/smanim.cpp index d57292b..69bf8e0 100644 --- a/extensions/smanim.cpp +++ b/extensions/smanim.cpp @@ -111,6 +111,7 @@ bool smAnmFile::loadAnmFromMemory(const char* ptr,DWORD size) DWORD msez=anm.getFileSize("content.meta"); parseMeta(mptr,msez); anm.releaseFilePtr("content.meta"); + return true; } void smAnmFile::close() { diff --git a/extensions/smbmfont.cpp b/extensions/smbmfont.cpp index 22f9280..97b7fdb 100644 --- a/extensions/smbmfont.cpp +++ b/extensions/smbmfont.cpp @@ -55,6 +55,7 @@ bool smBMFont::loadAnmFromMemory(const char* ptr,DWORD size) anm.releaseFilePtr("content.meta"); setBlend(BLEND_ALPHABLEND); setColor(0xFFFFFFFF); + return true; } void smBMFont::close() { @@ -155,6 +156,7 @@ bool smBMFontw::loadAnmFromMemory(char* ptr,DWORD size) DWORD msez=anm.getFileSize("content.meta"); parseMeta(mptr,msez); anm.releaseFilePtr("content.meta"); + return true; } void smBMFontw::close() { diff --git a/extensions/smdatapack.cpp b/extensions/smdatapack.cpp index 2e77324..8b2c12b 100644 --- a/extensions/smdatapack.cpp +++ b/extensions/smdatapack.cpp @@ -11,9 +11,11 @@ #include "smdatapack.hpp" #include #include -#define gzgetDWORD(f) ((gzgetc(f)<<24)|(gzgetc(f)<<16)|(gzgetc(f)<<8)|(gzgetc(f)))&0xFFFFFFFF -#define gch ((*(cp++))&0xFF) -#define mmgetDWORD ((gch<<24)|(gch<<16)|(gch<<8)|(gch))&0xFFFFFFFF +inline int gzgch(gzFile f){return gzgetc(f);} +inline DWORD gzgetDWORD(gzFile f) +{return ((gzgch(f)<<24)|(gzgch(f)<<16)|(gzgch(f)<<8)|gzgch(f))&0xFFFFFFFF;} +inline DWORD gch(const char *&cp){return (DWORD)((*(cp++))&0xFF);} +inline DWORD mmgetDWORD(const char *&cp){return ((gch(cp)<<24)|(gch(cp)<<16)|(gch(cp)<<8)|(gch(cp)))&0xFFFFFFFF;} #define gzputDWORD(f,a) gzputc(f,a>>24);gzputc(f,(a>>16)&0xFF);gzputc(f,(a>>8)&0xFF);gzputc(f,a&0xFF); bool smDtpFileR::openDtp(const char* path) { @@ -35,6 +37,7 @@ bool smDtpFileR::openDtp(const char* path) f.crc=gzgetDWORD(file); m[std::string(f.path)]=f; } + return true; } bool smDtpFileR::openDtpFromMemory(const char* ptr,DWORD size) { @@ -50,11 +53,12 @@ bool smDtpFileR::openDtpFromMemory(const char* ptr,DWORD size) f.path=new char[pl+1];f.data=NULL; for(int j=0;j