hrev45618 adds 14 changesets to branch 'master' old head: 1a84d6b362cdb05577f739d1d0bdc06c9a23b197 new head: 62e60219cc0e6ca897d70524dddf3cbee49a29dc overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=62e6021+%5E1a84d6b ---------------------------------------------------------------------------- afcbccb: Codycam: some 64 bit fixes dc4e3ce: added B_PRIxOFF 48350f1: bluetooth_server: some 64 bit fixes 60128b5: Icon-o-matic: some 64 bit fixes 55a4a88: Mail: some 64 bit fixes cf91714: Magnify: some 64 bit fixes 113817f: MediaPlayer: 64 bit build fixes for an ugly use of BList. bd380b5: PackageInstaller: some 64 bit fixes 14b32de: People: some 64 bit fixes 3e4cf3a: PowerStatus: some 64 bit fixes c0722ad: TextSearch: some 64 bit fixes 2443899: WebWatch: some 64 bit fixes a31ac99: Diskprobe: some 64 bit fixes * also warnings about comparisons between signed and non signed. 62e6021: ShowImage: initialize rgb_color.alpha field. [ Jérôme Duval <jerome.duval@xxxxxxxxx> ] ---------------------------------------------------------------------------- 44 files changed, 178 insertions(+), 152 deletions(-) headers/os/support/SupportDefs.h | 1 + src/apps/codycam/CodyCam.cpp | 4 +-- src/apps/codycam/Settings.cpp | 2 +- src/apps/codycam/Settings.h | 2 +- src/apps/codycam/VideoConsumer.cpp | 17 ++++----- src/apps/codycam/VideoConsumer.h | 6 ++-- src/apps/diskprobe/DataEditor.cpp | 18 ++++++---- src/apps/diskprobe/DataView.cpp | 12 +++---- src/apps/diskprobe/ProbeView.cpp | 36 ++++++++++++-------- src/apps/diskprobe/TypeEditors.cpp | 20 +++++------ src/apps/icon-o-matic/MainWindow.cpp | 2 +- .../icon-o-matic/generic/listener/Observable.cpp | 4 +-- .../generic/property/view/PropertyListView.cpp | 6 ++-- .../icon-o-matic/generic/support/support.cpp | 2 +- .../import_export/flat_icon/FlatIconExporter.cpp | 12 +++---- .../styled_text/StyledTextImporter.cpp | 4 +-- .../import_export/svg/SVGExporter.cpp | 2 +- src/apps/icon-o-matic/shape/PathManipulator.cpp | 8 ++--- .../commands/FreezeTransformationCommand.cpp | 2 +- src/apps/magnify/Magnify.cpp | 25 ++++++++------ src/apps/magnify/Magnify.h | 2 +- src/apps/mail/Content.cpp | 8 ++--- src/apps/mail/Header.cpp | 4 +-- src/apps/mail/MailWindow.cpp | 12 +++---- src/apps/mail/Prefs.cpp | 4 +-- src/apps/mail/Signature.cpp | 2 +- src/apps/mail/Status.cpp | 2 +- src/apps/mediaplayer/playlist/ListViews.cpp | 14 ++++---- .../mediaplayer/playlist/PlaylistListView.cpp | 6 ++-- .../playlist/RandomizePLItemsCommand.cpp | 4 +-- src/apps/packageinstaller/PackageInfo.cpp | 6 ++-- src/apps/people/PersonView.cpp | 2 +- src/apps/powerstatus/PowerStatusView.cpp | 16 +++++---- src/apps/showimage/Filter.cpp | 2 ++ src/apps/text_search/Grepper.cpp | 10 +++--- src/apps/text_search/Model.cpp | 4 +-- src/apps/webwatch/WatchView.cpp | 2 +- src/kits/mail/MailAttachment.cpp | 10 +++--- src/kits/mail/MailContainer.cpp | 6 ++-- src/kits/mail/MailMessage.cpp | 4 +-- src/kits/mail/mail_util.cpp | 2 +- src/servers/bluetooth/BluetoothServer.cpp | 10 +++--- src/servers/bluetooth/HCITransportAccessor.cpp | 8 ++--- src/servers/bluetooth/LocalDeviceHandler.cpp | 5 +-- ############################################################################ Commit: afcbccb9b5489c88d96edf4d3f851eaa35872852 URL: http://cgit.haiku-os.org/haiku/commit/?id=afcbccb Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 11:39:20 2013 UTC Codycam: some 64 bit fixes ---------------------------------------------------------------------------- diff --git a/src/apps/codycam/CodyCam.cpp b/src/apps/codycam/CodyCam.cpp index 36f17d4..f68df37 100644 --- a/src/apps/codycam/CodyCam.cpp +++ b/src/apps/codycam/CodyCam.cpp @@ -65,7 +65,7 @@ ErrorAlert(const char* message, status_t err, BWindow *window = NULL) alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); - printf("%s\n%s [%lx]", message, strerror(err), err); + printf("%s\n%s [%" B_PRIx32 "]", message, strerror(err), err); } @@ -541,7 +541,7 @@ VideoWindow::MessageReceived(BMessage* message) case msg_upl_client: message->FindInt32("client", &(fFtpInfo.uploadClient)); - FTPINFO("upl client = %ld\n", fFtpInfo.uploadClient); + FTPINFO("upl client = %" B_PRId32 "\n", fFtpInfo.uploadClient); _UploadClientChanged(); break; diff --git a/src/apps/codycam/Settings.cpp b/src/apps/codycam/Settings.cpp index af06871..537d0bf 100644 --- a/src/apps/codycam/Settings.cpp +++ b/src/apps/codycam/Settings.cpp @@ -177,7 +177,7 @@ ScalarValueSetting::Value() const void ScalarValueSetting::GetValueAsString(char* buffer) const { - sprintf(buffer, "%ld", fValue); + sprintf(buffer, "%" B_PRId32, fValue); } diff --git a/src/apps/codycam/Settings.h b/src/apps/codycam/Settings.h index 7bce955..cde0f82 100644 --- a/src/apps/codycam/Settings.h +++ b/src/apps/codycam/Settings.h @@ -61,7 +61,7 @@ public: int32 defaultValue, const char* valueExpectedErrorString, const char* wrongValueErrorString, - int32 min = LONG_MIN, int32 max = LONG_MAX); + int32 min = INT32_MIN, int32 max = INT32_MAX); virtual ~ScalarValueSetting(); void ValueChanged(int32 newValue); diff --git a/src/apps/codycam/VideoConsumer.cpp b/src/apps/codycam/VideoConsumer.cpp index c764d19..55618e0 100644 --- a/src/apps/codycam/VideoConsumer.cpp +++ b/src/apps/codycam/VideoConsumer.cpp @@ -124,7 +124,7 @@ VideoConsumer::~VideoConsumer() BMediaAddOn* -VideoConsumer::AddOn(long* cookie) const +VideoConsumer::AddOn(int32* cookie) const { FUNCTION("VideoConsumer::AddOn\n"); // do the right thing if we're ever used with an add-on @@ -243,7 +243,8 @@ VideoConsumer::HandleMessage(int32 message, const void* data, size_t size) void VideoConsumer::BufferReceived(BBuffer* buffer) { - LOOP("VideoConsumer::Buffer #%ld received, start_time %Ld\n", buffer->ID(), buffer->Header()->start_time); + LOOP("VideoConsumer::Buffer #%" B_PRId32 " received, start_time %" B_PRIdBIGTIME + "\n", buffer->ID(), buffer->Header()->start_time); if (RunState() == B_STOPPED) { buffer->Recycle(); @@ -309,8 +310,8 @@ VideoConsumer::CreateBuffers(const media_format& withFormat) else PROGRESS("VideoConsumer::CreateBuffers - SUCCESSFUL ADD BUFFER TO GROUP\n"); } else { - ERROR("VideoConsumer::CreateBuffers - ERROR CREATING VIDEO RING BUFFER: %08lx\n", - status); + ERROR("VideoConsumer::CreateBuffers - ERROR CREATING VIDEO RING " + "BUFFER: %08" B_PRIx32 "\n", status); return B_ERROR; } } @@ -322,8 +323,8 @@ VideoConsumer::CreateBuffers(const media_format& withFormat) if ((status = fBuffers->GetBufferList(3, buffList)) == B_OK) for (int j = 0; j < 3; j++) if (buffList[j] != NULL) { - fBufferMap[j] = (uint32)buffList[j]; - PROGRESS(" j = %d buffer = %08lx\n", j, fBufferMap[j]); + fBufferMap[j] = buffList[j]; + PROGRESS(" j = %d buffer = %p\n", j, fBufferMap[j]); } else { ERROR("VideoConsumer::CreateBuffers ERROR MAPPING RING BUFFER\n"); return B_ERROR; @@ -542,7 +543,7 @@ VideoConsumer::HandleEvent(const media_timed_event* event, bigtime_t lateness, uint32 index = 0; fOurBuffers = true; while (index < 3) - if ((uint32)buffer == fBufferMap[index]) + if (buffer == fBufferMap[index]) break; else index++; @@ -735,7 +736,7 @@ VideoConsumer::FtpSave(char* filename) uint32 time = real_time_clock(); char s[80]; strcpy(s, B_TRANSLATE("Last Capture: ")); - strcat(s, ctime((const long*)&time)); + strcat(s, ctime((const time_t*)&time)); s[strlen(s) - 1] = 0; UpdateFtpStatus(s); delete ftp; diff --git a/src/apps/codycam/VideoConsumer.h b/src/apps/codycam/VideoConsumer.h index 473bd4f..af3e640 100644 --- a/src/apps/codycam/VideoConsumer.h +++ b/src/apps/codycam/VideoConsumer.h @@ -43,7 +43,7 @@ class VideoConsumer : public BMediaEventLooper, public BBufferConsumer { /* BMediaNode */ public: - virtual BMediaAddOn* AddOn(long* cookie) const; + virtual BMediaAddOn* AddOn(int32* cookie) const; protected: virtual void Start(bigtime_t performanceTime); @@ -114,7 +114,7 @@ class VideoConsumer : public BMediaEventLooper, public BBufferConsumer { private: BStringView* fStatusLine; - uint32 fInternalID; + int32 fInternalID; BMediaAddOn* fAddOn; thread_id fFtpThread; @@ -129,7 +129,7 @@ class VideoConsumer : public BMediaEventLooper, public BBufferConsumer { BBitmap* fBitmap[3]; bool fOurBuffers; BBufferGroup* fBuffers; - uint32 fBufferMap[3]; + BBuffer* fBufferMap[3]; BBitmap* fFtpBitmap; volatile bool fTimeToFtp; ############################################################################ Commit: dc4e3ce33748d2d2b4138a433bb3839c388168e4 URL: http://cgit.haiku-os.org/haiku/commit/?id=dc4e3ce Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 11:40:12 2013 UTC added B_PRIxOFF ---------------------------------------------------------------------------- diff --git a/headers/os/support/SupportDefs.h b/headers/os/support/SupportDefs.h index a37bd7d..7cc5aaf 100644 --- a/headers/os/support/SupportDefs.h +++ b/headers/os/support/SupportDefs.h @@ -137,6 +137,7 @@ typedef generic_addr_t generic_size_t; /* off_t */ #define B_PRIdOFF B_PRId64 #define B_PRIiOFF B_PRIi64 +#define B_PRIxOFF B_PRIx64 /* dev_t */ #define B_PRIdDEV B_PRId32 #define B_PRIiDEV B_PRIi32 ############################################################################ Commit: 48350f1a72b010a532b54c818d64e9f69d797bad URL: http://cgit.haiku-os.org/haiku/commit/?id=48350f1 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 11:48:24 2013 UTC bluetooth_server: some 64 bit fixes ---------------------------------------------------------------------------- diff --git a/src/servers/bluetooth/BluetoothServer.cpp b/src/servers/bluetooth/BluetoothServer.cpp index 40da9da..d5ea861 100644 --- a/src/servers/bluetooth/BluetoothServer.cpp +++ b/src/servers/bluetooth/BluetoothServer.cpp @@ -344,7 +344,8 @@ BluetoothServer::HandleAcquireLocalDevice(BMessage* message, BMessage* reply) for (int index = lastIndex + 1; index < fLocalDevicesList.CountItems(); index++) { lDeviceImpl= fLocalDevicesList.ItemAt(index); - printf("Requesting local device %ld\n", lDeviceImpl->GetID()); + printf("Requesting local device %" B_PRId32 "\n", + lDeviceImpl->GetID()); if (lDeviceImpl != NULL && lDeviceImpl->Available()) { Output::Instance()->Postf(BLACKBOARD_KIT, "Device available: %lx\n", lDeviceImpl->GetID()); @@ -357,7 +358,8 @@ BluetoothServer::HandleAcquireLocalDevice(BMessage* message, BMessage* reply) if (lDeviceImpl == NULL) { for (int index = 0; index <= lastIndex ; index ++) { lDeviceImpl = fLocalDevicesList.ItemAt(index); - printf("Requesting local device %ld\n", lDeviceImpl->GetID()); + printf("Requesting local device %" B_PRId32 "\n", + lDeviceImpl->GetID()); if (lDeviceImpl != NULL && lDeviceImpl->Available()) { Output::Instance()->Postf(BLACKBOARD_KIT, "Device available: %lx\n", lDeviceImpl->GetID()); @@ -600,7 +602,7 @@ BluetoothServer::_InstallDeskbarIcon() status_t res = deskbar.AddItem(&appInfo.ref); if (res != B_OK) { - printf("Failed adding deskbar icon: %ld\n", res); + printf("Failed adding deskbar icon: %" B_PRId32 "\n", res); } } @@ -611,7 +613,7 @@ BluetoothServer::_RemoveDeskbarIcon() BDeskbar deskbar; status_t res = deskbar.RemoveItem(kDeskbarItemName); if (res != B_OK) { - printf("Failed removing Deskbar icon: %ld: \n", res); + printf("Failed removing Deskbar icon: %" B_PRId32 ": \n", res); } } diff --git a/src/servers/bluetooth/HCITransportAccessor.cpp b/src/servers/bluetooth/HCITransportAccessor.cpp index 2c070d6..8e64949 100644 --- a/src/servers/bluetooth/HCITransportAccessor.cpp +++ b/src/servers/bluetooth/HCITransportAccessor.cpp @@ -20,11 +20,11 @@ HCITransportAccessor::HCITransportAccessor(BPath* path) : HCIDelegate(path) if (fDescriptor > 0) { // find out which ID was assigned status = ioctl(fDescriptor, GET_HCI_ID, &fIdentifier, 0); - printf("%s: hid retrieved %lx status=%ld\n", __FUNCTION__, - fIdentifier, status); + printf("%s: hid retrieved %" B_PRIx32 " status=%" B_PRId32 "\n", + __FUNCTION__, fIdentifier, status); } else { - printf("%s: Device driver %s could not be opened %ld\n", __FUNCTION__, - path->Path(), fIdentifier); + printf("%s: Device driver %s could not be opened %" B_PRId32 "\n", + __FUNCTION__, path->Path(), fIdentifier); fIdentifier = B_ERROR; } diff --git a/src/servers/bluetooth/LocalDeviceHandler.cpp b/src/servers/bluetooth/LocalDeviceHandler.cpp index 8a0e7ff..7d3936a 100644 --- a/src/servers/bluetooth/LocalDeviceHandler.cpp +++ b/src/servers/bluetooth/LocalDeviceHandler.cpp @@ -93,11 +93,12 @@ LocalDeviceHandler::ClearWantedEvent(BMessage* msg, uint16 event, uint16 opcode) // for each Event while (msg->FindInt16("eventExpected", eventIndex, &eventFound) == B_OK) { - printf("%s:Event expected %d@%ld...\n", __FUNCTION__, event, eventIndex); + printf("%s:Event expected %d@%" B_PRId32 "...\n", __FUNCTION__, event, + eventIndex); if (eventFound == event) { - printf("%s:Event matches@%ld", __FUNCTION__, eventIndex); + printf("%s:Event matches@%" B_PRId32 "\n", __FUNCTION__, eventIndex); // there is an opcode specified if (opcode != 0) { ############################################################################ Commit: 60128b54b483dc49e67e08ebbca3f08f5c47edea URL: http://cgit.haiku-os.org/haiku/commit/?id=60128b5 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 09:57:53 2013 UTC Icon-o-matic: some 64 bit fixes ---------------------------------------------------------------------------- diff --git a/src/apps/icon-o-matic/MainWindow.cpp b/src/apps/icon-o-matic/MainWindow.cpp index d8ac569..ee5a4ce 100644 --- a/src/apps/icon-o-matic/MainWindow.cpp +++ b/src/apps/icon-o-matic/MainWindow.cpp @@ -176,7 +176,7 @@ MainWindow::MessageReceived(BMessage* message) if (message->WasDropped()) { const rgb_color* color; - int32 length; + ssize_t length; // create styles from dropped colors for (int32 i = 0; message->FindData("RGBColor", B_RGB_COLOR_TYPE, i, (const void**)&color, &length) == B_OK; i++) { diff --git a/src/apps/icon-o-matic/generic/listener/Observable.cpp b/src/apps/icon-o-matic/generic/listener/Observable.cpp index 36d198c..f169468 100644 --- a/src/apps/icon-o-matic/generic/listener/Observable.cpp +++ b/src/apps/icon-o-matic/generic/listener/Observable.cpp @@ -29,8 +29,8 @@ Observable::~Observable() if (fObservers.CountItems() > 0) { char message[256]; Observer* o = (Observer*)fObservers.ItemAt(0); - sprintf(message, "Observable::~Observable() - %ld " - "observers still watching, first: %s\n", + sprintf(message, "Observable::~Observable() - %" B_PRId32 + " observers still watching, first: %s\n", fObservers.CountItems(), typeid(*o).name()); debugger(message); } diff --git a/src/apps/icon-o-matic/generic/property/view/PropertyListView.cpp b/src/apps/icon-o-matic/generic/property/view/PropertyListView.cpp index dfb220d..8550dc9 100644 --- a/src/apps/icon-o-matic/generic/property/view/PropertyListView.cpp +++ b/src/apps/icon-o-matic/generic/property/view/PropertyListView.cpp @@ -399,7 +399,7 @@ PropertyListView::SetTo(PropertyObject* object) // unkown to the PropertyEditorFactory and therefor // there is no editor view at this item fprintf(stderr, "PropertyListView::_SetTo() - " - "property mismatch at %ld\n", i); + "property mismatch at %" B_PRId32 "\n", i); error = true; break; } @@ -425,7 +425,7 @@ PropertyListView::SetTo(PropertyObject* object) int32 focused = -1; for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) { if (item->IsSelected()) - selection.AddItem((void*)i); + selection.AddItem((void*)(long)i); if (item->IsFocused()) focused = i; } @@ -449,7 +449,7 @@ PropertyListView::SetTo(PropertyObject* object) // restore scroll pos, selection and focus SetScrollOffset(scrollOffset); for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) { - if (selection.HasItem((void*)i)) + if (selection.HasItem((void*)(long)i)) item->SetSelected(true); if (i == focused) item->MakeFocus(true); diff --git a/src/apps/icon-o-matic/generic/support/support.cpp b/src/apps/icon-o-matic/generic/support/support.cpp index 77e1e32..f2f7fc9 100644 --- a/src/apps/icon-o-matic/generic/support/support.cpp +++ b/src/apps/icon-o-matic/generic/support/support.cpp @@ -111,7 +111,7 @@ append_float(BString& string, float n, int32 maxDigits) n = n - rounded; rounded = (int32)(n * pow(10, maxDigits)); char tmp[maxDigits + 1]; - sprintf(tmp, "%0*ld", (int)maxDigits, rounded); + sprintf(tmp, "%0*" B_PRId32, (int)maxDigits, rounded); tmp[maxDigits] = 0; int32 digits = strlen(tmp); for (int32 i = strlen(tmp) - 1; i >= 0; i--) { diff --git a/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp b/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp index 10ac43f..a0eb7b8 100644 --- a/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp +++ b/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp @@ -51,12 +51,12 @@ FlatIconExporter::~FlatIconExporter() { #if PRINT_STATISTICS printf("Statistics\n" - "--style section size: %ld\n" - " gradients: %ld\n" - " gradient transforms: %ld\n" - "---path section size: %ld\n" - "--shape section size: %ld\n" - "---total/different points: %ld/%lu\n", + "--style section size: %" B_PRId32 "\n" + " gradients: %" B_PRId32 "\n" + " gradient transforms: %" B_PRId32 "\n" + "---path section size: %" B_PRId32 "\n" + "--shape section size: %" B_PRId32 "\n" + "---total/different points: %" B_PRId32 "/%" B_PRIdSSIZE "\n", fStyleSectionSize, fGradientSize, fGradientTransformSize, diff --git a/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp b/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp index 0d6b10f..eaa9902 100644 --- a/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp +++ b/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp @@ -186,14 +186,14 @@ StyledTextImporter::Import(Icon* icon, BMessage* clipping) { CALLED(); const char *text; - int32 textLength; + ssize_t textLength; if (clipping == NULL) return ENOENT; if (clipping->FindData("text/plain", B_MIME_TYPE, (const void **)&text, &textLength) == B_OK) { text_run_array *runs = NULL; - int32 runsLength; + ssize_t runsLength; if (clipping->FindData("application/x-vnd.Be-text_run_array", B_MIME_TYPE, (const void **)&runs, &runsLength) < B_OK) runs = NULL; diff --git a/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp b/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp index 0b57dc7..ee9fcec 100644 --- a/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp +++ b/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp @@ -490,7 +490,7 @@ SVGExporter::_GetFill(const Style* style, char* string, status_t ret = B_OK; if (Gradient* gradient = style->Gradient()) { ret = _ExportGradient(gradient, stream); - sprintf(string, "url(#gradient%ld)", fGradientCount++); + sprintf(string, "url(#gradient%" B_PRId32 ")", fGradientCount++); } else { sprintf(string, "#%.2x%.2x%.2x", style->Color().red, style->Color().green, diff --git a/src/apps/icon-o-matic/shape/PathManipulator.cpp b/src/apps/icon-o-matic/shape/PathManipulator.cpp index 4a06a51..fa30575 100644 --- a/src/apps/icon-o-matic/shape/PathManipulator.cpp +++ b/src/apps/icon-o-matic/shape/PathManipulator.cpp @@ -143,21 +143,21 @@ public: break; } } - BList::AddItem((void*)value, index); + BList::AddItem((void*)(long)value, index); } } inline bool Remove(int32 value) - { return BList::RemoveItem((void*)value); } + { return BList::RemoveItem((void*)(long)value); } inline bool Contains(int32 value) const - { return BList::HasItem((void*)value); } + { return BList::HasItem((void*)(long)value); } inline bool IsEmpty() const { return BList::IsEmpty(); } inline int32 IndexAt(int32 index) const - { return (int32)BList::ItemAt(index); } + { return (int32)(long)BList::ItemAt(index); } inline void MakeEmpty() { BList::MakeEmpty(); } diff --git a/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.cpp b/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.cpp index b7a43f4..1054792 100644 --- a/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.cpp +++ b/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.cpp @@ -147,7 +147,7 @@ FreezeTransformationCommand::_ApplyTransformation(Shape* shape, path->ApplyTransform(transform); } else { printf("Not transfering transformation of \"%s\" onto " - "path \"%s\", because %ld other shapes " + "path \"%s\", because %" B_PRId32 " other shapes " "have it assigned.\n", shape->Name(), path->Name(), shapes - 1); } ############################################################################ Commit: 55a4a88045ee553e36e92406200079ea13b858d6 URL: http://cgit.haiku-os.org/haiku/commit/?id=55a4a88 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 12:40:26 2013 UTC Mail: some 64 bit fixes ---------------------------------------------------------------------------- diff --git a/src/apps/mail/Content.cpp b/src/apps/mail/Content.cpp index 54927c2..21b5cd7 100644 --- a/src/apps/mail/Content.cpp +++ b/src/apps/mail/Content.cpp @@ -148,7 +148,7 @@ FilterHTMLTag(int32 &first, char **t, char *end) // check for some common entities (in ISO-Latin-1) if (first == '&') { // filter out and convert decimal values - if (a[1] == '#' && sscanf(a + 2, "%ld;", &first) == 1) { + if (a[1] == '#' && sscanf(a + 2, "%" B_SCNd32 ";", &first) == 1) { t[0] += strchr(a, ';') - a; return false; } @@ -932,11 +932,11 @@ TTextView::UpdateFont(const BFont* newFont) fFont = *newFont; // update the text run array safely with new font - text_run_array *runArray = RunArray(0, LONG_MAX); + text_run_array *runArray = RunArray(0, INT32_MAX); for (int i = 0; i < runArray->count; i++) runArray->runs[i].font = *newFont; - SetRunArray(0, LONG_MAX, runArray); + SetRunArray(0, INT32_MAX, runArray); FreeRunArray(runArray); } @@ -1917,7 +1917,7 @@ TTextView::Open(hyper_text *enclosure) strcpy(baseName, enclosure->name ? enclosure->name : "enclosure"); strcpy(name, baseName); for (int32 index = 0; dir.Contains(name); index++) - sprintf(name, "%s_%ld", baseName, index); + sprintf(name, "%s_%" B_PRId32, baseName, index); BEntry entry(path.Path()); entry_ref ref; diff --git a/src/apps/mail/Header.cpp b/src/apps/mail/Header.cpp index 60530c8..2fc6165 100644 --- a/src/apps/mail/Header.cpp +++ b/src/apps/mail/Header.cpp @@ -348,7 +348,7 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming, fAccountMenu->AddItem( item = new BMenuItem(B_TRANSLATE("<none>"), NULL)); item->SetEnabled(false); - fAccountID = ~0UL; + fAccountID = ~(int32)0; } // default account is invalid, set to marked // TODO: do this differently, no casting and knowledge @@ -1093,7 +1093,7 @@ QPopupMenu::AddPersonItem(const entry_ref *ref, ino_t node, BString &name, if (!parentMenu->AddItem(newItem, index + 1)) { fprintf (stderr, "QPopupMenu::AddPersonItem: Unable to add menu " - "item \"%s\" at index %ld.\n", sortKey.String(), index + 1); + "item \"%s\" at index %" B_PRId32 ".\n", sortKey.String(), index + 1); delete newItem; } } diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp index f9879d6..2862073 100644 --- a/src/apps/mail/MailWindow.cpp +++ b/src/apps/mail/MailWindow.cpp @@ -2396,7 +2396,7 @@ TMailWindow::Send(bool now) char versionString[255]; sprintf(versionString, - "Mail/Haiku %ld.%ld.%ld", + "Mail/Haiku %" B_PRIu32 ".%" B_PRIu32 ".%" B_PRIu32, info.major, info.middle, info.minor); fMail->SetHeaderField("X-Mailer", versionString); } @@ -2578,7 +2578,7 @@ TMailWindow::SaveAsDraft() if (status == B_OK) break; char appendix[B_FILE_NAME_LENGTH]; - sprintf(appendix, " %ld", i++); + sprintf(appendix, " %" B_PRId32, i++); int32 pos = min_c(sizeof(fileName) - strlen(appendix), originalLength); sprintf(fileName + pos, "%s", appendix); @@ -2746,8 +2746,8 @@ TMailWindow::TrainMessageAs(const char *CommandWord) ErrorExit: beep(); sprintf(errorString, "Unable to train the message file \"%s\" as %s. " - "Possibly useful error code: %s (%ld).", - filePath.Path(), CommandWord, strerror (errorCode), errorCode); + "Possibly useful error code: %s (%" B_PRId32 ").", + filePath.Path(), CommandWord, strerror(errorCode), errorCode); BAlert* alert = new BAlert("", errorString, B_TRANSLATE("OK")); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); @@ -2921,7 +2921,7 @@ TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding) // Put the addresses in the 'Save Address' Menu // BMenuItem *item; - while ((item = fSaveAddrMenu->RemoveItem(0L)) != NULL) + while ((item = fSaveAddrMenu->RemoveItem((int32)0)) != NULL) delete item; // create the list of addresses @@ -2935,7 +2935,7 @@ TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding) BMessage *msg; for (int32 i = addressList.CountItems(); i-- > 0;) { - char *address = (char *)addressList.RemoveItem(0L); + char *address = (char *)addressList.RemoveItem((int32)0); // insert the new address in alphabetical order int32 index = 0; diff --git a/src/apps/mail/Prefs.cpp b/src/apps/mail/Prefs.cpp index 8611f1f..45b32cd 100644 --- a/src/apps/mail/Prefs.cpp +++ b/src/apps/mail/Prefs.cpp @@ -338,7 +338,7 @@ TPrefsWindow::MessageReceived(BMessage* msg) fNewFont->SetSize(old_size); if (revert) { - sprintf(label, "%ld", old_size); + sprintf(label, "%" B_PRId32, old_size); item = fSizeMenu->FindItem(label); if (item != NULL) item->SetMarked(true); @@ -759,7 +759,7 @@ TPrefsWindow::_BuildSizeMenu(BFont* font) for (loop = 0; loop < sizeof(sizes) / sizeof(int32); loop++) { msg = new BMessage(P_SIZE); msg->AddInt32("size", sizes[loop]); - sprintf(label, "%ld", sizes[loop]); + sprintf(label, "%" B_PRId32, sizes[loop]); menu->AddItem(item = new BMenuItem(label, msg)); if (sizes[loop] == (int32)size) item->SetMarked(true); diff --git a/src/apps/mail/Signature.cpp b/src/apps/mail/Signature.cpp index 48a0203..dc8bcf9 100644 --- a/src/apps/mail/Signature.cpp +++ b/src/apps/mail/Signature.cpp @@ -369,7 +369,7 @@ TSignatureWindow::Save() fFile = new BFile(); while(true) { - sprintf(name, "signature_%ld", index++); + sprintf(name, "signature_%" B_PRId32, index++); if ((result = dir.CreateFile(name, fFile, true)) == B_NO_ERROR) break; if (result != EEXIST) diff --git a/src/apps/mail/Status.cpp b/src/apps/mail/Status.cpp index 544646f..7acee48 100644 --- a/src/apps/mail/Status.cpp +++ b/src/apps/mail/Status.cpp @@ -165,7 +165,7 @@ TStatusWindow::MessageReceived(BMessage* msg) break; if (result != EEXIST) goto err_exit; - sprintf(newName, "%s_%ld", name, index++); + sprintf(newName, "%s_%" B_PRId32, name, index++); } dir.FindEntry(newName, &entry); node = new BNodeInfo(&file); diff --git a/src/kits/mail/MailAttachment.cpp b/src/kits/mail/MailAttachment.cpp index 057427e..be734bf 100644 --- a/src/kits/mail/MailAttachment.cpp +++ b/src/kits/mail/MailAttachment.cpp @@ -320,7 +320,7 @@ BSimpleMailAttachment::SetToRFC822(BPositionIO *data, size_t length, BMailComponent::SetToRFC822(data, length, parseNow); // this actually happens... - if (data->Position() - position > length) + if (data->Position() - position > (off_t)length) return B_ERROR; length -= (data->Position() - position); @@ -519,8 +519,8 @@ BAttributedMailAttachment::SetTo(BFile *file, bool deleteFileWhenDone) // Also, we have the make up the boundary out of whole cloth // This is likely to give a completely random string BString boundary; - boundary << "BFile--" << (int32(file) ^ time(NULL)) << "-" - << ~((int32)file ^ (int32)&fStatus ^ (int32)&_attributes) << "--"; + boundary << "BFile--" << ((long)file ^ time(NULL)) << "-" + << ~((long)file ^ (long)&fStatus ^ (long)&_attributes) << "--"; fContainer->SetBoundary(boundary.String()); return fStatus = B_OK; @@ -558,8 +558,8 @@ BAttributedMailAttachment::SetTo(entry_ref *ref) buffer[i] = '_'; } buffer[32] = '\0'; - boundary << "BFile-" << buffer << "--" << ((int32)_data ^ time(NULL)) - << "-" << ~((int32)_data ^ (int32)&buffer ^ (int32)&_attributes) + boundary << "BFile-" << buffer << "--" << ((long)_data ^ time(NULL)) + << "-" << ~((long)_data ^ (long)&buffer ^ (long)&_attributes) << "--"; fContainer->SetBoundary(boundary.String()); diff --git a/src/kits/mail/MailContainer.cpp b/src/kits/mail/MailContainer.cpp index a348b41..97f07eb 100644 --- a/src/kits/mail/MailContainer.cpp +++ b/src/kits/mail/MailContainer.cpp @@ -425,8 +425,10 @@ status_t BMIMEMultipartMailContainer::RenderToRFC822(BPositionIO *render_to) { ssize_t amountWritten, length; message_part *part = (message_part *)_components_in_raw.ItemAt(i); - for (off_t begin = part->start; begin < part->end; begin += sizeof(buffer)) { - length = ((part->end - begin) >= sizeof(buffer)) ? sizeof(buffer) : (part->end - begin); + for (off_t begin = part->start; begin < part->end; + begin += sizeof(buffer)) { + length = (((off_t)part->end - begin) >= (off_t)sizeof(buffer)) + ? sizeof(buffer) : (part->end - begin); _io_data->ReadAt(begin,buffer,length); amountWritten = render_to->Write(buffer,length); diff --git a/src/kits/mail/MailMessage.cpp b/src/kits/mail/MailMessage.cpp index e91139f..abf7de2 100644 --- a/src/kits/mail/MailMessage.cpp +++ b/src/kits/mail/MailMessage.cpp @@ -122,7 +122,7 @@ BEmailMessage::ReplyMessage(mail_reply_to_mode replyTo, bool accountFromMail, BString cc; for (int32 i = list.CountItems(); i-- > 0;) { - char *address = (char *)list.RemoveItem(0L); + char *address = (char *)list.RemoveItem((int32)0); // add everything which is not the sender and not already in the list if (sender.ICompare(address) && cc.FindFirst(address) < 0) { @@ -731,7 +731,7 @@ BEmailMessage::RenderToRFC822(BPositionIO *file) BString recipients; for (int32 i = recipientList.CountItems(); i-- > 0;) { - char *address = (char *)recipientList.RemoveItem(0L); + char *address = (char *)recipientList.RemoveItem((int32)0); recipients << '<' << address << '>'; if (i) diff --git a/src/kits/mail/mail_util.cpp b/src/kits/mail/mail_util.cpp index 8d8c86e..e7ea0a6 100644 --- a/src/kits/mail/mail_util.cpp +++ b/src/kits/mail/mail_util.cpp @@ -681,7 +681,7 @@ utf8_to_rfc2047 (char **bufp, ssize_t length, uint32 charset, char encoding) } } - while ((currentWord = (struct word *)words.RemoveItem(0L)) != NULL) { + while ((currentWord = (struct word *)words.RemoveItem((int32)0)) != NULL) { if ((encoding != quoted_printable && encoding != base64) || !currentWord->needsEncoding) { rfc2047.Append (currentWord->convertedWord); ############################################################################ Commit: cf91714bf27a0166f5c6bed025a196aff35fb274 URL: http://cgit.haiku-os.org/haiku/commit/?id=cf91714 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 12:15:27 2013 UTC Magnify: some 64 bit fixes ---------------------------------------------------------------------------- diff --git a/src/apps/magnify/Magnify.cpp b/src/apps/magnify/Magnify.cpp index c757b63..85184c9 100644 --- a/src/apps/magnify/Magnify.cpp +++ b/src/apps/magnify/Magnify.cpp @@ -873,8 +873,8 @@ TInfoView::Draw(BRect updateRect) float h = Bounds().Height(); if (ch2Showing) { MovePenTo(10, h-12); - sprintf(str, "2) x: %li y: %li y: %i", (int32)pt2.x, (int32)pt2.y, - abs((int)(pt1.y - pt2.y))); + sprintf(str, "2) x: %" B_PRIi32 " y: %" B_PRIi32 " y: %d", + (int32)pt2.x, (int32)pt2.y, abs((int)(pt1.y - pt2.y))); invalRect.Set(10, h-12-fFontHeight, 10 + StringWidth(fCH2Str), h-10); SetHighColor(ViewColor()); FillRect(invalRect); @@ -886,8 +886,8 @@ TInfoView::Draw(BRect updateRect) if (ch1Showing && ch2Showing) { MovePenTo(10, h-10-fFontHeight-2); - sprintf(str, "1) x: %li y: %li x: %i", (int32)pt1.x, (int32)pt1.y, - abs((int)(pt1.x - pt2.x))); + sprintf(str, "1) x: %" B_PRIi32 " y: %" B_PRIi32 " x: %d", + (int32)pt1.x, (int32)pt1.y, abs((int)(pt1.x - pt2.x))); invalRect.Set(10, h-10-2*fFontHeight-2, 10 + StringWidth(fCH1Str), h-10-fFontHeight); SetHighColor(ViewColor()); FillRect(invalRect); @@ -897,7 +897,7 @@ TInfoView::Draw(BRect updateRect) DrawString(fCH1Str); } else if (ch1Showing) { MovePenTo(10, h-10); - sprintf(str, "x: %li y: %li", (int32)pt1.x, (int32)pt1.y); + sprintf(str, "x: %" B_PRIi32 " y: %" B_PRIi32, (int32)pt1.x, (int32)pt1.y); invalRect.Set(10, h-10-fFontHeight, 10 + StringWidth(fCH1Str), h-8); SetHighColor(ViewColor()); FillRect(invalRect); @@ -1410,7 +1410,7 @@ void TMagnify::NudgeMouse(float x, float y) { BPoint loc; - ulong button; + uint32 button; GetMouse(&loc, &button); ConvertToScreen(&loc); @@ -1429,7 +1429,7 @@ TMagnify::WindowActivated(bool active) } -long +status_t TMagnify::MagnifyTask(void *arg) { TMagnify* view = (TMagnify*)arg; @@ -1456,7 +1456,7 @@ void TMagnify::Update(bool force) { BPoint loc; - ulong button; + uint32 button; static long counter = 0; if (!fStickCoordinates) { @@ -1697,11 +1697,14 @@ TMagnify::SaveBits(BFile* file, const BBitmap *bitmap, const char* name) const char str[1024]; // stream out the width, height and ColorSpace - sprintf(str, "const int32 k%sWidth = %ld;\n", name, (int32)bitmap->Bounds().Width()+1); + sprintf(str, "const int32 k%sWidth = %" B_PRIi32 ";\n", name, + (int32)bitmap->Bounds().Width()+1); file->Write(str, strlen(str)); - sprintf(str, "const int32 k%sHeight = %ld;\n", name, (int32)bitmap->Bounds().Height()+1); + sprintf(str, "const int32 k%sHeight = %" B_PRIi32 ";\n", name, + (int32)bitmap->Bounds().Height()+1); file->Write(str, strlen(str)); - sprintf(str, "const color_space k%sColorSpace = %s;\n\n", name, kColorSpaceName); + sprintf(str, "const color_space k%sColorSpace = %s;\n\n", name, + kColorSpaceName); file->Write(str, strlen(str)); // stream out the constant name for this array diff --git a/src/apps/magnify/Magnify.h b/src/apps/magnify/Magnify.h index c4d468c..ae19a71 100644 --- a/src/apps/magnify/Magnify.h +++ b/src/apps/magnify/Magnify.h @@ -119,7 +119,7 @@ class TMagnify : public BView { void EndSave(); private: - static long MagnifyTask(void *); + static status_t MagnifyTask(void *); bool fNeedToUpdate; long fThread; // magnify thread id ############################################################################ Commit: 113817f035bc6877d0f9d85abb1fe912369413ce URL: http://cgit.haiku-os.org/haiku/commit/?id=113817f Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 12:52:21 2013 UTC MediaPlayer: 64 bit build fixes for an ugly use of BList. ---------------------------------------------------------------------------- diff --git a/src/apps/mediaplayer/playlist/ListViews.cpp b/src/apps/mediaplayer/playlist/ListViews.cpp index c5dbbb6..c8eebcd 100644 --- a/src/apps/mediaplayer/playlist/ListViews.cpp +++ b/src/apps/mediaplayer/playlist/ListViews.cpp @@ -328,7 +328,7 @@ DragSortableListView::MessageReceived(BMessage* message) BList indices; int32 index; for (int32 i = 0; message->FindInt32("index", i, &index) == B_OK; i++) - indices.AddItem((void*)index); + indices.AddItem((void*)(long)index); if (indices.CountItems() > 0) { if (modifiers() & B_SHIFT_KEY) CopyItems(indices, fDropIndex); @@ -636,7 +636,7 @@ DragSortableListView::MoveItems(const BList& indices, int32 index) BList removedItems; int32 count = indices.CountItems(); for (int32 i = 0; i < count; i++) { - int32 removeIndex = (int32)indices.ItemAtFast(i) - i; + int32 removeIndex = (int32)(long)indices.ItemAtFast(i) - i; BListItem* item = RemoveItem(removeIndex); if (item && removedItems.AddItem((void*)item)) { if (removeIndex < index) @@ -669,9 +669,9 @@ DragSortableListView::CopyItems(const BList& indices, int32 toIndex) BList clonedItems; int32 count = indices.CountItems(); for (int32 i = 0; i < count; i++) { - int32 index = (int32)indices.ItemAtFast(i); + int32 index = (int32)(long)indices.ItemAtFast(i); BListItem* item = CloneItem(index); - if (item && !clonedItems.AddItem((void*)item)) + if (item && !clonedItems.AddItem((void*)(long)item)) delete item; } count = clonedItems.CountItems(); @@ -693,7 +693,7 @@ DragSortableListView::RemoveItemList(const BList& indices) { int32 count = indices.CountItems(); for (int32 i = 0; i < count; i++) { - int32 index = (int32)indices.ItemAtFast(i) - i; + int32 index = (int32)(long)indices.ItemAtFast(i) - i; delete RemoveItem(index); } } @@ -706,7 +706,7 @@ DragSortableListView::GetSelectedItems(BList& indices) int32 index = CurrentSelection(i); if (index < 0) break; - if (!indices.AddItem((void*)index)) + if (!indices.AddItem((void*)(long)index)) break; } } @@ -731,7 +731,7 @@ DragSortableListView::RemoveAll() BList indices; int32 count = CountItems(); for (int32 i = 0; i < count; i++) { - if (!indices.AddItem((void*)i)) + if (!indices.AddItem((void*)(long)i)) break; } diff --git a/src/apps/mediaplayer/playlist/PlaylistListView.cpp b/src/apps/mediaplayer/playlist/PlaylistListView.cpp index df2e048..7c80341 100644 --- a/src/apps/mediaplayer/playlist/PlaylistListView.cpp +++ b/src/apps/mediaplayer/playlist/PlaylistListView.cpp @@ -425,7 +425,7 @@ PlaylistListView::Randomize() int32 index = CurrentSelection(count); if (index < 0) break; - if (!indices.AddItem((void*)index)) + if (!indices.AddItem((void*)(long)index)) return; count++; } @@ -435,7 +435,7 @@ PlaylistListView::Randomize() // no selection, simply add all items count = CountItems(); for (int32 i = 0; i < count; i++) { - if (!indices.AddItem((void*)i)) + if (!indices.AddItem((void*)(long)i)) return; } } @@ -458,7 +458,7 @@ void PlaylistListView::RemoveToTrash(int32 index) { BList indices; - indices.AddItem((void*)index); + indices.AddItem((void*)(long)index); RemoveItemList(indices, true); } diff --git a/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp b/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp index 3f9ad41..77de4a0 100644 --- a/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp +++ b/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp @@ -48,7 +48,7 @@ RandomizePLItemsCommand::RandomizePLItemsCommand(Playlist* playlist, BList indexSet; for (int32 i = 0; i < fCount; i++) { fItems[i] = fPlaylist->ItemAt(fListIndices[i]); - if (fItems[i] == NULL || !indexSet.AddItem((void*)i)) { + if (fItems[i] == NULL || !indexSet.AddItem((void*)(long)i)) { // indicate a bad object state delete[] fItems; fItems = NULL; @@ -59,7 +59,7 @@ RandomizePLItemsCommand::RandomizePLItemsCommand(Playlist* playlist, // remove the indices from the set in random order for (int32 i = 0; i < fCount; i++) { int32 randomSetIndex = rand() % indexSet.CountItems(); - fRandomInternalIndices[i] = (int32)indexSet.RemoveItem(randomSetIndex); + fRandomInternalIndices[i] = (int32)(long)indexSet.RemoveItem(randomSetIndex); } } ############################################################################ Commit: bd380b558ac049d9b29f9e9ce475f5aae6564eb0 URL: http://cgit.haiku-os.org/haiku/commit/?id=bd380b5 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 12:58:53 2013 UTC PackageInstaller: some 64 bit fixes ---------------------------------------------------------------------------- diff --git a/src/apps/packageinstaller/PackageInfo.cpp b/src/apps/packageinstaller/PackageInfo.cpp index 22cfe55..9354934 100644 --- a/src/apps/packageinstaller/PackageInfo.cpp +++ b/src/apps/packageinstaller/PackageInfo.cpp @@ -73,7 +73,7 @@ PackageInfo::~PackageInfo() { pkg_profile *iter = 0; while (1) { - iter = static_cast<pkg_profile *>(fProfiles.RemoveItem((long int)0)); + iter = static_cast<pkg_profile *>(fProfiles.RemoveItem((int32)0)); if (iter == NULL) break; @@ -82,7 +82,7 @@ PackageInfo::~PackageInfo() PackageItem *file = 0; while (true) { - file = static_cast<PackageItem *>(fFiles.RemoveItem((long int)0)); + file = static_cast<PackageItem *>(fFiles.RemoveItem((int32)0)); if (file == NULL) break; @@ -90,7 +90,7 @@ PackageInfo::~PackageInfo() } while (true) { - file = static_cast<PackageScript *>(fScripts.RemoveItem((long int)0)); + file = static_cast<PackageScript *>(fScripts.RemoveItem((int32)0)); if (file == NULL) break; ############################################################################ Commit: 14b32de1d5efe99b4c6d4ef8c25df47eb009cf0f URL: http://cgit.haiku-os.org/haiku/commit/?id=14b32de Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 13:00:54 2013 UTC People: some 64 bit fixes ---------------------------------------------------------------------------- diff --git a/src/apps/people/PersonView.cpp b/src/apps/people/PersonView.cpp index 9dc3165..656bef1 100644 --- a/src/apps/people/PersonView.cpp +++ b/src/apps/people/PersonView.cpp @@ -217,7 +217,7 @@ PersonView::BuildGroupMenu() if (file.InitCheck() == B_OK && file.GetAttrInfo(fCategoryAttribute, &info) == B_OK && info.size > 1) { - if (info.size > sizeof(buffer)) + if (info.size > (off_t)sizeof(buffer)) info.size = sizeof(buffer); if (file.ReadAttr(fCategoryAttribute.String(), B_STRING_TYPE, ############################################################################ Commit: 3e4cf3a1b815340796780eb8ae0e648b2d1a72f3 URL: http://cgit.haiku-os.org/haiku/commit/?id=3e4cf3a Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 13:04:32 2013 UTC PowerStatus: some 64 bit fixes ---------------------------------------------------------------------------- diff --git a/src/apps/powerstatus/PowerStatusView.cpp b/src/apps/powerstatus/PowerStatusView.cpp index 62ef64e..c7a6968 100644 --- a/src/apps/powerstatus/PowerStatusView.cpp +++ b/src/apps/powerstatus/PowerStatusView.cpp @@ -321,10 +321,11 @@ PowerStatusView::_SetLabel(char* buffer, size_t bufferLength) close = ")"; } - if (!fShowTime && fPercent >= 0) - snprintf(buffer, bufferLength, "%s%ld%%%s", open, fPercent, close); - else if (fShowTime && fTimeLeft >= 0) { - snprintf(buffer, bufferLength, "%s%ld:%02ld%s", + if (!fShowTime && fPercent >= 0) { + snprintf(buffer, bufferLength, "%s%" B_PRId32 "%%%s", open, fPercent, + close); + } else if (fShowTime && fTimeLeft >= 0) { + snprintf(buffer, bufferLength, "%s%" B_PRId32 ":%02" B_PRId32 "%s", open, fTimeLeft / 3600, (fTimeLeft / 60) % 60, close); } } @@ -372,11 +373,12 @@ PowerStatusView::Update(bool force) close = ")"; } if (fHasBattery) { - size_t length = snprintf(text, sizeof(text), "%s%ld%%%s", - open, fPercent, close); + size_t length = snprintf(text, sizeof(text), "%s%" B_PRId32 + "%%%s", open, fPercent, close); if (fTimeLeft) { length += snprintf(text + length, sizeof(text) - length, - "\n%ld:%02ld", fTimeLeft / 3600, (fTimeLeft / 60) % 60); + "\n%" B_PRId32 ":%02" B_PRId32, fTimeLeft / 3600, + (fTimeLeft / 60) % 60); } const char* state = NULL; ############################################################################ Commit: c0722add753912f2c678964522fd8bd81803f668 URL: http://cgit.haiku-os.org/haiku/commit/?id=c0722ad Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 13:11:09 2013 UTC TextSearch: some 64 bit fixes ---------------------------------------------------------------------------- diff --git a/src/apps/text_search/Grepper.cpp b/src/apps/text_search/Grepper.cpp index a20103e..00b6657 100644 --- a/src/apps/text_search/Grepper.cpp +++ b/src/apps/text_search/Grepper.cpp @@ -69,8 +69,8 @@ strdup_to_utf8(uint32 encode, const char* src, int32 length) char* dup = strdup(dst); delete[] dst; if (srcLen != length) { - fprintf(stderr, "strdup_to_utf8(%ld, %ld) dst allocate smalled(%ld)\n", - encode, length, dstLen); + fprintf(stderr, "strdup_to_utf8(%" B_PRId32 ", %" B_PRId32 + ") dst allocate smalled(%" B_PRId32 ")\n", encode, length, dstLen); } return dup; } @@ -91,8 +91,8 @@ strdup_from_utf8(uint32 encode, const char* src, int32 length) char* dup = strdup(dst); delete[] dst; if (srcLen != length) { - fprintf(stderr, "strdup_from_utf8(%ld, %ld) dst allocate " - "smalled(%ld)\n", encode, length, dstLen); + fprintf(stderr, "strdup_from_utf8(%" B_PRId32 ", %" B_PRId32 + ") dst allocate smalled(%" B_PRId32 ")\n", encode, length, dstLen); } return dup; } @@ -183,7 +183,7 @@ Grepper::_GrepperThread() char command[B_PATH_NAME_LENGTH + 32]; BPath tempFile; - sprintf(fileName, "/tmp/SearchText%ld", fThreadId); + sprintf(fileName, "/tmp/SearchText%" B_PRId32, fThreadId); tempFile.SetTo(fileName); while (!fMustQuit && fIterator->GetNextName(fileName)) { diff --git a/src/apps/text_search/Model.cpp b/src/apps/text_search/Model.cpp index d90d6e3..eb847a9 100644 --- a/src/apps/text_search/Model.cpp +++ b/src/apps/text_search/Model.cpp @@ -29,7 +29,7 @@ using std::nothrow; Model::Model() : fDirectory(), - fSelectedFiles(0UL), + fSelectedFiles((uint32)0), fRecurseDirs(true), fRecurseLinks(false), @@ -204,7 +204,7 @@ Model::AddToHistory(const char* text) } while (items.CountItems() >= HISTORY_LIMIT) - delete static_cast<BString*>(items.RemoveItem(0L)); + delete static_cast<BString*>(items.RemoveItem((int32)0)); _SaveHistory(items); _FreeHistory(items); ############################################################################ Commit: 2443899f1bb7acc04d59624c229afbf6870b24ca URL: http://cgit.haiku-os.org/haiku/commit/?id=2443899 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 13:12:35 2013 UTC WebWatch: some 64 bit fixes ---------------------------------------------------------------------------- diff --git a/src/apps/webwatch/WatchView.cpp b/src/apps/webwatch/WatchView.cpp index 3488bae..ad5f3b4 100644 --- a/src/apps/webwatch/WatchView.cpp +++ b/src/apps/webwatch/WatchView.cpp @@ -97,7 +97,7 @@ void WatchView::Draw(BRect updateRect) super::Draw(updateRect); char string[5]; - sprintf(string, "@%03ld", GetInternetTime()); + sprintf(string, "@%03" B_PRId32, GetInternetTime()); font_height height; // center the text horizontally GetFontHeight(&height); // and vertically in the Deskbar ############################################################################ Commit: a31ac990cc82daeccd7c8deb39e0c634643418fc URL: http://cgit.haiku-os.org/haiku/commit/?id=a31ac99 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 11:41:26 2013 UTC Diskprobe: some 64 bit fixes * also warnings about comparisons between signed and non signed. ---------------------------------------------------------------------------- diff --git a/src/apps/diskprobe/DataEditor.cpp b/src/apps/diskprobe/DataEditor.cpp index 2fd85a2..72701cf 100644 --- a/src/apps/diskprobe/DataEditor.cpp +++ b/src/apps/diskprobe/DataEditor.cpp @@ -236,8 +236,10 @@ void ReplaceChange::Apply(off_t bufferOffset, uint8 *buffer, size_t bufferSize) { // is it in our range? - if (fOffset > bufferOffset + bufferSize || fOffset + fSize < bufferOffset) + if (fOffset > (bufferOffset + (off_t)bufferSize) + || (fOffset + (off_t)fSize) < bufferOffset) { return; + } // don't change anything outside the supplied buffer off_t offset = fOffset; @@ -263,8 +265,10 @@ void ReplaceChange::Revert(off_t bufferOffset, uint8 *buffer, size_t bufferSize) { // is it in our range? - if (fOffset - bufferOffset > bufferSize || fOffset + fSize < bufferOffset) + if ((fOffset - bufferOffset) > (off_t)bufferSize + || (fOffset + (off_t)fSize) < bufferOffset) { return; + } // don't change anything outside the supplied buffer off_t offset = fOffset; @@ -307,8 +311,8 @@ ReplaceChange::Merge(DataChange *_change) // are the changes adjacent? - if (change->fOffset + change->fSize != fOffset - && fOffset + fSize != change->fOffset) + if ((change->fOffset + (off_t)change->fSize) != fOffset + && (fOffset + (off_t)fSize) != change->fOffset) return false; // okay, we can try to merge the two changes @@ -560,7 +564,7 @@ DataEditor::Replace(off_t offset, const uint8 *data, size_t length) if (offset >= fSize) return B_BAD_VALUE; - if (offset + length > fSize) + if ((offset + (off_t)length) > fSize) length = fSize - offset; if (fNeedsUpdate) { @@ -705,7 +709,7 @@ DataEditor::Save() // don't try to change the file size size_t size = fRealViewSize; - if (fRealViewOffset + fRealViewSize > fSize) + if ((fRealViewOffset + (off_t)fRealViewSize) > (off_t)fSize) size = fSize - fRealViewOffset; ssize_t bytesWritten; @@ -1125,7 +1129,7 @@ DataEditor::Find(off_t startPosition, const uint8 *data, size_t dataSize, } for (size_t i = firstByte; i < fRealViewSize; i++) { - if (position + i + dataSize > fSize) + if (position + (off_t)(i + dataSize) > (off_t)fSize) break; if (!compareFunc(fView + i, data, 1)) { diff --git a/src/apps/diskprobe/DataView.cpp b/src/apps/diskprobe/DataView.cpp index bd01742..5958943 100644 --- a/src/apps/diskprobe/DataView.cpp +++ b/src/apps/diskprobe/DataView.cpp @@ -163,19 +163,19 @@ DataView::UpdateFromEditor(BMessage *message) if (message != NULL && message->FindInt64("offset", &offset) == B_OK && message->FindInt64("size", &size) == B_OK) { - if (offset > fOffset + fDataSize - || offset + size < fOffset) { + if (offset > fOffset + (off_t)fDataSize + || offset + (off_t)size < fOffset) { // the changes are not within our scope, so we can ignore them return; } if (offset > fOffset) start = offset - fOffset; - if (offset + size < fOffset + fDataSize) + if (offset + (off_t)size < fOffset + (off_t)fDataSize) end = offset + size - fOffset; } - if (fOffset + fDataSize > fFileSize) + if (fOffset + (off_t)fDataSize > fFileSize) fSizeInView = fFileSize - fOffset; else fSizeInView = fDataSize; @@ -356,8 +356,8 @@ DataView::ConvertLine(char *line, off_t offset, const uint8 *buffer, size_t size return; } - line += sprintf(line, fBase == kHexBase ? "%0*Lx: " : "%0*Ld: ", - (int)fPositionLength, offset); + line += sprintf(line, fBase == kHexBase ? "%0*" B_PRIxOFF": " : "%0*" + B_PRIdOFF": ", (int)fPositionLength, offset); for (uint32 i = 0; i < kBlockSize; i++) { if (i >= size) { diff --git a/src/apps/diskprobe/ProbeView.cpp b/src/apps/diskprobe/ProbeView.cpp index 2aef09d..943889f 100644 --- a/src/apps/diskprobe/ProbeView.cpp +++ b/src/apps/diskprobe/ProbeView.cpp @@ -216,7 +216,7 @@ get_type_string(char *buffer, size_t bufferSize, type_code type) for (int32 i = 0; i < 4; i++) { buffer[i] = type >> (24 - 8 * i); if (buffer[i] < ' ' || buffer[i] == 0x7f) { - snprintf(buffer, bufferSize, "0x%04lx", type); + snprintf(buffer, bufferSize, "0x%04" B_PRIx32, type); break; } else if (i == 3) buffer[4] = '\0'; @@ -705,7 +705,8 @@ HeaderView::UpdateIcon() void HeaderView::FormatValue(char *buffer, size_t bufferSize, off_t value) { - snprintf(buffer, bufferSize, fBase == kHexBase ? "0x%Lx" : "%Ld", value); + snprintf(buffer, bufferSize, fBase == kHexBase ? "0x%" B_PRIxOFF : "%" + B_PRIdOFF, value); } @@ -1550,7 +1551,7 @@ ProbeView::AttachedToWindow() const uint32 blockSizes[] = {512, 1024, 2048}; for (uint32 i = 0; i < sizeof(blockSizes) / sizeof(blockSizes[0]); i++) { char buffer[32]; - snprintf(buffer, sizeof(buffer), "%ld%s", blockSizes[i], + snprintf(buffer, sizeof(buffer), "%" B_PRId32 "%s", blockSizes[i], fEditor.IsDevice() && fEditor.BlockSize() == blockSizes[i] ? B_TRANSLATE(" (native)") : ""); subMenu->AddItem(item = new BMenuItem(buffer, @@ -1582,7 +1583,7 @@ ProbeView::AttachedToWindow() fontSize = 0; for (uint32 i = 0; i < sizeof(fontSizes) / sizeof(fontSizes[0]); i++) { char buffer[16]; - snprintf(buffer, sizeof(buffer), "%ld", fontSizes[i]); + snprintf(buffer, sizeof(buffer), "%" B_PRId32, fontSizes[i]); subMenu->AddItem(item = new BMenuItem(buffer, message = new BMessage(kMsgFontSize))); message->AddFloat("font_size", fontSizes[i]); @@ -1653,23 +1654,30 @@ ProbeView::_UpdateSelectionMenuItems(int64 start, int64 end) // update menu items char buffer[128]; - if (fDataView->Base() == kHexBase) - snprintf(buffer, sizeof(buffer), B_TRANSLATE("Native: 0x%0*Lx"), size * 2, position); - else - snprintf(buffer, sizeof(buffer), B_TRANSLATE("Native: %Ld (0x%0*Lx)"), position, size * 2, position); + if (fDataView->Base() == kHexBase) { + snprintf(buffer, sizeof(buffer), B_TRANSLATE("Native: 0x%0*Lx"), + size * 2, position); + } else { + snprintf(buffer, sizeof(buffer), B_TRANSLATE("Native: %Ld (0x%0*Lx)"), + position, size * 2, position); + } fNativeMenuItem->SetLabel(buffer); - fNativeMenuItem->SetEnabled(position >= 0 && (position * fEditor.BlockSize()) < fEditor.FileSize()); + fNativeMenuItem->SetEnabled(position >= 0 + && (off_t)(position * fEditor.BlockSize()) < fEditor.FileSize()); fNativeMenuItem->Message()->ReplaceInt64("block", position); position = B_SWAP_INT64(position) >> (8 * (8 - size)); - if (fDataView->Base() == kHexBase) - snprintf(buffer, sizeof(buffer), B_TRANSLATE("Swapped: 0x%0*Lx"), size * 2, position); - else - snprintf(buffer, sizeof(buffer), B_TRANSLATE("Swapped: %Ld (0x%0*Lx)"), position, size * 2, position); + if (fDataView->Base() == kHexBase) { + snprintf(buffer, sizeof(buffer), B_TRANSLATE("Swapped: 0x%0*Lx"), + size * 2, position); + } else { + snprintf(buffer, sizeof(buffer), B_TRANSLATE("Swapped: %Ld (0x%0*Lx)"), + position, size * 2, position); + } fSwappedMenuItem->SetLabel(buffer); - fSwappedMenuItem->SetEnabled(position >= 0 && (position * fEditor.BlockSize()) < fEditor.FileSize()); + fSwappedMenuItem->SetEnabled(position >= 0 && (off_t)(position * fEditor.BlockSize()) < fEditor.FileSize()); fSwappedMenuItem->Message()->ReplaceInt64("block", position); } diff --git a/src/apps/diskprobe/TypeEditors.cpp b/src/apps/diskprobe/TypeEditors.cpp index 2183ff8..39bfbf8 100644 --- a/src/apps/diskprobe/TypeEditors.cpp +++ b/src/apps/diskprobe/TypeEditors.cpp @@ -226,7 +226,7 @@ StringEditor::_UpdateText() size_t viewSize = fEditor.ViewSize(); // that may need some more memory... - if (viewSize < fEditor.FileSize()) + if ((off_t)viewSize < fEditor.FileSize()) fEditor.SetViewSize(fEditor.FileSize()); const char *buffer; @@ -486,7 +486,7 @@ NumberEditor::_UpdateText() bool NumberEditor::TypeMatches() { - return fEditor.FileSize() >= _Size(); + return fEditor.FileSize() >= (off_t)_Size(); // we only look at as many bytes we need to } @@ -949,7 +949,7 @@ ImageView::_UpdateImage() size_t viewSize = fEditor.ViewSize(); // that may need some more memory... - if (viewSize < fEditor.FileSize()) + if ((off_t)viewSize < fEditor.FileSize()) fEditor.SetViewSize(fEditor.FileSize()); const char *data; @@ -1169,7 +1169,7 @@ MessageView::_TypeToString(type_code type) for (int32 i = 0; i < 4; i++) { text[i] = type >> (24 - 8 * i); if (text[i] < ' ' || text[i] == 0x7f) { - snprintf(text, sizeof(text), "0x%04lx", type); + snprintf(text, sizeof(text), "0x%04" B_PRIx32, type); break; } else if (i == 3) text[4] = '\0'; @@ -1226,16 +1226,16 @@ MessageView::SetTo(BMessage& message) switch (type) { case B_INT64_TYPE: - snprintf(text, sizeof(text), "%Ld", *(int64*)data); + snprintf(text, sizeof(text), "%" B_PRId64, *(int64*)data); break; case B_UINT64_TYPE: - snprintf(text, sizeof(text), "%Lu", *(uint64*)data); + snprintf(text, sizeof(text), "%" B_PRIu64, *(uint64*)data); break; case B_INT32_TYPE: - snprintf(text, sizeof(text), "%ld", *(int32*)data); + snprintf(text, sizeof(text), "%" B_PRId32, *(int32*)data); break; case B_UINT32_TYPE: - snprintf(text, sizeof(text), "%lu", *(uint32*)data); + snprintf(text, sizeof(text), "%" B_PRIu32, *(uint32*)data); break; case B_BOOL_TYPE: if (*(uint8*)data) @@ -1255,7 +1255,7 @@ MessageView::SetTo(BMessage& message) fTextView->Insert("\t\t"); if (count > 1) { char index[16]; - snprintf(index, sizeof(index), "%ld.\t", j); + snprintf(index, sizeof(index), "%" B_PRId32 ".\t", j); fTextView->Insert(index); } fTextView->Insert(text); @@ -1273,7 +1273,7 @@ MessageView::_UpdateMessage() size_t viewSize = fEditor.ViewSize(); // that may need some more memory... - if (viewSize < fEditor.FileSize()) + if ((off_t)viewSize < fEditor.FileSize()) fEditor.SetViewSize(fEditor.FileSize()); const char *buffer; ############################################################################ Revision: hrev45618 Commit: 62e60219cc0e6ca897d70524dddf3cbee49a29dc URL: http://cgit.haiku-os.org/haiku/commit/?id=62e6021 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Sat May 4 13:28:36 2013 UTC ShowImage: initialize rgb_color.alpha field. ---------------------------------------------------------------------------- diff --git a/src/apps/showimage/Filter.cpp b/src/apps/showimage/Filter.cpp index 6c5769a..c8e7fc7 100644 --- a/src/apps/showimage/Filter.cpp +++ b/src/apps/showimage/Filter.cpp @@ -829,6 +829,7 @@ Scaler::Dither(int32 fromRow, int32 toRow) color.red = Limit(srcData[2] + error[0] / 16); color.green = Limit(srcData[1] + error[1] / 16); color.blue = Limit(srcData[0] + error[2] / 16); + color.alpha = UINT8_MAX; index = screen.IndexForColor(color); actualColor = screen.ColorForIndex(index); @@ -879,6 +880,7 @@ Scaler::Dither(int32 fromRow, int32 toRow) color.red = Limit(srcData[2] + error[0] / 16); color.green = Limit(srcData[1] + error[1] / 16); color.blue = Limit(srcData[0] + error[2] / 16); + color.alpha = UINT8_MAX; index = screen.IndexForColor(color); actualColor = screen.ColorForIndex(index);