Summary: Fix a lot of warnings in apps (merge from fixes-branch)

Keywords:

Patches applied:

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--base-0
   tag of n.reedijk@planet.nl--openbeos-2004/bin-applications--mainline--0.1--base-0

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-1
   Fix warning

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-2
   Fix warning in roster.cpp

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-3
   Fix warning in clipboard.cpp

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-4
   Fix warning in shutdown.cpp (trivial)

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-5
   Fix warnings in chop.c (trivial)

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-6
   Trivial warning fix in eject.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-7
   Trivial warning fix in hd.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-8
   Trivial warning fixes in listarea.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-9
   TRIVIAL: Fix warning in listimage.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-10
   TRIVIAL warning fix in listport.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-11
   TRIVIAL fix in listsem.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-12
   TRIVIAL fix in mount.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-13
   Trivial fix in prio.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-14
   TRIVIAL changes in ps.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-15
   TRIVIAL fix in renice.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-16
   TRIVIAL fix for rescan

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-17
   TRIVIAL fix in sysinfo.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-18
   TRIVIAL fix in unchop.c

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-19
   TRIVIAL fix in chkbfs

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-20
   TRIVIAL fixes for listdev

 * n.reedijk@planet.nl--nielx-2003/bin-applications--fixes--0.1--patch-21
   TRIVIAL fixes in pc


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5557 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Niels Sascha Reedijk 2003-12-03 20:02:15 +00:00
parent 859c1f0198
commit b9a05f7f4c
21 changed files with 66 additions and 53 deletions

View File

@ -27,7 +27,7 @@ openDevice(const char *name)
fs_info info;
if (fs_stat_dev(volume, &info) < B_OK) {
fprintf(stderr, "%s: could not stat device: %s\n", gProgramName, name, errno);
fprintf(stderr, "%s: could not stat device: %s: %s\n", gProgramName, name, strerror(errno));
return errno;
}
@ -212,7 +212,7 @@ main(int argc, char **argv)
}
// print stats
printf("checked %ld nodes, %Ld blocks not allocated, %Ld blocks already set, %Ld blocks could be freed\n",
printf("checked %Ld nodes, %Ld blocks not allocated, %Ld blocks already set, %Ld blocks could be freed\n",
nodes, control.stats.missing, control.stats.already_set, control.stats.freed);
printf("\tfiles\t\t%Ld\n\tdirectories\t%Ld\n\tattributes\t%Ld\n\tattr. dirs\t%Ld\n\tindices\t\t%Ld\n",
files, directories, attributes, attributeDirectories, indices);

View File

@ -40,6 +40,8 @@
#include <OS.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@ -180,13 +182,13 @@ chop_file(int fdin, char *fname, off_t fsize)
bool open_next_file = true; // when to open a new output file
char fnameN[256]; // name of the current output file (file01, file02, etc.)
int index = 0; // used to generate the next output file name
int fdout; // output file descriptor
int fdout = -1; // output file descriptor
ssize_t got; // size of the current data block -- i.e. from the last read()
ssize_t put; // number of bytes just written -- i.e. from the last write()
ssize_t needed; // how many bytes we can safely write to the current output file
ssize_t avail; // how many bytes we can safely grab from the current data block
off_t curr_written; // number of bytes written to the current output file
off_t curr_written = 0; // number of bytes written to the current output file
off_t total_written = 0; // total bytes written out to all output files
char *beg = Block; // pointer to the beginning of the block data to be written out

View File

@ -158,6 +158,9 @@ int main( int argc, char **argv )
case Arguments::READ:
Clipboard::Read( argv[2] );
break;
default: //Shouldn't happen
Status::Code = B_BAD_VALUE;
break;
}
}
}

View File

@ -205,14 +205,14 @@ void PrintBlocks (int64 blocks, int64 blocksize, bool human)
} else {
double fblocks = ((double)blocks) * (blocksize / 1024);
if (fblocks < 1024) {
sprintf(temp, "%.1LfK", fblocks);
sprintf(temp, "%.1fK", fblocks);
} else {
fblocks = (((double)blocks) / 1024) * (blocksize / 1024);;
if (fblocks < 1024) {
sprintf(temp, "%.1LfM", fblocks);
sprintf(temp, "%.1fM", fblocks);
} else {
fblocks = (((double)blocks) / (1024*1024)) * (blocksize / 1024);
sprintf(temp, "%.1LfG", fblocks);
sprintf(temp, "%.1fG", fblocks);
}
}
}

