[haiku-commits] haiku: hrev49419 - src/bin

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 19 Jul 2015 16:43:54 +0200 (CEST)

hrev49419 adds 7 changesets to branch 'master'
old head: 93407f0c870981d98a4dafbc16ef5e25b01c52a7
new head: d52bb3081c38f29a6d962260a7f3200923ad58a2
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=d52bb3081c38+%5E93407f0c8709

----------------------------------------------------------------------------

deb9fbcb851f: bin/df: Fix format strings through B_PRI macros

f783542c1bbf: bin/diskimage: Fix format strings through B_PRI macros

ec4e0aea7636: bin/driveinfo: Fix format strings through B_PRI macros

3f06c69ed414: bin/fstrim: Fix format strings through B_PRI macros

46e1214196b1: bin/hd: Fix format strings through B_PRI macros

0469da76ba87: bin/iroster: Fix format strings through B_PRI macros

d52bb3081c38: bin/fdinfo: Fix format strings through B_PRI macros

[ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

7 files changed, 53 insertions(+), 46 deletions(-)
src/bin/df.cpp | 24 ++++++++++++++----------
src/bin/diskimage.cpp | 27 +++++++++++++++------------
src/bin/driveinfo.c | 20 ++++++++++----------
src/bin/fdinfo.cpp | 20 ++++++++++----------
src/bin/fstrim.cpp | 2 +-
src/bin/hd.c | 2 +-
src/bin/iroster.cpp | 4 ++--

############################################################################

Commit: deb9fbcb851f7091b35ff911f736a704c40cfe23
URL: http://cgit.haiku-os.org/haiku/commit/?id=deb9fbcb851f
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Sun Jul 19 14:12:19 2015 UTC

bin/df: Fix format strings through B_PRI macros

----------------------------------------------------------------------------

diff --git a/src/bin/df.cpp b/src/bin/df.cpp
index 8d48183..efb6e55 100644
--- a/src/bin/df.cpp
+++ b/src/bin/df.cpp
@@ -69,7 +69,7 @@ ByteString(int64 numBlocks, int64 blockSize)
static char string[64];

if (blocks < 1024)
- sprintf(string, "%Ld", numBlocks * blockSize);
+ sprintf(string, "%" B_PRId64, numBlocks * blockSize);
else {
const char *units[] = {"K", "M", "G", NULL};
int32 i = -1;
@@ -92,7 +92,7 @@ PrintBlocks(int64 blocks, int64 blockSize, bool showBlocks)
char temp[1024];

if (showBlocks)
- sprintf(temp, "%Ld", blocks * (blockSize / 1024));
+ sprintf(temp, "%" B_PRId64, blocks * (blockSize / 1024));
else
strcpy(temp, ByteString(blocks, blockSize));

@@ -109,7 +109,7 @@ PrintVerbose(dev_t device)
return;
}

- printf(" Device No.: %ld\n", info.dev);
+ printf(" Device No.: %" B_PRIdDEV "\n", info.dev);
PrintMountPoint(info.dev, true);
printf(" Volume Name: \"%s\"\n", info.volume_name);
printf(" File System: %s\n", info.fsh_name);
@@ -124,13 +124,17 @@ PrintVerbose(dev_t device)
PrintFlag(info.flags, B_FS_IS_REMOVABLE, "R", "-");
PrintFlag(info.flags, B_FS_IS_READONLY, "-", "W");

- printf("\n I/O Size: %10s (%Ld byte)\n", ByteString(info.io_size,
1), info.io_size);
- printf(" Block Size: %10s (%Ld byte)\n", ByteString(info.block_size,
1), info.block_size);
- printf(" Total Blocks: %10s (%Ld blocks)\n",
ByteString(info.total_blocks, info.block_size), info.total_blocks);
- printf(" Free Blocks: %10s (%Ld blocks)\n",
ByteString(info.free_blocks, info.block_size), info.free_blocks);
- printf(" Total Nodes: %Ld\n", info.total_nodes);
- printf(" Free Nodes: %Ld\n", info.free_nodes);
- printf(" Root Inode: %Ld\n", info.root);
+ printf("\n I/O Size: %10s (%" B_PRIdOFF " byte)\n",
+ ByteString(info.io_size, 1), info.io_size);
+ printf(" Block Size: %10s (%" B_PRIdOFF " byte)\n",
+ ByteString(info.block_size, 1), info.block_size);
+ printf(" Total Blocks: %10s (%" B_PRIdOFF " blocks)\n",
+ ByteString(info.total_blocks, info.block_size),
info.total_blocks);
+ printf(" Free Blocks: %10s (%" B_PRIdOFF " blocks)\n",
+ ByteString(info.free_blocks, info.block_size),
info.free_blocks);
+ printf(" Total Nodes: %" B_PRIdOFF "\n", info.total_nodes);
+ printf(" Free Nodes: %" B_PRIdOFF "\n", info.free_nodes);
+ printf(" Root Inode: %" B_PRIdINO "\n", info.root);
}



