Now writes the file type of the PNG files as well. This fixes bug #374, even though

it only cures the symptoms, ie. bug #194 remains valid (broken file types when built
from Linux).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16954 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-04-01 15:51:48 +00:00
parent a1a04a4742
commit 82e704cd1b

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2005, Haiku.
* Copyright 2001-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -11,17 +11,16 @@
#include "PNGDump.h"
#include <NodeInfo.h>
#include <Rect.h>
#include <png.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <png.h>
#include <Rect.h>
#include <OS.h>
#include "frame_buffer_support.h"
#define TRACE_PNGDUMP
#ifdef TRACE_PNGDUMP
@ -30,6 +29,7 @@
# define TRACE(x) ;
#endif
status_t
SaveToPNG(const char* filename, const BRect& bounds, color_space space,
const void* bits, int32 bitsLength, int32 bytesPerRow)
@ -113,5 +113,13 @@ SaveToPNG(const char* filename, const BRect& bounds, color_space space,
png_destroy_write_struct(&png, NULL);
fclose(file);
// Set the file type manually, so that it doesn't have to be
// picked up by the registrar or Tracker, first
BNode node(filename);
BNodeInfo nodeInfo(&node);
if (nodeInfo.InitCheck() == B_OK)
nodeInfo.SetType("image/png");
return B_OK;
}