app_server: Fix invalid cast of int32 to size_t array.

Make ServerFont::GetBoundingBoxesForStrings() use size_t.
This commit is contained in:
Michael Lotz 2018-12-28 23:55:35 +01:00
parent 9dad3fb4b0
commit 22ce55254f
4 changed files with 5 additions and 7 deletions

View File

@ -394,7 +394,7 @@ determine_bounds_draw_shape(void* _state, const BShape& shape, bool fill)
static void
determine_bounds_draw_string(void* _state, const char* string, size_t _length,
determine_bounds_draw_string(void* _state, const char* string, size_t length,
float deltaSpace, float deltaNonSpace)
{
TRACE_BB("%p string '%s'\n", _state, string);
@ -405,7 +405,6 @@ determine_bounds_draw_string(void* _state, const char* string, size_t _length,
escapement_delta delta = { deltaSpace, deltaNonSpace };
BRect rect;
int32 length = _length;
font.GetBoundingBoxesForStrings((char**)&string, &length, 1, &rect,
B_SCREEN_METRIC, &delta);

View File

@ -2563,8 +2563,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
for(int32 i = 0; i < numStrings; i++) {
// This version of ReadString allocates the strings, we free
// them below
// TODO: this does not work on 64-bit (size_t != int32)
link.ReadString(&stringArray[i], (size_t*)&lengthArray[i]);
link.ReadString(&stringArray[i], &lengthArray[i]);
link.Read<escapement_delta>(&deltaArray[i]);
}

View File

@ -1017,7 +1017,7 @@ ServerFont::GetBoundingBoxes(const char* string, int32 numBytes,
status_t
ServerFont::GetBoundingBoxesForStrings(char *charArray[], int32 lengthArray[],
ServerFont::GetBoundingBoxesForStrings(char *charArray[], size_t lengthArray[],
int32 numStrings, BRect rectArray[], font_metric_mode mode,
escapement_delta deltaArray[])
{
@ -1028,7 +1028,7 @@ ServerFont::GetBoundingBoxesForStrings(char *charArray[], int32 lengthArray[],
Transformable transform(EmbeddedTransformation());
for (int32 i = 0; i < numStrings; i++) {
int32 numBytes = lengthArray[i];
size_t numBytes = lengthArray[i];
const char* string = charArray[i];
escapement_delta delta = deltaArray[i];

View File

@ -140,7 +140,7 @@ class ServerFont {
bool asString);
status_t GetBoundingBoxesForStrings(char *charArray[],
int32 lengthArray[], int32 numStrings,
size_t lengthArray[], int32 numStrings,
BRect rectArray[], font_metric_mode mode,
escapement_delta deltaArray[]);