* Fixed the good old operator& precedence bug I noticed while looking over a
patch by Ziusudra. * Use new(std::nothrow) instead of new. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37126 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,11 +3,12 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
\file session.cpp
|
/*! \file session.cpp
|
||||||
\brief Disk device manager partition module for CD/DVD sessions.
|
\brief Disk device manager partition module for CD/DVD sessions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <disk_device_manager/ddm_modules.h>
|
#include <disk_device_manager/ddm_modules.h>
|
||||||
@@ -45,12 +46,12 @@ identify_partition(int fd, partition_data *partition, void **cookie)
|
|||||||
|
|
||||||
device_geometry geometry;
|
device_geometry geometry;
|
||||||
float result = -1;
|
float result = -1;
|
||||||
if (partition->flags & B_PARTITION_IS_DEVICE
|
if ((partition->flags & B_PARTITION_IS_DEVICE) != 0
|
||||||
&& partition->block_size == 2048
|
&& partition->block_size == 2048
|
||||||
&& ioctl(fd, B_GET_GEOMETRY, &geometry) == 0
|
&& ioctl(fd, B_GET_GEOMETRY, &geometry) == 0
|
||||||
&& geometry.device_type == B_CD) {
|
&& geometry.device_type == B_CD) {
|
||||||
Disc *disc = new Disc(fd);
|
Disc *disc = new(std::nothrow) Disc(fd);
|
||||||
if (disc && disc->InitCheck() == B_OK) {
|
if (disc != NULL && disc->InitCheck() == B_OK) {
|
||||||
*cookie = static_cast<void*>(disc);
|
*cookie = static_cast<void*>(disc);
|
||||||
result = 0.7;
|
result = 0.7;
|
||||||
} else
|
} else
|
||||||
|
|||||||
Reference in New Issue
Block a user