mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-05 04:25:19 +02:00
Kill float and double
This commit is contained in:
parent
8a87e8e1ab
commit
667fb05a35
@ -1867,12 +1867,9 @@ string GMenu2X::getDiskFree() {
|
||||
|
||||
int ret = statvfs("/card/gmenu2x", &b);
|
||||
if (ret==0) {
|
||||
/*unsigned long free = b.f_bfree*b.f_frsize/1048576;
|
||||
unsigned long total = b.f_blocks*b.f_frsize/1048576;
|
||||
ss << free << "/" << total << "MB";*/
|
||||
double free = (double)b.f_bfree * (double)b.f_bsize / 1048576.0;
|
||||
double total = (double)b.f_blocks * (double)b.f_frsize / 1048576.0;
|
||||
ss << (unsigned long)free << "/" << (unsigned long)total << "MB";
|
||||
unsigned long long free = b.f_bfree * b.f_bsize / 1048576;
|
||||
unsigned long long total = b.f_blocks * b.f_frsize / 1048576;
|
||||
ss << free << "/" << total << "MB";
|
||||
ss >> df;
|
||||
} else cout << "\033[0;34mGMENU2X:\033[0;31m statvfs failed with error '" << strerror(errno) << "'\033[0m" << endl;
|
||||
return df;
|
||||
|
10
src/menu.cpp
10
src/menu.cpp
@ -364,10 +364,13 @@ void Menu::linkRight() {
|
||||
setLinkIndex(iLink+1);
|
||||
}
|
||||
|
||||
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
|
||||
|
||||
void Menu::linkUp() {
|
||||
int l = iLink-gmenu2x->linkColumns;
|
||||
if (l<0) {
|
||||
uint rows = (uint)ceil(sectionLinks()->size()/(double)gmenu2x->linkColumns);
|
||||
unsigned int rows;
|
||||
rows = DIV_ROUND_UP(sectionLinks()->size(), gmenu2x->linkColumns);
|
||||
l = (rows*gmenu2x->linkColumns)+l;
|
||||
if (l >= (int)sectionLinks()->size())
|
||||
l -= gmenu2x->linkColumns;
|
||||
@ -378,8 +381,9 @@ void Menu::linkUp() {
|
||||
void Menu::linkDown() {
|
||||
uint l = iLink+gmenu2x->linkColumns;
|
||||
if (l >= sectionLinks()->size()) {
|
||||
uint rows = (uint)ceil(sectionLinks()->size()/(double)gmenu2x->linkColumns);
|
||||
uint curCol = (uint)ceil((iLink+1)/(double)gmenu2x->linkColumns);
|
||||
unsigned int rows, curCol;
|
||||
rows = DIV_ROUND_UP(sectionLinks()->size(), gmenu2x->linkColumns);
|
||||
curCol = DIV_ROUND_UP(iLink + 1, gmenu2x->linkColumns);
|
||||
if (rows > curCol)
|
||||
l = sectionLinks()->size()-1;
|
||||
else
|
||||
|
@ -123,16 +123,6 @@ string evalStrConf (string *val, string def) {
|
||||
return *val;
|
||||
}
|
||||
|
||||
float max (float a, float b) {
|
||||
return a>b ? a : b;
|
||||
}
|
||||
float min (float a, float b) {
|
||||
return a<b ? a : b;
|
||||
}
|
||||
float constrain (float x, float imin, float imax) {
|
||||
return min( imax, max(imin,x) );
|
||||
}
|
||||
|
||||
bool split (vector<string> &vec, const string &str, const string &delim, bool destructive) {
|
||||
vec.clear();
|
||||
|
||||
@ -188,7 +178,6 @@ string cmdclean (string cmdline) {
|
||||
|
||||
int intTransition(int from, int to, long tickStart, long duration, long tickNow) {
|
||||
if (tickNow<0) tickNow = SDL_GetTicks();
|
||||
float elapsed = (float)(tickNow-tickStart)/duration;
|
||||
return constrain(((tickNow-tickStart) * (to-from)) / duration, from, to);
|
||||
// elapsed increments
|
||||
return constrain(round(elapsed*(to-from)),from,to);
|
||||
}
|
||||
|
@ -71,10 +71,6 @@ int evalIntConf (int *val, int def, int imin, int imax);
|
||||
string evalStrConf (string val, string def);
|
||||
string evalStrConf (string *val, string def);
|
||||
|
||||
float max (float a, float b);
|
||||
float min (float a, float b);
|
||||
float constrain (float x, float imin, float imax);
|
||||
|
||||
bool split (vector<string> &vec, const string &str, const string &delim, bool destructive=true);
|
||||
|
||||
int intTransition(int from, int to, long int tickStart, long duration=500, long tickNow=-1);
|
||||
|
Loading…
Reference in New Issue
Block a user