diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c index f98fc27db8..0a01f3a1d6 100644 --- a/apps/plugins/euroconverter.c +++ b/apps/plugins/euroconverter.c @@ -48,6 +48,9 @@ static const char cfg_filename[] = "euroconverter.cfg"; #define CFGFILE_VERSION 0 /* Current config file version */ #define CFGFILE_MINVERSION 0 /* Minimum config file version to accept */ +/* typedef for simplifying usage of long long type */ +typedef long long int longlong_t; + /*Pattern for the converter*/ static unsigned char pattern_euro[]={0x07, 0x08, 0x1E, 0x10, 0x1E, 0x08, 0x07}; /* € */ static unsigned char pattern_home[]={0x04, 0x0A, 0x11, 0x1F, 0x11, 0x11, 0x1F}; /* Home icon*/ @@ -85,7 +88,7 @@ static int nb_digit[12]={ }; /* max euro to have home currency */ -static long long max_euro[12]={ +static longlong_t max_euro[12]={ 99999999000LL, /*FRF France 999 999.99 */ 99999999000LL, /*DEM Germany 999 999.99 */ 99999999000LL, /*ATS Austria 999 999.99 */ @@ -102,7 +105,7 @@ static long long max_euro[12]={ /* max home to have euro currency */ /* 92233720300000 Limitation due to the max capacity of long long (2^63)*/ -static long long max_curr[12]={ +static longlong_t max_curr[12]={ 99999999000LL, /*FRF France 152449.02 */ 99999999000LL, /*DEM Germany 511291.88 */ 99999999000LL, /*ATS Austria 72672.83 */ @@ -152,9 +155,10 @@ static char *currency_str[12] = { "Greece" }; + static int country; /*Country selected*/ static int cur_pos; /*Cursor position*/ -static long long inc; +static longlong_t inc; /* Persistent settings */ static struct configdata config[] = { @@ -163,23 +167,23 @@ static struct configdata config[] = { /* 64bits*64 bits with 5 digits after the . */ -static long long mul(long long a, long long b) +static longlong_t mymul(longlong_t a, longlong_t b) { - return((a*b)/100000); + return((a*b)/100000LL); } /* 64bits/64 bits with 5 digits after the . */ -static long long mydiv(long long a, long long b) +static longlong_t mydiv(longlong_t a, longlong_t b) { - return((a*100000)/b); + return((a*100000LL)/b); } /* 123.45=12345000 split => i=123 f=45000*/ -static void split(long long v, long long* i, long long* f) +static void split(longlong_t v, longlong_t* i, longlong_t* f) { - long long t; + longlong_t t; t=v/100000LL; (*i)=t; @@ -188,10 +192,10 @@ static void split(long long v, long long* i, long long* f) /* result=10^n */ -static long long pow10(int n) +static longlong_t pow10(int n) { int i; - long long r; + longlong_t r; r=1; for (i=0;ihome*/ - h=mul(e,currency[country]); + h=mymul(e,currency[country]); else /*Home>euro*/ e=mydiv(h,currency[country]); display(e,h,pos);