summaryrefslogtreecommitdiff
path: root/src/im_file.cpp
diff options
context:
space:
mode:
authorscuri <scuri>2009-08-23 23:57:50 +0000
committerscuri <scuri>2009-08-23 23:57:50 +0000
commit67475cb6aa3af3a0c65351562c22f25814a45fcb (patch)
treeea2698cddce9503641e5546166dbbb51d8d677db /src/im_file.cpp
parent36e80e6481f7518e8005527d8965148039ba8dc2 (diff)
*** empty log message ***
Diffstat (limited to 'src/im_file.cpp')
-rw-r--r--src/im_file.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/im_file.cpp b/src/im_file.cpp
index 5cfe49d..3bfa779 100644
--- a/src/im_file.cpp
+++ b/src/im_file.cpp
@@ -2,7 +2,7 @@
* \brief File Access
*
* See Copyright Notice in im_lib.h
- * $Id: im_file.cpp,v 1.4 2009/08/19 18:39:43 scuri Exp $
+ * $Id: im_file.cpp,v 1.5 2009/08/23 23:57:51 scuri Exp $
*/
#include <stdlib.h>
@@ -45,6 +45,16 @@ void imFileClear(imFile* ifile)
ifile->palette[i] = imColorEncode((imbyte)i, (imbyte)i, (imbyte)i);
}
+void imFileSetBaseAttributes(imFile* ifile)
+{
+ imFileFormatBase* ifileformat = (imFileFormatBase*)ifile;
+ imAttribTable* atable = (imAttribTable*)ifileformat->attrib_table;
+
+ atable->Set("FileFormat", IM_BYTE, -1, ifileformat->iformat->format);
+ atable->Set("FileCompression", IM_BYTE, -1, ifileformat->compression);
+ atable->Set("FileImageCount", IM_INT, 1, &ifileformat->image_count);
+}
+
imFile* imFileOpen(const char* file_name, int *error)
{
assert(file_name);
@@ -56,9 +66,7 @@ imFile* imFileOpen(const char* file_name, int *error)
imFileClear(ifileformat);
ifileformat->attrib_table = new imAttribTable(599);
- imFileSetAttribute(ifileformat, "FileFormat", IM_BYTE, -1, ifileformat->iformat->format);
- imFileSetAttribute(ifileformat, "FileCompression", IM_BYTE, -1, ifileformat->compression);
- imFileSetAttribute(ifileformat, "FileImageCount", IM_INT, 1, &ifileformat->image_count);
+ imFileSetBaseAttributes(ifileformat);
ifileformat->counter = imCounterBegin(file_name);
@@ -76,9 +84,7 @@ imFile* imFileOpenAs(const char* file_name, const char* format, int *error)
imFileClear(ifileformat);
ifileformat->attrib_table = new imAttribTable(599);
- imFileSetAttribute(ifileformat, "FileFormat", IM_BYTE, -1, ifileformat->iformat->format);
- imFileSetAttribute(ifileformat, "FileCompression", IM_BYTE, -1, ifileformat->compression);
- imFileSetAttribute(ifileformat, "FileImageCount", IM_INT, 1, &ifileformat->image_count);
+ imFileSetBaseAttributes(ifileformat);
ifileformat->counter = imCounterBegin(file_name);