############################################################################

Commit: f783542c1bbf572c15b42f1b87b26c91a38fa0eb
URL: http://cgit.haiku-os.org/haiku/commit/?id=f783542c1bbf
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Sun Jul 19 14:19:11 2015 UTC

bin/diskimage: Fix format strings through B_PRI macros

----------------------------------------------------------------------------

diff --git a/src/bin/diskimage.cpp b/src/bin/diskimage.cpp
index 2fc4582..85033d0 100644
--- a/src/bin/diskimage.cpp
+++ b/src/bin/diskimage.cpp
@@ -57,7 +57,7 @@ list_file_disk_devices()
continue;

// ID
- printf("%6ld ", device.ID());
+ printf("%6" B_PRId32 " ", device.ID());

// file path
BPath path;
@@ -104,11 +104,11 @@ register_file_disk_device(const char* fileName)
BPath path;
if (roster.GetDeviceWithID(id, &device) == B_OK
&& device.GetPath(&path) == B_OK) {
- printf("Registered file as disk device \"%s\" with ID %ld.\n",
+ printf("Registered file as disk device \"%s\" with ID %"
B_PRId32 ".\n",
path.Path(), id);
} else {
- printf("Registered file as disk device with ID %ld, but failed
to "
- "get the device path.\n", id);
+ printf("Registered file as disk device with ID %" B_PRId32 ", "
+ "but failed to get the device path.\n", id);
}

return B_OK;
@@ -128,15 +128,16 @@ unregister_file_disk_device(const char* fileNameOrID)
status_t error = roster.UnregisterFileDevice(id);
if (error != B_OK) {
fprintf(stderr, "Error: Failed to unregister
file disk device "
- "with ID %ld: %s\n", id,
strerror(error));
+ "with ID %" B_PRId32 ": %s\n", id,
strerror(error));
return error;
}

- printf("Unregistered file disk device with ID %ld.\n",
id);
+ printf("Unregistered file disk device with ID %"
B_PRId32 ".\n",
+ id);
return B_OK;
} else {
- fprintf(stderr, "No file disk device with ID %ld,
trying file "
- "\"%s\"\n", id, fileNameOrID);
+ fprintf(stderr, "No file disk device with ID %"
B_PRId32 ","
+ "trying file \"%s\"\n", id, fileNameOrID);
}
}

@@ -172,13 +173,15 @@ unregister_file_disk_device(const char* fileNameOrID)
status_t error =
roster.UnregisterFileDevice(device.ID());
if (error != B_OK) {
fprintf(stderr, "Error: Failed to unregister
file disk device"
- "%s \"%s\" (ID: %ld): %s\n", isFilePath
? " for file" : "",
- fileNameOrID, device.ID(),
strerror(error));
+ "%s \"%s\" (ID: %" B_PRId32 "): %s\n",
+ isFilePath ? " for file" : "",
fileNameOrID, device.ID(),
+ strerror(error));
return error;
}

- printf("Unregistered file disk device%s \"%s\" (ID:
%ld)\n",
- isFilePath ? " for file" : "", fileNameOrID,
device.ID());
+ printf("Unregistered file disk device%s \"%s\" "
+ "(ID: %" B_PRId32 ")\n", isFilePath ? " for
file" : "",
+ fileNameOrID, device.ID());

return B_OK;
}

############################################################################

Commit: ec4e0aea7636a59a96d1fb9b8dcb46a31ae8580d
URL: http://cgit.haiku-os.org/haiku/commit/?id=ec4e0aea7636
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Sun Jul 19 14:23:54 2015 UTC

