From 9be774b553296a712704078314f2291ae5fc352c Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Mon, 30 Jul 2012 21:27:21 +0100 Subject: [PATCH] Compilation and 64-bit fixes to libbe.so sources. Fixed the usual issues - printf format strings, uint32 instead of addr_t, etc. One thing that isn't so nice is several places where BList is used to store (u)int32, these require a double cast to addr_t then void* to silence a warning on x86_64. --- headers/os/interface/TextView.h | 2 +- src/kits/app/Application.cpp | 2 +- src/kits/app/Looper.cpp | 7 ++++--- src/kits/app/PropertyInfo.cpp | 2 +- src/kits/app/Roster.cpp | 4 ++-- src/kits/interface/Alert.cpp | 2 +- src/kits/interface/ChannelSlider.cpp | 3 ++- src/kits/interface/Menu.cpp | 6 +++--- src/kits/interface/Polygon.cpp | 7 ++++--- src/kits/interface/PrintJob.cpp | 2 +- src/kits/interface/Shelf.cpp | 4 ++-- src/kits/interface/TextView.cpp | 14 +++++++------- src/kits/interface/View.cpp | 10 +++++----- src/kits/interface/Window.cpp | 9 +++++---- src/kits/interface/layouter/ComplexLayouter.cpp | 9 ++++++--- src/kits/interface/textview_support/LineBuffer.cpp | 2 +- src/kits/interface/textview_support/LineBuffer.h | 2 +- src/kits/interface/textview_support/StyleBuffer.h | 2 +- .../interface/textview_support/TextGapBuffer.cpp | 6 +++--- src/kits/locale/DefaultCatalog.cpp | 6 +++--- src/kits/shared/QueryFile.cpp | 6 +++--- src/kits/storage/AppFileInfo.cpp | 2 +- src/kits/storage/Entry.cpp | 6 +++--- src/kits/storage/QueryPredicate.cpp | 4 ++-- src/kits/storage/disk_device/Partition.cpp | 5 +++-- src/kits/storage/disk_device/PartitioningInfo.cpp | 6 +++--- src/kits/storage/sniffer/Range.cpp | 4 ++-- src/kits/support/BufferIO.cpp | 6 +++--- 28 files changed, 74 insertions(+), 66 deletions(-) diff --git a/headers/os/interface/TextView.h b/headers/os/interface/TextView.h index 4d3e958f04..10861e24ab 100644 --- a/headers/os/interface/TextView.h +++ b/headers/os/interface/TextView.h @@ -411,7 +411,7 @@ private: void _ShowContextMenu(BPoint where); void _FilterDisallowedChars(char* text, - int32& length, text_run_array* runArray); + ssize_t& length, text_run_array* runArray); private: BPrivate::TextGapBuffer* fText; diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index 4d68d63422..3330becbdd 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -522,7 +522,7 @@ BApplication::Quit() if (!name) name = "no-name"; printf("ERROR - you must Lock the application object before calling " - "Quit(), team=%ld, looper=%s\n", Team(), name); + "Quit(), team=%" B_PRId32 ", looper=%s\n", Team(), name); unlock = true; if (!Lock()) return; diff --git a/src/kits/app/Looper.cpp b/src/kits/app/Looper.cpp index 2d1879dbcb..1713e99cb9 100644 --- a/src/kits/app/Looper.cpp +++ b/src/kits/app/Looper.cpp @@ -443,7 +443,8 @@ BLooper::Quit() if (!IsLocked()) { printf("ERROR - you must Lock a looper before calling Quit(), " - "team=%ld, looper=%s\n", Team(), Name() ? Name() : "unnamed"); + "team=%" B_PRId32 ", looper=%s\n", Team(), + Name() ? Name() : "unnamed"); } // Try to lock @@ -547,7 +548,7 @@ BLooper::IsLocked() const } uint32 stack; - return ((uint32)&stack & ~(B_PAGE_SIZE - 1)) == fCachedStack + return ((addr_t)&stack & ~(B_PAGE_SIZE - 1)) == fCachedStack || find_thread(NULL) == fOwner; } @@ -1338,7 +1339,7 @@ BLooper::check_lock() // It is used in situations where it's clear that the looper is valid, // ie. from handlers uint32 stack; - if (((uint32)&stack & ~(B_PAGE_SIZE - 1)) == fCachedStack + if (((addr_t)&stack & ~(B_PAGE_SIZE - 1)) == fCachedStack || fOwner == find_thread(NULL)) return; diff --git a/src/kits/app/PropertyInfo.cpp b/src/kits/app/PropertyInfo.cpp index 10f45b3e09..e09c4863b3 100644 --- a/src/kits/app/PropertyInfo.cpp +++ b/src/kits/app/PropertyInfo.cpp @@ -426,7 +426,7 @@ BPropertyInfo::PrintToStream() const // specifiers for (int32 i = 0; i < 10 && fPropInfo[pi].specifiers[i] != 0; i++) { uint32 spec = fPropInfo[pi].specifiers[i]; - printf("%lu", spec); + printf("%" B_PRIu32, spec); } printf("\n"); } diff --git a/src/kits/app/Roster.cpp b/src/kits/app/Roster.cpp index a500c70dd7..051d200270 100644 --- a/src/kits/app/Roster.cpp +++ b/src/kits/app/Roster.cpp @@ -657,7 +657,7 @@ BRoster::GetAppList(BList* teamIDList) const if (reply.what == B_REG_SUCCESS) { team_id team; for (int32 i = 0; reply.FindInt32("teams", i, &team) == B_OK; i++) - teamIDList->AddItem((void*)team); + teamIDList->AddItem((void*)(addr_t)team); } else { if (reply.FindInt32("error", &error) != B_OK) error = B_ERROR; @@ -700,7 +700,7 @@ BRoster::GetAppList(const char* sig, BList* teamIDList) const if (reply.what == B_REG_SUCCESS) { team_id team; for (int32 i = 0; reply.FindInt32("teams", i, &team) == B_OK; i++) - teamIDList->AddItem((void*)team); + teamIDList->AddItem((void*)(addr_t)team); } else if (reply.FindInt32("error", &error) != B_OK) error = B_ERROR; } diff --git a/src/kits/interface/Alert.cpp b/src/kits/interface/Alert.cpp index b6ec85cfa4..ed53bb17d9 100644 --- a/src/kits/interface/Alert.cpp +++ b/src/kits/interface/Alert.cpp @@ -697,7 +697,7 @@ BAlert::_CreateButton(int32 which, const char* label) rect.bottom = rect.top; char name[32]; - snprintf(name, sizeof(name), "_b%ld_", which); + snprintf(name, sizeof(name), "_b%" B_PRId32 "_", which); BButton* button = new(std::nothrow) BButton(rect, name, label, message, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); diff --git a/src/kits/interface/ChannelSlider.cpp b/src/kits/interface/ChannelSlider.cpp index c2d6040a3d..02e90a9470 100644 --- a/src/kits/interface/ChannelSlider.cpp +++ b/src/kits/interface/ChannelSlider.cpp @@ -839,7 +839,8 @@ BChannelSlider::_DrawThumbs() // draw some kind of current value tool tip if (fCurrentChannel != -1 && fMinPoint != 0) { char valueString[32]; - snprintf(valueString, 32, "%ld", ValueFor(fCurrentChannel)); + snprintf(valueString, 32, "%" B_PRId32, + ValueFor(fCurrentChannel)); float stringWidth = fBackingView->StringWidth(valueString); float width = max_c(10.0, stringWidth); BRect valueRect(0.0, 0.0, width, 10.0); diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index c8692063d9..2e8e423c5e 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -68,9 +68,9 @@ public: // TODO: make this work with Unicode characters! bool HasTrigger(uint32 c) - { return fList.HasItem((void*)tolower(c)); } + { return fList.HasItem((void*)(addr_t)tolower(c)); } bool AddTrigger(uint32 c) - { return fList.AddItem((void*)tolower(c)); } + { return fList.AddItem((void*)(addr_t)tolower(c)); } private: BList fList; @@ -2883,7 +2883,7 @@ bool BMenu::_OkToProceed(BMenuItem* item, bool keyDown) { BPoint where; - ulong buttons; + uint32 buttons; GetMouse(&where, &buttons, false); bool stickyMode = _IsStickyMode(); // Quit if user clicks the mouse button in sticky mode diff --git a/src/kits/interface/Polygon.cpp b/src/kits/interface/Polygon.cpp index 07c27ba55c..0728b785ad 100644 --- a/src/kits/interface/Polygon.cpp +++ b/src/kits/interface/Polygon.cpp @@ -157,15 +157,16 @@ BPolygon::_AddPoints(const BPoint* points, int32 count, bool computeBounds) if (points == NULL || count <= 0) return false; if (count > MAX_POINT_COUNT || (fCount + count) > MAX_POINT_COUNT) { - fprintf(stderr, "BPolygon::_AddPoints(%ld) - too many points\n", - count); + fprintf(stderr, "BPolygon::_AddPoints(%" B_PRId32 ") - too many points" + "\n", count); return false; } BPoint* newPoints = (BPoint*)realloc(fPoints, (fCount + count) * sizeof(BPoint)); if (newPoints == NULL) { - fprintf(stderr, "BPolygon::_AddPoints(%ld) out of memory\n", count); + fprintf(stderr, "BPolygon::_AddPoints(%" B_PRId32 ") out of memory\n", + count); return false; } diff --git a/src/kits/interface/PrintJob.cpp b/src/kits/interface/PrintJob.cpp index d21f27fa09..83efdf7e1a 100644 --- a/src/kits/interface/PrintJob.cpp +++ b/src/kits/interface/PrintJob.cpp @@ -575,7 +575,7 @@ BPrintJob::_RecurseView(BView* view, BPoint origin, BPicture* picture, void BPrintJob::_GetMangledName(char* buffer, size_t bufferSize) const { - snprintf(buffer, bufferSize, "%s@%lld", fPrintJobName, + snprintf(buffer, bufferSize, "%s@%" B_PRId64, fPrintJobName, system_time() / 1000); } diff --git a/src/kits/interface/Shelf.cpp b/src/kits/interface/Shelf.cpp index bcd75b979c..0ffdf5671d 100644 --- a/src/kits/interface/Shelf.cpp +++ b/src/kits/interface/Shelf.cpp @@ -557,7 +557,7 @@ BShelf::~BShelf() while (fReplicants.CountItems() > 0) { replicant_data *data = (replicant_data *)fReplicants.ItemAt(0); - fReplicants.RemoveItem(0L); + fReplicants.RemoveItem((int32)0); delete data; } } @@ -1003,7 +1003,7 @@ BShelf::ReplicantAt(int32 index, BView **_view, uint32 *_uniqueID, if (_view) *_view = NULL; if (_uniqueID) - *_uniqueID = ~0UL; + *_uniqueID = ~(uint32)0; if (_error) *_error = B_BAD_INDEX; diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index d46414d982..855731f52a 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -731,7 +731,7 @@ BTextView::WindowActivated(bool state) } BPoint where; - ulong buttons; + uint32 buttons; GetMouse(&where, &buttons, false); if (Bounds().Contains(where)) @@ -3241,7 +3241,7 @@ BTextView::_InitObject(BRect textRect, const BFont *initialFont, fSelectable = true; fEditable = true; fWrap = true; - fMaxBytes = LONG_MAX; + fMaxBytes = INT32_MAX; fDisallowedChars = NULL; fAlignment = B_ALIGN_LEFT; fAutoindent = false; @@ -5036,7 +5036,7 @@ BTextView::_Activate() _ShowCaret(); BPoint where; - ulong buttons; + uint32 buttons; GetMouse(&where, &buttons, false); if (Bounds().Contains(where)) _TrackMouse(where, NULL); @@ -5600,7 +5600,7 @@ BTextView::_ShowContextMenu(BPoint where) void -BTextView::_FilterDisallowedChars(char* text, int32& length, +BTextView::_FilterDisallowedChars(char* text, ssize_t& length, text_run_array* runArray) { if (!fDisallowedChars) @@ -5609,9 +5609,9 @@ BTextView::_FilterDisallowedChars(char* text, int32& length, if (fDisallowedChars->IsEmpty() || !text) return; - int32 stringIndex = 0; + ssize_t stringIndex = 0; if (runArray) { - int32 remNext = 0; + ssize_t remNext = 0; for (int i = 0; i < runArray->count; i++) { runArray->runs[i].offset -= remNext; @@ -5669,7 +5669,7 @@ void BTextView::TextTrackState::SimulateMouseMovement(BTextView *textView) { BPoint where; - ulong buttons; + uint32 buttons; // When the mouse cursor is still and outside the textview, // no B_MOUSE_MOVED message are sent, obviously. But scrolling // has to work neverthless, so we "fake" a MouseMoved() call here. diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index efbe9549a6..615226071b 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -5882,8 +5882,8 @@ BView::_PrintToStream() "\tNextSibling: %s\n" "\tPrevSibling: %s\n" "\tOwner(Window): %s\n" - "\tToken: %ld\n" - "\tFlags: %ld\n" + "\tToken: %" B_PRId32 "\n" + "\tFlags: %" B_PRId32 "\n" "\tView origin: (%f,%f)\n" "\tView Bounds rectangle: (%f,%f,%f,%f)\n" "\tShow level: %d\n" @@ -5893,8 +5893,8 @@ BView::_PrintToStream() "\tHorizontal Scrollbar %s\n" "\tIs Printing?: %s\n" "\tShelf?: %s\n" - "\tEventMask: %ld\n" - "\tEventOptions: %ld\n", + "\tEventMask: %" B_PRId32 "\n" + "\tEventOptions: %" B_PRId32 "\n", Name(), fParent ? fParent->Name() : "NULL", fFirstChild ? fFirstChild->Name() : "NULL", @@ -5922,7 +5922,7 @@ BView::_PrintToStream() "\t\tHighColor: [%d,%d,%d,%d]\n" "\t\tLowColor: [%d,%d,%d,%d]\n" "\t\tViewColor: [%d,%d,%d,%d]\n" - "\t\tPattern: %llx\n" + "\t\tPattern: %" B_PRIx64 "\n" "\t\tDrawingMode: %d\n" "\t\tLineJoinMode: %d\n" "\t\tLineCapMode: %d\n" diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 8292e52158..07278cec6e 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -515,7 +515,7 @@ BWindow::Quit() name = "no-name"; printf("ERROR - you must Lock a looper before calling Quit(), " - "team=%ld, looper=%s\n", Team(), name); + "team=%" B_PRId32 ", looper=%s\n", Team(), name); } // Try to lock @@ -1032,7 +1032,8 @@ BWindow::DispatchMessage(BMessage* msg, BHandler* target) be_roster->GetAppList(info.signature, &list); for (int32 i = 0; i < list.CountItems(); i++) { - do_minimize_team(BRect(), (team_id)list.ItemAt(i), false); + do_minimize_team(BRect(), (team_id)(addr_t)list.ItemAt(i), + false); } break; } @@ -1433,8 +1434,8 @@ FrameMoved(origin); if (BView* view = _FindView(info->token)) view->_Draw(info->updateRect); else { - printf("_UPDATE_ - didn't find view by token: %ld\n", - info->token); + printf("_UPDATE_ - didn't find view by token: %" + B_PRId32 "\n", info->token); } //drawTime += system_time() - drawStart; } diff --git a/src/kits/interface/layouter/ComplexLayouter.cpp b/src/kits/interface/layouter/ComplexLayouter.cpp index 00f559a7a1..c694bda059 100644 --- a/src/kits/interface/layouter/ComplexLayouter.cpp +++ b/src/kits/interface/layouter/ComplexLayouter.cpp @@ -85,9 +85,12 @@ public: void Dump() { - printf("ComplexLayouter::MyLayoutInfo(): %ld elements:\n", fCount); - for (int32 i = 0; i < fCount + 1; i++) - printf(" %2ld: location: %4ld\n", i, fLocations[i]); + printf("ComplexLayouter::MyLayoutInfo(): %" B_PRId32 " elements:\n", + fCount); + for (int32 i = 0; i < fCount + 1; i++) { + printf(" %2" B_PRId32 ": location: %4" B_PRId32 "\n", i, + fLocations[i]); + } } public: diff --git a/src/kits/interface/textview_support/LineBuffer.cpp b/src/kits/interface/textview_support/LineBuffer.cpp index 82c38e55a6..35c0c0772c 100644 --- a/src/kits/interface/textview_support/LineBuffer.cpp +++ b/src/kits/interface/textview_support/LineBuffer.cpp @@ -94,7 +94,7 @@ BTextView::LineBuffer::PixelToLine(float pixel) const void -BTextView::LineBuffer::BumpOrigin(float delta, long index) +BTextView::LineBuffer::BumpOrigin(float delta, int32 index) { for (long i = index; i < fItemCount; i++) fBuffer[i].origin += delta; diff --git a/src/kits/interface/textview_support/LineBuffer.h b/src/kits/interface/textview_support/LineBuffer.h index a32758bbde..81e124eb78 100644 --- a/src/kits/interface/textview_support/LineBuffer.h +++ b/src/kits/interface/textview_support/LineBuffer.h @@ -39,7 +39,7 @@ public: void BumpOrigin(float delta, int32 index); void BumpOffset(int32 delta, int32 index); - long NumLines() const; + int32 NumLines() const; float MaxWidth() const; STELine* operator[](int32 index) const; }; diff --git a/src/kits/interface/textview_support/StyleBuffer.h b/src/kits/interface/textview_support/StyleBuffer.h index 227fc91e9e..9b289a24b2 100644 --- a/src/kits/interface/textview_support/StyleBuffer.h +++ b/src/kits/interface/textview_support/StyleBuffer.h @@ -56,7 +56,7 @@ class _BStyleRunDescBuffer_ : public _BTextViewSupportBuffer_ { void InsertDesc(STEStyleRunDesc* inDesc, int32 index); void RemoveDescs(int32 index, int32 count = 1); - long OffsetToRun(int32 offset) const; + int32 OffsetToRun(int32 offset) const; void BumpOffset(int32 delta, int32 index); STEStyleRunDesc* operator[](int32 index) const; diff --git a/src/kits/interface/textview_support/TextGapBuffer.cpp b/src/kits/interface/textview_support/TextGapBuffer.cpp index af122f0c6c..bc4de30dc2 100644 --- a/src/kits/interface/textview_support/TextGapBuffer.cpp +++ b/src/kits/interface/textview_support/TextGapBuffer.cpp @@ -188,7 +188,7 @@ TextGapBuffer::GetString(int32 fromOffset, int32* _numBytes) bool -TextGapBuffer::FindChar(char inChar, long fromIndex, long* ioDelta) +TextGapBuffer::FindChar(char inChar, int32 fromIndex, int32* ioDelta) { long numChars = *ioDelta; for (long i = 0; i < numChars; i++) { @@ -333,7 +333,7 @@ TextGapBuffer::_MoveGapTo(int32 toIndex) void -TextGapBuffer::_EnlargeGapTo(long inCount) +TextGapBuffer::_EnlargeGapTo(int32 inCount) { if (inCount == fGapCount) return; @@ -348,7 +348,7 @@ TextGapBuffer::_EnlargeGapTo(long inCount) void -TextGapBuffer::_ShrinkGapTo(long inCount) +TextGapBuffer::_ShrinkGapTo(int32 inCount) { if (inCount == fGapCount) return; diff --git a/src/kits/locale/DefaultCatalog.cpp b/src/kits/locale/DefaultCatalog.cpp index dbb913d952..43a39d06b2 100644 --- a/src/kits/locale/DefaultCatalog.cpp +++ b/src/kits/locale/DefaultCatalog.cpp @@ -359,7 +359,7 @@ DefaultCatalog::WriteToFile(const char *path) return res; BMallocIO mallocIO; - mallocIO.SetBlockSize(max(fCatMap.Size() * 20, 256L)); + mallocIO.SetBlockSize(max(fCatMap.Size() * 20, (int32)256)); // set a largish block-size in order to avoid reallocs res = Flatten(&mallocIO); if (res == B_OK) { @@ -390,7 +390,7 @@ DefaultCatalog::WriteToAttribute(const entry_ref &appOrAddOnRef) return res; BMallocIO mallocIO; - mallocIO.SetBlockSize(max(fCatMap.Size() * 20, 256L)); + mallocIO.SetBlockSize(max(fCatMap.Size() * 20, (int32)256)); // set a largish block-size in order to avoid reallocs res = Flatten(&mallocIO); @@ -421,7 +421,7 @@ DefaultCatalog::WriteToResource(const entry_ref &appOrAddOnRef) return res; BMallocIO mallocIO; - mallocIO.SetBlockSize(max(fCatMap.Size() * 20, 256L)); + mallocIO.SetBlockSize(max(fCatMap.Size() * 20, (int32)256)); // set a largish block-size in order to avoid reallocs res = Flatten(&mallocIO); diff --git a/src/kits/shared/QueryFile.cpp b/src/kits/shared/QueryFile.cpp index 05314be9bb..159c4101c6 100644 --- a/src/kits/shared/QueryFile.cpp +++ b/src/kits/shared/QueryFile.cpp @@ -180,14 +180,14 @@ BQueryFile::SetPredicate(const char* predicate) status_t BQueryFile::AddVolume(const BVolume& volume) { - return fVolumes.AddItem((void*)volume.Device()) ? B_OK : B_NO_MEMORY; + return fVolumes.AddItem((void*)(addr_t)volume.Device()) ? B_OK : B_NO_MEMORY; } status_t BQueryFile::AddVolume(dev_t device) { - return fVolumes.AddItem((void*)device) ? B_OK : B_NO_MEMORY; + return fVolumes.AddItem((void*)(addr_t)device) ? B_OK : B_NO_MEMORY; } @@ -211,7 +211,7 @@ BQueryFile::VolumeAt(int32 index) const if (index < 0 || index >= fVolumes.CountItems()) return -1; - return (dev_t)fVolumes.ItemAt(index); + return (dev_t)(addr_t)fVolumes.ItemAt(index); } diff --git a/src/kits/storage/AppFileInfo.cpp b/src/kits/storage/AppFileInfo.cpp index fb9581e52e..ad81175416 100644 --- a/src/kits/storage/AppFileInfo.cpp +++ b/src/kits/storage/AppFileInfo.cpp @@ -1430,7 +1430,7 @@ BAppFileInfo::_ReadData(const char* name, int32 id, type_code type, error = B_NO_MEMORY; bufferSize = info.size; } - if (error == B_OK && bufferSize < info.size) + if (error == B_OK && (off_t)bufferSize < info.size) error = B_BAD_VALUE; // read the data diff --git a/src/kits/storage/Entry.cpp b/src/kits/storage/Entry.cpp index 7ff8715695..be0edd0f12 100644 --- a/src/kits/storage/Entry.cpp +++ b/src/kits/storage/Entry.cpp @@ -684,14 +684,14 @@ BEntry::_Dump(const char* name) printf("------------------------------------------------------------\n"); } - printf("fCStatus == %ld\n", fCStatus); + printf("fCStatus == %" B_PRId32 "\n", fCStatus); struct stat st; if (fDirFd != -1 && _kern_read_stat(fDirFd, NULL, false, &st, sizeof(struct stat)) == B_OK) { - printf("dir.device == %ld\n", st.st_dev); - printf("dir.inode == %lld\n", st.st_ino); + printf("dir.device == %" B_PRIdDEV "\n", st.st_dev); + printf("dir.inode == %" B_PRIdINO "\n", st.st_ino); } else { printf("dir == NullFd\n"); } diff --git a/src/kits/storage/QueryPredicate.cpp b/src/kits/storage/QueryPredicate.cpp index 997c5dda13..bb48f961cc 100644 --- a/src/kits/storage/QueryPredicate.cpp +++ b/src/kits/storage/QueryPredicate.cpp @@ -272,7 +272,7 @@ ValueNode::GetString(BString &predicate) } value; value.asFloat = fValue; // int32 value = *reinterpret_cast(&fValue); - sprintf(buffer, "0x%08lx", value.asInteger); + sprintf(buffer, "0x%08" B_PRIx32, value.asInteger); predicate.SetTo(buffer); return B_OK; } @@ -289,7 +289,7 @@ ValueNode::GetString(BString &predicate) } value; // int64 value = *reinterpret_cast(&fValue); value.asFloat = fValue; - sprintf(buffer, "0x%016Lx", value.asInteger); + sprintf(buffer, "0x%016" B_PRIx64, value.asInteger); predicate.SetTo(buffer); return B_OK; } diff --git a/src/kits/storage/disk_device/Partition.cpp b/src/kits/storage/disk_device/Partition.cpp index 8bd5fea703..3dbcadd60b 100644 --- a/src/kits/storage/disk_device/Partition.cpp +++ b/src/kits/storage/disk_device/Partition.cpp @@ -354,10 +354,11 @@ BPartition::GetPath(BPath* path) const if (!leaf || strcmp(leaf, "raw") != B_OK) return B_ERROR; - snprintf(indexBuffer, sizeof(indexBuffer), "%ld", Index()); + snprintf(indexBuffer, sizeof(indexBuffer), "%" B_PRId32, Index()); } else { // Our parent is a normal partition, no device: Append our index. - snprintf(indexBuffer, sizeof(indexBuffer), "%s_%ld", path->Leaf(), Index()); + snprintf(indexBuffer, sizeof(indexBuffer), "%s_%" B_PRId32, + path->Leaf(), Index()); } error = path->GetParent(path); diff --git a/src/kits/storage/disk_device/PartitioningInfo.cpp b/src/kits/storage/disk_device/PartitioningInfo.cpp index 19abfe8296..0e0cba3c90 100644 --- a/src/kits/storage/disk_device/PartitioningInfo.cpp +++ b/src/kits/storage/disk_device/PartitioningInfo.cpp @@ -220,10 +220,10 @@ BPartitioningInfo::PrintToStream() const printf("BPartitioningInfo is not initialized\n"); return; } - printf("BPartitioningInfo has %ld spaces:\n", fCount); + printf("BPartitioningInfo has %" B_PRId32 " spaces:\n", fCount); for (int32 i = 0; i < fCount; i++) { - printf(" space at %ld: offset = %lld, size = %lld\n", - i, fSpaces[i].offset, fSpaces[i].size); + printf(" space at %" B_PRId32 ": offset = %" B_PRId64 ", size = %" + B_PRId64 "\n", i, fSpaces[i].offset, fSpaces[i].size); } } diff --git a/src/kits/storage/sniffer/Range.cpp b/src/kits/storage/sniffer/Range.cpp index 2f994f7970..ebf64711a5 100644 --- a/src/kits/storage/sniffer/Range.cpp +++ b/src/kits/storage/sniffer/Range.cpp @@ -34,8 +34,8 @@ Range::GetErr() const { else { char start_str[32]; char end_str[32]; - sprintf(start_str, "%ld", fStart); - sprintf(end_str, "%ld", fEnd); + sprintf(start_str, "%" B_PRId32, fStart); + sprintf(end_str, "%" B_PRId32, fEnd); return new Err(std::string("Sniffer Parser Error -- Invalid range: [") + start_str + ":" + end_str + "]", -1); } } diff --git a/src/kits/support/BufferIO.cpp b/src/kits/support/BufferIO.cpp index f6d1cc9afd..a64d611c4e 100644 --- a/src/kits/support/BufferIO.cpp +++ b/src/kits/support/BufferIO.cpp @@ -71,7 +71,7 @@ BBufferIO::ReadAt(off_t pos, void* buffer, size_t size) // If the data we are looking for is not in the buffer... if (size > fBufferUsed || pos < fBufferStart - || pos > fBufferStart + fBufferUsed + || pos > fBufferStart + (off_t)fBufferUsed || pos + size > fBufferStart + fBufferUsed) { if (fBufferIsDirty) { // If there are pending writes, do them. @@ -119,7 +119,7 @@ BBufferIO::WriteAt(off_t pos, const void* buffer, size_t size) } // If we want to write beyond the cached data... - if (pos > fBufferStart + fBufferUsed + if (pos > fBufferStart + (off_t)fBufferUsed || pos < fBufferStart) { ssize_t read; off_t where = pos; @@ -245,7 +245,7 @@ BBufferIO::PrintToStream() const { printf("stream %p\n", fStream); printf("buffer %p\n", fBuffer); - printf("start %lld\n", fBufferStart); + printf("start %" B_PRId64 "\n", fBufferStart); printf("used %ld\n", fBufferUsed); printf("phys %ld\n", fBufferSize); printf("dirty %s\n", (fBufferIsDirty) ? "true" : "false");