app_server: Fixed/documented uses of new without nothrow.
* This should fix all occurrences except for those in the drawing sub directory. * In some cases, the use of new without nothrow was okay, though.
This commit is contained in:
parent
f744935b65
commit
eb69155bbf
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2009, Haiku.
|
||||
* Copyright 2001-2016, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -341,7 +341,7 @@ CursorManager::GetCursor(BCursorID which)
|
||||
\param token ID of the cursor to find
|
||||
\return The cursor or NULL if not found
|
||||
*/
|
||||
ServerCursor *
|
||||
ServerCursor*
|
||||
CursorManager::FindCursor(int32 token)
|
||||
{
|
||||
if (!Lock())
|
||||
@ -357,6 +357,11 @@ CursorManager::FindCursor(int32 token)
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Initializes a predefined system cursor.
|
||||
|
||||
This method must only be called in the CursorManager's constructor,
|
||||
as it may throw exceptions.
|
||||
*/
|
||||
void
|
||||
CursorManager::_InitCursor(ServerCursor*& cursorMember,
|
||||
const uint8* cursorBits, BCursorID id, const BPoint& hotSpot)
|
||||
|
@ -481,6 +481,8 @@ Desktop::RegisterListener(DesktopListener* listener)
|
||||
}
|
||||
|
||||
|
||||
/*! This method is allowed to throw exceptions.
|
||||
*/
|
||||
status_t
|
||||
Desktop::Init()
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2014, Haiku.
|
||||
* Copyright 2001-2016, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -31,6 +31,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
// functions needed to convert a freetype vector graphics to a BShape
|
||||
inline BPoint
|
||||
VectorToPoint(const FT_Vector *vector)
|
||||
@ -401,7 +402,7 @@ ServerFont::PutTransformedFace(FT_Face face) const
|
||||
|
||||
status_t
|
||||
ServerFont::GetGlyphShapes(const char charArray[], int32 numChars,
|
||||
BShape *shapeArray[]) const
|
||||
BShape* shapeArray[]) const
|
||||
{
|
||||
if (!charArray || numChars <= 0 || !shapeArray)
|
||||
return B_BAD_DATA;
|
||||
@ -418,9 +419,13 @@ ServerFont::GetGlyphShapes(const char charArray[], int32 numChars,
|
||||
funcs.shift = 0;
|
||||
funcs.delta = 0;
|
||||
|
||||
const char *string = charArray;
|
||||
const char* string = charArray;
|
||||
for (int i = 0; i < numChars; i++) {
|
||||
shapeArray[i] = new BShape();
|
||||
shapeArray[i] = new (std::nothrow) BShape();
|
||||
if (shapeArray[i] == NULL) {
|
||||
PutTransformedFace(face);
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
FT_Load_Char(face, UTF8ToCharCode(&string), FT_LOAD_NO_BITMAP);
|
||||
FT_Outline outline = face->glyph->outline;
|
||||
FT_Outline_Decompose(&outline, &funcs, shapeArray[i]);
|
||||
@ -871,7 +876,10 @@ ServerFont::TruncateString(BString* inOut, uint32 mode, float width) const
|
||||
int32 numChars = inOut->CountChars();
|
||||
|
||||
// get the escapement of each glyph in font units
|
||||
float* escapementArray = new float[numChars];
|
||||
float* escapementArray = new (std::nothrow) float[numChars];
|
||||
if (escapementArray == NULL)
|
||||
return;
|
||||
|
||||
static escapement_delta delta = (escapement_delta){ 0.0, 0.0 };
|
||||
if (GetEscapements(inOut->String(), inOut->Length(), numChars, delta,
|
||||
escapementArray) == B_OK) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2009, Haiku.
|
||||
* Copyright 2001-2016, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -7,13 +7,13 @@
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
/*! Manages font families and styles */
|
||||
|
||||
|
||||
#include "FontFamily.h"
|
||||
#include "FontManager.h"
|
||||
#include "ServerConfig.h"
|
||||
#include "ServerFont.h"
|
||||
|
||||
#include <new>
|
||||
|
||||
#include <Autolock.h>
|
||||
#include <Directory.h>
|
||||
@ -25,7 +25,10 @@
|
||||
#include <Path.h>
|
||||
#include <String.h>
|
||||
|
||||
#include <new>
|
||||
#include "FontFamily.h"
|
||||
#include "ServerConfig.h"
|
||||
#include "ServerFont.h"
|
||||
|
||||
|
||||
//#define TRACE_FONT_MANAGER
|
||||
#ifdef TRACE_FONT_MANAGER
|
||||
@ -608,8 +611,8 @@ FontManager::_AddFont(font_directory& directory, BEntry& entry)
|
||||
FTRACE(("\tadd style: %s, %s\n", face->family_name, face->style_name));
|
||||
|
||||
// the FontStyle takes over ownership of the FT_Face object
|
||||
FontStyle *style = new FontStyle(nodeRef, path.Path(), face);
|
||||
if (!family->AddStyle(style)) {
|
||||
FontStyle *style = new (std::nothrow) FontStyle(nodeRef, path.Path(), face);
|
||||
if (style == NULL || !family->AddStyle(style)) {
|
||||
delete style;
|
||||
delete family;
|
||||
return B_NO_MEMORY;
|
||||
|
Loading…
x
Reference in New Issue
Block a user