From: <jim...@us...> - 2006-11-15 06:28:49
|
Revision: 599 http://svn.sourceforge.net/panotools/?rev=599&view=rev Author: jim0watters Date: 2006-11-14 22:28:49 -0800 (Tue, 14 Nov 2006) Log Message: ----------- created file i/o functions with error checking to replace macro. Modified Paths: -------------- trunk/libpano/ChangeLog trunk/libpano/filter.c trunk/libpano/filter.h trunk/libpano/jpeg.c Modified: trunk/libpano/ChangeLog =================================================================== --- trunk/libpano/ChangeLog 2006-11-13 06:33:23 UTC (rev 598) +++ trunk/libpano/ChangeLog 2006-11-15 06:28:49 UTC (rev 599) @@ -1,3 +1,7 @@ +2006-11-15 Jim <jwa...@ph...> + + * filter.h, filter.cpp created file i/o funtions with error checking to replace macro. + 2006-11-12 Jim <jwa...@ph...> * Updated MSVC project file to build current version. Add files. Modified: trunk/libpano/filter.c =================================================================== --- trunk/libpano/filter.c 2006-11-13 06:33:23 UTC (rev 598) +++ trunk/libpano/filter.c 2006-11-15 06:28:49 UTC (rev 599) @@ -1265,3 +1265,67 @@ printf("**EndMetadata***%s\n", message); } + +/* ENDIAN aware file i/o funtions. Used for reading and writing photoshop files */ +BOOL panoWriteUCHAR(file_spec fnum, UCHAR theChar ) +{ + size_t count = 1; + mywrite( fnum, count, &theChar ); + return(count == 1); +} + +BOOL panoWriteSHORT(file_spec fnum, USHORT theShort ) +{ + size_t count = 2; + char data[2], *d; + d = data; + SHORTNUMBER( theShort, d ); + mywrite( fnum, count, data ); + return(count == 2); +} + +BOOL panoWriteINT32(file_spec fnum, ULONG theLong ) +{ + size_t count = 4; + char data[4], *d; + d = data; + LONGNUMBER( theLong, d ); + mywrite( fnum, count, data ); + return(count == 4); +} + +BOOL panoReadUCHAR(file_spec fnum, UCHAR *pChar ) +{ + size_t count = 1; + myread( fnum, count, pChar ); + return (count == 1); +} + +BOOL panoReadSHORT(file_spec fnum, USHORT *pShort ) +{ + size_t count = 2; + char data[2], *d; + myread( fnum, count, data ); + if(count != 2) + { + return FALSE; + } + d = data; + NUMBERSHORT( (*pShort), d ); + return TRUE; +} + +BOOL panoReadINT32(file_spec fnum, ULONG *pLong ) +{ + size_t count = 4; + char data[4], *d; + myread( fnum, count, data ); + if(count != 4) + { + return FALSE; + } + d = data; + NUMBERLONG( (*pLong), d ); + return TRUE; +} + Modified: trunk/libpano/filter.h =================================================================== --- trunk/libpano/filter.h 2006-11-13 06:33:23 UTC (rev 598) +++ trunk/libpano/filter.h 2006-11-15 06:28:49 UTC (rev 599) @@ -655,7 +655,7 @@ int LaunchAndSendScript(char* application, char* script); aPrefs* readAdjustLine( fullPath *theScript ); -#ifdef __Mac__ +#if 1 //def __Mac__ int readImage ( Image *im, fullPath *sfile ); int writeImage ( Image *im, fullPath *sfile ); int makeTempPath ( fullPath *path ); @@ -902,6 +902,7 @@ #endif // PT_BIGENDIAN +//TODO: JMW These File i/o macros are to be replaced in code with the error catching functions below #define WRITEUCHAR( theChar ) ch = theChar; count = 1; mywrite(fnum,count,&ch); #define WRITESHORT( theShort ) svar = theShort; d = data; SHORTNUMBER( svar, d ); \ @@ -968,6 +969,14 @@ #endif +/* ENDIAN aware file i/o funtions. Used for reading and writing photoshop files */ +BOOL panoWriteUCHAR(file_spec fnum, UCHAR theChar ); +BOOL panoWriteSHORT(file_spec fnum, USHORT theShort ); +BOOL panoWriteINT32(file_spec fnum, ULONG theLong ); +BOOL panoReadUCHAR (file_spec fnum, UCHAR *pChar ); +BOOL panoReadSHORT (file_spec fnum, USHORT *pShort ); +BOOL panoReadINT32 (file_spec fnum, ULONG *pLong ); + #define PANO_DEFAULT_PIXELS_PER_RESOLUTION 150.0 #define PANO_DEFAULT_TIFF_RESOLUTION_UNITS RESUNIT_INCH Modified: trunk/libpano/jpeg.c =================================================================== --- trunk/libpano/jpeg.c 2006-11-13 06:33:23 UTC (rev 598) +++ trunk/libpano/jpeg.c 2006-11-15 06:28:49 UTC (rev 599) @@ -1,6 +1,6 @@ #include <stdio.h> #include <jpeglib.h> -#define __NO_SYSTEM__ +//#define __NO_SYSTEM__ #include "filter.h" #include "metadata.h" #include "file.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |