Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
bdadd45a
Commit
bdadd45a
authored
Aug 27, 2015
by
Hisham Muhammad
Browse files
Fix indentation.
parent
bde3406a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Meter.c
View file @
bdadd45a
...
@@ -142,31 +142,31 @@ Meter* Meter_new(struct ProcessList_* pl, int param, MeterClass* type) {
...
@@ -142,31 +142,31 @@ Meter* Meter_new(struct ProcessList_* pl, int param, MeterClass* type) {
}
}
int
Meter_humanUnit
(
char
*
buffer
,
unsigned
long
int
value
,
int
size
)
{
int
Meter_humanUnit
(
char
*
buffer
,
unsigned
long
int
value
,
int
size
)
{
const
char
*
prefix
=
"KMGTPEZY"
;
const
char
*
prefix
=
"KMGTPEZY"
;
unsigned
long
int
powi
=
1
;
unsigned
long
int
powi
=
1
;
unsigned
int
written
,
powj
=
1
,
precision
=
2
;
unsigned
int
written
,
powj
=
1
,
precision
=
2
;
for
(;;)
{
for
(;;)
{
if
(
value
/
1024
<
powi
)
if
(
value
/
1024
<
powi
)
break
;
break
;
if
(
prefix
[
1
]
==
0
)
if
(
prefix
[
1
]
==
0
)
break
;
break
;
powi
*=
1024
;
powi
*=
1024
;
++
prefix
;
++
prefix
;
}
}
for
(;
precision
>
0
;
precision
--
)
{
for
(;
precision
>
0
;
precision
--
)
{
powj
*=
10
;
powj
*=
10
;
if
(
value
/
powi
<
powj
)
if
(
value
/
powi
<
powj
)
break
;
break
;
}
}
written
=
snprintf
(
buffer
,
size
,
"%.*f%c"
,
written
=
snprintf
(
buffer
,
size
,
"%.*f%c"
,
precision
,
(
double
)
value
/
powi
,
*
prefix
);
precision
,
(
double
)
value
/
powi
,
*
prefix
);
return
written
;
return
written
;
}
}
void
Meter_delete
(
Object
*
cast
)
{
void
Meter_delete
(
Object
*
cast
)
{
...
@@ -463,9 +463,9 @@ static void LEDMeterMode_draw(Meter* this, int x, int y, int w) {
...
@@ -463,9 +463,9 @@ static void LEDMeterMode_draw(Meter* this, int x, int y, int w) {
int
yText
=
int
yText
=
#ifdef HAVE_LIBNCURSESW
#ifdef HAVE_LIBNCURSESW
CRT_utf8
?
y
+
1
:
CRT_utf8
?
y
+
1
:
#endif
#endif
y
+
2
;
y
+
2
;
attrset
(
CRT_colors
[
LED_COLOR
]);
attrset
(
CRT_colors
[
LED_COLOR
]);
mvaddstr
(
yText
,
x
,
this
->
caption
);
mvaddstr
(
yText
,
x
,
this
->
caption
);
int
xx
=
x
+
strlen
(
this
->
caption
);
int
xx
=
x
+
strlen
(
this
->
caption
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment