mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +00:00
More moving towards using signed types.
I'm still feeling this out, but I am starting to like the general idea.
This commit is contained in:
parent
beda478821
commit
9624b54703
48 changed files with 234 additions and 250 deletions
|
@ -42,6 +42,9 @@ int main(int, char**)
|
|||
ASSERT(ok);
|
||||
String mount_point = parts[5];
|
||||
|
||||
(void)total_inode_count;
|
||||
(void)free_inode_count;
|
||||
|
||||
printf("% 10s", fs.characters());
|
||||
printf("%10u ", total_block_count);
|
||||
printf("%10u ", total_block_count - free_block_count);
|
||||
|
|
|
@ -11,13 +11,13 @@ static unsigned parse_uint(const String& str, bool& ok)
|
|||
return 0;
|
||||
}
|
||||
unsigned value = 0;
|
||||
for (size_t i = 0; i < str.length(); ++i) {
|
||||
for (int i = 0; i < str.length(); ++i) {
|
||||
if (str[i] < '0' || str[i] > '9') {
|
||||
ok = false;
|
||||
return 0;
|
||||
}
|
||||
value = value * 10;
|
||||
value += str[i] - '0';
|
||||
value += (unsigned)(str[i] - '0');
|
||||
}
|
||||
ok = true;
|
||||
return value;
|
||||
|
|
|
@ -55,7 +55,7 @@ int main(int argc, char** argv)
|
|||
return do_dir_short(path);
|
||||
}
|
||||
|
||||
void get_geometry(unsigned& rows, unsigned& columns)
|
||||
void get_geometry(int& rows, int& columns)
|
||||
{
|
||||
struct winsize ws;
|
||||
ioctl(0, TIOCGWINSZ, &ws);
|
||||
|
@ -187,8 +187,8 @@ int do_dir(const char* path)
|
|||
|
||||
int do_dir_short(const char* path)
|
||||
{
|
||||
unsigned rows;
|
||||
unsigned columns;
|
||||
int rows;
|
||||
int columns;
|
||||
get_geometry(rows, columns);
|
||||
|
||||
DIR* dirp = opendir(path);
|
||||
|
@ -198,7 +198,7 @@ int do_dir_short(const char* path)
|
|||
}
|
||||
|
||||
Vector<String> names;
|
||||
size_t longest_name = 0;
|
||||
int longest_name = 0;
|
||||
while (auto* de = readdir(dirp)) {
|
||||
if (de->d_name[0] == '.' && !flag_show_dotfiles)
|
||||
continue;
|
||||
|
@ -210,7 +210,7 @@ int do_dir_short(const char* path)
|
|||
|
||||
int printed_on_row = 0;
|
||||
|
||||
for (size_t i = 0; i < names.size(); ++i) {
|
||||
for (int i = 0; i < names.size(); ++i) {
|
||||
auto& name = names[i];
|
||||
struct stat st;
|
||||
char pathbuf[256];
|
||||
|
@ -221,11 +221,11 @@ int do_dir_short(const char* path)
|
|||
return 2;
|
||||
}
|
||||
|
||||
unsigned nprinted = print_name(st, name.characters());
|
||||
unsigned column_width = 14;
|
||||
int nprinted = print_name(st, name.characters());
|
||||
int column_width = 14;
|
||||
printed_on_row += column_width;
|
||||
|
||||
for (unsigned i = nprinted; i < column_width; ++i)
|
||||
for (int i = nprinted; i < column_width; ++i)
|
||||
printf(" ");
|
||||
if ((printed_on_row + column_width) >= columns) {
|
||||
if (i != names.size() - 1)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
static unsigned parse_uint(const String& str, bool& ok)
|
||||
{
|
||||
unsigned value = 0;
|
||||
for (size_t i = 0; i < str.length(); ++i) {
|
||||
for (int i = 0; i < str.length(); ++i) {
|
||||
if (str[i] < '0' || str[i] > '9') {
|
||||
ok = false;
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue