Author: axeld Date: 2010-06-13 18:52:21 +0200 (Sun, 13 Jun 2010) New Revision: 37126 Changeset: http://dev.haiku-os.org/changeset/37126/haiku Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/session/session.cpp Log: * 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. Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/session/session.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/partitioning_systems/session/session.cpp 2010-06-13 16:17:23 UTC (rev 37125) +++ haiku/trunk/src/add-ons/kernel/partitioning_systems/session/session.cpp 2010-06-13 16:52:21 UTC (rev 37126) @@ -3,11 +3,12 @@ * Distributed under the terms of the MIT License. */ -/*! - \file session.cpp + +/*! \file session.cpp \brief Disk device manager partition module for CD/DVD sessions. */ + #include <unistd.h> #include <disk_device_manager/ddm_modules.h> @@ -45,12 +46,12 @@ device_geometry geometry; float result = -1; - if (partition->flags & B_PARTITION_IS_DEVICE + if ((partition->flags & B_PARTITION_IS_DEVICE) != 0 && partition->block_size == 2048 && ioctl(fd, B_GET_GEOMETRY, &geometry) == 0 && geometry.device_type == B_CD) { - Disc *disc = new Disc(fd); - if (disc && disc->InitCheck() == B_OK) { + Disc *disc = new(std::nothrow) Disc(fd); + if (disc != NULL && disc->InitCheck() == B_OK) { *cookie = static_cast<void*>(disc); result = 0.7; } else