diff --git a/build/jam/Haiku64Image b/build/jam/Haiku64Image index 7a5e19db21..97852bd482 100644 --- a/build/jam/Haiku64Image +++ b/build/jam/Haiku64Image @@ -14,9 +14,9 @@ SYSTEM_BIN = "[" addattr base64 basename bash beep cal cat catattr checkfs id ifconfig install isvolume join kernel_debugger kill less lessecho lesskey link linkcatkeys listdev ln locale locate logger logname ls makebootable md5sum mimeset mkdir mkfifo mkfs mktemp mount mountvolume - mv nl nohup notify nproc od paste patch pathchk ping pr printenv printf + mv nl nohup notify nproc od open paste patch pathchk ping pr printenv printf ps ptx pwd query rc readlink ReadOnlyBootPrompt rm rmattr rmdir safemode - sdiff seq sha1sum shred shuf sleep sort split stat strace stty su sum sync + sdiff seq sha1sum shred shuf shutdown sleep sort split stat strace stty su sum sync sysinfo tac tail tee test timeout touch tr true truncate tsort tty unexpand uname uniq unlink unmount unzip updatedb waitfor wc wget whoami xargs xres yes zdiff zforce zgrep zip zipcloak zipgrep zipnote zipsplit diff --git a/docs/user/game/FileGameSound.dox b/docs/user/game/FileGameSound.dox new file mode 100644 index 0000000000..c01c33b349 --- /dev/null +++ b/docs/user/game/FileGameSound.dox @@ -0,0 +1,138 @@ +/* + * Copyright 2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * src/kits/game/FileGameSound.cpp hrev45076 + * src/kits/game/FileGameSound.h hrev45076 + */ + + +/*! + \file FileGameSound.h + \brief Provides the BFileGameSound class. +*/ + + +/*! + \class BFileGameSound + \ingroup game + \ingroup libbe + \brief Playback audio from a sound file on disk. +*/ + + +/*! + \fn BFileGameSound::BFileGameSound(const entry_ref *file, bool looping, + BGameSoundDevice *device) + \brief Creates and initializes a BFileGameSound object from an + \c entry_ref allowing you to play the specified sound file. + + If \a looping is \c true, the sound automatically replays from the + beginning once the end is reached. This is useful for playing + background music in a loop. + + You can specify the sound devise to use by setting the \a device + parameter. Setting \a device to \c NULL uses the default sound device. + + \param file The entry ref pointing to the sound file on disk. + \param looping Whether or not to repeat the sound in a loop. + \param device The sound device to use to play the sound, use \c NULL for + default. +*/ + + +/*! + \fn BFileGameSound::BFileGameSound(const char *file, bool looping, + BGameSoundDevice *device) + \brief Creates and initializes a BFileGameSound object from a file path + allowing you to play the specified sound file. + + If \a looping is \c true, the sound automatically replays from the + beginning once the end is reached. This is useful for playing + background music in a loop. + + You can specify the sound devise to use by setting the \a device + parameter. Setting \a device to \c NULL uses the default sound device. + + \param file The path of the sound file on disk. + \param looping Whether or not to repeat the sound in a loop. + \param device The sound device to use to play the sound, use \c NULL for + default. +*/ + + +/*! + \fn BFileGameSound::~BFileGameSound() + \brief Destroys the BFileGameSound object. +*/ + + +/*! + \fn BGameSound* BFileGameSound::Clone() const + \brief Not implemented, always returns \c NULL. +*/ + + +/*! + \fn status_t BFileGameSound::StartPlaying() + \brief Plays the sound file. + + \returns A status code, \c B_OK on success or an error code on error. +*/ + + +/*! + \fn status_t BFileGameSound::StopPlaying() + \brief Stops playback of the sound file. + + \returns A status code, \c B_OK on success or an error code on error. +*/ + + +/*! + \fn status_t BFileGameSound::Preload() + \brief Preload the sound file into memory so that playback won't be delayed. + + \returns A status code, \c B_OK on success or an error code if we were + unable to communicate with the sound port. +*/ + + +/*! + \fn void BFileGameSound::FillBuffer(void *inBuffer, size_t inByteCount) + \brief Fill a buffer with sound data. + + \param inBuffer The buffer to fill. + \param inByteCount The number of bytes to fill buffer with. +*/ + + +/*! + \fn status_t BFileGameSound::SetPaused(bool isPaused, bigtime_t rampTime) + \brief Pauses playback if \a isPaused is \c true or resumes play if + \a isPaused is \c false. + + \param isPaused \c true to pause playback, \c false to resume playback. + \param rampTime Determines how long the change in playback state should + take to complete in microseconds. Set to 0 for an instantaneous + change. + + \returns A status code. + \retval B_OK The playback state was updated. + \retval EALREADY Already in the requested playback state. +*/ + + +/*! + \fn int32 BFileGameSound::IsPaused() + \brief Returns the current playback status. + + \returns An integer indicating the current playback status. + \retval B_NOT_PAUSED Sound is playing. + \retval B_PAUSE_IN_PROGRESS The sound is transitioning to or from a paused state. + \retval B_PAUSED Sound is paused. +*/ diff --git a/docs/user/locale/Catalog.dox b/docs/user/locale/Catalog.dox index 37948bd72e..d3da6b8df3 100644 --- a/docs/user/locale/Catalog.dox +++ b/docs/user/locale/Catalog.dox @@ -1,5 +1,5 @@ /* - * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Copyright 2011-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -8,8 +8,8 @@ * Oliver Tappe, zooey@hirschkaefer.de * * Corresponds to: - * /trunk/headers/os/locale/Catalog.h rev 43095 - * /trunk/src/kits/locale/Catalog.cpp rev 43095 + * /trunk/headers/os/locale/Catalog.h hrev45083 + * /trunk/src/kits/locale/Catalog.cpp hrev45083 */ @@ -22,7 +22,8 @@ /*! \class BCatalog \ingroup locale - \brief Class handling string localization. + \ingroup libbe + \brief String localization handling. BCatalog is the class that allows you to perform string localization. This means you give it a string in english, and it automatically returns the @@ -31,13 +32,13 @@ Most of the time, you don't have to deal with BCatalog directly. You use the translation macros instead. However, there are some cases where you will have to use catalogs directly. These include : - \li Tools for managing catalogs : if you want to add, remove or edit - entries in a catalog, you need to do it using the BCatalog class. - \li Accessing catalogs other than your own : the macros only grant you - access to the catalog linked with your application. To access - other catalogs (for example if you create a script interpreter and - want to localize the scripts), you will have to open a catalog - associated with your script. + - Tools for managing catalogs : if you want to add, remove or edit + entries in a catalog, you need to do it using the BCatalog class. + - Accessing catalogs other than your own : the macros only grant you + access to the catalog linked with your application. To access + other catalogs (for example if you create a script interpreter and + want to localize the scripts), you will have to open a catalog + associated with your script. \section macros Using the macros You don't have to do much in your program to handle catalogs. You must @@ -58,13 +59,13 @@ For example, if the user sets his language preferences as french(France), spanish, english, when an application loads a catalog, the following rules - are used : - \li Try to load a french(France) catalog. If it is found, this catalog - will automatically include strings from the generic french catalog. - \li Try to load a generic french catalog. - \li Try to load a generic spanish catalog. - \li Try to load a generic english catalog. - \li If all of them failed, use the strings that are in the source code. + are used: + - Try to load a french(France) catalog. If it is found, this catalog + will automatically include strings from the generic french catalog. + - Try to load a generic french catalog. + - Try to load a generic spanish catalog. + - Try to load a generic english catalog. + - If all of them failed, use the strings that are in the source code. Note that french(France) will failback to french, but then directly to the language in the source code. This avoids mixing 3 or more languages in the @@ -73,9 +74,17 @@ /*! - \fn BCatalog::Catalog(const entry_ref& catalogOwner, - const char* language = NULL, uint32 fingerprint = 0); - \brief Construct a catalog for the given \a catalogOwner. + \fn BCatalog::BCatalog() + \brief Construct an empty BCatalog object. + + Should be followed by SetTo() method to set the catalog. +*/ + + +/*! + \fn BCatalog::BCatalog(const entry_ref& catalogOwner, const char* language, + uint32 fingerprint) + \brief Construct a BCatalog object for the given \a catalogOwner. If you don't specify a language, the system default list will be used. The language is passed here as a 2 letter ISO code. @@ -97,9 +106,15 @@ */ +/*! + \fn BCatalog::~BCatalog() + \brief Destroys the BCatalog object freeing memory used by it. +*/ + + /*! \fn const char* BCatalog::GetString(const char* string, - const char* context = NULL, const char* comment = NULL) + const char* context, const char* comment) \brief Get a string from the catalog. This method access the data of the catalog and reeturns you the translated @@ -133,6 +148,7 @@ all the catalog files under control. \param id The identifier of the string. + \returns The translated string if found, or an empty string. */ @@ -150,7 +166,12 @@ \param name The name of the data to retrieve. \param msg The BMessage to fill in with the data. - \returns An error code. + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to get an exclusive lock on data. + \retval B_NO_INIT Catalog is \c NULL. + \retval B_NAME_NOT_FOUND catalog with the specified \a name could not be + found. */ @@ -189,6 +210,10 @@ \param lang The string where to copy the language. \returns An error code. + \retval B_OK Everything went as expected. + \retval B_ERROR Could not get exclusive lock on catalog. + \retval B_BAD_VALUE \a lang is \c NULL. + \retval B_NO_INIT Catalog data is \c NULL. */ @@ -202,43 +227,43 @@ \param fp The integer to set to the fingerprint value. \returns An error code. + \retval B_OK Everything went as expected. + \retval B_ERROR Could not get exclusive lock on catalog. + \retval B_BAD_VALUE \a fp is \c NULL. + \retval B_NO_INIT Catalog data is \c NULL. */ /*! - \fn status_t BCatalog::SetCatalog(const entry_ref& catalogOwner, - uint32 fingerprint) + \fn status_t BCatalog::SetTo(const entry_ref& catalogOwner, + const char* language, uint32 fingerprint) \brief Reload the string data. This method reloads the data for the given signature and fingerprint. - \param catalogOwner The entry_ref of the catalog that you want to load. + \param catalogOwner The \c entry_ref of the catalog that you want to load. + \param language The language of the catalog to load. If \c NULL, the user + settings will be used. \param fingerprint The fingerprint of the catalog you want to load. - \returns An error code. + \returns A status code, \c B_OK on success, \c B_ERROR on error. */ /*! \fn status_t BCatalog::InitCheck() const - \brief Check if the catalog is in an useable state. + \brief Check if the catalog is in a valid and usable state. - \returns \c B_OK if the catalog is initialized properly. + \returns A status code. + \retval B_OK The catalog is initialized properly. + \retval B_ERROR Could not get exclusive lock on catalog. + \retval B_NO_INIT Catalog data is \c NULL. */ /*! \fn int32 BCatalog::CountItems() - \brief Returns the number of items in the catalog. + \brief Gets the number of items in the catalog. - \returns the number of strings in the catalog. -*/ - - -/*! - \fn BCatalogaddOn* BCatalog::CatalogAddOn() - \brief Returns the internal storage for this catalog. - - \returns the internal storage class used by this catalog. You should - not have to use it. + \returns the number of strings in the catalog or 0 on error. */ diff --git a/docs/user/locale/DurationFormat.dox b/docs/user/locale/DurationFormat.dox index 8177757dc9..7f47e104fa 100644 --- a/docs/user/locale/DurationFormat.dox +++ b/docs/user/locale/DurationFormat.dox @@ -4,55 +4,109 @@ * * Authors: * Adrien Destugues, pulkomandy@pulkomandy.ath.cx + * John Scipione, jscipione@gmail.com * * Corresponds to: - * /trunk/headers/os/locale/DurationFormat.h rev 42944 - * /trunk/src/kits/locale/DurationFormat.cpp rev 42944 + * /trunk/headers/os/locale/DurationFormat.h hrev45084 + * /trunk/src/kits/locale/DurationFormat.cpp hrev45084 */ /*! - \class BDurationFormat - \ingroup locale - \brief Formatter for time interfals + \class BDurationFormat + \ingroup locale + \ingroup libbe + \brief Formatter for time intervals. - BDurationFormat is a formatter for time intervals. A time interval is defined - by its start and end values, and the result is a string such as - "1 hour, 2 minutes, 28 seconds". + BDurationFormat is a formatter for time intervals. A time interval is + defined by its start and end values, and the result is a string such as + "1 hour, 2 minutes, 28 seconds". */ /*! - \fn BDurationFormat::BDurationFormat(const BString& separator) - \brief Constructor. + \fn BDurationFormat::BDurationFormat(const BString& separator) + \brief Constructor. - \warning Creating a BDurationFormat is a costly operation. Most of the time, - you most likely want to use the default one through the BLocale class. + \warning Creating a BDurationFormat is a costly operation. Most of the + time want to use the default one through the BLocale class. - The separator string will be appended between the elements of formated - durations. + \param separator String appended between the duration elements. */ /*! - \fn void BDurationFormat::SetSeparator(cosnt BString& separator) - \brief Replace the spearator for this formatter. + \fn BDurationFormat::BDurationFormat(const BDurationFormat& other) + \brief Copy Constructor. + + \param other The BDurationFormat object to copy from. */ /*! - \fn status_t BDurationForamt::SetLocale(const BLocale* locale) - \brief Sets the locale for this formatter. + \fn BDurationFormat::~BDurationFormat() + \brief Destructor. */ /*! - \fn status_t BDurationFormat::Format(bigtime_t startValue, - bigtime_t endValue, BString* buffer, time_unit_style = B_TIME_UNIT_FULL) - const; - \brief Formats a duration defined by its start and end values. + \fn BDurationFormat& + BDurationFormat::operator=(const BDurationFormat& other) + \brief Assignment overload. -The start and end values are in milliseconds. The result is appeded to the -buffer. The full time style uses full words (hours, minuts, seconds), while the -shot one uses units (h, m, s). + \param other The BDurationFormat object to copy from. + + \returns The resulting BDurationFormat object. +*/ + + +/*! + \fn void BDurationFormat::SetSeparator(const BString& separator) + \brief Replace the separator for this formatter. + + \param separator The separator string to set. +*/ + + +/*! + \fn status_t BDurationFormat::SetLocale(const BLocale* locale) + \brief Sets the locale for this formatter. + + \param locale The BLocale object to set. + + \returns A status code, \c B_OK on success or an error code on error. +*/ + + +/*! + \fn status_t BDurationFormat::SetTimeZone(const BTimeZone* timeZone) + \brief Sets the timezone for this formatter. + + \param timeZone The BTimeZone object to set. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT Format object is \c NULL. + \retval B_ERROR Other errors. +*/ + + +/*! + \fn status_t BDurationFormat::Format(bigtime_t startValue, + bigtime_t stopValue, BString* buffer, time_unit_style style) const + \brief Formats a duration defined by its start and end values. + + The start and end values are in milliseconds. The result is appended to + the buffer. The full time style uses full words (hours, minutes, seconds), + while the short one uses units (h, m, s). + + \param startValue The start value in milliseconds. + \param stopValue The stop value in milliseconds. + \param buffer The buffer to fill out. + \param style The time unit style to use. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_BAD_VALUE Buffer was \c NULL. + \retval B_ERROR Formatting error. */ diff --git a/docs/user/media/FileInterface.dox b/docs/user/media/FileInterface.dox new file mode 100644 index 0000000000..c91dd3a61e --- /dev/null +++ b/docs/user/media/FileInterface.dox @@ -0,0 +1,175 @@ +/* + * Copyright 2012 Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * /trunk/headers/os/media/FileInterface.h hrev45081 + * /trunk/src/kits/media/FileInterface.cpp hrev45081 + */ + + +/*! + \file FileInterface.h + \brief Provides BFileInterface abstract class. +*/ + + +/*! + \class BFileInterface + \ingroup media + \ingroup libbe + \brief A node that can read and write data to a file on disk. + + You should derive your subclass from BFileInterface so that your + application may specify the file that the node will reference. + The Media Server will then call upon the node to try to identify + and work with files that are hereunto unknown to it. + + Your node must also derive from BBufferConsumer or BBufferProducer, + in addition to BFileInterface. +*/ + + +/*! + \fn BFileInterface::BFileInterface() + \brief Constructor. +*/ + + +/*! + \fn BFileInterface::~BFileInterface() + \brief Destructor. +*/ + + +/*! + \fn status_t BFileInterface::HandleMessage(int32 message, + const void *data, size_t size) + \brief Dispatches a message to the appropriate BMediaNode hook method + given a message received on the control port. Implement this method + to handle messages that arrive on your control port. + + \param message The message identifier. + \param data The message data. + \param size The size of the message data in bytes. + + \returns A status code. + \retval B_OK Message was dispatched. + \retval B_ERROR There was an error dispatching the message, possibly + because it doesn't correspond to a hook function. + + \see BMediaNode::HandleMessage() for details. +*/ + + +/*! + \fn status_t BFileInterface::GetNextFileFormat(int32* cookie, + media_file_format* _format) = 0; + \brief Implement this method to fill out information about a file format + indexed by \a cookie. + + The first time this method is called \a cookie will be set to 0. + In your implementation you should set information about the first + file format you support in \a _format and set \a cookie to some + meaningful non-zero value to track your positing in the list of + supported formats, then return \c B_OK. + + On successive calls return successive file format information and update + \a cookie to track your position in the list. Each time you return new + information about a file format return \c B_OK. + + Once you run out of formats return \c B_ERROR. + + \param cookie Index of file format to fill out. + \param _format Pointer to a preallocated \c media_file_format object to + fill out. + + \return \c B_OK if a file format was filled out for \a cookie, \c B_ERROR + or an appropriate error code otherwise. +*/ + + +/*! + \fn void BFileInterface::DisposeFileFormatCookie(int32 cookie) = 0; + \brief Implement this method to dispose of a file format supported by your + node indexed by \a cookie. + + You are responsible for freeing any data blocks associated with this + \a cookie before returning. + + \param cookie Index of the cookie you wish to dispose of. +*/ + + +/*! + \fn status_t BFileInterface::GetDuration(bigtime_t* _time) = 0; + \brief Implement this method to fill out the duration in microseconds of + the media data contained in the currently referenced file in + \a _time. + + \param _time The duration parameter to fill out. + + \return A status code, typically \c B_OK on success and \c B_ERROR + or another error code on error. +*/ + + +/*! + \fn status_t BFileInterface::SniffRef(const entry_ref& file, + char* _mimeType, float* _quality) = 0; + \brief Implement this method to allow the Media Roster to identify + a file format associated with this node. + + If you can handle the format, set \a _mimeType to the MIME type + of the file format and set \a _quality to indicate how well you + can process the file. + + A \a _quality of 0.0 means that you can't handle the file format + at all and an \a _quality of 1.0 means you have total control over + the file format. + + \param file The file being sniffed. + \param _mimeType Fill this out with the appropriate MIME type. + \param _quality How well you are able to handle the file format + from 0.0 to 1.0. + + \return \c B_OK if you can identify the file's contents, otherwise return + an appropriate error code. If you can't handle the file format at + all, you should return \c B_MEDIA_NO_HANDLER. +*/ + + +/*! + \fn status_t BFileInterface::SetRef(const entry_ref& file, bool create, + bigtime_t* _time) = 0; + \brief Used when an application wants your node to use a specific file. + + The file specified by \a file may or may not exist. + + If create is \c false you should try to open the existing file, and if + successful you should write the running time of the file into \a _time. + If you the file does not exist you should return \c B_ENTRY_NOT_FOUND. + + If \a create is \c true you should create a new file, initialize the file + for writing, and store 0 in \a _time. You should overwrite the file if + it already exists. + + \return \c B_OK on success or an appropriate error code such as \c B_ERROR + or \c B_ENTRY_NOT_FOUND on error. +*/ + + +/*! + \fn status_t BFileInterface::GetRef(entry_ref* _ref, char* _mimeType) = 0; + \brief Implement to set the \c entry_ref and the MIME type of the file + referenced by the current node. + + \param _ref Set to the \c entry_ref of the file. + \param _mimeType Set to the MIME type of the current file. + + \return \c B_OK on success or an appropriate error code such as \c B_ERROR + on error. +*/ diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index aed1be324e..b13e0f9b89 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -36,6 +36,7 @@ #define INTEL_TYPE_IGD (INTEL_TYPE_9xx | 0x0800) #define INTEL_TYPE_ILK (INTEL_TYPE_9xx | 0x1000) #define INTEL_TYPE_SNB (INTEL_TYPE_9xx | 0x2000) +#define INTEL_TYPE_IVB (INTEL_TYPE_9xx | 0x4000) // models #define INTEL_TYPE_SERVER 0x0004 #define INTEL_TYPE_MOBILE 0x0008 @@ -55,6 +56,9 @@ #define INTEL_TYPE_SNBG (INTEL_TYPE_SNB) #define INTEL_TYPE_SNBGM (INTEL_TYPE_SNB | INTEL_TYPE_MOBILE) #define INTEL_TYPE_SNBGS (INTEL_TYPE_SNB | INTEL_TYPE_SERVER) +#define INTEL_TYPE_IVBG (INTEL_TYPE_IVB) +#define INTEL_TYPE_IVBGM (INTEL_TYPE_IVB | INTEL_TYPE_MOBILE) +#define INTEL_TYPE_IVBGS (INTEL_TYPE_IVB | INTEL_TYPE_SERVER) #define DEVICE_NAME "intel_extreme" #define INTEL_ACCELERANT_NAME "intel_extreme.accelerant" diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp index 5c3c20be26..4b80ca4ef7 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp @@ -84,7 +84,13 @@ const struct supported_device { {0x0106, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT1"}, {0x0116, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT2"}, {0x0126, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT2+"}, - {0x010a, INTEL_TYPE_SNBGS, "SandyBridge Server"} + {0x010a, INTEL_TYPE_SNBGS, "SandyBridge Server"}, + + {0x0152, INTEL_TYPE_IVBG, "IvyBridge Desktop GT1"}, + {0x0162, INTEL_TYPE_IVBG, "IvyBridge Desktop GT2"}, + {0x0156, INTEL_TYPE_IVBGM, "IvyBridge Mobile GT1"}, + {0x0166, INTEL_TYPE_IVBGM, "IvyBridge Mobile GT2"}, + {0x015a, INTEL_TYPE_IVBGS, "IvyBridge Server GT1"} }; int32 api_version = B_CUR_DRIVER_API_VERSION; diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h index 15e3efc966..8df7837870 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h @@ -60,7 +60,7 @@ find_reg(const intel_info& info, uint32 target) RETURN_REG(INTERRUPT_STATUS) } - #undef RETURN_REG; + #undef RETURN_REG panic("find_reg didn't have any matching register\n"); return target; diff --git a/src/apps/debugger/arch/Architecture.cpp b/src/apps/debugger/arch/Architecture.cpp index 05eb903689..01b39992e5 100644 --- a/src/apps/debugger/arch/Architecture.cpp +++ b/src/apps/debugger/arch/Architecture.cpp @@ -94,7 +94,8 @@ Architecture::InitRegisterRules(CfaContext& context) const status_t Architecture::CreateStackTrace(Team* team, ImageDebugInfoProvider* imageInfoProvider, CpuState* cpuState, - StackTrace*& _stackTrace, int32 maxStackDepth, bool useExistingTrace) + StackTrace*& _stackTrace, int32 maxStackDepth, bool useExistingTrace, + bool getFullFrameInfo) { BReference cpuStateReference(cpuState); @@ -161,8 +162,8 @@ Architecture::CreateStackTrace(Team* team, CpuState* previousCpuState = NULL; if (function != NULL) { status_t error = functionDebugInfo->GetSpecificImageDebugInfo() - ->CreateFrame(image, function, cpuState, frame, - previousCpuState); + ->CreateFrame(image, function, cpuState, getFullFrameInfo, + frame, previousCpuState); if (error != B_OK && error != B_UNSUPPORTED) break; } @@ -170,7 +171,8 @@ Architecture::CreateStackTrace(Team* team, // If we have no frame yet, let the architecture create it. if (frame == NULL) { status_t error = CreateStackFrame(image, functionDebugInfo, - cpuState, nextFrame == NULL, frame, previousCpuState); + cpuState, nextFrame == NULL, frame, + previousCpuState); if (error != B_OK) break; } @@ -185,7 +187,7 @@ Architecture::CreateStackTrace(Team* team, return B_NO_MEMORY; } - frame = nextFrame; + nextFrame = frame; cpuState = previousCpuState; if (--maxStackDepth == 0) break; diff --git a/src/apps/debugger/arch/Architecture.h b/src/apps/debugger/arch/Architecture.h index 998d3be7f4..38409d0a3a 100644 --- a/src/apps/debugger/arch/Architecture.h +++ b/src/apps/debugger/arch/Architecture.h @@ -109,7 +109,8 @@ public: CpuState* cpuState, StackTrace*& _stackTrace, int32 maxStackDepth = -1, - bool useExistingTrace = false); + bool useExistingTrace = false, + bool getFullFrameInfo = true); // team is not locked virtual status_t GetWatchpointDebugCapabilities( diff --git a/src/apps/debugger/arch/x86_64/ArchitectureX8664.cpp b/src/apps/debugger/arch/x86_64/ArchitectureX8664.cpp index 747ee12424..21525627e7 100644 --- a/src/apps/debugger/arch/x86_64/ArchitectureX8664.cpp +++ b/src/apps/debugger/arch/x86_64/ArchitectureX8664.cpp @@ -303,7 +303,39 @@ ArchitectureX8664::UpdateStackFrameCpuState(const StackFrame* frame, Image* previousImage, FunctionDebugInfo* previousFunction, CpuState* previousCpuState) { - fprintf(stderr, "ArchitectureX8664::UpdateStackFrameCpuState: TODO\n"); + // This is not a top frame, so we want to offset rip to the previous + // (calling) instruction. + CpuStateX8664* cpuState = dynamic_cast(previousCpuState); + + // get rip + uint64 rip = cpuState->IntRegisterValue(X86_64_REGISTER_RIP); + if (previousFunction == NULL || rip <= previousFunction->Address()) + return; + target_addr_t functionAddress = previousFunction->Address(); + + // allocate a buffer for the function code to disassemble + size_t bufferSize = rip - functionAddress; + void* buffer = malloc(bufferSize); + if (buffer == NULL) + return; + MemoryDeleter bufferDeleter(buffer); + + // read the code + ssize_t bytesRead = fTeamMemory->ReadMemory(functionAddress, buffer, + bufferSize); + if (bytesRead != (ssize_t)bufferSize) + return; + + // disassemble to get the previous instruction + DisassemblerX8664 disassembler; + target_addr_t instructionAddress; + target_size_t instructionSize; + if (disassembler.Init(functionAddress, buffer, bufferSize) == B_OK + && disassembler.GetPreviousInstruction(rip, instructionAddress, + instructionSize) == B_OK) { + rip -= instructionSize; + cpuState->SetIntRegister(X86_64_REGISTER_RIP, rip); + } } diff --git a/src/apps/debugger/controllers/ThreadHandler.cpp b/src/apps/debugger/controllers/ThreadHandler.cpp index 366c3923b9..40539460a0 100644 --- a/src/apps/debugger/controllers/ThreadHandler.cpp +++ b/src/apps/debugger/controllers/ThreadHandler.cpp @@ -253,7 +253,8 @@ ThreadHandler::HandleThreadAction(uint32 action) if (stackTrace == NULL && cpuState != NULL) { if (fDebuggerInterface->GetArchitecture()->CreateStackTrace( - fThread->GetTeam(), this, cpuState, stackTrace, 1) == B_OK) { + fThread->GetTeam(), this, cpuState, stackTrace, 1, false, + false) == B_OK) { stackTraceReference.SetTo(stackTrace, true); } } diff --git a/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp b/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp index 01467c789d..da467da3b0 100644 --- a/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp @@ -68,7 +68,8 @@ DebuggerImageDebugInfo::GetAddressSectionType(target_addr_t address) status_t DebuggerImageDebugInfo::CreateFrame(Image* image, FunctionInstance* functionInstance, CpuState* cpuState, - StackFrame*& _previousFrame, CpuState*& _previousCpuState) + bool getFullFrameInfo, StackFrame*& _previousFrame, + CpuState*& _previousCpuState) { return B_UNSUPPORTED; } diff --git a/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h b/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h index 043b4eae52..8c0c520160 100644 --- a/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h +++ b/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h @@ -35,6 +35,7 @@ public: virtual status_t CreateFrame(Image* image, FunctionInstance* functionInstance, CpuState* cpuState, + bool getFullFrameInfo, StackFrame*& _previousFrame, CpuState*& _previousCpuState); virtual status_t GetStatement(FunctionDebugInfo* function, diff --git a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp index 2781768c3b..c6aa3ca4ac 100644 --- a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp @@ -26,6 +26,7 @@ #include "DebuggerInterface.h" #include "DebugInfoEntries.h" #include "Demangler.h" +#include "DisassembledCode.h" #include "Dwarf.h" #include "DwarfFile.h" #include "DwarfFunctionDebugInfo.h" @@ -40,6 +41,7 @@ #include "FunctionID.h" #include "FunctionInstance.h" #include "GlobalTypeLookup.h" +#include "InstructionInfo.h" #include "LocatableFile.h" #include "Register.h" #include "RegisterMap.h" @@ -516,7 +518,7 @@ DwarfImageDebugInfo::GetAddressSectionType(target_addr_t address) status_t DwarfImageDebugInfo::CreateFrame(Image* image, FunctionInstance* functionInstance, CpuState* cpuState, - StackFrame*& _frame, CpuState*& _previousCpuState) + bool getFullFrameInfo, StackFrame*& _frame, CpuState*& _previousCpuState) { DwarfFunctionDebugInfo* function = dynamic_cast( functionInstance->GetFunctionDebugInfo()); @@ -635,7 +637,7 @@ DwarfImageDebugInfo::CreateFrame(Image* image, // The subprogram entry may not be available since this may be a case // where .eh_frame was used to unwind the stack without other DWARF // info being available. - if (subprogramEntry != NULL) { + if (subprogramEntry != NULL && getFullFrameInfo) { // create function parameter objects for (DebugInfoEntryList::ConstIterator it = subprogramEntry->Parameters().GetIterator(); @@ -665,6 +667,14 @@ DwarfImageDebugInfo::CreateFrame(Image* image, _CreateLocalVariables(unit, frame, functionID, *stackFrameDebugInfo, instructionPointer, functionInstance->Address() - fRelocationDelta, subprogramEntry->Variables(), subprogramEntry->Blocks()); + + // determine if the previously executed instruction was a function + // call to see if we need to potentially retrieve a return value + // as well + if (instructionPointer > functionInstance->Address() - fRelocationDelta) { + _CreateReturnValue(functionInstance, function, frame, + *stackFrameDebugInfo, instructionPointer); + } } _frame = frameReference.Detach(); @@ -1073,6 +1083,50 @@ DwarfImageDebugInfo::_CreateLocalVariables(CompilationUnit* unit, } +status_t +DwarfImageDebugInfo::_CreateReturnValue(FunctionInstance* functionInstance, + DwarfFunctionDebugInfo* function, StackFrame* frame, + DwarfStackFrameDebugInfo& factory, target_addr_t instructionPointer) +{ + DisassembledCode* sourceCode = NULL; + target_size_t bufferSize = std::min(functionInstance->Size(), + (target_size_t)64 * 1024); + void* buffer = malloc(bufferSize); + if (buffer == NULL) + return B_NO_MEMORY; + MemoryDeleter bufferDeleter(buffer); + ssize_t bytesRead = function->GetSpecificImageDebugInfo() + ->ReadCode(functionInstance->Address(), buffer, bufferSize); + if (bytesRead < 0) + return bytesRead; + + status_t result = fArchitecture->DisassembleCode(function, buffer, + bytesRead, sourceCode); + if (result != B_OK) + return result; + + BReference sourceCodeReference(sourceCode, true); + target_addr_t previousStatementAddress = instructionPointer + fRelocationDelta - 1; + Statement* statement = sourceCode->StatementAtAddress( + previousStatementAddress); + if (statement == NULL) + return B_BAD_VALUE; + + TargetAddressRange range = statement->CoveringAddressRange(); + InstructionInfo info; + if (fArchitecture->GetInstructionInfo(range.Start(), info) == B_OK + && info.Type() == INSTRUCTION_TYPE_SUBROUTINE_CALL) { + // TODO: determine where the previous instruction actually jumps to, + // retrieve that function (could potentially be in another image), + // and use its return type to retrieve the return value (will need + // architecture support since function return value passing convention + // is arch-dependent). + } + + return B_OK; +} + + bool DwarfImageDebugInfo::_EvaluateBaseTypeConstraints(DIEType* type, const TypeLookupConstraints& constraints) diff --git a/src/apps/debugger/debug_info/DwarfImageDebugInfo.h b/src/apps/debugger/debug_info/DwarfImageDebugInfo.h index 67b1cf1e1f..c03370fdea 100644 --- a/src/apps/debugger/debug_info/DwarfImageDebugInfo.h +++ b/src/apps/debugger/debug_info/DwarfImageDebugInfo.h @@ -21,12 +21,14 @@ class Architecture; class CompilationUnit; class DebuggerInterface; class DIEType; +class DwarfFunctionDebugInfo; class DwarfStackFrameDebugInfo; class DwarfFile; class ElfSegment; class FileManager; class FileSourceCode; class FunctionID; +class FunctionInstance; class GlobalTypeCache; class GlobalTypeLookup; class LocatableFile; @@ -61,6 +63,7 @@ public: virtual status_t CreateFrame(Image* image, FunctionInstance* functionInstance, CpuState* cpuState, + bool getFullFrameInfo, StackFrame*& _frame, CpuState*& _previousCpuState); virtual status_t GetStatement(FunctionDebugInfo* function, @@ -100,6 +103,12 @@ private: const EntryListWrapper& variableEntries, const EntryListWrapper& blockEntries); + status_t _CreateReturnValue(FunctionInstance* instance, + DwarfFunctionDebugInfo* info, + StackFrame* frame, + DwarfStackFrameDebugInfo& factory, + target_addr_t instructionPointer); + bool _EvaluateBaseTypeConstraints(DIEType* type, const TypeLookupConstraints& constraints); diff --git a/src/apps/debugger/debug_info/DwarfTypeFactory.cpp b/src/apps/debugger/debug_info/DwarfTypeFactory.cpp index 527e500d0a..ed28f8820c 100644 --- a/src/apps/debugger/debug_info/DwarfTypeFactory.cpp +++ b/src/apps/debugger/debug_info/DwarfTypeFactory.cpp @@ -576,8 +576,9 @@ printf(" -> failed to add type to cache\n"); = dynamic_cast(_typeEntry); DwarfType* templateType; if (templateTypeEntry != NULL) { - if (CreateType(templateTypeEntry->GetType(), templateType) - != B_OK) { + if (templateTypeEntry->GetType() == NULL + || CreateType(templateTypeEntry->GetType(), + templateType) != B_OK) { continue; } } else { diff --git a/src/apps/debugger/debug_info/SpecificImageDebugInfo.h b/src/apps/debugger/debug_info/SpecificImageDebugInfo.h index 0f9f74ad68..7287964ce5 100644 --- a/src/apps/debugger/debug_info/SpecificImageDebugInfo.h +++ b/src/apps/debugger/debug_info/SpecificImageDebugInfo.h @@ -55,11 +55,15 @@ public: virtual status_t CreateFrame(Image* image, FunctionInstance* functionInstance, CpuState* cpuState, + bool getFullFrameInfo, StackFrame*& _Frame, CpuState*& _previousCpuState) = 0; // returns reference to previous frame // and CPU state; returned CPU state // can be NULL; can return B_UNSUPPORTED + // getFullFrameInfo: try to retrieve + // variables/parameters if true + // (and supported) virtual status_t GetStatement(FunctionDebugInfo* function, target_addr_t address, Statement*& _statement) = 0; diff --git a/src/apps/debugger/dwarf/DwarfFile.cpp b/src/apps/debugger/dwarf/DwarfFile.cpp index 7c71714295..14ba4bbb7b 100644 --- a/src/apps/debugger/dwarf/DwarfFile.cpp +++ b/src/apps/debugger/dwarf/DwarfFile.cpp @@ -234,8 +234,11 @@ struct DwarfFile::CIEAugmentation { : fString(NULL), fFlags(0), - fAddressEncoding(0) + fAddressEncoding(CFI_ADDRESS_FORMAT_ABSOLUTE) { + // we default to absolute address format since that corresponds + // to the DWARF standard for .debug_frame. In gcc's case, however, + // .eh_frame will generally override that via augmentation 'R' } void Init(DataReader& dataReader) @@ -270,11 +273,12 @@ struct DwarfFile::CIEAugmentation { break; case 'P': { - char personalityEncoding = dataReader.Read(0); - uint8 addressSize = EncodedAddressSize( - personalityEncoding, NULL); - dataReader.Skip(addressSize); - remaining -= addressSize + 1; + char tempEncoding = fAddressEncoding; + fAddressEncoding = dataReader.Read(0); + off_t offset = dataReader.Offset(); + ReadEncodedAddress(dataReader, NULL, NULL, true); + fAddressEncoding = tempEncoding; + remaining -= dataReader.Offset() - offset + 1; break; } case 'R': @@ -283,14 +287,20 @@ struct DwarfFile::CIEAugmentation { --remaining; break; default: + WARNING("Encountered unsupported augmentation '%c' " + " while parsing CIE augmentation string %s\n", + *string, fString); return B_UNSUPPORTED; } string++; } - dataReader.Skip(remaining); + // we should have read through all of the augmentation data + // at this point, if not, something is wrong. if (remaining != 0 || dataReader.HasOverflow()) { - WARNING("Error while reading CIE Augmentation\n"); + WARNING("Error while reading CIE Augmentation, expected " + "%" B_PRIu64 " bytes of augmentation data, but read " + "%" B_PRIu64 " bytes.\n", length, length - remaining); return B_BAD_DATA; } @@ -370,24 +380,6 @@ struct DwarfFile::CIEAugmentation { return 0; } - int8 EncodedAddressSize(char encoding, CompilationUnit* unit) const - { - switch (encoding & 0x07) { - case CFI_ADDRESS_FORMAT_ABSOLUTE: - return unit->AddressSize(); - case CFI_ADDRESS_FORMAT_UNSIGNED_16: - return 2; - case CFI_ADDRESS_FORMAT_UNSIGNED_32: - return 4; - case CFI_ADDRESS_FORMAT_UNSIGNED_64: - return 8; - } - - // TODO: gcc doesn't (currently) actually generate LEB128-formatted - // addresses. If that changes, we'll need to handle them accordingly - return 0; - } - uint8 FDEAddressType() const { return fAddressEncoding & 0x70; diff --git a/src/apps/mail/Content.cpp b/src/apps/mail/Content.cpp index c4f40717f7..54927c2441 100644 --- a/src/apps/mail/Content.cpp +++ b/src/apps/mail/Content.cpp @@ -119,19 +119,14 @@ Unicode2UTF8(int32 c, char **out) if (c < 0x80) *(s++) = c; - else if (c < 0x800) - { + else if (c < 0x800) { *(s++) = 0xc0 | (c >> 6); *(s++) = 0x80 | (c & 0x3f); - } - else if (c < 0x10000) - { + } else if (c < 0x10000) { *(s++) = 0xe0 | (c >> 12); *(s++) = 0x80 | ((c >> 6) & 0x3f); *(s++) = 0x80 | (c & 0x3f); - } - else if (c < 0x200000) - { + } else if (c < 0x200000) { *(s++) = 0xf0 | (c >> 18); *(s++) = 0x80 | ((c >> 12) & 0x3f); *(s++) = 0x80 | ((c >> 6) & 0x3f); @@ -974,15 +969,12 @@ TTextView::KeyDown(const char *key, int32 count) msg = Window()->CurrentMessage(); mods = msg->FindInt32("modifiers"); - switch (key[0]) - { + switch (key[0]) { case B_HOME: - if (IsSelectable()) - { + if (IsSelectable()) { if (IsEditable()) BTextView::KeyDown(key, count); - else - { + else { // scroll to the beginning Select(0, 0); ScrollToSelection(); @@ -991,12 +983,10 @@ TTextView::KeyDown(const char *key, int32 count) break; case B_END: - if (IsSelectable()) - { + if (IsSelectable()) { if (IsEditable()) BTextView::KeyDown(key, count); - else - { + else { // scroll to the end int32 length = TextLength(); Select(length, length); @@ -1006,19 +996,15 @@ TTextView::KeyDown(const char *key, int32 count) break; case 0x02: // ^b - back 1 char - if (IsSelectable()) - { + if (IsSelectable()) { GetSelection(&start, &end); - while (!IsInitialUTF8Byte(ByteAt(--start))) - { - if (start < 0) - { + while (!IsInitialUTF8Byte(ByteAt(--start))) { + if (start < 0) { start = 0; break; } } - if (start >= 0) - { + if (start >= 0) { Select(start, start); ScrollToSelection(); } @@ -1026,21 +1012,16 @@ TTextView::KeyDown(const char *key, int32 count) break; case B_DELETE: - if (IsSelectable()) - { - if ((key[0] == B_DELETE) || (mods & B_CONTROL_KEY)) // ^d - { - if (IsEditable()) - { + if (IsSelectable()) { + if ((key[0] == B_DELETE) || (mods & B_CONTROL_KEY)) { + // ^d + if (IsEditable()) { GetSelection(&start, &end); if (start != end) Delete(); - else - { - for (end = start + 1; !IsInitialUTF8Byte(ByteAt(end)); end++) - { - if (end > textLen) - { + else { + for (end = start + 1; !IsInitialUTF8Byte(ByteAt(end)); end++) { + if (end > textLen) { end = textLen; break; } @@ -1057,12 +1038,10 @@ TTextView::KeyDown(const char *key, int32 count) break; case 0x05: // ^e - end of line - if ((IsSelectable()) && (mods & B_CONTROL_KEY)) - { + if (IsSelectable() && (mods & B_CONTROL_KEY)) { if (CurrentLine() == CountLines() - 1) Select(TextLength(), TextLength()); - else - { + else { GoToLine(CurrentLine() + 1); GetSelection(&start, &end); Select(start - 1, start - 1); @@ -1071,17 +1050,14 @@ TTextView::KeyDown(const char *key, int32 count) break; case 0x06: // ^f - forward 1 char - if (IsSelectable()) - { + if (IsSelectable()) { GetSelection(&start, &end); if (end > start) start = end; - else - { - for (end = start + 1; !IsInitialUTF8Byte(ByteAt(end)); end++) - { - if (end > textLen) - { + else { + for (end = start + 1; !IsInitialUTF8Byte(ByteAt(end)); + end++) { + if (end > textLen) { end = textLen; break; } @@ -1094,16 +1070,14 @@ TTextView::KeyDown(const char *key, int32 count) break; case 0x0e: // ^n - next line - if (IsSelectable()) - { + if (IsSelectable()) { raw = B_DOWN_ARROW; BTextView::KeyDown(&raw, 1); } break; case 0x0f: // ^o - open line - if (IsEditable()) - { + if (IsEditable()) { GetSelection(&start, &end); Delete(); @@ -1123,7 +1097,7 @@ TTextView::KeyDown(const char *key, int32 count) fYankBuffer = NULL; } fLastPosition = start; - if (CurrentLine() < (CountLines() - 1)) { + if (CurrentLine() < CountLines() - 1) { GoToLine(CurrentLine() + 1); GetSelection(&end, &end); end--; @@ -1161,7 +1135,7 @@ TTextView::KeyDown(const char *key, int32 count) break; case 0x19: // ^y yank text - if ((IsEditable()) && (fYankBuffer)) { + if (IsEditable() && fYankBuffer) { Delete(); Insert(fYankBuffer); ScrollToSelection(); @@ -2256,7 +2230,7 @@ TTextView::AddAsContent(BEmailMessage *mail, bool wrap, uint32 charset, mail_enc // add a newline to every line except for the ones // that already end in newlines, and the last line - if ((text[endOffset - 1] != '\n') && (i < (numLines - 1))) { + if ((text[endOffset - 1] != '\n') && (i < numLines - 1)) { content[contentLength++] = '\n'; // copy quote level of the first line diff --git a/src/apps/mail/KUndoBuffer.cpp b/src/apps/mail/KUndoBuffer.cpp index 37729c57ba..8b4533c1ae 100644 --- a/src/apps/mail/KUndoBuffer.cpp +++ b/src/apps/mail/KUndoBuffer.cpp @@ -4,39 +4,38 @@ #include "KUndoBuffer.h" -KUndoItem::KUndoItem(const char* redo_text, - int32 length, - int32 offset, - undo_type history, - int32 cursor_pos) +KUndoItem::KUndoItem(const char* redo_text, int32 length, int32 offset, + undo_type history, int32 cursor_pos) { Offset = offset; Length = length; History = history; CursorPos = cursor_pos; - if (redo_text!=NULL) { + if (redo_text != NULL) { RedoText = (char*)malloc(length); memcpy(RedoText, redo_text, length); - if (RedoText!=NULL) { + if (RedoText != NULL) fStatus = B_OK; - } else { + else fStatus = B_ERROR; - } } } + KUndoItem::~KUndoItem() { free(RedoText); } + status_t KUndoItem::InitCheck() { return fStatus; } + void KUndoItem::Merge(const char* text, int32 length) { @@ -53,6 +52,7 @@ KUndoBuffer::KUndoBuffer():BList(1024) fNewItem = true; } + KUndoBuffer::~KUndoBuffer() { MakeEmpty(); @@ -62,34 +62,38 @@ KUndoBuffer::~KUndoBuffer() bool KUndoBuffer::AddItem(KUndoItem* item, int32 index) { - for (int32 i=CountItems()-1; i>=index; i--) { + for (int32 i = CountItems() - 1; i >= index; i--) RemoveItem(i); - } + return AddItem(item); } + bool KUndoBuffer::AddItem(KUndoItem* item) { return BList::AddItem(item); } + void KUndoBuffer::MakeEmpty(void) { - for(int32 i=CountItems()-1; i>=0;i--) { + for (int32 i = CountItems() - 1; i >= 0; i--) RemoveItem(i); - } } + KUndoItem* KUndoBuffer::RemoveItem(int32 index) { - if (fIndex>=CountItems()) fIndex--; + if (fIndex >= CountItems()) + fIndex--; delete this->ItemAt(index); return (KUndoItem*)BList::RemoveItem(index); } + KUndoItem* KUndoBuffer::ItemAt(int32 index) const { @@ -103,12 +107,14 @@ KUndoBuffer::On() fNoTouch = false; } + void KUndoBuffer::Off() { fNoTouch = true; } + status_t KUndoBuffer::NewUndo(const char* text, int32 length, int32 offset, undo_type history, int32 cursor_pos) @@ -117,9 +123,9 @@ KUndoBuffer::NewUndo(const char* text, int32 length, int32 offset, cursor_pos); status_t status = NewUndoItem->InitCheck(); - if ( status != B_OK) { + if (status != B_OK) { delete NewUndoItem; - return status; + return status; } AddItem(NewUndoItem, fIndex); fIndex++; @@ -136,13 +142,13 @@ KUndoBuffer::AddUndo(const char* text, int32 length, int32 offset, status_t status = B_OK; - if (fNewItem || (fIndex < CountItems()) || (CountItems()==0)) { + if (fNewItem || fIndex < CountItems() || CountItems() == 0) { status = NewUndo(text, length, offset, history, cursor_pos); fNewItem = false; } else { KUndoItem* CurrentUndoItem; - CurrentUndoItem = ItemAt(fIndex-1); - if (CurrentUndoItem!=NULL) { + CurrentUndoItem = ItemAt(fIndex - 1); + if (CurrentUndoItem != NULL) { int32 c_length = CurrentUndoItem->Length; int32 c_offset = CurrentUndoItem->Offset; undo_type c_history = CurrentUndoItem->History; @@ -150,9 +156,9 @@ KUndoBuffer::AddUndo(const char* text, int32 length, int32 offset, switch(c_history) { case K_INSERTED: case K_REPLACED: - if ((c_offset + c_length) == offset) { + if ((c_offset + c_length) == offset) CurrentUndoItem->Merge(text, length); - } else { + else { status = NewUndo(text, length, offset, history, cursor_pos); } @@ -162,9 +168,8 @@ KUndoBuffer::AddUndo(const char* text, int32 length, int32 offset, cursor_pos); break; } - } else { + } else status = NewUndo(text, length, offset, history, cursor_pos); - } } } @@ -184,65 +189,50 @@ KUndoBuffer::MakeNewUndoItem() status_t -KUndoBuffer::Undo(char** text, - int32* length, - int32* offset, - undo_type* history, - int32* cursor_pos) +KUndoBuffer::Undo(char** text, int32* length, int32* offset, + undo_type* history, int32* cursor_pos) { KUndoItem* undoItem; - status_t status; + status_t status = B_ERROR; - if (fIndex>0) { - undoItem = ItemAt(fIndex-1); - if (undoItem!=NULL) { + if (fIndex > 0) { + undoItem = ItemAt(fIndex - 1); + if (undoItem != NULL) { *text = undoItem->RedoText; *length = undoItem->Length; *offset = undoItem->Offset; *history = undoItem->History; *cursor_pos = undoItem->CursorPos + undoItem->Length; status = B_OK; - } else { - status = B_ERROR; } fIndex--; - } else { - status = B_ERROR; } return status; } + status_t -KUndoBuffer::Redo(char** text, - int32* length, - int32* offset, - undo_type* history, - int32* cursor_pos, - bool* replaced) +KUndoBuffer::Redo(char** text, int32* length, int32* offset, + undo_type* history, int32* cursor_pos, bool* replaced) { KUndoItem* undoItem; - status_t status; + status_t status = B_ERROR; if (fIndex < CountItems()) { undoItem = ItemAt(fIndex); - if (undoItem!=NULL) { + if (undoItem != NULL) { *text = undoItem->RedoText; *length = undoItem->Length; *offset = undoItem->Offset; *history = undoItem->History; *cursor_pos = undoItem->CursorPos; - if ((fIndex+1) < CountItems()) { - *replaced = ItemAt(fIndex+1)->History==K_REPLACED; - } else { + if (fIndex + 1 < CountItems()) + *replaced = ItemAt(fIndex + 1)->History == K_REPLACED; + else *replaced = false; - } status = B_OK; - } else { - status = B_ERROR; } fIndex++; - } else { - status = B_ERROR; } return status; } @@ -251,10 +241,10 @@ KUndoBuffer::Redo(char** text, void KUndoBuffer::PrintToStream() { - for(int32 i=0; iHistory) { + switch (item->History) { case K_INSERTED: printf("INSERTED "); break; @@ -269,13 +259,12 @@ KUndoBuffer::PrintToStream() printf("Length = %d ", (int)item->Length); printf("CursorPos = %d ", (int)item->CursorPos); printf("RedoText = '"); - for(int32 j=0;jLength;j++) { + for (int32 j = 0; j < item->Length; j++) { uchar c = (uchar)item->RedoText[j]; - if (c >= 0x20) { + if (c >= 0x20) printf("%c", c); - } else { + else printf("?"); - } } printf("'\n"); } diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index ab8fc6201f..0dfd0c9ea0 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -1515,7 +1515,7 @@ StyledEditWindow::_ReloadDocument(BMessage* message) bs_printf(&alertText, B_TRANSLATE("\"%s\" has unsaved changes.\n" "Revert it to the last saved version? "), Title()); - if (_ShowAlert(alertText, B_TRANSLATE("Cancel"), B_TRANSLATE("OK"), + if (_ShowAlert(alertText, B_TRANSLATE("Cancel"), B_TRANSLATE("Revert"), "", B_WARNING_ALERT) != 1) return; } diff --git a/src/kits/game/FileGameSound.cpp b/src/kits/game/FileGameSound.cpp index f26c76645b..085add4b4b 100644 --- a/src/kits/game/FileGameSound.cpp +++ b/src/kits/game/FileGameSound.cpp @@ -331,27 +331,28 @@ BFileGameSound::Perform(int32 selector, status_t BFileGameSound::SetPaused(bool isPaused, bigtime_t rampTime) { - if (fPaused != isPaused) { - Lock(); + if (fPaused == isPaused) + return EALREADY; - // Clear any old ramping - delete fPausing; - fPausing = NULL; + Lock(); - if (rampTime > 100000) { - // Setup for ramping - if (isPaused) - fPausing = InitRamp(&fPauseGain, 0.0, - Format().frame_rate, rampTime); - else - fPausing = InitRamp(&fPauseGain, 1.0, - Format().frame_rate, rampTime); - } + // Clear any old ramping + delete fPausing; + fPausing = NULL; - fPaused = isPaused; - Unlock(); + if (rampTime > 100000) { + // Setup for ramping + if (isPaused) + fPausing = InitRamp(&fPauseGain, 0.0, + Format().frame_rate, rampTime); + else + fPausing = InitRamp(&fPauseGain, 1.0, + Format().frame_rate, rampTime); } + fPaused = isPaused; + Unlock(); + return B_OK; } diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index 2a85b8720e..6b2611cfcf 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -419,8 +419,8 @@ DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/, font_height fontHeight; font.GetHeight(&fontHeight); - float height = fontHeight.ascent + fontHeight.descent + fontHeight.leading - + 2 + Bounds().Height() + 8; + float height = ceil(fontHeight.ascent + fontHeight.descent + + fontHeight.leading + 2 + Bounds().Height() + 8); BRect rect(0, 0, max_c(Bounds().Width(), font.StringWidth(model->Name()) + 4), height); @@ -2554,10 +2554,13 @@ BContainerWindow::SetupMoveCopyMenus(const entry_ref* item_ref, BMenu* parent) // Set the "Identify" item label BMenuItem* identifyItem = parent->FindItem(kIdentifyEntry); if (identifyItem != NULL) { - if (modifierKeys & B_SHIFT_KEY) + if (modifierKeys & B_SHIFT_KEY) { identifyItem->SetLabel(B_TRANSLATE("Force identify")); - else + identifyItem->Message()->ReplaceBool("force", true); + } else { identifyItem->SetLabel(B_TRANSLATE("Identify")); + identifyItem->Message()->ReplaceBool("force", false); + } } } @@ -2778,8 +2781,9 @@ BContainerWindow::AddFileContextMenus(BMenu* menu) #endif menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem(B_TRANSLATE("Identify"), - new BMessage(kIdentifyEntry))); + BMessage* message = new BMessage(kIdentifyEntry); + message->AddBool("force", false); + menu->AddItem(new BMenuItem(B_TRANSLATE("Identify"), message)); BMenu* addOnMenuItem = new BMenu(B_TRANSLATE("Add-ons")); addOnMenuItem->SetFont(be_plain_font); menu->AddItem(addOnMenuItem); diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 9c4971cd52..23e356b5af 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -2368,8 +2368,13 @@ BPoseView::MessageReceived(BMessage* message) break; case kIdentifyEntry: - IdentifySelection(); + { + bool force; + if (message->FindBool("force", &force) != B_OK) + force = false; + IdentifySelection(force); break; + } case kEditItem: { @@ -8360,9 +8365,8 @@ BPoseView::OpenParent() void -BPoseView::IdentifySelection() -{ - bool force = (modifiers() & B_SHIFT_KEY) != 0; +BPoseView::IdentifySelection(bool force) +{ int32 count = fSelectionList->CountItems(); for (int32 index = 0; index < count; index++) { BPose* pose = fSelectionList->ItemAt(index); diff --git a/src/kits/tracker/PoseView.h b/src/kits/tracker/PoseView.h index 6179f07d17..d1dd5bac87 100644 --- a/src/kits/tracker/PoseView.h +++ b/src/kits/tracker/PoseView.h @@ -284,7 +284,7 @@ class BPoseView : public BView { void OpenInfoWindows(); void SetDefaultPrinter(); - void IdentifySelection(); + void IdentifySelection(bool force = false); void UnmountSelectedVolumes(); virtual void OpenParent(); diff --git a/src/servers/cddb_daemon/cddb_daemon.cpp b/src/servers/cddb_daemon/cddb_daemon.cpp index e43ca455a5..ef2529d72a 100644 --- a/src/servers/cddb_daemon/cddb_daemon.cpp +++ b/src/servers/cddb_daemon/cddb_daemon.cpp @@ -247,15 +247,15 @@ CDDBDaemon::_WriteCDData(dev_t device, QueryResponseData* diskData, // Add relevant attributes. We consider an error here as non-fatal. BNode node(&entry); - node.WriteAttr("Audio:Title", B_STRING_TYPE, 0, (data->title).String(), + node.WriteAttr("Media:Title", B_STRING_TYPE, 0, (data->title).String(), (data->title).Length()); node.WriteAttr("Audio:Album", B_STRING_TYPE, 0, (readResponse->title).String(), (readResponse->title).Length()); - node.WriteAttr("Audio:Genre", B_STRING_TYPE, 0, + node.WriteAttr("Media:Genre", B_STRING_TYPE, 0, (readResponse->genre).String(), (readResponse->genre).Length()); - node.WriteAttr("Audio:Year", B_INT32_TYPE, 0, &(readResponse->year), + node.WriteAttr("Media:Year", B_INT32_TYPE, 0, &(readResponse->year), sizeof(int32)); if (data->artist == "") { diff --git a/src/servers/debug/DebugServer.cpp b/src/servers/debug/DebugServer.cpp index 6727c5203f..9f11b30114 100644 --- a/src/servers/debug/DebugServer.cpp +++ b/src/servers/debug/DebugServer.cpp @@ -715,7 +715,7 @@ TeamDebugHandler::_HandleMessage(DebugMessage *message) #ifdef HANDOVER_USE_DEBUGGER BAlert *alert = new BAlert(NULL, buffer.String(), B_TRANSLATE("Terminate"), B_TRANSLATE("Debug"), - B_TRANSLATE("Save Report"), B_WIDTH_AS_USUAL, B_WARNING_ALERT); + B_TRANSLATE("Save report"), B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); debugAction = alert->Go(); _NotifyRegistrar(fTeam, false, debugAction != kActionKillTeam);