Compilation fixes for Terminal, add to image.

It runs, but has shown up various bugs: app_server crashes, kernel
panics, rendering problems. Working on fixing these now.
This commit is contained in:
Alex Smith 2012-08-05 10:24:22 +01:00
parent e5363c936a
commit adf8818ec0
24 changed files with 76 additions and 66 deletions

@ -34,7 +34,7 @@ SYSTEM_BIN = "[" addattr base64 basename bash beep cal cat catattr chgrp chmod
zdiff zforce zgrep zip zipcloak <bin>zipgrep zipnote zipsplit zmore znew
;
SYSTEM_APPS = ;
SYSTEM_APPS = Terminal ;
SYSTEM_PREFERENCES = ;
@ -42,7 +42,7 @@ SYSTEM_DEMOS = ;
SYSTEM_LIBS = libbe.so libbnetapi.so libnetwork.so
libroot.so libroot-addon-icu.so
libtextencoding.so libtranslation.so
libtextencoding.so libtracker.so libtranslation.so
$(HAIKU_SHARED_LIBSTDC++) $(HAIKU_SHARED_LIBSUPC++)
$(HAIKU_FREETYPE_CURRENT_LIB)
;

@ -116,6 +116,13 @@ if [ "$SAFEMODE" != "yes" ]; then
waitfor _input_server_event_loop_ # wait for input devices
fi
# TODO: remove this when x86_64 is more complete.
if [ "$(uname -m)" = "x86_64" ]; then
cd /boot/home
launch system/apps/Terminal
exit
fi
# Now ask the user if he wants to run the Installer or continue to the Desktop.
if [ "$isReadOnly" = "yes" ]; then
# Create Installer link (using the write overlay)

