diff --git a/src/add-ons/kernel/bus_managers/acpi/oshaiku.cpp b/src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp similarity index 100% rename from src/add-ons/kernel/bus_managers/acpi/oshaiku.cpp rename to src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h b/src/add-ons/kernel/bus_managers/acpi/ACPIPrivate.h similarity index 99% rename from src/add-ons/kernel/bus_managers/acpi/acpi_priv.h rename to src/add-ons/kernel/bus_managers/acpi/ACPIPrivate.h index 5bf47e5271..7af1e5e705 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h +++ b/src/add-ons/kernel/bus_managers/acpi/ACPIPrivate.h @@ -3,8 +3,8 @@ * Copyright 2006, Jérôme Duval. All rights reserved. * Distributed under the terms of the MIT License. */ -#ifndef __ACPI_PRIV_H__ -#define __ACPI_PRIV_H__ +#ifndef _ACPI_PRIVATE_H +#define _ACPI_PRIVATE_H #include @@ -227,4 +227,4 @@ status_t get_table(const char* signature, uint32 instance, void** tableHeader); __END_DECLS -#endif /* __ACPI_PRIV_H__ */ +#endif /* _ACPI_PRIVATE_H */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c b/src/add-ons/kernel/bus_managers/acpi/BusManager.cpp similarity index 96% rename from src/add-ons/kernel/bus_managers/acpi/acpi_busman.c rename to src/add-ons/kernel/bus_managers/acpi/BusManager.cpp index 557247ccdc..0f2317dc21 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c +++ b/src/add-ons/kernel/bus_managers/acpi/BusManager.cpp @@ -20,11 +20,13 @@ #include +extern "C" { #include "acpi.h" #include "accommon.h" #include "acdisasm.h" #include "acnamesp.h" -#include "acpi_priv.h" +} +#include "ACPIPrivate.h" //#define TRACE_ACPI_BUS #ifdef TRACE_ACPI_BUS @@ -384,7 +386,7 @@ status_t install_fixed_event_handler(uint32 event, interrupt_handler* handler, void *data) { - return AcpiInstallFixedEventHandler(event, (void*)handler, data) == AE_OK + return AcpiInstallFixedEventHandler(event, (ACPI_EVENT_HANDLER)handler, data) == AE_OK ? B_OK : B_ERROR; } @@ -392,7 +394,7 @@ install_fixed_event_handler(uint32 event, interrupt_handler* handler, status_t remove_fixed_event_handler(uint32 event, interrupt_handler* handler) { - return AcpiRemoveFixedEventHandler(event, (void*)handler) == AE_OK + return AcpiRemoveFixedEventHandler(event, (ACPI_EVENT_HANDLER)handler) == AE_OK ? B_OK : B_ERROR; } @@ -441,7 +443,7 @@ get_device(const char* hid, uint32 index, char* result, size_t resultLength) char *buffer = NULL; TRACE("get_device %s, index %ld\n", hid, index); - status = AcpiGetDevices((ACPI_STRING)hid, (void*)&get_device_by_hid_callback, + status = AcpiGetDevices((ACPI_STRING)hid, (ACPI_WALK_CALLBACK)&get_device_by_hid_callback, counter, (void**)&buffer); if (status != AE_OK || buffer == NULL) return B_ENTRY_NOT_FOUND; @@ -523,7 +525,7 @@ get_object(const char* path, acpi_object_type** _returnValue) status = AcpiEvaluateObject(handle, NULL, NULL, &buffer); - *_returnValue = buffer.Pointer; + *_returnValue = (acpi_object_type*)buffer.Pointer; return status == AE_OK ? B_OK : B_ERROR; } @@ -545,7 +547,7 @@ get_object_typed(const char* path, acpi_object_type** _returnValue, status = AcpiEvaluateObjectTyped(handle, NULL, NULL, &buffer, objectType); - *_returnValue = buffer.Pointer; + *_returnValue = (acpi_object_type*)buffer.Pointer; return status == AE_OK ? B_OK : B_ERROR; } @@ -642,7 +644,7 @@ prepare_sleep_state(uint8 state, void (*wakeFunc)(void), size_t size) status_t status; // Note: The supplied code must already be locked into memory. - status = get_memory_map(wakeFunc, size, &wakeVector, 1); + status = get_memory_map((const void*)wakeFunc, size, &wakeVector, 1); if (status != B_OK) return status; @@ -676,7 +678,10 @@ enter_sleep_state(uint8 state, uint8 flags) TRACE("enter_sleep_state %d with flags %d\n", state, flags); + cpu_status cpu = disable_interrupts(); status = AcpiEnterSleepState(state, flags); + restore_interrupts(cpu); + panic("AcpiEnterSleepState should not return."); if (status != AE_OK) return B_ERROR; diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_device.c b/src/add-ons/kernel/bus_managers/acpi/Device.cpp similarity index 90% rename from src/add-ons/kernel/bus_managers/acpi/acpi_device.c rename to src/add-ons/kernel/bus_managers/acpi/Device.cpp index 6ac8361c60..77d1cc1d93 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_device.c +++ b/src/add-ons/kernel/bus_managers/acpi/Device.cpp @@ -9,8 +9,10 @@ #include #include -#include "acpi_priv.h" +#include "ACPIPrivate.h" +extern "C" { #include "acpi.h" +} static status_t @@ -43,17 +45,17 @@ acpi_remove_address_space_handler(acpi_device device, uint32 spaceId, { return remove_address_space_handler(device->handle, spaceId, handler); } - -static uint32 + +static uint32 acpi_get_object_type(acpi_device device) { return device->type; } -static status_t -acpi_get_object(acpi_device device, const char *path, acpi_object_type **return_value) +static status_t +acpi_get_object(acpi_device device, const char *path, acpi_object_type **return_value) { if (path) { char objname[255]; @@ -64,9 +66,9 @@ acpi_get_object(acpi_device device, const char *path, acpi_object_type **return_ } -static status_t +static status_t acpi_evaluate_method(acpi_device device, const char *method, - acpi_objects *args, acpi_data *returnValue) + acpi_objects *args, acpi_data *returnValue) { return evaluate_method(device->handle, method, args, returnValue); } @@ -77,19 +79,17 @@ acpi_device_init_driver(device_node *node, void **cookie) { ACPI_HANDLE handle; const char *path; - acpi_device_cookie *device; - status_t status = B_OK; uint32 type; - + if (gDeviceManager->get_attr_uint32(node, ACPI_DEVICE_TYPE_ITEM, &type, false) != B_OK) return B_ERROR; if (gDeviceManager->get_attr_string(node, ACPI_DEVICE_PATH_ITEM, &path, false) != B_OK) return B_ERROR; - - device = malloc(sizeof(*device)); + + acpi_device_cookie *device = (acpi_device_cookie*)malloc(sizeof(*device)); if (device == NULL) return B_NO_MEMORY; - + memset(device, 0, sizeof(*device)); if (AcpiGetHandle(NULL, (ACPI_STRING)path, &handle) != AE_OK) { @@ -102,20 +102,17 @@ acpi_device_init_driver(device_node *node, void **cookie) device->type = type; device->node = node; - snprintf(device->name, sizeof(device->name), "acpi_device %s", - path); - + snprintf(device->name, sizeof(device->name), "acpi_device %s", path); *cookie = device; - - return status; + return B_OK; } static void acpi_device_uninit_driver(void *cookie) { - acpi_device_cookie *device = cookie; - + acpi_device_cookie *device = (acpi_device_cookie*)cookie; + free(device->path); free(device); } @@ -133,7 +130,7 @@ acpi_device_std_ops(int32 op, ...) return B_BAD_VALUE; } - + acpi_device_module_info gACPIDeviceModule = { { { diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp b/src/add-ons/kernel/bus_managers/acpi/EmbeddedController.cpp similarity index 99% rename from src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp rename to src/add-ons/kernel/bus_managers/acpi/EmbeddedController.cpp index 9cbfbc7f08..e504a705ea 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp +++ b/src/add-ons/kernel/bus_managers/acpi/EmbeddedController.cpp @@ -28,7 +28,7 @@ */ -#include "acpi_embedded_controller.h" +#include "EmbeddedController.h" #include #include @@ -555,7 +555,7 @@ EcGpeQueryHandler(void* context) if (status != B_OK) { TRACE("evaluation of query method %s failed\n", qxx); } - + // Reenable runtime GPE if its execution was deferred. if (sci_enqueued) { status = sc->ec_acpi_module->finish_gpe(sc->ec_gpehandle, sc->ec_gpebit); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h b/src/add-ons/kernel/bus_managers/acpi/EmbeddedController.h similarity index 99% rename from src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h rename to src/add-ons/kernel/bus_managers/acpi/EmbeddedController.h index e8e1ef2cf3..c9ad95d58e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h +++ b/src/add-ons/kernel/bus_managers/acpi/EmbeddedController.h @@ -44,7 +44,7 @@ extern "C" { # include "accommon.h" # include "acnamesp.h" # include "actypes.h" -# include "acpi_priv.h" +# include "ACPIPrivate.h" } diff --git a/src/add-ons/kernel/bus_managers/acpi/Jamfile b/src/add-ons/kernel/bus_managers/acpi/Jamfile index 8852b64d3e..800fe4e296 100644 --- a/src/add-ons/kernel/bus_managers/acpi/Jamfile +++ b/src/add-ons/kernel/bus_managers/acpi/Jamfile @@ -200,12 +200,12 @@ SEARCH on [ FGristFiles $(tables_src) ] = [ FDirName $(HAIKU_TOP) src add-ons ke SEARCH on [ FGristFiles $(utilities_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi acpica components utilities ] ; KernelAddon acpi : - oshaiku.cpp - acpi_busman.c - acpi_module.c - acpi_device.c - acpi_ns_dump.cpp - acpi_embedded_controller.cpp + ACPICAHaiku.cpp + BusManager.cpp + Module.cpp + Device.cpp + NamespaceDump.cpp + EmbeddedController.cpp SmallResourceData.cpp : libacpi_ca.a diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_module.c b/src/add-ons/kernel/bus_managers/acpi/Module.cpp similarity index 98% rename from src/add-ons/kernel/bus_managers/acpi/acpi_module.c rename to src/add-ons/kernel/bus_managers/acpi/Module.cpp index fbddef1228..6b37c47275 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_module.c +++ b/src/add-ons/kernel/bus_managers/acpi/Module.cpp @@ -9,7 +9,7 @@ #include #include -#include "acpi_priv.h" +#include "ACPIPrivate.h" #include #include @@ -126,7 +126,7 @@ acpi_enumerate_child_devices(device_node* node, const char* root) static status_t acpi_module_register_child_devices(void* cookie) { - device_node* node = cookie; + device_node* node = (device_node*)cookie; status_t status = gDeviceManager->publish_device(node, "acpi/namespace", ACPI_NS_DUMP_DEVICE_MODULE_NAME); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp b/src/add-ons/kernel/bus_managers/acpi/NamespaceDump.cpp similarity index 97% rename from src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp rename to src/add-ons/kernel/bus_managers/acpi/NamespaceDump.cpp index 2640920a85..3502fd4a84 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp +++ b/src/add-ons/kernel/bus_managers/acpi/NamespaceDump.cpp @@ -1,5 +1,5 @@ /* ++++++++++ - ACPI namespace dump. + ACPI namespace dump. Nothing special here, just tree enumeration and type identification. +++++ */ @@ -9,7 +9,7 @@ #include #include -#include "acpi_priv.h" +#include "ACPIPrivate.h" #include #include @@ -17,7 +17,7 @@ class RingBuffer { public: RingBuffer(size_t size = 1024); - ~RingBuffer(); + ~RingBuffer(); size_t Read(void *buffer, ssize_t length); size_t Write(const void *buffer, ssize_t length); size_t WritableAmount() const; @@ -60,18 +60,18 @@ make_space(acpi_ns_device_info *device, size_t space) } snooze(10000); - if (!device->buffer->Lock()) + if (!device->buffer->Lock()) return false; - + } while (device->buffer->WritableAmount() < space); - + return true; -} +} -static void -dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting) +static void +dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting) { char result[255]; char output[320]; @@ -79,13 +79,13 @@ dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting) char hid[16] = ""; int i; size_t written = 0; - for (i = 0; i < indenting; i++) + for (i = 0; i < indenting; i++) strlcat(tabs, "| ", sizeof(tabs)); strlcat(tabs, "|--- ", sizeof(tabs)); int depth = sizeof(char) * 5 * indenting + sizeof(char); // index into result where the device name will be. - + void *counter = NULL; while (device->acpi->get_next_entry(ACPI_TYPE_ANY, root, result, 255, &counter) == B_OK) { uint32 type = device->acpi->get_object_type(result); @@ -142,13 +142,13 @@ dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting) written = 0; RingBuffer &ringBuffer = *device->buffer; size_t toWrite = strlen(output); - + if (toWrite <= 0) break; strlcat(output, "\n", sizeof(output)); toWrite++; - if (!ringBuffer.Lock()) + if (!ringBuffer.Lock()) break; if (ringBuffer.WritableAmount() < toWrite && diff --git a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp index 4a9b5c5af6..befa138729 100644 --- a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp @@ -693,10 +693,12 @@ DwarfImageDebugInfo::GetStatement(FunctionDebugInfo* _function, int32 statementLine = -1; int32 statementColumn = -1; while (program.GetNextRow(state)) { - bool isOurFile = state.file == fileIndex; + // skip statements of other files + if (state.file != fileIndex) + continue; if (statementAddress != 0 - && (!isOurFile || state.isStatement || state.isSequenceEnd)) { + && (state.isStatement || state.isSequenceEnd)) { target_addr_t endAddress = state.address; if (address >= statementAddress && address < endAddress) { ContiguousStatement* statement = new(std::nothrow) @@ -714,10 +716,6 @@ DwarfImageDebugInfo::GetStatement(FunctionDebugInfo* _function, statementAddress = 0; } - // skip statements of other files - if (!isOurFile) - continue; - if (state.isStatement) { statementAddress = state.address; statementLine = state.line - 1; diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.cpp b/src/apps/debugger/dwarf/DebugInfoEntries.cpp index 976684090c..9c2ecf47a9 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.cpp +++ b/src/apps/debugger/dwarf/DebugInfoEntries.cpp @@ -2697,6 +2697,7 @@ DebugInfoEntryFactory::CreateDebugInfoEntry(uint16 tag, DebugInfoEntry*& _entry) entry = new(std::nothrow) DIESharedType; break; default: + return B_ENTRY_NOT_FOUND; break; } diff --git a/src/apps/debugger/dwarf/DwarfFile.cpp b/src/apps/debugger/dwarf/DwarfFile.cpp index f07f10ae2a..f95d18ea4a 100644 --- a/src/apps/debugger/dwarf/DwarfFile.cpp +++ b/src/apps/debugger/dwarf/DwarfFile.cpp @@ -825,8 +825,12 @@ DwarfFile::_ParseDebugInfoEntry(DataReader& dataReader, DebugInfoEntry* entry; status_t error = fDebugInfoFactory.CreateDebugInfoEntry( abbreviationEntry.Tag(), entry); - if (error != B_OK) + if (error != B_OK) { + WARNING("Failed to generate entry for tag %lu, code %lu\n", + abbreviationEntry.Tag(), code); return error; + } + ObjectDeleter entryDeleter(entry); TRACE_DIE("%*sentry %p at %lld: %lu, tag: %s (%lu), children: %d\n", diff --git a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp index c3612e6576..224cb0a88f 100644 --- a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp +++ b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp @@ -251,9 +251,6 @@ InspectorWindow::MessageReceived(BMessage* msg) } break; } - { - break; - } default: { BWindow::MessageReceived(msg); diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index bb8ca25c42..61636f8531 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -109,6 +109,7 @@ TeamWindow::TeamWindow(::Team* team, UserInterfaceListener* listener) fStepOverButton(NULL), fStepIntoButton(NULL), fStepOutButton(NULL), + fInspectorWindow(NULL), fSourceLocatePanel(NULL) { fTeam->Lock(); @@ -237,6 +238,7 @@ TeamWindow::MessageReceived(BMessage* message) { _SaveInspectorSettings(CurrentMessage()); fInspectorWindow = NULL; + break; } case B_REFS_RECEIVED: diff --git a/src/apps/debugger/util/IntegerFormatter.cpp b/src/apps/debugger/util/IntegerFormatter.cpp index 818b4f308c..8ae05d1217 100644 --- a/src/apps/debugger/util/IntegerFormatter.cpp +++ b/src/apps/debugger/util/IntegerFormatter.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2012, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -7,10 +8,88 @@ #include "IntegerFormatter.h" #include +#include #include +static integer_format +GetFormatForTypeAndFormat(type_code type, integer_format format, + char* _formatString, int formatSize) +{ + integer_format result = format; + _formatString[0] = '%'; + ++_formatString; + formatSize -= 1; + + switch (type) { + case B_INT8_TYPE: + switch (format) { + case INTEGER_FORMAT_HEX_DEFAULT: + result = INTEGER_FORMAT_HEX_8; + break; + case INTEGER_FORMAT_SIGNED: + strlcpy(_formatString, B_PRId8, formatSize); + break; + case INTEGER_FORMAT_UNSIGNED: + strlcpy(_formatString, B_PRIu8, formatSize); + break; + default: + break; + } + break; + case B_INT16_TYPE: + switch (format) { + case INTEGER_FORMAT_HEX_DEFAULT: + result = INTEGER_FORMAT_HEX_16; + break; + case INTEGER_FORMAT_SIGNED: + strlcpy(_formatString, B_PRId16, formatSize); + break; + case INTEGER_FORMAT_UNSIGNED: + strlcpy(_formatString, B_PRIu16, formatSize); + break; + default: + break; + } + break; + case B_INT32_TYPE: + switch (format) { + case INTEGER_FORMAT_HEX_DEFAULT: + result = INTEGER_FORMAT_HEX_32; + break; + case INTEGER_FORMAT_SIGNED: + strlcpy(_formatString, B_PRId32, formatSize); + break; + case INTEGER_FORMAT_UNSIGNED: + strlcpy(_formatString, B_PRIu32, formatSize); + break; + default: + break; + } + break; + case B_INT64_TYPE: + default: + switch (format) { + case INTEGER_FORMAT_HEX_DEFAULT: + result = INTEGER_FORMAT_HEX_64; + break; + case INTEGER_FORMAT_SIGNED: + strlcpy(_formatString, B_PRId64, formatSize); + break; + case INTEGER_FORMAT_UNSIGNED: + strlcpy(_formatString, B_PRIu64, formatSize); + break; + default: + break; + } + break; + } + + return result; +} + + /*static*/ bool IntegerFormatter::FormatValue(const BVariant& value, integer_format format, char* buffer, size_t bufferSize) @@ -19,38 +98,30 @@ IntegerFormatter::FormatValue(const BVariant& value, integer_format format, if (!value.IsInteger(&isSigned)) return false; - if (format == INTEGER_FORMAT_DEFAULT) - format = isSigned ? INTEGER_FORMAT_SIGNED : INTEGER_FORMAT_UNSIGNED; + char formatString[10]; - if (format == INTEGER_FORMAT_HEX_DEFAULT) { - switch (value.Type()) { - case B_INT8_TYPE: - case B_UINT8_TYPE: - format = INTEGER_FORMAT_HEX_8; - break; - case B_INT16_TYPE: - case B_UINT16_TYPE: - format = INTEGER_FORMAT_HEX_16; - break; - case B_INT32_TYPE: - case B_UINT32_TYPE: - format = INTEGER_FORMAT_HEX_32; - break; - case B_INT64_TYPE: - case B_UINT64_TYPE: - default: - format = INTEGER_FORMAT_HEX_64; - break; - } + if (format == INTEGER_FORMAT_DEFAULT) { + format = isSigned ? INTEGER_FORMAT_SIGNED : INTEGER_FORMAT_UNSIGNED; } + format = GetFormatForTypeAndFormat(value.Type(), format, formatString, + sizeof(formatString)); + // format the value switch (format) { case INTEGER_FORMAT_SIGNED: - snprintf(buffer, bufferSize, "%lld", value.ToInt64()); + snprintf(buffer, bufferSize, formatString, + value.Type() == B_INT8_TYPE ? value.ToInt8() : + value.Type() == B_INT16_TYPE ? value.ToInt16() : + value.Type() == B_INT32_TYPE ? value.ToInt32() : + value.ToInt64()); break; case INTEGER_FORMAT_UNSIGNED: - snprintf(buffer, bufferSize, "%llu", value.ToUInt64()); + snprintf(buffer, bufferSize, formatString, + value.Type() == B_INT8_TYPE ? value.ToUInt8() : + value.Type() == B_INT16_TYPE ? value.ToUInt16() : + value.Type() == B_INT32_TYPE ? value.ToUInt32() : + value.ToUInt64()); break; case INTEGER_FORMAT_HEX_8: snprintf(buffer, bufferSize, "%#x", (uint8)value.ToUInt64()); @@ -62,7 +133,6 @@ IntegerFormatter::FormatValue(const BVariant& value, integer_format format, snprintf(buffer, bufferSize, "%#lx", (uint32)value.ToUInt64()); break; case INTEGER_FORMAT_HEX_64: - case INTEGER_FORMAT_HEX_DEFAULT: default: snprintf(buffer, bufferSize, "%#llx", value.ToUInt64()); break; diff --git a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp index 8316d6e8dc..b805a35332 100644 --- a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp @@ -281,6 +281,9 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, uint8* messageBuffer = new(std::nothrow) uint8[totalSize]; if (messageBuffer == NULL) return B_NO_MEMORY; + + ArrayDeleter deleter(messageBuffer); + memset(messageBuffer, 0, totalSize); memcpy(messageBuffer, fHeader, sizeof(BMessage::message_header)); uint8* tempBuffer = messageBuffer + sizeof(BMessage::message_header); @@ -313,7 +316,6 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, } error = fMessage.Unflatten((const char*)messageBuffer); - delete[] messageBuffer; if (error != B_OK) return error; diff --git a/src/kits/interface/ColumnTypes.cpp b/src/kits/interface/ColumnTypes.cpp index 5298f19276..82a8fef579 100644 --- a/src/kits/interface/ColumnTypes.cpp +++ b/src/kits/interface/ColumnTypes.cpp @@ -130,7 +130,7 @@ BStringField::SetString(const char* val) fString = val; fClippedString = ""; fWidth = 0; -} +} const char* @@ -158,7 +158,7 @@ void BStringField::SetClippedString(const char* val) { fClippedString = val; -} +} const char* @@ -184,15 +184,17 @@ BStringColumn::DrawField(BField* _field, BRect rect, BView* parent) { float width = rect.Width() - (2 * kTEXT_MARGIN); BStringField* field = static_cast(_field); + bool clipNeeded = width < field->Width(); - if (width != field->Width()) { + if (clipNeeded) { BString out_string(field->String()); parent->TruncateString(&out_string, fTruncate, width + 2); field->SetClippedString(out_string.String()); field->SetWidth(width); } - DrawString(field->ClippedString(), parent, rect); + + DrawString(clipNeeded ? field->ClippedString() : field->String(), parent, rect); } @@ -256,7 +258,7 @@ void BDateField::SetClippedString(const char* val) { fClippedString = val; -} +} const char* @@ -643,7 +645,7 @@ BBitmapColumn::CompareFields(BField* /*field1*/, BField* /*field2*/) } -bool +bool BBitmapColumn::AcceptsField(const BField *field) const { return static_cast(dynamic_cast(field));