Corrected reply handling of FlushWithReply in many places what should fix some strange bugs.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12211 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2005-04-01 03:02:15 +00:00
parent 54f7283aa0
commit 20337f3165
2 changed files with 48 additions and 42 deletions

View File

@ -779,15 +779,15 @@ BFont::TruncateString(BString *inOut, uint32 mode, float width) const
link.StartMessage(AS_GET_TRUNCATED_STRINGS);
if(code!=SERVER_TRUE)
return;
link.Attach<uint32>(mode);
link.Attach<float>(width);
link.Attach<int32>(1);
link.AttachString(inOut->String());
link.FlushWithReply(&code);
if(code!=SERVER_TRUE)
return;
char *string;
link.ReadString(&string);
*inOut=string;
@ -808,9 +808,6 @@ BFont::GetTruncatedStrings(const char *stringArray[], int32 numStrings,
link.StartMessage(AS_GET_TRUNCATED_STRINGS);
if(code!=SERVER_TRUE)
return;
link.Attach<uint32>(mode);
link.Attach<float>(width);
link.Attach<int32>(numStrings);
@ -820,6 +817,9 @@ BFont::GetTruncatedStrings(const char *stringArray[], int32 numStrings,
link.FlushWithReply(&code);
if(code!=SERVER_TRUE)
return;
for(int32 i=0; i<numStrings; i++)
{
char *string;
@ -842,9 +842,6 @@ BFont::GetTruncatedStrings(const char *stringArray[], int32 numStrings,
link.StartMessage(AS_GET_TRUNCATED_STRINGS);
if(code!=SERVER_TRUE)
return;
link.Attach<uint32>(mode);
link.Attach<float>(width);
link.Attach<int32>(numStrings);
@ -854,6 +851,9 @@ BFont::GetTruncatedStrings(const char *stringArray[], int32 numStrings,
link.FlushWithReply(&code);
if(code!=SERVER_TRUE)
return;
// TODO: Look into a possible BPortLink::ReadIntoString() method to speed things
// like this up, along with the other string truncation functions
for(int32 i=0; i<numStrings; i++)
@ -913,9 +913,6 @@ BFont::GetStringWidths(const char *stringArray[], const int32 lengthArray[],
link.StartMessage(AS_GET_STRING_WIDTHS);
if(code!=SERVER_TRUE)
return;
link.Attach<int32>(numStrings);
for(int32 i=0; i<numStrings; i++)
@ -926,6 +923,9 @@ BFont::GetStringWidths(const char *stringArray[], const int32 lengthArray[],
link.FlushWithReply(&code);
if(code!=SERVER_TRUE)
return;
for(int32 i=0; i<numStrings; i++)
link.Read<float>(&widthArray[i]);
}
@ -965,8 +965,6 @@ BFont::GetEscapements(const char charArray[], int32 numChars, escapement_delta *
BPrivate::BAppServerLink link;
link.StartMessage(AS_GET_ESCAPEMENTS);
if(code!=SERVER_TRUE)
return;
link.Attach<int32>(numChars);
@ -990,6 +988,9 @@ BFont::GetEscapements(const char charArray[], int32 numChars, escapement_delta *
}
link.FlushWithReply(&code);
if(code!=SERVER_TRUE)
return;
for(int32 i=0; i<numChars; i++)
link.Read<BPoint>(&escapementArray[i]);
}
@ -1006,9 +1007,6 @@ BFont::GetEdges(const char charArray[], int32 numBytes, edge_info edgeArray[]) c
link.StartMessage(AS_GET_EDGES);
if(code!=SERVER_TRUE)
return;
link.Attach<int32>(numBytes);
for(int32 i=0; i<numBytes; i++)
@ -1016,6 +1014,9 @@ BFont::GetEdges(const char charArray[], int32 numBytes, edge_info edgeArray[]) c
link.FlushWithReply(&code);
if(code!=SERVER_TRUE)
return;
for(int32 i=0; i<numBytes; i++)
link.Read<edge_info>(&edgeArray[i]);
}
@ -1064,9 +1065,6 @@ BFont::GetBoundingBoxesAsString(const char charArray[], int32 numChars, font_met
link.StartMessage(AS_GET_BOUNDINGBOXES_CHARS);
if(code!=SERVER_TRUE)
return;
link.Attach<font_metric_mode>(mode);
if(delta)
@ -1086,6 +1084,9 @@ BFont::GetBoundingBoxesAsString(const char charArray[], int32 numChars, font_met
link.FlushWithReply(&code);
if(code!=SERVER_TRUE)
return;
for(int32 i=0; i<numChars; i++)
link.Read<BRect>(&boundingBoxArray[i]);
}
@ -1103,9 +1104,6 @@ BFont::GetBoundingBoxesForStrings(const char *stringArray[], int32 numStrings,
link.StartMessage(AS_GET_BOUNDINGBOXES_STRINGS);
if(code!=SERVER_TRUE)
return;
link.Attach<font_metric_mode>(mode);
link.Attach<int32>(numStrings);
@ -1129,6 +1127,9 @@ BFont::GetBoundingBoxesForStrings(const char *stringArray[], int32 numStrings,
}
link.FlushWithReply(&code);
if(code!=SERVER_TRUE)
return;
for(int32 i=0; i<numStrings; i++)
link.Read<BRect>(&boundingBoxArray[i]);
}
@ -1138,7 +1139,6 @@ void
BFont::GetGlyphShapes(const char charArray[], int32 numChars, BShape *glyphShapeArray[]) const
{
// TODO: implement code specifically for passing BShapes to and from the server
if(!charArray || numChars<1 || !glyphShapeArray)
return;
@ -1147,9 +1147,6 @@ BFont::GetGlyphShapes(const char charArray[], int32 numChars, BShape *glyphShape
link.StartMessage(AS_GET_GLYPH_SHAPES);
if(code!=SERVER_TRUE)
return;
link.Attach<int32>(numChars);
for(int32 i=0; i<numChars; i++)
@ -1157,6 +1154,9 @@ BFont::GetGlyphShapes(const char charArray[], int32 numChars, BShape *glyphShape
link.FlushWithReply(&code);
if(code!=SERVER_TRUE)
return;
// This is going to be dog slow, but it'll do for now
char *buffer=NULL;
size_t buffersize=0;
@ -1197,9 +1197,6 @@ BFont::GetHasGlyphs(const char charArray[], int32 numChars, bool hasArray[]) con
link.StartMessage(AS_GET_HAS_GLYPHS);
if(code!=SERVER_TRUE)
return;
link.Attach<int32>(numChars);
for(int32 i=0; i<numChars; i++)
@ -1207,6 +1204,9 @@ BFont::GetHasGlyphs(const char charArray[], int32 numChars, bool hasArray[]) con
link.FlushWithReply(&code);
if(code!=SERVER_TRUE)
return;
for(int32 i=0; i<numChars; i++)
link.Read<bool>(&hasArray[i]);
}

View File

@ -83,9 +83,10 @@ get_scroll_bar_info(scroll_bar_info *info)
int32 code;
link.StartMessage(AS_GET_SCROLLBAR_INFO);
link.FlushWithReply(&code);
link.Read<scroll_bar_info>(info);
if(code==SERVER_TRUE)
link.Read<scroll_bar_info>(info);
return B_OK;
return ((code==SERVER_TRUE)?B_OK:B_ERROR);
}
@ -101,7 +102,7 @@ set_scroll_bar_info(scroll_bar_info *info)
link.StartMessage(AS_SET_SCROLLBAR_INFO);
link.Attach<scroll_bar_info>(*info);
link.FlushWithReply(&code);
return B_OK;
return ((code==SERVER_TRUE)?B_OK:B_ERROR);
}
#endif // COMPILE_FOR_R5
@ -419,13 +420,14 @@ keyboard_navigation_color()
_IMPEXP_BE int32
count_workspaces()
{
int32 count;
int32 count=1;
BAppServerLink link;
int32 code;
link.StartMessage(AS_COUNT_WORKSPACES);
link.FlushWithReply(&code);
link.Read<int32>(&count);
if(code==SERVER_TRUE)
link.Read<int32>(&count);
return count;
}
@ -443,13 +445,14 @@ set_workspace_count(int32 count)
_IMPEXP_BE int32
current_workspace()
{
int32 index;
int32 index = 1;
BAppServerLink link;
int32 code;
link.StartMessage(AS_CURRENT_WORKSPACE);
link.FlushWithReply(&code);
link.Read<int32>(&index);
if(code==SERVER_TRUE)
link.Read<int32>(&index);
return index;
}
@ -468,13 +471,14 @@ activate_workspace(int32 workspace)
_IMPEXP_BE bigtime_t
idle_time()
{
bigtime_t idletime;
bigtime_t idletime = 0;
BAppServerLink link;
int32 code;
link.StartMessage(AS_IDLE_TIME);
link.FlushWithReply(&code);
link.Read<int64>(&idletime);
if(code==SERVER_TRUE)
link.Read<int64>(&idletime);
return idletime;
}
@ -518,13 +522,14 @@ set_focus_follows_mouse(bool follow)
_IMPEXP_BE bool
focus_follows_mouse()
{
bool ffm;
bool ffm = false;
BAppServerLink link;
int32 code;
link.StartMessage(AS_FOCUS_FOLLOWS_MOUSE);
link.FlushWithReply(&code);
link.Read<bool>(&ffm);
if(code==SERVER_TRUE)
link.Read<bool>(&ffm);
return ffm;
}
@ -548,7 +553,8 @@ mouse_mode()
int32 code;
link.StartMessage(AS_GET_MOUSE_MODE);
link.FlushWithReply(&code);
link.Read<mode_mouse>(&mode);
if(code==SERVER_TRUE)
link.Read<mode_mouse>(&mode);
return mode;
}