decreased whitespace between files, modified error message text
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7273 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -83,7 +83,7 @@ pngcb_flush_data(png_structp ppng)
|
|||||||
void
|
void
|
||||||
PrintPNGInfo(const char *path)
|
PrintPNGInfo(const char *path)
|
||||||
{
|
{
|
||||||
printf("\n\n--- %s ---\n", path);
|
printf("\n--- %s ---\n", path);
|
||||||
|
|
||||||
BFile *pfile;
|
BFile *pfile;
|
||||||
pfile = new BFile(path, B_READ_ONLY);
|
pfile = new BFile(path, B_READ_ONLY);
|
||||||
@@ -101,10 +101,10 @@ PrintPNGInfo(const char *path)
|
|||||||
}
|
}
|
||||||
if (!png_check_sig(buf, kSigSize)) {
|
if (!png_check_sig(buf, kSigSize)) {
|
||||||
// if first 8 bytes of stream don't match PNG signature bail
|
// if first 8 bytes of stream don't match PNG signature bail
|
||||||
printf("File doesn't begin with PNG signature\n");
|
printf("Error: file doesn't begin with PNG signature\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use libpng to get info about the file
|
// use libpng to get info about the file
|
||||||
png_structp ppng = NULL;
|
png_structp ppng = NULL;
|
||||||
png_infop pinfo = NULL;
|
png_infop pinfo = NULL;
|
||||||
@@ -118,11 +118,13 @@ PrintPNGInfo(const char *path)
|
|||||||
if (!pinfo)
|
if (!pinfo)
|
||||||
break;
|
break;
|
||||||
// set error handling
|
// set error handling
|
||||||
if (setjmp(png_jmpbuf(ppng)))
|
if (setjmp(png_jmpbuf(ppng))) {
|
||||||
// When an error occurs in libpng, it uses
|
// When an error occurs in libpng, it uses
|
||||||
// the longjmp function to continue execution
|
// the longjmp function to continue execution
|
||||||
// from this point
|
// from this point
|
||||||
|
printf("Error: error in libpng function\n");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// set read callback function
|
// set read callback function
|
||||||
png_set_read_fn(ppng, static_cast<void *>(pio), pngcb_read_data);
|
png_set_read_fn(ppng, static_cast<void *>(pio), pngcb_read_data);
|
||||||
@@ -130,12 +132,12 @@ PrintPNGInfo(const char *path)
|
|||||||
// Read in PNG image info
|
// Read in PNG image info
|
||||||
png_set_sig_bytes(ppng, 8);
|
png_set_sig_bytes(ppng, 8);
|
||||||
png_read_info(ppng, pinfo);
|
png_read_info(ppng, pinfo);
|
||||||
|
|
||||||
png_uint_32 width, height;
|
png_uint_32 width, height;
|
||||||
int bit_depth, color_type, interlace_type, compression_type, filter_type;
|
int bit_depth, color_type, interlace_type, compression_type, filter_type;
|
||||||
png_get_IHDR(ppng, pinfo, &width, &height, &bit_depth, &color_type,
|
png_get_IHDR(ppng, pinfo, &width, &height, &bit_depth, &color_type,
|
||||||
&interlace_type, &compression_type, &filter_type);
|
&interlace_type, &compression_type, &filter_type);
|
||||||
|
|
||||||
printf(" width: %u\n", width);
|
printf(" width: %u\n", width);
|
||||||
printf(" height: %u\n", height);
|
printf(" height: %u\n", height);
|
||||||
printf(" row bytes: %u\n", pinfo->rowbytes);
|
printf(" row bytes: %u\n", pinfo->rowbytes);
|
||||||
|
|||||||
Reference in New Issue
Block a user