From 501b323ead05ff80e1aad3c05c400e73ca67cc37 Mon Sep 17 00:00:00 2001 From: cxgeorge <> Date: Wed, 6 Jun 2001 23:18:58 +0000 Subject: [PATCH] elim name conflicts --- panda/src/pnm/ppmcmap.h | 5 + panda/src/pnmimagetypes/pnmFileTypeAlias.cxx | 32 +++--- panda/src/pnmimagetypes/pnmFileTypeBMP.cxx | 12 +-- panda/src/pnmimagetypes/pnmFileTypeIMG.cxx | 34 +++---- panda/src/pnmimagetypes/pnmFileTypeJPG.cxx | 12 +-- panda/src/pnmimagetypes/pnmFileTypePNM.cxx | 12 +-- .../src/pnmimagetypes/pnmFileTypeRadiance.cxx | 12 +-- panda/src/pnmimagetypes/pnmFileTypeSGI.cxx | 12 +-- .../pnmimagetypes/pnmFileTypeSoftImage.cxx | 98 +++++++++---------- panda/src/pnmimagetypes/pnmFileTypeTGA.cxx | 12 +-- panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx | 12 +-- panda/src/pnmimagetypes/pnmFileTypeYUV.cxx | 12 +-- panda/src/pnmimagetypes/sgi.h | 5 +- 13 files changed, 139 insertions(+), 131 deletions(-) diff --git a/panda/src/pnm/ppmcmap.h b/panda/src/pnm/ppmcmap.h index 5f7e5e300c..2a2eb3db5c 100644 --- a/panda/src/pnm/ppmcmap.h +++ b/panda/src/pnm/ppmcmap.h @@ -3,6 +3,9 @@ /* Color histogram stuff. */ +#ifndef PPMCMAP_H +#define PPMCMAP_H + typedef struct colorhist_item* colorhist_vector; struct colorhist_item { @@ -43,3 +46,5 @@ int ppm_addtocolorhash ARGS(( colorhash_table cht, pixel* colorP, int value )); colorhash_table ppm_alloccolorhash ARGS(( void )); void ppm_freecolorhash( colorhash_table cht ); + +#endif diff --git a/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx b/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx index 9354acee50..b58d89e672 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx @@ -27,10 +27,10 @@ // or height is larger than this, it must be bogus. #define INSANE_SIZE 20000 -static const char * const extensions[] = { +static const char * const extensions_ALIAS[] = { "pix", "als" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_ALIAS = sizeof(extensions_ALIAS) / sizeof(const char *); TypeHandle PNMFileTypeAlias::_type_handle; @@ -57,11 +57,11 @@ get_name() const { // Function: PNMFileTypeAlias::get_num_extensions // Access: Public, Virtual // Description: Returns the number of different possible filename -// extensions associated with this particular file type. +// extensions_ALIAS associated with this particular file type. //////////////////////////////////////////////////////////////////// int PNMFileTypeAlias:: get_num_extensions() const { - return num_extensions; + return num_extensions_ALIAS; } //////////////////////////////////////////////////////////////////// @@ -73,8 +73,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypeAlias:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_ALIAS, string()); + return extensions_ALIAS[n]; } //////////////////////////////////////////////////////////////////// @@ -124,7 +124,7 @@ read_ushort(FILE *file) { } inline unsigned char -read_uchar(FILE *file) { +read_uchar_ALIAS(FILE *file) { int x; x = getc(file); return (x!=EOF) ? (unsigned char)x : 0; @@ -136,7 +136,7 @@ write_ushort(FILE *file, unsigned short x) { } inline void -write_uchar(FILE *file, unsigned char x) { +write_uchar_ALIAS(FILE *file, unsigned char x) { putc(x, file); } @@ -240,15 +240,15 @@ read_row(xel *row_data, xelval *) { x = 0; while (x < _x_size) { - num = read_uchar(_file); + num = read_uchar_ALIAS(_file); if (num==0 || x+num > _x_size) { return false; } - blu = read_uchar(_file); + blu = read_uchar_ALIAS(_file); if (get_color_type() == PNMImageHeader::CT_color) { - grn = read_uchar(_file); - red = read_uchar(_file); + grn = read_uchar_ALIAS(_file); + red = read_uchar_ALIAS(_file); while (num>0) { PPM_ASSIGN(row_data[x], red, grn, blu); x++; @@ -272,10 +272,10 @@ static int num_count = 0; static void flush_color(FILE *file) { if (num_count>0) { - write_uchar(file, num_count); - write_uchar(file, last_blu); - write_uchar(file, last_grn); - write_uchar(file, last_red); + write_uchar_ALIAS(file, num_count); + write_uchar_ALIAS(file, last_blu); + write_uchar_ALIAS(file, last_grn); + write_uchar_ALIAS(file, last_red); num_count = 0; } } diff --git a/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx b/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx index e05623511c..0c7dfee97d 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx @@ -22,10 +22,10 @@ #include #include -static const char * const extensions[] = { +static const char * const extensions_BMP[] = { "bmp" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_BMP = sizeof(extensions_BMP) / sizeof(const char *); TypeHandle PNMFileTypeBMP::_type_handle; @@ -52,11 +52,11 @@ get_name() const { // Function: PNMFileTypeBMP::get_num_extensions // Access: Public, Virtual // Description: Returns the number of different possible filename -// extensions associated with this particular file type. +// extensions_BMP associated with this particular file type. //////////////////////////////////////////////////////////////////// int PNMFileTypeBMP:: get_num_extensions() const { - return num_extensions; + return num_extensions_BMP; } //////////////////////////////////////////////////////////////////// @@ -68,8 +68,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypeBMP:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_BMP, string()); + return extensions_BMP[n]; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx b/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx index c82fe6dbd1..0ed79e5cbe 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx @@ -27,10 +27,10 @@ // larger than this, it must be bogus. #define INSANE_SIZE 20000 -static const char * const extensions[] = { +static const char * const extensionsIMG[] = { "img" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_IMG = sizeof(extensionsIMG) / sizeof(const char *); TypeHandle PNMFileTypeIMG::_type_handle; @@ -61,7 +61,7 @@ get_name() const { //////////////////////////////////////////////////////////////////// int PNMFileTypeIMG:: get_num_extensions() const { - return num_extensions; + return num_extensions_IMG; } //////////////////////////////////////////////////////////////////// @@ -73,8 +73,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypeIMG:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_IMG, string()); + return extensionsIMG[n]; } //////////////////////////////////////////////////////////////////// @@ -123,13 +123,13 @@ read_ulong(FILE *file) { } inline unsigned short -read_ushort(FILE *file) { +read_ushort_IMG(FILE *file) { unsigned short x; return pm_readbigshort(file, (short *)&x)==0 ? x : 0; } inline unsigned char -read_uchar(FILE *file) { +read_uchar_IMG(FILE *file) { int x; x = getc(file); return (x!=EOF) ? (unsigned char)x : 0; @@ -141,12 +141,12 @@ write_ulong(FILE *file, unsigned long x) { } inline void -write_ushort(FILE *file, unsigned long x) { +write_ushort_IMG(FILE *file, unsigned long x) { pm_writebigshort(file, (short)(long)x); } inline void -write_uchar(FILE *file, unsigned char x) { +write_uchar_IMG(FILE *file, unsigned char x) { putc(x, file); } @@ -258,9 +258,9 @@ read_row(xel *row_data, xelval *) { int x; xelval red, grn, blu; for (x = 0; x < _x_size; x++) { - red = read_uchar(_file); - grn = read_uchar(_file); - blu = read_uchar(_file); + red = read_uchar_IMG(_file); + grn = read_uchar_IMG(_file); + blu = read_uchar_IMG(_file); PPM_ASSIGN(row_data[x], red, grn, blu); } @@ -314,8 +314,8 @@ write_header() { write_ulong(_file, _x_size); write_ulong(_file, _y_size); } else if (img_header_type == IHT_short) { - write_ushort(_file, _x_size); - write_ushort(_file, _y_size); + write_ushort_IMG(_file, _x_size); + write_ushort_IMG(_file, _y_size); } return true; } @@ -339,9 +339,9 @@ bool PNMFileTypeIMG::Writer:: write_row(xel *row_data, xelval *) { int x; for (x = 0; x < _x_size; x++) { - write_uchar(_file, (unsigned char)(255*PPM_GETR(row_data[x])/_maxval)); - write_uchar(_file, (unsigned char)(255*PPM_GETG(row_data[x])/_maxval)); - write_uchar(_file, (unsigned char)(255*PPM_GETB(row_data[x])/_maxval)); + write_uchar_IMG(_file, (unsigned char)(255*PPM_GETR(row_data[x])/_maxval)); + write_uchar_IMG(_file, (unsigned char)(255*PPM_GETG(row_data[x])/_maxval)); + write_uchar_IMG(_file, (unsigned char)(255*PPM_GETB(row_data[x])/_maxval)); } return true; diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx b/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx index de76091b98..39dd03e687 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx @@ -22,10 +22,10 @@ #include #include -static const char * const extensions[] = { +static const char * const extensions_JPG[] = { "jpg", "jpeg" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_JPG = sizeof(extensions_JPG) / sizeof(const char *); TypeHandle PNMFileTypeJPG::_type_handle; @@ -52,11 +52,11 @@ get_name() const { // Function: PNMFileTypeJPG::get_num_extensions // Access: Public, Virtual // Description: Returns the number of different possible filename -// extensions associated with this particular file type. +// extensions_JPG associated with this particular file type. //////////////////////////////////////////////////////////////////// int PNMFileTypeJPG:: get_num_extensions() const { - return num_extensions; + return num_extensions_JPG; } //////////////////////////////////////////////////////////////////// @@ -68,8 +68,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypeJPG:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_JPG, string()); + return extensions_JPG[n]; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimagetypes/pnmFileTypePNM.cxx b/panda/src/pnmimagetypes/pnmFileTypePNM.cxx index 7f1f978c1a..86daaa5439 100644 --- a/panda/src/pnmimagetypes/pnmFileTypePNM.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypePNM.cxx @@ -32,10 +32,10 @@ extern "C" { #include "../pnm/libpbm.h" } -static const char * const extensions[] = { +static const char * const extensions_PNM[] = { "pbm", "ppm", "pnm" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_PNM = sizeof(extensions_PNM) / sizeof(const char *); TypeHandle PNMFileTypePNM::_type_handle; @@ -62,11 +62,11 @@ get_name() const { // Function: PNMFileTypePNM::get_num_extensions // Access: Public, Virtual // Description: Returns the number of different possible filename -// extensions associated with this particular file type. +// extensions_PNM associated with this particular file type. //////////////////////////////////////////////////////////////////// int PNMFileTypePNM:: get_num_extensions() const { - return num_extensions; + return num_extensions_PNM; } //////////////////////////////////////////////////////////////////// @@ -78,8 +78,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypePNM:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_PNM, string()); + return extensions_PNM[n]; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimagetypes/pnmFileTypeRadiance.cxx b/panda/src/pnmimagetypes/pnmFileTypeRadiance.cxx index ad0d686b5a..d837ae3541 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeRadiance.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeRadiance.cxx @@ -39,10 +39,10 @@ extern "C" { void gambs_colrs(COLR *, int); } -static const char * const extensions[] = { +static const char * const extensions_RAD[] = { "pic", "rad" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_RAD = sizeof(extensions_RAD) / sizeof(const char *); TypeHandle PNMFileTypeRadiance::_type_handle; @@ -72,11 +72,11 @@ get_name() const { // Function: PNMFileTypeRadiance::get_num_extensions // Access: Public, Virtual // Description: Returns the number of different possible filename -// extensions associated with this particular file type. +// extensions_RAD associated with this particular file type. //////////////////////////////////////////////////////////////////// int PNMFileTypeRadiance:: get_num_extensions() const { - return num_extensions; + return num_extensions_RAD; } //////////////////////////////////////////////////////////////////// @@ -88,8 +88,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypeRadiance:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_RAD, string()); + return extensions_RAD[n]; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx b/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx index 4ca7b9b795..af4b3c3c11 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx @@ -23,10 +23,10 @@ #include #include -static const char * const extensions[] = { +static const char * const extensions_SGI[] = { "rgb", "rgba", "sgi" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_SGI = sizeof(extensions_SGI) / sizeof(const char *); TypeHandle PNMFileTypeSGI::_type_handle; @@ -53,11 +53,11 @@ get_name() const { // Function: PNMFileTypeSGI::get_num_extensions // Access: Public, Virtual // Description: Returns the number of different possible filename -// extensions associated with this particular file type. +// extensions_SGI associated with this particular file type. //////////////////////////////////////////////////////////////////// int PNMFileTypeSGI:: get_num_extensions() const { - return num_extensions; + return num_extensions_SGI; } //////////////////////////////////////////////////////////////////// @@ -69,8 +69,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypeSGI:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_SGI, string()); + return extensions_SGI[n]; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx b/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx index 1b24dd28ea..8d036a2e00 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx @@ -39,10 +39,10 @@ static const char imageComment[imageCommentLength+1] = #define SOFTIMAGE_MAGIC1 0x5380 #define SOFTIMAGE_MAGIC2 0xf634 -static const char * const extensions[] = { +static const char * const extensions_SI[] = { "pic", "soft" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_SI = sizeof(extensions_SI) / sizeof(const char *); TypeHandle PNMFileTypeSoftImage::_type_handle; @@ -58,25 +58,25 @@ read_float(FILE *file) { } inline unsigned short -read_ushort(FILE *file) { +read_ushort_SI(FILE *file) { unsigned short x; return pm_readbigshort(file, (short *)&x)==0 ? x : 0; } inline unsigned char -read_uchar(FILE *file) { +read_uchar_SI(FILE *file) { int x; x = getc(file); return (x!=EOF) ? (unsigned char)x : 0; } inline void -write_ushort(FILE *file, unsigned short x) { +write_ushort_SI(FILE *file, unsigned short x) { pm_writebigshort(file, (short)x); } inline void -write_uchar(FILE *file, unsigned char x) { +write_uchar_SI(FILE *file, unsigned char x) { putc(x, file); } @@ -88,10 +88,10 @@ write_float(FILE *file, float x) { static int read_channel_pkt(FILE *file, int &chained, int &size, int &type, int &channel) { - chained = read_uchar(file); - size = read_uchar(file); - type = read_uchar(file); - channel = read_uchar(file); + chained = read_uchar_SI(file); + size = read_uchar_SI(file); + type = read_uchar_SI(file); + channel = read_uchar_SI(file); if (feof(file)) { return false; @@ -109,9 +109,9 @@ read_channel_pkt(FILE *file, static void read_rgb(xel *row_data, xelval *, FILE *file, int x, int repeat) { xelval red, grn, blu; - red = read_uchar(file); - grn = read_uchar(file); - blu = read_uchar(file); + red = read_uchar_SI(file); + grn = read_uchar_SI(file); + blu = read_uchar_SI(file); while (repeat>0) { PPM_ASSIGN(row_data[x], red, grn, blu); @@ -122,7 +122,7 @@ read_rgb(xel *row_data, xelval *, FILE *file, int x, int repeat) { static void read_alpha(xel *, xelval *alpha_data, FILE *file, int x, int repeat) { - xelval alpha = read_uchar(file); + xelval alpha = read_uchar_SI(file); while (repeat>0) { alpha_data[x] = alpha; @@ -134,10 +134,10 @@ read_alpha(xel *, xelval *alpha_data, FILE *file, int x, int repeat) { static void read_rgba(xel *row_data, xelval *alpha_data, FILE *file, int x, int repeat) { xelval red, grn, blu, alpha; - red = read_uchar(file); - grn = read_uchar(file); - blu = read_uchar(file); - alpha = read_uchar(file); + red = read_uchar_SI(file); + grn = read_uchar_SI(file); + blu = read_uchar_SI(file); + alpha = read_uchar_SI(file); while (repeat>0) { PPM_ASSIGN(row_data[x], red, grn, blu); @@ -164,7 +164,7 @@ read_scanline(xel *row_data, xelval *alpha_data, int cols, FILE *file, x = 0; while (x < cols) { - num = read_uchar(file); + num = read_uchar_SI(file); if (num<128) { // Sequence of non-repeated values. @@ -183,7 +183,7 @@ read_scanline(xel *row_data, xelval *alpha_data, int cols, FILE *file, } else { // Sequence of repeated values. if (num==128) { - num = read_ushort(file); + num = read_ushort_SI(file); } else { num -= 127; } @@ -225,11 +225,11 @@ get_name() const { // Function: PNMFileTypeSoftImage::get_num_extensions // Access: Public, Virtual // Description: Returns the number of different possible filename -// extensions associated with this particular file type. +// extensions_SI associated with this particular file type. //////////////////////////////////////////////////////////////////// int PNMFileTypeSoftImage:: get_num_extensions() const { - return num_extensions; + return num_extensions_SI; } //////////////////////////////////////////////////////////////////// @@ -241,8 +241,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypeSoftImage:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_SI, string()); + return extensions_SI[n]; } //////////////////////////////////////////////////////////////////// @@ -359,12 +359,12 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : return; } - _x_size = read_ushort(_file); - _y_size = read_ushort(_file); + _x_size = read_ushort_SI(_file); + _y_size = read_ushort_SI(_file); /* float ratio = */ read_float(_file); - /* int fields = */ read_ushort(_file); - read_ushort(_file); + /* int fields = */ read_ushort_SI(_file); + read_ushort_SI(_file); int chained, size, channel; if (!read_channel_pkt(_file, chained, size, rgb_ctype, channel)) { @@ -494,17 +494,17 @@ read_row(xel *row_data, xelval *alpha_data) { static void write_channel_pkt(FILE *file, int chained, int size, int type, int channel) { - write_uchar(file, chained); - write_uchar(file, size); - write_uchar(file, type); - write_uchar(file, channel); + write_uchar_SI(file, chained); + write_uchar_SI(file, size); + write_uchar_SI(file, type); + write_uchar_SI(file, channel); } static void write_rgb(xel *row_data, xelval *, FILE *file, int x) { - write_uchar(file, PPM_GETR(row_data[x])); - write_uchar(file, PPM_GETG(row_data[x])); - write_uchar(file, PPM_GETB(row_data[x])); + write_uchar_SI(file, PPM_GETR(row_data[x])); + write_uchar_SI(file, PPM_GETG(row_data[x])); + write_uchar_SI(file, PPM_GETB(row_data[x])); } static int @@ -514,9 +514,9 @@ compare_rgb(xel *row_data, xelval *, int x1, int x2) { static void write_gray(xel *row_data, xelval *, FILE *file, int x) { - write_uchar(file, PPM_GETB(row_data[x])); - write_uchar(file, PPM_GETB(row_data[x])); - write_uchar(file, PPM_GETB(row_data[x])); + write_uchar_SI(file, PPM_GETB(row_data[x])); + write_uchar_SI(file, PPM_GETB(row_data[x])); + write_uchar_SI(file, PPM_GETB(row_data[x])); } static int @@ -526,7 +526,7 @@ compare_gray(xel *row_data, xelval *, int x1, int x2) { static void write_alpha(xel *, xelval *alpha_data, FILE *file, int x) { - write_uchar(file, alpha_data[x]); + write_uchar_SI(file, alpha_data[x]); } static int @@ -542,7 +542,7 @@ write_diff(xel *row_data, xelval *alpha_data, FILE *file, if (length>0) { nassertv(length<=128); - write_uchar(file, length-1); + write_uchar_SI(file, length-1); while (length>0) { length--; write_data(row_data, alpha_data, file, tox-length); @@ -560,10 +560,10 @@ write_same(xel *row_data, xelval *alpha_data, FILE *file, } else if (length>0) { if (length<128) { - write_uchar(file, length+127); + write_uchar_SI(file, length+127); } else { - write_uchar(file, 128); - write_ushort(file, length); + write_uchar_SI(file, 128); + write_ushort_SI(file, length); } write_data(row_data, alpha_data, file, tox); } @@ -702,19 +702,19 @@ supports_write_row() const { //////////////////////////////////////////////////////////////////// bool PNMFileTypeSoftImage::Writer:: write_header() { - write_ushort(_file, SOFTIMAGE_MAGIC1); - write_ushort(_file, SOFTIMAGE_MAGIC2); + write_ushort_SI(_file, SOFTIMAGE_MAGIC1); + write_ushort_SI(_file, SOFTIMAGE_MAGIC2); write_float(_file, imageVersionNumber); fwrite(imageComment, 1, imageCommentLength, _file); fwrite("PICT", 1, 4, _file); - write_ushort(_file, _x_size); - write_ushort(_file, _y_size); + write_ushort_SI(_file, _x_size); + write_ushort_SI(_file, _y_size); write_float(_file, 1.0); // pixel aspect ratio; we don't know. - write_ushort(_file, 3); // fields value; we don't really know either. - write_ushort(_file, 0); // padding + write_ushort_SI(_file, 3); // fields value; we don't really know either. + write_ushort_SI(_file, 0); // padding // There doesn't seem to be a variation on SoftImage image formats for // grayscale images. We'll write out grayscale as a 3-channel image. diff --git a/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx b/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx index 4a52fa80f2..a5113862b9 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx @@ -55,10 +55,10 @@ #include #include -static const char * const extensions[] = { +static const char * const extensions_TGA[] = { "tga" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_TGA = sizeof(extensions_TGA) / sizeof(const char *); TypeHandle PNMFileTypeTGA::_type_handle; @@ -123,11 +123,11 @@ get_name() const { // Function: PNMFileTypeTGA::get_num_extensions // Access: Public, Virtual // Description: Returns the number of different possible filename -// extensions associated with this particular file type. +// extensions_TGA associated with this particular file type. //////////////////////////////////////////////////////////////////// int PNMFileTypeTGA:: get_num_extensions() const { - return num_extensions; + return num_extensions_TGA; } //////////////////////////////////////////////////////////////////// @@ -139,8 +139,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypeTGA:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_TGA, string()); + return extensions_TGA[n]; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx index a6946d6278..2d677f491a 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx @@ -32,10 +32,10 @@ extern "C" { #include "../tiff/tiffio.h" } -static const char * const extensions[] = { +static const char * const extensions_TIFF[] = { "tiff", "tif" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_TIFF = sizeof(extensions_TIFF) / sizeof(const char *); // These are configurable parameters to specify TIFF details on output. // See tools/drr/../pnm/libtiff/tiff.h or type man pnmtotiff for a better @@ -151,11 +151,11 @@ get_name() const { // Function: PNMFileTypeTIFF::get_num_extensions // Access: Public, Virtual // Description: Returns the number of different possible filename -// extensions associated with this particular file type. +// extensions_TIFF associated with this particular file type. //////////////////////////////////////////////////////////////////// int PNMFileTypeTIFF:: get_num_extensions() const { - return num_extensions; + return num_extensions_TIFF; } //////////////////////////////////////////////////////////////////// @@ -167,8 +167,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypeTIFF:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_TIFF, string()); + return extensions_TIFF[n]; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimagetypes/pnmFileTypeYUV.cxx b/panda/src/pnmimagetypes/pnmFileTypeYUV.cxx index b302a41512..43139dd1ef 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeYUV.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeYUV.cxx @@ -70,10 +70,10 @@ /* x must be signed for the following to work correctly */ #define limit(x) (xelval)(((x>0xffffff)?0xff0000:((x<=0xffff)?0:x&0xff0000))>>16) -static const char * const extensions[] = { +static const char * const extensions_YUV[] = { "yuv" }; -static const int num_extensions = sizeof(extensions) / sizeof(const char *); +static const int num_extensions_YUV = sizeof(extensions_YUV) / sizeof(const char *); TypeHandle PNMFileTypeYUV::_type_handle; @@ -100,11 +100,11 @@ get_name() const { // Function: PNMFileTypeYUV::get_num_extensions // Access: Public, Virtual // Description: Returns the number of different possible filename -// extensions associated with this particular file type. +// extensions_YUV associated with this particular file type. //////////////////////////////////////////////////////////////////// int PNMFileTypeYUV:: get_num_extensions() const { - return num_extensions; + return num_extensions_YUV; } //////////////////////////////////////////////////////////////////// @@ -116,8 +116,8 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// string PNMFileTypeYUV:: get_extension(int n) const { - nassertr(n >= 0 && n < num_extensions, string()); - return extensions[n]; + nassertr(n >= 0 && n < num_extensions_YUV, string()); + return extensions_YUV[n]; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimagetypes/sgi.h b/panda/src/pnmimagetypes/sgi.h index 9fddf33c73..2b5df5c09a 100644 --- a/panda/src/pnmimagetypes/sgi.h +++ b/panda/src/pnmimagetypes/sgi.h @@ -16,6 +16,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef SGI_IMAGE_H +#define SGI_IMAGE_H + typedef struct { short magic; char storage; @@ -42,4 +45,4 @@ typedef struct { #define CMAP_SCREEN 2 /* not supported */ #define CMAP_COLORMAP 3 /* not supported */ - +#endif