bin/driveinfo: Fix format strings through B_PRI macros

----------------------------------------------------------------------------

diff --git a/src/bin/driveinfo.c b/src/bin/driveinfo.c
index 84a2a02..eca37eb 100644
--- a/src/bin/driveinfo.c
+++ b/src/bin/driveinfo.c
@@ -12,7 +12,7 @@ static void dump_dev_size(int dev)
perror("ioctl(B_GET_DEVICE_SIZE)");
return;
}
- printf("size: %ld bytes\n", sz);
+ printf("size: %" B_PRIuSIZE " bytes\n", sz);
}

static void dump_bios_id(int dev)
@@ -59,10 +59,10 @@ static void dump_geom(int dev, bool bios)
return;
}
printf("%sgeometry:\n", bios?"bios ":"");
- printf("bytes_per_sector:\t%ld\n", geom.bytes_per_sector);
- printf("sectors_per_track:\t%ld\n", geom.sectors_per_track);
- printf("cylinder_count:\t%ld\n", geom.cylinder_count);
- printf("head_count:\t%ld\n", geom.head_count);
+ printf("bytes_per_sector:\t%" B_PRIu32 "\n", geom.bytes_per_sector);
+ printf("sectors_per_track:\t%" B_PRIu32 "\n", geom.sectors_per_track);
+ printf("cylinder_count:\t%" B_PRIu32 "\n", geom.cylinder_count);
+ printf("head_count:\t%" B_PRIu32 "\n", geom.head_count);
printf("device_type:\t%d, %s\n", geom.device_type,
device_type(geom.device_type));
printf("%sremovable.\n", geom.removable?"":"not ");
printf("%sread_only.\n", geom.read_only?"":"not ");
@@ -78,11 +78,11 @@ static void dump_partition(int dev)
return;
}
printf("partition:\n");
- printf("offset:\t%lld\n", partition.offset);
- printf("size:\t%lld\n", partition.size);
- printf("logical_block_size:\t%ld\n", partition.logical_block_size);
- printf("session:\t%ld\n", partition.session);
- printf("partition:\t%ld\n", partition.partition);
+ printf("offset:\t%" B_PRIdOFF "\n", partition.offset);
+ printf("size:\t%" B_PRIdOFF "\n", partition.size);
+ printf("logical_block_size:\t%" B_PRId32 "\n",
partition.logical_block_size);
+ printf("session:\t%" B_PRId32 "\n", partition.session);
+ printf("partition:\t%" B_PRId32 "\n", partition.partition);
printf("device:\t%s\n", partition.device);
}


############################################################################

Commit: 3f06c69ed4140fe54301717d09f3bf751eff1d8f
URL: http://cgit.haiku-os.org/haiku/commit/?id=3f06c69ed414
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Sun Jul 19 14:25:41 2015 UTC

bin/fstrim: Fix format strings through B_PRI macros

----------------------------------------------------------------------------

diff --git a/src/bin/fstrim.cpp b/src/bin/fstrim.cpp
index cc0b47f..b09cd41 100644
--- a/src/bin/fstrim.cpp
+++ b/src/bin/fstrim.cpp
@@ -77,6 +77,6 @@ main(int argc, char** argv)
return EXIT_FAILURE;
}

- printf("Trimmed %lld bytes from device.\n", trimData.trimmed_size);
+ printf("Trimmed %" B_PRIu64 " bytes from device.\n",
trimData.trimmed_size);
return EXIT_SUCCESS;
}

############################################################################

Commit: 46e1214196b111c44b011889315edd014804c8ec
URL: http://cgit.haiku-os.org/haiku/commit/?id=46e1214196b1
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Sun Jul 19 14:31:03 2015 UTC

bin/hd: Fix format strings through B_PRI macros

----------------------------------------------------------------------------

