Fix a confusion with the big-endian versus little endian saving of the
magic four bytes to recognize native (BMessage-based) icons. The file recognition rule didn't work in the end. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27951 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -740,7 +740,7 @@ IconEditorApp::_InstallDocumentMimeType()
|
||||
strerror(ret));
|
||||
|
||||
// set sniffer rule
|
||||
const char* snifferRule = "0.9 ('GSMI')";
|
||||
const char* snifferRule = "0.9 ('IMSG')";
|
||||
ret = mime.SetSnifferRule(snifferRule);
|
||||
if (ret < B_OK) {
|
||||
BString parseError;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#include "Defines.h"
|
||||
|
||||
const uint32 kNativeIconMagicNumber = 'GSMI';
|
||||
const uint32 kNativeIconMagicNumber = 'IMSG';
|
||||
const char* kNativeIconMimeType = "application/x-vnd.Haiku-icon";
|
||||
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ MessageExporter::Export(const Icon* icon, BPositionIO* stream)
|
||||
// later tells us that this file is one of us
|
||||
if (ret == B_OK) {
|
||||
ssize_t size = sizeof(uint32);
|
||||
uint32 magic = B_HOST_TO_LENDIAN_INT32(kNativeIconMagicNumber);
|
||||
uint32 magic = B_HOST_TO_BENDIAN_INT32(kNativeIconMagicNumber);
|
||||
ssize_t written = stream->Write(&magic, size);
|
||||
if (written != size) {
|
||||
if (written < 0)
|
||||
|
||||
@@ -59,7 +59,7 @@ MessageImporter::Import(Icon* icon, BPositionIO* stream)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (B_LENDIAN_TO_HOST_INT32(magic) != kNativeIconMagicNumber) {
|
||||
if (B_BENDIAN_TO_HOST_INT32(magic) != kNativeIconMagicNumber) {
|
||||
// this might be an old native icon file, where
|
||||
// we didn't prepend the magic number yet, seek back
|
||||
if (stream->Seek(position, SEEK_SET) != position) {
|
||||
|
||||
Reference in New Issue
Block a user