Constructor no longer crashes when data == NULL.

Now exports B_CURSOR_SYSTEM_DEFAULT and B_CURSOR_I_BEAM - maybe they should
be part of AppDefs.cpp, though.
Style update.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8200 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-06-27 22:23:29 +00:00
parent 32081c1ebb
commit 917cf3f748
+29 -42
View File
@@ -1,5 +1,5 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS // Copyright (c) 2001-2004, Haiku
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
@@ -32,6 +32,7 @@
// Standard Includes ----------------------------------------------------------- // Standard Includes -----------------------------------------------------------
// System Includes ------------------------------------------------------------- // System Includes -------------------------------------------------------------
#include <AppDefs.h>
#include <Cursor.h> #include <Cursor.h>
#include <PortLink.h> #include <PortLink.h>
#include <PortMessage.h> #include <PortMessage.h>
@@ -40,24 +41,21 @@
// Project Includes ------------------------------------------------------------ // Project Includes ------------------------------------------------------------
#include <ServerProtocol.h> #include <ServerProtocol.h>
// Local Includes --------------------------------------------------------------
// Local Defines --------------------------------------------------------------- const BCursor *B_CURSOR_SYSTEM_DEFAULT;
const BCursor *B_CURSOR_I_BEAM;
// Globals --------------------------------------------------------------------- // these are initialized in BApplication::InitData()
//------------------------------------------------------------------------------
BCursor::BCursor(const void *cursorData) BCursor::BCursor(const void *cursorData)
{ {
int8 *data = (int8 *)cursorData; int8 *data = (int8 *)cursorData;
m_serverToken = 0; m_serverToken = 0;
if ( data[0] != 16 ) if (data == NULL
return; || data[0] != 16 // size
if ( data[1] != 1 ) || data[1] != 1 // depth
return; || data[2] >= 16 || data[3] >= 16) // hot-spot
if ( (data[2] >= 16) || (data[3] >= 16) )
return; return;
// Send data directly to server // Send data directly to server
@@ -65,18 +63,21 @@ BCursor::BCursor(const void *cursorData)
PortMessage msg; PortMessage msg;
serverlink.SetOpCode(AS_CREATE_BCURSOR); serverlink.SetOpCode(AS_CREATE_BCURSOR);
serverlink.Attach(cursorData,68); serverlink.Attach(cursorData, 68);
serverlink.FlushWithReply(&msg); serverlink.FlushWithReply(&msg);
msg.Read<int32>(&m_serverToken); msg.Read<int32>(&m_serverToken);
} }
//------------------------------------------------------------------------------
// undefined on BeOS // undefined on BeOS
BCursor::BCursor(BMessage *data) BCursor::BCursor(BMessage *data)
{ {
m_serverToken = 0; m_serverToken = 0;
} }
//------------------------------------------------------------------------------
BCursor::~BCursor() BCursor::~BCursor()
{ {
// Notify server to deallocate server-side objects for this cursor // Notify server to deallocate server-side objects for this cursor
@@ -85,49 +86,35 @@ BCursor::~BCursor()
serverlink.Attach<int32>(m_serverToken); serverlink.Attach<int32>(m_serverToken);
serverlink.Flush(); serverlink.Flush();
} }
//------------------------------------------------------------------------------
// not implemented on BeOS // not implemented on BeOS
status_t BCursor::Archive(BMessage *into, bool deep) const status_t BCursor::Archive(BMessage *into, bool deep) const
{ {
return B_OK; return B_OK;
} }
//------------------------------------------------------------------------------
// not implemented on BeOS // not implemented on BeOS
BArchivable *BCursor::Instantiate(BMessage *data) BArchivable *BCursor::Instantiate(BMessage *data)
{ {
return NULL; return NULL;
} }
//------------------------------------------------------------------------------
status_t BCursor::Perform(perform_code d, void *arg)
status_t
BCursor::Perform(perform_code d, void *arg)
{ {
/* /*
printf("perform %d\n", (int)d); printf("perform %d\n", (int)d);
*/ */
return B_OK; return B_OK;
} }
//------------------------------------------------------------------------------
void BCursor::_ReservedCursor1()
{
}
//------------------------------------------------------------------------------
void BCursor::_ReservedCursor2()
{
}
//------------------------------------------------------------------------------
void BCursor::_ReservedCursor3()
{
}
//------------------------------------------------------------------------------
void BCursor::_ReservedCursor4()
{
}
//------------------------------------------------------------------------------
/*
* $Log $
*
* $Id $
*
*/
void BCursor::_ReservedCursor1() {}
void BCursor::_ReservedCursor2() {}
void BCursor::_ReservedCursor3() {}
void BCursor::_ReservedCursor4() {}