@ -386,7 +386,7 @@ TermParse::EscParse()
int32 srcLen = sizeof(cbuf);
int32 dstLen = sizeof(dstbuf);
long dummyState = 0;
int32 dummyState = 0;
int width = 1;
BAutolock locker(fBuffer);
@ -1250,7 +1250,7 @@ TermParse::_DeviceStatusReport(int n)
}
case 6:
// Cursor position report requested
len = sprintf(sbuf, "\033[%ld;%ldR",
len = sprintf(sbuf, "\033[%" B_PRId32 ";%" B_PRId32 "R",
fBuffer->Cursor().y + 1,
fBuffer->Cursor().x + 1);
write(fFd, sbuf, len);

@ -1560,7 +1560,7 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
if (fEncoding != M_UTF8) {
char destBuffer[16];
int32 destLen = sizeof(destBuffer);
long state = 0;
int32 state = 0;
convert_from_utf8(fEncoding, bytes, &numBytes, destBuffer,
&destLen, &state, '?');
_ScrollTo(0, true);
@ -1758,7 +1758,7 @@ TermView::MessageReceived(BMessage *msg)
if (msg->WasDropped() && (msg->what == B_SIMPLE_DATA
|| msg->what == B_MIME_DATA)) {
char *text;
int32 numBytes;
ssize_t numBytes;
//rgb_color *color;
int32 i = 0;

@ -1553,7 +1553,7 @@ TermWindow::_MakeWindowSizeMenu()
char label[32];
int32 columns = windowSizes[i][0];
int32 rows = windowSizes[i][1];
snprintf(label, sizeof(label), "%ldx%ld", columns, rows);
snprintf(label, sizeof(label), "%" B_PRId32 "x%" B_PRId32, columns, rows);
BMessage* message = new BMessage(MSG_COLS_CHANGED);
message->AddInt32("columns", columns);
message->AddInt32("rows", rows);

@ -1308,7 +1308,7 @@ BContainerWindow::SetLayoutState(BNode* node, const BMessage* message)
for (int32 index = 0; index < count; index++) {
const void* buffer;
int32 size;
ssize_t size;
result = message->FindData(name, type, index, &buffer, &size);
if (result != B_OK) {
PRINT(("error reading %s \n", name));
@ -3059,7 +3059,7 @@ BContainerWindow::BuildAddOnMenu(BMenu* menu)
// found the addons menu, empty it first
for (;;) {
item = menu->RemoveItem(0L);
item = menu->RemoveItem((int32)0);
if (!item)
break;
delete item;

@ -229,7 +229,7 @@ BCountView::Draw(BRect updateRect)
else {
itemString.SetTo(B_TRANSLATE("%num items"));
char numString[256];
snprintf(numString, sizeof(numString), "%ld", fLastCount);
snprintf(numString, sizeof(numString), "%" B_PRId32, fLastCount);
itemString.ReplaceFirst("%num", numString);
}
}

@ -462,7 +462,7 @@ BDeskWindow::MessageReceived(BMessage* message)
{
if (message->WasDropped()) {
const rgb_color* color;
int32 size;
ssize_t size;
// handle "roColour"-style color drops
if (message->FindData("RGBColor", 'RGBC',
(const void**)&color, &size) == B_OK) {

@ -73,14 +73,14 @@ MakeNodeFromName(node_ref* node, char* name)
static inline void
MakeRefName(char* refName, const node_ref* node)
{
sprintf(refName, "r%ld_%Ld", node->device, node->node);
sprintf(refName, "r%" B_PRIdDEV "_%" B_PRIdINO, node->device, node->node);
}
static inline void
MakeModeName(char* modeName, const node_ref* node)
{
sprintf(modeName, "m%ld_%Ld", node->device, node->node);
sprintf(modeName, "m%" B_PRIdDEV "_%" B_PRIdINO, node->device, node->node);
}
@ -702,7 +702,7 @@ BClipboardRefsWatcher::RemoveNodesByDevice(dev_t device)
BMessage* clip = be_clipboard->Data();
if (clip != NULL) {
char deviceName[6];
sprintf(deviceName, "r%ld_", device);
sprintf(deviceName, "r%" B_PRIdDEV "_", device);
int32 index = 0;
char* refName;

@ -1264,7 +1264,7 @@ LowLevelCopy(BEntry* srcEntry, StatStruct* srcStat, BDirectory* destDir,
const size_t kMaxBufferSize = 1024* 1024;
size_t bufsize = kMinBufferSize;
if (bufsize < srcStat->st_size) {
if ((off_t)bufsize < srcStat->st_size) {
// File bigger than the buffer size: determine an optimal buffer size
system_info sinfo;
get_system_info(&sinfo);
@ -2343,7 +2343,7 @@ FSMakeOriginalName(char* name, BDirectory* destDir, const char* suffix)
fnum = 1;
strcpy(temp_name, name);
while (destDir->Contains(temp_name)) {
sprintf(temp_name, "%s %ld", copybase, ++fnum);
sprintf(temp_name, "%s %" B_PRId32, copybase, ++fnum);
if (strlen(temp_name) > (B_FILE_NAME_LENGTH - 1)) {
// The name has grown too long. Maybe we just went from
@ -2352,7 +2352,7 @@ FSMakeOriginalName(char* name, BDirectory* destDir, const char* suffix)
// truncate the 'root' name and continue.
// ??? should we reset fnum or not ???
root[strlen(root) - 1] = '\0';
sprintf(temp_name, "%s%s %ld", root, suffix, fnum);
sprintf(temp_name, "%s%s %" B_PRId32, root, suffix, fnum);
}
}
@ -3233,7 +3233,7 @@ _TrackerLaunchAppWithDocuments(const entry_ref* appRef, const BMessage* refs,
if (error == B_OK) {
// close possible parent window, if specified
const node_ref* nodeToClose = 0;
int32 numBytes;
ssize_t numBytes;
refs->FindData("nodeRefsToClose", B_RAW_TYPE,
(const void**)&nodeToClose, &numBytes);
if (nodeToClose)

@ -2303,7 +2303,7 @@ FindPanel::RestoreWindowState(const BNode* node)
BTextControl* textControl = dynamic_cast<BTextControl*>(view);
if (textControl != NULL && Mode() == kByFormulaItem) {
int32 selStart = 0;
int32 selEnd = LONG_MAX;
int32 selEnd = INT32_MAX;
node->ReadAttr("_trk/focusedSelStart", B_INT32_TYPE, 0,
&selStart, sizeof(selStart));
node->ReadAttr("_trk/focusedSelEnd", B_INT32_TYPE, 0,
@ -3162,7 +3162,7 @@ MostUsedNames::~MostUsedNames()
if (entry->count < -10 && i > 0)
continue;
sprintf(line, "%ld %s\n", entry->count, entry->name);
sprintf(line, "%" B_PRId32 " %s\n", entry->count, entry->name);
if (file.Write(line, strlen(line)) < B_OK)
break;
}

@ -27,7 +27,7 @@ TMenuItemGroup::~TMenuItemGroup()
if (fMenu == NULL) {
BMenuItem* item;
while ((item = RemoveItem(0L)) != NULL)
while ((item = RemoveItem((int32)0)) != NULL)
delete item;
}
}
@ -176,7 +176,7 @@ TGroupedMenu::TGroupedMenu(const char* name)
TGroupedMenu::~TGroupedMenu()
{
TMenuItemGroup* group;
while ((group = static_cast<TMenuItemGroup*>(fGroups.RemoveItem(0L)))
while ((group = static_cast<TMenuItemGroup*>(fGroups.RemoveItem((int32)0)))
!= NULL) {
delete group;
}

@ -675,7 +675,7 @@ BInfoWindow::GetSizeString(BString &result, off_t size, int32 fileCount)
// TODO: use BCountry::FormatNumber
if (size >= kKBSize) {
char numStr[128];
snprintf(numStr, sizeof(numStr), "%Ld", size);
snprintf(numStr, sizeof(numStr), "%" B_PRIdOFF, size);
BString bytes;
uint32 length = strlen(numStr);

@ -1083,7 +1083,7 @@ Model::SupportsMimeType(const char* type, const BObjectList<BString>* list,
// check if this model lists the type of dropped document as supported
const char* mimeSignature;
int32 bufferLength;
ssize_t bufferLength;
if (message.FindData("types", 'CSTR', index,
(const void**)&mimeSignature, &bufferLength)) {
@ -1157,7 +1157,7 @@ Model::IsSuperHandler() const
for (int32 index = 0; ; index++) {
const char* mimeSignature;
int32 bufferLength;
ssize_t bufferLength;
if (message.FindData("types", 'CSTR', index,
(const void**)&mimeSignature, &bufferLength)) {
@ -1271,8 +1271,8 @@ Model::GetVersionString(BString &result, version_kind kind)
return error;
char vstr[32];
sprintf(vstr, "%ld.%ld.%ld", version.major, version.middle,
version.minor);
sprintf(vstr, "%" B_PRId32 ".%" B_PRId32 ".%" B_PRId32, version.major,
version.middle, version.minor);
result = vstr;
return B_OK;
}

@ -171,7 +171,7 @@ MountMenu::AddDynamicItem(add_state)
{
// remove old items
for (;;) {
BMenuItem* item = RemoveItem(0L);
BMenuItem* item = RemoveItem((int32)0);
if (item == NULL)
break;
delete item;

@ -211,7 +211,7 @@ BPoseView::BPoseView(Model* model, BRect bounds, uint32 viewMode,
fVScrollBar(NULL),
fModel(model),
fActivePose(NULL),
fExtent(LONG_MAX, LONG_MAX, LONG_MIN, LONG_MIN),
fExtent(INT32_MAX, INT32_MAX, INT32_MIN, INT32_MIN),
fPoseList(new PoseList(40, true)),
fFilteredPoseList(new PoseList()),
fVSPoseList(new PoseList()),
@ -227,10 +227,10 @@ BPoseView::BPoseView(Model* model, BRect bounds, uint32 viewMode,
fDropTarget(NULL),
fAlreadySelectedDropTarget(NULL),
fSelectionHandler(be_app),
fLastClickPt(LONG_MAX, LONG_MAX),
fLastClickPt(INT32_MAX, INT32_MAX),
fLastClickTime(0),
fLastClickedPose(NULL),
fLastExtent(LONG_MAX, LONG_MAX, LONG_MIN, LONG_MIN),
fLastExtent(INT32_MAX, INT32_MAX, INT32_MIN, INT32_MIN),
fTitleView(NULL),
fRefFilter(NULL),
fAutoScrollInc(20),
@ -4513,7 +4513,7 @@ BPoseView::HandleDropCommon(BMessage* message, Model* targetModel, BPose* target
return false;
// find the text
int32 textLength;
ssize_t textLength;
const char* text;
if (message->FindData(kPlainTextMimeType, B_MIME_TYPE, (const void**)&text,
&textLength) != B_OK)
@ -4540,12 +4540,13 @@ BPoseView::HandleDropCommon(BMessage* message, Model* targetModel, BPose* target
// pick up TextView styles if available and save them with the file
const text_run_array* textRuns = NULL;
int32 dataSize = 0;
ssize_t dataSize = 0;
if (message->FindData("application/x-vnd.Be-text_run_array", B_MIME_TYPE,
(const void**)&textRuns, &dataSize) == B_OK && textRuns && dataSize) {
// save styles the same way StyledEdit does
void* data = BTextView::FlattenRunArray(textRuns, &dataSize);
file.WriteAttr("styles", B_RAW_TYPE, 0, data, (size_t)dataSize);
int32 tmpSize = dataSize;
void* data = BTextView::FlattenRunArray(textRuns, &tmpSize);
file.WriteAttr("styles", B_RAW_TYPE, 0, data, (size_t)tmpSize);
free(data);
}
@ -7037,7 +7038,7 @@ BPoseView::WasDoubleClick(const BPose* pose, BPoint point)
&& fabs(delta.x) < kDoubleClickTresh
&& fabs(delta.y) < kDoubleClickTresh
&& pose == fLastClickedPose) {
fLastClickPt.Set(LONG_MAX, LONG_MAX);
fLastClickPt.Set(INT32_MAX, INT32_MAX);
fLastClickedPose = NULL;
fLastClickTime = 0;
return true;
@ -7336,7 +7337,7 @@ BPoseView::SelectPosesListMode(BRect selectionRect, BList** oldList)
if (selectionRect.Intersects(poseRect)) {
bool selected = pose->IsSelected();
pose->Select(!fSelectionList->HasItem(pose));
newList->AddItem((void*)index);
newList->AddItem((void*)(addr_t)index);
// this sucks, need to clean up using a vector class instead
// of BList
@ -7358,9 +7359,9 @@ BPoseView::SelectPosesListMode(BRect selectionRect, BList** oldList)
// on those which are no longer enclosed
count = (*oldList)->CountItems();
for (int32 index = 0; index < count; index++) {
int32 oldIndex = (int32)(*oldList)->ItemAt(index);
int32 oldIndex = (addr_t)(*oldList)->ItemAt(index);
if (!newList->HasItem((void*)oldIndex)) {
if (!newList->HasItem((void*)(addr_t)oldIndex)) {
BPose* pose = poseList->ItemAt(oldIndex);
pose->Select(!pose->IsSelected());
loc.Set(0, oldIndex * fListElemHeight);
@ -7400,7 +7401,7 @@ BPoseView::SelectPosesIconMode(BRect selectionRect, BList** oldList)
if (selectionRect.Intersects(poseRect)) {
bool selected = pose->IsSelected();
pose->Select(!fSelectionList->HasItem(pose));
newList->AddItem((void*)index);
newList->AddItem((void*)(addr_t)index);
if ((selected != pose->IsSelected())
&& poseRect.Intersects(bounds)) {
@ -7421,9 +7422,9 @@ BPoseView::SelectPosesIconMode(BRect selectionRect, BList** oldList)
// on those which are no longer enclosed
count = (*oldList)->CountItems();
for (int32 index = 0; index < count; index++) {
int32 oldIndex = (int32)(*oldList)->ItemAt(index);
int32 oldIndex = (addr_t)(*oldList)->ItemAt(index);
if (!newList->HasItem((void*)oldIndex)) {
if (!newList->HasItem((void*)(addr_t)oldIndex)) {
BPose* pose = fVSPoseList->ItemAt(oldIndex);
pose->Select(!pose->IsSelected());
BRect poseRect(pose->CalcRect(this));

@ -1014,7 +1014,7 @@ BPoseView::AddToExtent(const BRect&rect)
inline void
BPoseView::ClearExtent()
{
fExtent.Set(LONG_MAX, LONG_MAX, LONG_MIN, LONG_MIN);
fExtent.Set(INT32_MAX, INT32_MAX, INT32_MIN, INT32_MIN);
}

@ -200,7 +200,7 @@ ScalarValueSetting::Value() const
void
ScalarValueSetting::GetValueAsString(char* buffer) const
{
sprintf(buffer, "%ld", fValue);
sprintf(buffer, "%" B_PRId32, fValue);
}
@ -212,7 +212,7 @@ ScalarValueSetting::Handle(const char* const* argv)
int32 newValue;
if ((*argv)[0] == '0' && (*argv)[1] == 'x')
sscanf(*argv,"%lx",&newValue);
sscanf(*argv, "%" B_PRIx32, &newValue);
else
newValue = atoi(*argv);
@ -253,14 +253,14 @@ HexScalarValueSetting::HexScalarValueSetting(const char* name,
void
HexScalarValueSetting::GetValueAsString(char* buffer) const
{
sprintf(buffer, "0x%08lx", fValue);
sprintf(buffer, "0x%08" B_PRIx32, fValue);
}
void
HexScalarValueSetting::SaveSettingValue(Settings* settings)
{
settings->Write("0x%08lx", fValue);
settings->Write("0x%08" B_PRIx32, fValue);
}

@ -86,8 +86,8 @@ class ScalarValueSetting : public SettingsArgvDispatcher {
public:
ScalarValueSetting(const char* name, int32 defaultValue,
const char* valueExpectedErrorString,
const char* wrongValueErrorString, int32 min = LONG_MIN,
int32 max = LONG_MAX);
const char* wrongValueErrorString, int32 min = INT32_MIN,
int32 max = INT32_MAX);
void ValueChanged(int32 newValue);
int32 Value() const;
@ -112,8 +112,8 @@ class HexScalarValueSetting : public ScalarValueSetting {
public:
HexScalarValueSetting(const char* name, int32 defaultValue,
const char* valueExpectedErrorString,
const char* wrongValueErrorString, int32 min = LONG_MIN,
int32 max = LONG_MAX);
const char* wrongValueErrorString, int32 min = INT32_MIN,
int32 max = INT32_MAX);
void GetValueAsString(char* buffer) const;

@ -103,8 +103,10 @@ ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void* passThru)
NextArgv();
fCurrentArgv[fArgc] = 0;
const char* result = (argvHandlerFunc)(fArgc, fCurrentArgv, passThru);
if (result)
printf("File %s; Line %ld # %s", fFileName, fLineNo, result);
if (result) {
printf("File %s; Line %" B_PRId32 " # %s", fFileName, fLineNo,
result);
}
MakeArgvEmpty();
if (result)
return B_ERROR;
@ -188,8 +190,8 @@ ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc,
// handle new line
fEatComment = false;
if (!fSawBackslash && (fInDoubleQuote || fInSingleQuote)) {
printf("File %s ; Line %ld # unterminated quote\n", name,
fLineNo);
printf("File %s ; Line %" B_PRId32 " # unterminated quote\n",
name, fLineNo);
result = B_ERROR;
break;
}

@ -580,7 +580,7 @@ BStatusView::InitStatus(int32 totalItems, off_t totalSize,
if (totalItems > 0) {
char totalStr[32];
buffer.SetTo(B_TRANSLATE("of %items"));
snprintf(totalStr, sizeof(totalStr), "%ld", totalItems);
snprintf(totalStr, sizeof(totalStr), "%" B_PRId32, totalItems);
buffer.ReplaceFirst("%items", totalStr);
}

@ -122,7 +122,7 @@ TemplatesMenu::BuildMenu(bool addItems)
fOpenItem = NULL;
int32 count = CountItems();
while (count--)
delete RemoveItem(0L);
delete RemoveItem((int32)0);
// Add the Folder
IconMenuItem* menuItem = new IconMenuItem(B_TRANSLATE("New folder"),

@ -415,7 +415,7 @@ TTracker::MessageReceived(BMessage* message)
case kCloseWindowAndChildren:
{
const node_ref* itemNode;
int32 bytes;
ssize_t bytes;
message->FindData("node_ref", B_RAW_TYPE,
(const void**)&itemNode, &bytes);
CloseWindowAndChildren(itemNode);

@ -1300,7 +1300,7 @@ GenericAttributeText::ReadValue(BString* result)
GenericValueStruct tmp;
if (fModel->Node()->GetAttrInfo(fColumn->AttrName(), &info)
== B_OK) {
if (info.size && info.size <= sizeof(int64)) {
if (info.size && info.size <= (off_t)sizeof(int64)) {
length = fModel->Node()->ReadAttr(fColumn->AttrName(),
fColumn->AttrType(), 0, &tmp, (size_t)info.size);
}
@ -1460,22 +1460,22 @@ GenericAttributeText::FitValue(BString* result, const BPoseView* view)
break;
case B_INT32_TYPE:
sprintf(buffer, "%ld", fValue.int32t);
sprintf(buffer, "%" B_PRId32, fValue.int32t);
fFullValueText = buffer;
break;
case B_UINT32_TYPE:
sprintf(buffer, "%ld", fValue.uint32t);
sprintf(buffer, "%" B_PRId32, fValue.uint32t);
fFullValueText = buffer;
break;
case B_INT64_TYPE:
sprintf(buffer, "%Ld", fValue.int64t);
sprintf(buffer, "%" B_PRId64, fValue.int64t);
fFullValueText = buffer;
break;
case B_UINT64_TYPE:
sprintf(buffer, "%Ld", fValue.uint64t);
sprintf(buffer, "%" B_PRId64, fValue.uint64t);
fFullValueText = buffer;
break;
@ -1886,10 +1886,10 @@ DurationAttributeText::FitValue(BString* result, const BPoseView* view)
char buffer[256];
if (hours > 0) {
snprintf(buffer, sizeof(buffer), "%s%ld:%02ld:%02ld",
negative ? "-" : "", hours, minutes, seconds);
snprintf(buffer, sizeof(buffer), "%s%" B_PRId32 ":%02" B_PRId32 ":%02"
B_PRId32, negative ? "-" : "", hours, minutes, seconds);
} else {
snprintf(buffer, sizeof(buffer), "%s%ld:%02ld",
snprintf(buffer, sizeof(buffer), "%s%" B_PRId32 ":%02" B_PRId32,
negative ? "-" : "", minutes, seconds);
}