View File

@ -19,7 +19,7 @@
#include <unistd.h>
#include <Drivers.h>
int usage(char *prog)
static int usage(char *prog)
{
printf("usage: eject [-q|-l|-s] /dev/disk/.../raw\n");
printf(" eject the device, or:\n");

View File

@ -14,6 +14,8 @@
#include <OS.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/stat.h>
@ -136,7 +138,7 @@ dump_file(FILE *fp)
void
display(uint32 offset, uint8 *data)
{
printf("%08x ", offset);
printf("%08lx ", offset);
printf(" %s ", hexbytes(data));
printf("%16s ", printable(data));

View File

@ -5,6 +5,7 @@
#include <drivers/config_manager.h>
#include "cm_wrapper.h"
#include "config_driver.h"
static int fd;

View File

@ -8,6 +8,7 @@
#include <drivers/module.h>
#include <drivers/PCI.h>
#include "cm_wrapper.h"
#include "config_driver.h"
#define NEXT_POSSIBLE(c) \
@ -64,7 +65,7 @@ dump_device_configuration(struct device_configuration *c)
for (i=0;i<num;i++) {
get_nth_resource_descriptor_of_type(c, i, B_IO_PORT_RESOURCE,
&r, sizeof(resource_descriptor));
printf("\n io range: min %x max %x align %x len %x",
printf("\n io range: min %lx max %lx align %lx len %lx",
r.d.r.minbase, r.d.r.maxbase,
r.d.r.basealign, r.d.r.len);
}
@ -75,7 +76,7 @@ dump_device_configuration(struct device_configuration *c)
for (i=0;i<num;i++) {
get_nth_resource_descriptor_of_type(c, i, B_MEMORY_RESOURCE,
&r, sizeof(resource_descriptor));
printf("\n mem range: min %x max %x align %x len %x",
printf("\n mem range: min %lx max %lx align %lx len %lx",
r.d.r.minbase, r.d.r.maxbase,
r.d.r.basealign, r.d.r.len);
}
@ -156,7 +157,7 @@ static void
dump_device_info(struct device_info *info, struct device_configuration *current,
struct possible_device_configurations *possible)
{
int i;
unsigned int i;
struct device_configuration *config;
printf((info->devtype.base < 13) ? base_desc[info->devtype.base] : "Unknown");
@ -183,7 +184,7 @@ dump_device_info(struct device_info *info, struct device_configuration *current,
printf("Currently unconfigured.\n");
}
printf("%x configurations\n", possible->num_possible);
printf("%lx configurations\n", possible->num_possible);
config = possible->possible + 0;
for (i=0;i<possible->num_possible;i++) {
printf("\nPossible configuration #%d: ", i);

View File

@ -51,16 +51,16 @@ list_image_info(team_id id)
status = get_team_info(id, &teamInfo);
if (status < B_OK) {
printf("\nCould not retrieve information about team %ld: \n", id, strerror(status));
printf("\nCould not retrieve information about team %ld: %s\n", id, strerror(status));
return;
}
printf("\nTEAM %4d (%s):\n", id, teamInfo.args);
printf("\nTEAM %4ld (%s):\n", id, teamInfo.args);
printf(" ID name text data seq# init#\n");
printf("--------------------------------------------------------------------------------------------------------\n");
while ((status = get_next_image_info(id, &cookie, &imageInfo)) == B_OK) {
printf("%5d %64s %.8x %.8x %4d %10u\n",
printf("%5ld %64s %p %p %4ld %10lu\n",
imageInfo.id,
imageInfo.name,
imageInfo.text,

View File

@ -57,7 +57,7 @@ show_port_totals()
left = max - used;
printf("port: total: %5d, used: %5d, left: %5d\n", max, used, left);
printf("port: total: %5ld, used: %5ld, left: %5ld\n", max, used, left);
}
@ -69,16 +69,16 @@ list_team_ports(team_id id)
team_info this_team;
if (get_team_info(id, &this_team) == B_BAD_TEAM_ID) {
printf("\nteam %d unknown\n", id);
printf("\nteam %ld unknown\n", id);
return;
}
printf("\nTEAM %4d (%s):\n", id, this_team.args);
printf("\nTEAM %4ld (%s):\n", id, this_team.args);
printf(" ID name capacity queued\n");
printf("----------------------------------------------------\n");
while (get_next_port_info(id, &cookie, &this_port) == B_OK) {
printf("%5d %28s %8d %6d\n",
printf("%5ld %28s %8ld %6ld\n",
this_port.port,
this_port.name,
this_port.capacity,

View File

@ -32,20 +32,21 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <OS.h>
void list_sems(team_info *tinfo)
static void list_sems(team_info *tinfo)
{
sem_info info;
int32 cookie = 0;
printf("TEAM %d (%s):\n", tinfo->team, tinfo->args );
printf("TEAM %ld (%s):\n", tinfo->team, tinfo->args );
printf(" ID name count\n");
printf("---------------------------------------------\n");
while (get_next_sem_info(tinfo->team, &cookie, &info) == B_OK)
{
printf("%7d%31s%7d\n", info.sem ,info.name , info.count );
printf("%7ld%31s%7ld\n", info.sem ,info.name , info.count );
}
printf("\n");
}
@ -59,7 +60,7 @@ int main(int argc, char **argv)
// show up some stats first...
get_system_info(&sysinfo);
printf("sem: total: %5i, used: %5i, left: %5i\n\n", sysinfo.max_sems, sysinfo.used_sems, sysinfo.max_sems - sysinfo.used_sems);
printf("sem: total: %5li, used: %5li, left: %5li\n\n", sysinfo.max_sems, sysinfo.used_sems, sysinfo.max_sems - sysinfo.used_sems);
if (argc == 1) {
while (get_next_team_info( &cook, &tinfo) == B_OK)

View File

@ -17,7 +17,7 @@
#include <errno.h>
void
static void
usage(const char *programName)
{

View File

@ -173,7 +173,7 @@ int (*set_var_lookup_hook(int (*func)(char *name, ULONG *val)))
ULONG last_result = 0;
int
static int
special_vars(char *name, ULONG *val)
{
if (strcmp(name, "time") == 0)
@ -213,7 +213,7 @@ main(int argc, char *argv[])
casting and comparisons we can determine if a value
will fit in a 32 bit quantity and only print that.
*/
void
static void
print_result(ULONG value)
{
int i;
@ -253,7 +253,7 @@ void
parse_args(int argc, char *argv[])
{
int i, len;
char *buff, *fmt_str;
char *buff;
ULONG value;
for(i=1, len=0; i < argc; i++)
@ -279,7 +279,6 @@ parse_args(int argc, char *argv[])
void
do_input(void)
{
int ret;
ULONG value;
char buff[256], *ptr;
@ -331,8 +330,8 @@ parse_expression(char *str)
ULONG
assignment_expr(char **str)
{
ULONG val, sum = 0;
char op, *orig_str;
ULONG val;
char *orig_str;
char *var_name;
variable *v;
@ -838,7 +837,7 @@ get_value(char **str)
if (**str == SINGLE_QUOTE) /* a character constant */
{
int i;
unsigned int i;
*str = *str + 1; /* advance over the leading quote */
val = 0;
@ -854,7 +853,7 @@ get_value(char **str)
if (**str != SINGLE_QUOTE) /* constant must have been too long */
{
fprintf(stderr, "Warning: character constant not terminated or too "
"long (max len == %d bytes)\n", sizeof(LONG));
"long (max len == %ld bytes)\n", sizeof(LONG));
while(**str && **str != SINGLE_QUOTE)
*str += 1;
}

View File

@ -14,6 +14,7 @@
#include <OS.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{

View File

@ -48,17 +48,17 @@ int main(int argc, char **argv)
if (strstr(p, string_to_match) == NULL)
continue;
}
printf("%s (team %d) (uid %d) (gid %d)\n", teaminfo.args, teaminfo.team, teaminfo.uid, teaminfo.gid);
printf("%s (team %ld) (uid %d) (gid %d)\n", teaminfo.args, teaminfo.team, teaminfo.uid, teaminfo.gid);
thcookie = 0;
while ((ret = get_next_thread_info(teaminfo.team, &thcookie, &thinfo)) >= B_OK) {
if (thinfo.state < B_THREAD_RUNNING || thinfo.state >B_THREAD_WAITING)
thstate = "???";
else
thstate = states[thinfo.state-1];
printf("%7ld %20s %3s %3d %7lli %7lli ", thinfo.thread, thinfo.name, thstate, thinfo.priority, thinfo.user_time/1000, thinfo.kernel_time/1000);
printf("%7ld %20s %3s %3ld %7lli %7lli ", thinfo.thread, thinfo.name, thstate, thinfo.priority, thinfo.user_time/1000, thinfo.kernel_time/1000);
if (thinfo.state == B_THREAD_WAITING) {
get_sem_info(thinfo.sem, &sinfo);
printf("%s(%d)\n", sinfo.name, sinfo.sem);
printf("%s(%ld)\n", sinfo.name, sinfo.sem);
} else
puts("");
}
@ -66,9 +66,9 @@ int main(int argc, char **argv)
puts("");
// system stats
get_system_info(&sysinfo);
printf("%ik (%li bytes) total memory\n", sysinfo.max_pages*B_PAGE_SIZE/1024, sysinfo.max_pages*B_PAGE_SIZE);
printf("%ik (%li bytes) currently committed\n", sysinfo.used_pages*B_PAGE_SIZE/1024, sysinfo.used_pages*B_PAGE_SIZE);
printf("%ik (%li bytes) currently available\n", (sysinfo.max_pages-sysinfo.used_pages)*B_PAGE_SIZE/1024, (sysinfo.max_pages-sysinfo.used_pages)*B_PAGE_SIZE);
printf("%lik (%li bytes) total memory\n", sysinfo.max_pages*B_PAGE_SIZE/1024, sysinfo.max_pages*B_PAGE_SIZE);
printf("%lik (%li bytes) currently committed\n", sysinfo.used_pages*B_PAGE_SIZE/1024, sysinfo.used_pages*B_PAGE_SIZE);
printf("%lik (%li bytes) currently available\n", (sysinfo.max_pages-sysinfo.used_pages)*B_PAGE_SIZE/1024, (sysinfo.max_pages-sysinfo.used_pages)*B_PAGE_SIZE);
printf("%2.1f%% memory utilisation\n", (float)100 * sysinfo.used_pages / sysinfo.max_pages);
return 0;
}

View File

@ -15,6 +15,7 @@
#include <OS.h>
#include <stdio.h>
#include <string.h>
/*
Notes:
@ -49,18 +50,18 @@ prio is locked into one pid, then the priority.
*/
// returns an equivalent UNIX priority for a given BeOS priority.
int32 prio_be_to_unix(int32 prio)
static int32 prio_be_to_unix(int32 prio)
{
return (prio > 10)?(- (20 * (prio - 10)) / 110):(2 * (10 - prio));
}
// returns an equivalent BeOS priority for a given UNIX priority.
int32 prio_unix_to_be(int32 prio)
static int32 prio_unix_to_be(int32 prio)
{
return (prio > 0)?(10 - (prio/2)):(10 + 110 * (-prio) / 20);
}
status_t renice_thread(int32 prio, int32 increment, bool use_be_prio, thread_id th)
static status_t renice_thread(int32 prio, int32 increment, bool use_be_prio, thread_id th)
{
thread_info thinfo;

View File

@ -1,6 +1,7 @@
#include <stdio.h>
// for O_WRONLY
#include <fcntl.h>
#include <unistd.h>
// 2002, François Revol
// technical reference:

View File

@ -25,7 +25,6 @@ bool OutputTeam( void * item_p )
static uint32 i = 0u; // counter
app_info info;
app_info *pinfo = &info;
// Roster stores team_id not team_id *
team_id id = reinterpret_cast<team_id>( item_p );

View File

@ -409,7 +409,7 @@ int main(int argc, char **argv)
if (time_to_sleep > 0) {
unsigned int left;
thread_id BApp_thread;
thread_id BApp_thread = -1;
signal(SIGUSR1, handle_usr1);

View File

@ -12,6 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <kernel/OS.h>
static const int cache_desc_values[] = {
@ -241,7 +242,7 @@ static void dump_cpu(system_info *info)
ret = get_cpuid(&cpuii[0], 0, i);
if (ret != B_OK) {
fprintf(stderr, "cpuid_info(, %ld, %ld): error 0x%08lx\n", 0, i, ret);
fprintf(stderr, "cpuid_info(, %d, %d): error 0x%08lx\n", 0, i, ret);
break;
}
max_eax = cpuii[0].eax_0.max_eax;
@ -250,7 +251,7 @@ static void dump_cpu(system_info *info)
for (j = 1; j <= max_eax && j < 5; j++) {
ret = get_cpuid(&cpuii[j], j, i);
if (ret != B_OK) {
fprintf(stderr, "cpuid_info(, %ld, %ld): error 0x%08lx\n", j, i, ret);
fprintf(stderr, "cpuid_info(, %d, %d): error 0x%08lx\n", j, i, ret);
break;
}
}
@ -266,7 +267,7 @@ static void dump_cpu(system_info *info)
if (check_extended) {
ret = get_cpuid(&cpuiie[0], 0x80000000, i);
if (ret != B_OK) {
fprintf(stderr, "cpuid_info(, %ld, %ld): error 0x%08lx\n", 0x80000000, i, ret);
fprintf(stderr, "cpuid_info(, %d, %d): error 0x%08lx\n", 0x80000000, i, ret);
break;
}
max_eeax = cpuiie[0].eax_0.max_eax & 0x0ff;
@ -274,7 +275,7 @@ static void dump_cpu(system_info *info)
for (j = 1; j <= max_eeax && j < 9; j++) {
ret = get_cpuid(&cpuiie[j], 0x80000000+j, i);
if (ret != B_OK) {
fprintf(stderr, "cpuid_info(, %ld, %ld): error 0x%08lx\n", 0x80000000+j, i, ret);
fprintf(stderr, "cpuid_info(, %d, %d): error 0x%08lx\n", 0x80000000+j, i, ret);
break;
}
}
@ -284,7 +285,7 @@ static void dump_cpu(system_info *info)
printf("CPU #%d: %.12s\n", i, cpuii[0].eax_0.vendorid);
if (max_eax == 0)
continue;
printf("\ttype %u, family %u, model %u, stepping %u, features 0x%08x\n",
printf("\ttype %u, family %u, model %u, stepping %u, features 0x%08lx\n",
cpuii[1].eax_1.type,
cpuii[1].eax_1.family,
cpuii[1].eax_1.model,
@ -293,7 +294,7 @@ static void dump_cpu(system_info *info)
/* Extended CPUID */
if (max_eeax > 0) {
printf("\tExtended information:\n");
printf("\ttype %u, family %u, model %u, stepping %u, features 0x%08x\n",
printf("\ttype %u, family %u, model %u, stepping %u, features 0x%08lx\n",
cpuiie[1].eax_1.type,
cpuiie[1].eax_1.family,
cpuiie[1].eax_1.model,
@ -336,7 +337,7 @@ static void dump_cpu(system_info *info)
break;
ret = get_cpuid(&cpuii[2], 2, i);
if (ret != B_OK) {
fprintf(stderr, "cpuid_info(, %ld, %ld): error 0x%08lx\n", 2, i, ret);
fprintf(stderr, "cpuid_info(, %d, %d): error 0x%08lx\n", 2, i, ret);
break;
}

View File

@ -14,6 +14,7 @@
#include <OS.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
@ -23,7 +24,7 @@
void append_file (int, int);
void do_unchop (char *, char *);
void replace (char *, char *);
char *temp_file ();
char *temp_file (void);
void usage (void);
bool valid_file (char *);
@ -166,7 +167,7 @@ replace(char *origfile, char *newfile)
char *
temp_file()
temp_file(void)
{
// creates a new, temporary file and returns its name