diff --git a/src/bin/hd.c b/src/bin/hd.c
index b8b74d7..cce6ed8 100644
--- a/src/bin/hd.c
+++ b/src/bin/hd.c
@@ -138,7 +138,7 @@ dump_file(FILE *fp)
void
display(uint32 offset, uint8 *data)
{
- printf("%08lx ", offset);
+ printf("%08" B_PRIx32 " ", offset);
printf(" %s ", hexbytes(data));
printf("%16s ", printable(data));


############################################################################

Commit: 0469da76ba871c930f81ff7e92b2772e7a359db4
URL: http://cgit.haiku-os.org/haiku/commit/?id=0469da76ba87
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Sun Jul 19 14:31:22 2015 UTC

bin/iroster: Fix format strings through B_PRI macros

----------------------------------------------------------------------------

diff --git a/src/bin/iroster.cpp b/src/bin/iroster.cpp
index 53d7cdf..023e9a8 100644
--- a/src/bin/iroster.cpp
+++ b/src/bin/iroster.cpp
@@ -52,7 +52,7 @@ static void start_device(const char *name)
printf("Error finding device \"%s\"\n", name);
}
else if ((status = device->Start()) != B_OK) {
- printf("Error starting device \"%s\" (%ld)\n", name, status);
+ printf("Error starting device \"%s\" (%" B_PRId32 ")\n", name,
status);
}
else {
printf("Started device \"%s\"\n", name);
@@ -71,7 +71,7 @@ static void stop_device(const char *name)
printf("Error finding device \"%s\"\n", name);
}
else if ((status = device->Stop()) != B_OK) {
- printf("Error stopping device \"%s\" (%ld)\n", name, status);
+ printf("Error stopping device \"%s\" (%" B_PRId32 ")\n", name,
status);
}
else {
printf("Stopped device \"%s\"\n", name);

############################################################################

Revision: hrev49419
Commit: d52bb3081c38f29a6d962260a7f3200923ad58a2
URL: http://cgit.haiku-os.org/haiku/commit/?id=d52bb3081c38
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Sun Jul 19 14:43:17 2015 UTC

bin/fdinfo: Fix format strings through B_PRI macros

----------------------------------------------------------------------------

diff --git a/src/bin/fdinfo.cpp b/src/bin/fdinfo.cpp
index 2ac12e0..3d4e8ac 100644
--- a/src/bin/fdinfo.cpp
+++ b/src/bin/fdinfo.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2006, Haiku, Inc.
+ * Copyright 2006-2015, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Author:
@@ -46,14 +46,14 @@ open_mode_to_string(int openMode)
void
print_fds(team_info &teamInfo)
{
- printf("Team: (%ld) %s\n", teamInfo.team, teamInfo.args);
+ printf("Team: (%" B_PRId32 ") %s\n", teamInfo.team, teamInfo.args);

uint32 cookie = 0;
fd_info info;

while (_kern_get_next_fd_info(teamInfo.team, &cookie, &info,
sizeof(fd_info)) == B_OK) {
- printf("%5d %s %ld:%Ld\n", info.number,
open_mode_to_string(info.open_mode),
- info.device, info.node);
+ printf("%5d %s %" B_PRIdDEV ":%" B_PRIdINO "\n", info.number,
+ open_mode_to_string(info.open_mode), info.device,
info.node);
}
}

@@ -69,13 +69,13 @@ filter_device(team_info &teamInfo, dev_t device, bool brief)
continue;

if (brief) {
- printf("%5ld %s\n", teamInfo.team, teamInfo.args);
+ printf("%5" B_PRId32 " %s\n", teamInfo.team,
teamInfo.args);
break;
}

- printf("%5ld %3d %3s %ld:%Ld %s\n", teamInfo.team,
info.number,
- open_mode_to_string(info.open_mode), info.device,
info.node,
- teamInfo.args);
+ printf("%5" B_PRId32 " %3d %3s %" B_PRIdDEV ":%" B_PRIdINO "
%s\n",
+ teamInfo.team, info.number,
open_mode_to_string(info.open_mode),
+ info.device, info.node, teamInfo.args);
}
}

@@ -91,11 +91,11 @@ filter_file(team_info &teamInfo, dev_t device, ino_t node,
bool brief)
continue;

if (brief) {
- printf("%5ld %s\n", teamInfo.team, teamInfo.args);
+ printf("%5" B_PRId32 " %s\n", teamInfo.team,
teamInfo.args);
break;
}

- printf("%5ld %3d %3s %s\n", teamInfo.team, info.number,
+ printf("%5" B_PRId32 " %3d %3s %s\n", teamInfo.team,
info.number,
open_mode_to_string(info.open_mode), teamInfo.args);
}
}


Other related posts:

  • » [haiku-commits] haiku: hrev49419 - src/bin - kallisti5