compile on Linux

This commit is contained in:
David Rose 2004-03-17 01:41:29 +00:00
parent 83a138529d
commit 55181edef0
6 changed files with 39 additions and 27 deletions

View File

@ -179,12 +179,12 @@ BMPreadinfoheader(
int *pclassv) int *pclassv)
{ {
unsigned long cbFix; unsigned long cbFix;
unsigned short cPlanes; unsigned short cPlanes = 0;
unsigned long cx; unsigned long cx = 0;
unsigned long cy; unsigned long cy = 0;
unsigned short cBitCount; unsigned short cBitCount = 0;
int classv; int classv = 0;
cbFix = GetLong(fp); cbFix = GetLong(fp);
@ -315,7 +315,7 @@ BMPreadrow(
pixval *G, pixval *G,
pixval *B) pixval *B)
{ {
BITSTREAM b; BITSTREAM b = NULL;
unsigned nbyte = 0; unsigned nbyte = 0;
int rc; int rc;
unsigned x; unsigned x;

View File

@ -143,7 +143,7 @@ BMPwriteinfoheader(
unsigned long x, unsigned long x,
unsigned long y) unsigned long y)
{ {
long cbFix; long cbFix = 0;
/* cbFix */ /* cbFix */
switch (classv) switch (classv)

View File

@ -31,6 +31,14 @@
#include <windows.h> // we need to include this before jpeglib. #include <windows.h> // we need to include this before jpeglib.
#endif #endif
#ifdef HAVE_PNG
// If we are going to be including png.h (in the unrelated file
// pnmFileTypePNG.h), be sure to include it before including setjmp.h.
// Ugly hack due to png weirdness with setjmp.
#include <png.h>
#endif
extern "C" { extern "C" {
#include <stdio.h> // jpeglib requires this to be included first. #include <stdio.h> // jpeglib requires this to be included first.
#include <jpeglib.h> #include <jpeglib.h>

View File

@ -351,7 +351,10 @@ read_data(xel *array, xelval *alpha_data) {
for (yi = 0; yi < num_rows; yi++) { for (yi = 0; yi < num_rows; yi++) {
png_bytep source = rows[yi]; png_bytep source = rows[yi];
for (int xi = 0; xi < _x_size; xi++) { for (int xi = 0; xi < _x_size; xi++) {
int red, green, blue, alpha; int red = 0;
int green = 0;
int blue = 0;
int alpha = 0;
if (_maxval > 255) { if (_maxval > 255) {
if (get_color) { if (get_color) {
@ -430,7 +433,7 @@ void PNMFileTypePNG::Reader::
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) {
Reader *self = (Reader *)png_get_io_ptr(png_ptr); Reader *self = (Reader *)png_get_io_ptr(png_ptr);
self->_file->read((char *)data, length); self->_file->read((char *)data, length);
if (self->_file->gcount() != length) { if (length != (png_size_t)self->_file->gcount()) {
pnmimage_png_cat.error() pnmimage_png_cat.error()
<< "Didn't read enough bytes.\n"; << "Didn't read enough bytes.\n";
// Is there no way to indicate a read failure to libpng? // Is there no way to indicate a read failure to libpng?

View File

@ -346,7 +346,7 @@ read_channel(istream *ifp,
TabEntry *table, TabEntry *table,
ScanElem *channel_data, long table_start, ScanElem *channel_data, long table_start,
int channel, int row) { int channel, int row) {
ScanElem *temp; ScanElem *temp = NULL;
int sgi_index, i; int sgi_index, i;
long offset, length; long offset, length;

View File

@ -646,43 +646,44 @@ readtga( istream *ifp, struct ImageHeader *tgaP, const string &magic_number ) {
void PNMFileTypeTGA::Reader:: void PNMFileTypeTGA::Reader::
get_map_entry( istream *ifp, pixel *Value, int Size, gray *Alpha ) { get_map_entry( istream *ifp, pixel *Value, int Size, gray *Alpha ) {
unsigned char j, k, r, g, b, a; unsigned char j, k;
unsigned char r = 0, g = 0, b = 0, a = 0;
/* Read appropriate number of bytes, break into rgb & put in map. */ /* Read appropriate number of bytes, break into rgb & put in map. */
switch ( Size ) switch ( Size )
{ {
case 8: /* Grey scale, read and triplicate. */ case 8: /* Grey scale, read and triplicate. */
r = g = b = getbyte( ifp ); r = g = b = getbyte( ifp );
a = 0; a = 0;
break; break;
case 16: /* 5 bits each of red green and blue. */ case 16: /* 5 bits each of red green and blue. */
case 15: /* Watch for byte order. */ case 15: /* Watch for byte order. */
j = getbyte( ifp ); j = getbyte( ifp );
k = getbyte( ifp ); k = getbyte( ifp );
r = ( k & 0x7C ) >> 2; r = ( k & 0x7C ) >> 2;
g = ( ( k & 0x03 ) << 3 ) + ( ( j & 0xE0 ) >> 5 ); g = ( ( k & 0x03 ) << 3 ) + ( ( j & 0xE0 ) >> 5 );
b = j & 0x1F; b = j & 0x1F;
a = 0; a = 0;
break; break;
case 32: /* 8 bits each of blue, green, red, and alpha */ case 32: /* 8 bits each of blue, green, red, and alpha */
case 24: /* 8 bits each of blue green and red. */ case 24: /* 8 bits each of blue green and red. */
b = getbyte( ifp ); b = getbyte( ifp );
g = getbyte( ifp ); g = getbyte( ifp );
r = getbyte( ifp ); r = getbyte( ifp );
if ( Size == 32 ) if ( Size == 32 )
a = getbyte( ifp ); a = getbyte( ifp );
else else
a = 0; a = 0;
break; break;
default: default:
pm_error( "unknown colormap pixel size (#2) - %d", Size ); pm_error( "unknown colormap pixel size (#2) - %d", Size );
} }
PPM_ASSIGN( *Value, r, g, b ); PPM_ASSIGN( *Value, r, g, b );
*Alpha = a; *Alpha = a;
} }