summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatěj Týč <bubla@users.sourceforge.net>2009-01-15 22:41:04 +0000
committerMatěj Týč <bubla@users.sourceforge.net>2009-01-15 22:41:04 +0000
commit867f7075cc87b37bc4f053131adc8c0cbb6ba1d9 (patch)
tree6844b5a4bcf33982fc2a8463d0b2a3c12c90ff15
parent523fff59ddb14ba257fa955c0f132bef333ff05a (diff)
downloaddevil-867f7075cc87b37bc4f053131adc8c0cbb6ba1d9.tar.gz
fixed some bugs that prevented correct compilation
-rw-r--r--DevIL/ChangeLog9
-rw-r--r--DevIL/configure.ac4
-rw-r--r--DevIL/examples/cpp_wrapper_example/il_wrap.cpp2
-rw-r--r--DevIL/include/IL/devil_cpp_wrapper.hpp23
-rw-r--r--DevIL/include/IL/il.h6
-rw-r--r--DevIL/lib/Makefile.am3
-rw-r--r--DevIL/src-IL/src/il_io.c4
-rw-r--r--DevIL/src-IL/src/il_jp2.c2
-rw-r--r--DevIL/src-IL/src/il_states.c36
-rwxr-xr-xDevIL/src-IL/src/il_wbmp.c2
10 files changed, 52 insertions, 39 deletions
diff --git a/DevIL/ChangeLog b/DevIL/ChangeLog
index 0737dc57..30f5519f 100644
--- a/DevIL/ChangeLog
+++ b/DevIL/ChangeLog
@@ -123,4 +123,11 @@
* il_io.c (ilLoadF): Uncommented ilLoadJp2F.
* il_dds-save.c (CompressTo565): Changed 24-bit to 16-bit code based on Charles Bloom's rant.
* il_dds.c (DxtcReadColor/DxtcReadColors): Changed conversion to copy high bits to lowest bits as well.
- \ No newline at end of file
+
+2009-01-15 Matěj Týč <bubla@sf.net>
+ * il_io.h, include/IL/il.h, il_states.h: Changed some normal strings to constant
+ strings (in ilSave, ilIsValid and ilGetString)
+ * configure.ac, lib/Makefile.am: Added wbmp compilation support
+ * il_jp2.c, il_wbmp.c: Fixed a typo that prevented compilation
+ * include/IL/devil_cpp_wrapper.hpp: Added a hopefully harmless solution for
+ the initialization of devil.
diff --git a/DevIL/configure.ac b/DevIL/configure.ac
index cbb26e3b..06671bdd 100644
--- a/DevIL/configure.ac
+++ b/DevIL/configure.ac
@@ -289,10 +289,6 @@ TEST_FORMAT([xpm], [XPM])
TEST_FORMAT([wal], [WAL])
TEST_FORMAT([wdp], [WDP])
-AC_DEFINE([IL_NO_WBMP],
- [1],
- [WBMP loading is not implemented yet])
-
dnl
dnl ILUT APIs library checking
dnl
diff --git a/DevIL/examples/cpp_wrapper_example/il_wrap.cpp b/DevIL/examples/cpp_wrapper_example/il_wrap.cpp
index 86b7a054..7e788f83 100644
--- a/DevIL/examples/cpp_wrapper_example/il_wrap.cpp
+++ b/DevIL/examples/cpp_wrapper_example/il_wrap.cpp
@@ -12,7 +12,7 @@ int main(int argc, char **argv)
ilImage Image(argv[1]);
- cout << Image.Width() << ' ' << Image.Height() << ' ' << (ILuint)Image.Bpp() << endl;
+ cout << Image.Width() << 'x' << Image.Height() << '@' << (ILuint)Image.Bpp() << endl;
ilEnable(IL_FILE_OVERWRITE);
diff --git a/DevIL/include/IL/devil_cpp_wrapper.hpp b/DevIL/include/IL/devil_cpp_wrapper.hpp
index fcd18de7..5497645d 100644
--- a/DevIL/include/IL/devil_cpp_wrapper.hpp
+++ b/DevIL/include/IL/devil_cpp_wrapper.hpp
@@ -72,9 +72,19 @@ protected:
ILuint Id;
private:
- void iStartUp();
+ static int ilStartUp();
+ static ILboolean ilStartedUp;
};
+// ensure that init is called exactly once
+int ilImage::ilStartUp()
+{
+ ilInit();
+ iluInit();
+ //ilutInit();
+ return true;
+}
+ILboolean ilImage::ilStartedUp = ilStartUp();
class ilFilters
{
@@ -196,7 +206,7 @@ private:
ilImage::ilImage()
{
this->Id = 0;
- this->iStartUp(); // This was commented out, but it needs to be somewhere...
+ //this->iStartUp(); // This was commented out, but it needs to be somewhere...
this->iGenBind();
return;
}
@@ -205,8 +215,7 @@ ilImage::ilImage()
ilImage::ilImage(char *FileName)
{
this->Id = 0;
- this->iStartUp(); // This was commented out, but it needs to be somewhere...
-
+ //this->iStartUp(); // This was commented out, but it needs to be somewhere...
this->iGenBind();
ilLoadImage(FileName);
return;
@@ -216,7 +225,7 @@ ilImage::ilImage(char *FileName)
ilImage::ilImage(const ilImage &Image)
{
this->Id = 0;
- //this->iStartUp();
+ // this->iStartUp();
this->iGenBind();
*this = Image;
return;
@@ -557,13 +566,13 @@ ILubyte* ilImage::GetPalette()
//
// Private members
//
-void ilImage::iStartUp()
+/*void ilImage::iStartUp()
{
ilInit();
iluInit();
ilutInit();
return;
-}
+}*/
void ilImage::iGenBind()
{
diff --git a/DevIL/include/IL/il.h b/DevIL/include/IL/il.h
index 08c73fff..74face5f 100644
--- a/DevIL/include/IL/il.h
+++ b/DevIL/include/IL/il.h
@@ -538,14 +538,14 @@ ILAPI ILint ILAPIENTRY ilGetInteger(ILenum Mode);
ILAPI void ILAPIENTRY ilGetIntegerv(ILenum Mode, ILint *Param);
ILAPI ILuint ILAPIENTRY ilGetLumpPos(void);
ILAPI ILubyte* ILAPIENTRY ilGetPalette(void);
-ILAPI ILstring ILAPIENTRY ilGetString(ILenum StringName);
+ILAPI ILconst_string ILAPIENTRY ilGetString(ILenum StringName);
ILAPI void ILAPIENTRY ilHint(ILenum Target, ILenum Mode);
ILAPI void ILAPIENTRY ilInit(void);
ILAPI ILboolean ILAPIENTRY ilIsDisabled(ILenum Mode);
ILAPI ILboolean ILAPIENTRY ilIsEnabled(ILenum Mode);
ILAPI ILenum ILAPIENTRY ilDetermineTypeF(ILHANDLE File);
ILAPI ILboolean ILAPIENTRY ilIsImage(ILuint Image);
-ILAPI ILboolean ILAPIENTRY ilIsValid(ILenum Type, ILstring FileName);
+ILAPI ILboolean ILAPIENTRY ilIsValid(ILenum Type, ILconst_string FileName);
ILAPI ILboolean ILAPIENTRY ilIsValidF(ILenum Type, ILHANDLE File);
ILAPI ILboolean ILAPIENTRY ilIsValidL(ILenum Type, void *Lump, ILuint Size);
ILAPI void ILAPIENTRY ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
@@ -574,7 +574,7 @@ ILAPI ILboolean ILAPIENTRY ilRemoveSave(ILconst_string Ext);
ILAPI void ILAPIENTRY ilResetMemory(void); // Deprecated
ILAPI void ILAPIENTRY ilResetRead(void);
ILAPI void ILAPIENTRY ilResetWrite(void);
-ILAPI ILboolean ILAPIENTRY ilSave(ILenum Type, ILstring FileName);
+ILAPI ILboolean ILAPIENTRY ilSave(ILenum Type, ILconst_string FileName);
ILAPI ILuint ILAPIENTRY ilSaveF(ILenum Type, ILHANDLE File);
ILAPI ILboolean ILAPIENTRY ilSaveImage(ILconst_string FileName);
ILAPI ILuint ILAPIENTRY ilSaveL(ILenum Type, void *Lump, ILuint Size);
diff --git a/DevIL/lib/Makefile.am b/DevIL/lib/Makefile.am
index e0bfc9a9..24c6b9bf 100644
--- a/DevIL/lib/Makefile.am
+++ b/DevIL/lib/Makefile.am
@@ -71,7 +71,8 @@ endif #BUILD_ILUT
libIL_la_CPPFLAGS = -I $(il_include) -I $(all_include)
libIL_la_CFLAGS = $(AM_CFLAGS) @IL_CFLAGS@
libIL_la_CXXFLAGS = $(AM_CFLAGS) @IL_CFLAGS@
-libIL_la_SOURCES = $(il_src)/il_alloc.c $(il_src)/il_doom.c $(il_src)/il_stack.c $(il_src)/il_pcx.c $(il_src)/il_rle.c $(il_src)/il_bits.c $(il_src)/il_endian.c $(il_src)/il_exr.cpp $(il_src)/il_jpeg.c $(il_src)/il_pic.c $(il_src)/il_sgi.c $(il_src)/il_bmp.c $(il_src)/il_error.c $(il_src)/il_lif.c $(il_src)/il_png.c $(il_src)/il_states.c $(il_src)/il_convbuff.c $(il_src)/il_files.c $(il_src)/il_main.c $(il_src)/il_pnm.c $(il_src)/il_targa.c $(il_src)/il_wdp.c $(il_src)/il_convert.c $(il_src)/il_gif.c $(il_src)/il_manip.c $(il_src)/il_profiles.c $(il_src)/il_tiff.c $(il_src)/il_cut.c $(il_src)/il_header.c $(il_src)/il_mdl.c $(il_src)/il_quantizer.c $(il_src)/il_utility.c $(il_src)/il_dcx.c $(il_src)/il_icon.c $(il_src)/il_mng.c $(il_src)/il_raw.c $(il_src)/il_wal.c $(il_src)/il_dds.c $(il_src)/il_internal.c $(il_src)/il_pal.c $(il_src)/il_rawdata.c $(il_src)/il_devil.c $(il_src)/il_io.c $(il_src)/il_pcd.c $(il_src)/il_register.c $(il_src)/il_psd.c $(il_src)/il_fastconv.c $(il_src)/il_neuquant.c $(il_src)/il_dds-save.c $(il_src)/il_psp.c $(il_src)/il_pix.c $(il_src)/il_pxr.c $(il_src)/il_vtf.c $(il_src)/il_xpm.c $(il_src)/il_hdr.c $(il_src)/il_icns.c $(il_src)/il_jp2.c $(il_src)/altivec_common.c $(il_src)/altivec_typeconversion.c $(il_src)/il_sun.c $(il_src)/il_nvidia.cpp
+libIL_la_SOURCES = $(il_src)/il_alloc.c $(il_src)/il_doom.c $(il_src)/il_stack.c $(il_src)/il_pcx.c $(il_src)/il_rle.c $(il_src)/il_bits.c $(il_src)/il_endian.c $(il_src)/il_exr.cpp $(il_src)/il_jpeg.c $(il_src)/il_pic.c $(il_src)/il_sgi.c $(il_src)/il_bmp.c $(il_src)/il_error.c $(il_src)/il_lif.c $(il_src)/il_png.c $(il_src)/il_states.c $(il_src)/il_convbuff.c $(il_src)/il_files.c $(il_src)/il_main.c $(il_src)/il_pnm.c $(il_src)/il_targa.c $(il_src)/il_wdp.c $(il_src)/il_convert.c $(il_src)/il_gif.c $(il_src)/il_manip.c $(il_src)/il_profiles.c $(il_src)/il_tiff.c $(il_src)/il_cut.c $(il_src)/il_header.c $(il_src)/il_mdl.c $(il_src)/il_quantizer.c $(il_src)/il_utility.c $(il_src)/il_dcx.c $(il_src)/il_icon.c $(il_src)/il_mng.c $(il_src)/il_raw.c $(il_src)/il_wal.c $(il_src)/il_dds.c $(il_src)/il_internal.c $(il_src)/il_pal.c $(il_src)/il_rawdata.c $(il_src)/il_devil.c $(il_src)/il_io.c $(il_src)/il_pcd.c $(il_src)/il_register.c $(il_src)/il_psd.c $(il_src)/il_fastconv.c $(il_src)/il_neuquant.c $(il_src)/il_dds-save.c $(il_src)/il_psp.c $(il_src)/il_pix.c $(il_src)/il_pxr.c $(il_src)/il_vtf.c $(il_src)/il_xpm.c $(il_src)/il_hdr.c $(il_src)/il_icns.c $(il_src)/il_jp2.c $(il_src)/altivec_common.c $(il_src)/altivec_typeconversion.c $(il_src)/il_sun.c $(il_src)/il_nvidia.cpp $(il_src)/il_wbmp.c
+
libIL_la_SOURCES += $(il_include)/altivec_common.h $(il_include)/altivec_typeconversion.h $(il_include)/il_alloc.h $(il_include)/il_bits.h $(il_include)/il_bmp.h $(il_include)/il_dcx.h $(il_include)/il_dds.h $(il_include)/il_doompal.h $(il_include)/il_endian.h $(il_include)/il_exr.h $(il_include)/il_files.h $(il_include)/il_gif.h $(il_include)/il_hdr.h $(il_include)/il_icns.h $(il_include)/il_icon.h $(il_include)/il_internal.h $(il_include)/il_jp2.h $(il_include)/il_jpeg.h $(il_include)/il_lif.h $(il_include)/il_manip.h $(il_include)/il_mdl.h $(il_include)/il_pal.h $(il_include)/il_pcx.h $(il_include)/il_pic.h $(il_include)/il_pnm.h $(il_include)/il_psd.h $(il_include)/il_psp.h $(il_include)/il_q2pal.h $(il_include)/il_register.h $(il_include)/il_rle.h $(il_include)/il_sgi.h $(il_include)/il_stack.h $(il_include)/il_states.h $(il_include)/il_targa.h $(il_include)/il_vtf.h $(il_include)/il_wdp.h $(all_include)/IL/devil_internal_exports.h
libIL_la_LDFLAGS = @IL_LIBS@ $(AM_LDFLAGS)
diff --git a/DevIL/src-IL/src/il_io.c b/DevIL/src-IL/src/il_io.c
index 3f97d7e2..915b515f 100644
--- a/DevIL/src-IL/src/il_io.c
+++ b/DevIL/src-IL/src/il_io.c
@@ -370,7 +370,7 @@ ILenum ilDetermineTypeL(const void *Lump, ILuint Size)
}
-ILboolean ILAPIENTRY ilIsValid(ILenum Type, ILstring FileName)
+ILboolean ILAPIENTRY ilIsValid(ILenum Type, ILconst_string FileName)
{
if (FileName == NULL) {
ilSetError(IL_INVALID_PARAM);
@@ -1579,7 +1579,7 @@ finish:
}
-ILboolean ILAPIENTRY ilSave(ILenum Type, ILstring FileName)
+ILboolean ILAPIENTRY ilSave(ILenum Type, ILconst_string FileName)
{
switch (Type)
{
diff --git a/DevIL/src-IL/src/il_jp2.c b/DevIL/src-IL/src/il_jp2.c
index 3667e8e3..30b24be5 100644
--- a/DevIL/src-IL/src/il_jp2.c
+++ b/DevIL/src-IL/src/il_jp2.c
@@ -512,7 +512,7 @@ ILboolean ilSaveJp2F(ILHANDLE File)
//! Writes a Jp2 to a memory "lump"
-ILboolean ilSaveJp2L(void *Lump, ILuint Size)
+ILboolean ilSaveJp2L(const void *Lump, ILuint Size)
{
iSetOutputLump(Lump, Size);
if (jas_init())
diff --git a/DevIL/src-IL/src/il_states.c b/DevIL/src-IL/src/il_states.c
index 69e8a942..c425a25d 100644
--- a/DevIL/src-IL/src/il_states.c
+++ b/DevIL/src-IL/src/il_states.c
@@ -19,8 +19,8 @@
//#include <malloc.h>
#include <stdlib.h>
-ILstring _ilVendor = IL_TEXT("Abysmal Software");
-ILstring _ilVersion = IL_TEXT("Developer's Image Library (DevIL) 1.7.5");
+ILconst_string _ilVendor = IL_TEXT("Abysmal Software");
+ILconst_string _ilVersion = IL_TEXT("Developer's Image Library (DevIL) 1.7.5");
char* _ilLoadExt = "" IL_BMP_EXT IL_CUT_EXT IL_DCX_EXT IL_DDS_EXT
@@ -99,41 +99,41 @@ void ilDefaultStates()
//! Returns a constant string detailing aspects about this library.
-ILstring ILAPIENTRY ilGetString(ILenum StringName)
+ILconst_string ILAPIENTRY ilGetString(ILenum StringName)
{
switch (StringName)
{
case IL_VENDOR:
- return (ILstring)_ilVendor;
+ return (ILconst_string)_ilVendor;
case IL_VERSION_NUM: //changed 2003-08-30: IL_VERSION changes //switch define ;-)
- return (ILstring)_ilVersion;
+ return (ILconst_string)_ilVersion;
case IL_LOAD_EXT:
- return (ILstring)_ilLoadExt;
+ return (ILconst_string)_ilLoadExt;
case IL_SAVE_EXT:
- return (ILstring)_ilSaveExt;
+ return (ILconst_string)_ilSaveExt;
case IL_TGA_ID_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilTgaId;
+ return (ILconst_string)ilStates[ilCurrentPos].ilTgaId;
case IL_TGA_AUTHNAME_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilTgaAuthName;
+ return (ILconst_string)ilStates[ilCurrentPos].ilTgaAuthName;
case IL_TGA_AUTHCOMMENT_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilTgaAuthComment;
+ return (ILconst_string)ilStates[ilCurrentPos].ilTgaAuthComment;
case IL_PNG_AUTHNAME_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilPngAuthName;
+ return (ILconst_string)ilStates[ilCurrentPos].ilPngAuthName;
case IL_PNG_TITLE_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilPngTitle;
+ return (ILconst_string)ilStates[ilCurrentPos].ilPngTitle;
case IL_PNG_DESCRIPTION_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilPngDescription;
+ return (ILconst_string)ilStates[ilCurrentPos].ilPngDescription;
//2003-08-31: added tif strings
case IL_TIF_DESCRIPTION_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilTifDescription;
+ return (ILconst_string)ilStates[ilCurrentPos].ilTifDescription;
case IL_TIF_HOSTCOMPUTER_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilTifHostComputer;
+ return (ILconst_string)ilStates[ilCurrentPos].ilTifHostComputer;
case IL_TIF_DOCUMENTNAME_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilTifDocumentName;
+ return (ILconst_string)ilStates[ilCurrentPos].ilTifDocumentName;
case IL_TIF_AUTHNAME_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilTifAuthName;
+ return (ILconst_string)ilStates[ilCurrentPos].ilTifAuthName;
case IL_CHEAD_HEADER_STRING:
- return (ILstring)ilStates[ilCurrentPos].ilCHeader;
+ return (ILconst_string)ilStates[ilCurrentPos].ilCHeader;
default:
ilSetError(IL_INVALID_ENUM);
break;
diff --git a/DevIL/src-IL/src/il_wbmp.c b/DevIL/src-IL/src/il_wbmp.c
index da9b0c37..cdf322b1 100755
--- a/DevIL/src-IL/src/il_wbmp.c
+++ b/DevIL/src-IL/src/il_wbmp.c
@@ -196,7 +196,7 @@ ILboolean ilSaveWbmpF(ILHANDLE File)
//! Writes a Wbmp to a memory "lump"
-ILboolean ilSaveWbmpL(void *Lump, ILuint Size)
+ILboolean ilSaveWbmpL(const void *Lump, ILuint Size)
{
iSetOutputLump(Lump, Size);
return iSaveWbmpInternal();