X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fhomebank;a=blobdiff_plain;f=src%2Fhb-misc.c;h=179e213ada4216026bbf1872be0a74a306a70fe0;hp=8424ecaa5504cdf81797e16709db2e30365042ed;hb=cd13d9691c46c2b2d6d459e9e6a76bed1c21b7a6;hpb=b84403141a4c3a32a594800eb3fcabdc856461f8 diff --git a/src/hb-misc.c b/src/hb-misc.c index 8424eca..179e213 100644 --- a/src/hb-misc.c +++ b/src/hb-misc.c @@ -1,5 +1,5 @@ /* HomeBank -- Free, easy, personal accounting for everyone. - * Copyright (C) 1995-2017 Maxime DOYEN + * Copyright (C) 1995-2018 Maxime DOYEN * * This file is part of HomeBank. * @@ -223,14 +223,16 @@ gdouble monval; } else { + monval = hb_amount_base(value, kcur); + monval = hb_amount_to_euro(monval); cur = &PREFS->minor_cur; - monval = hb_amount_to_euro(value); g_ascii_formatd(formatd_buf, outlen, cur->format, monval); hb_str_formatd(outstr, outlen, formatd_buf, cur, TRUE); } } + void hb_strfmon_int(gchar *outstr, gint outlen, gdouble value, guint32 kcur, gboolean minor) { gchar formatd_buf[outlen]; @@ -249,8 +251,9 @@ gdouble monval; } else { + monval = hb_amount_base(value, kcur); + monval = hb_amount_to_euro(monval); cur = &PREFS->minor_cur; - monval = hb_amount_to_euro(value); g_ascii_formatd(formatd_buf, outlen, cur->format, monval); hb_str_formatd(outstr, outlen, formatd_buf, cur, TRUE); } @@ -286,7 +289,6 @@ gdouble monval; } - gchar *get_normal_color_amount(gdouble value) { gchar *color = NULL; @@ -452,7 +454,52 @@ gchar *d = str; } -/*static void strip_extra_spaces(char* str) { +gchar *hb_string_copy_jsonpair(gchar *dst, gchar *str) +{ + + while( *str!='\0' ) + { + if( *str=='}' ) + break; + + if( *str==',' ) + { + *dst = '\0'; + return str + 1; + } + + if( *str!='{' && *str!='\"' ) + { + *dst++ = *str; + } + str++; + } + *dst = '\0'; + return NULL; +} + + +void hb_string_inline(gchar *str) +{ +gchar *s = str; +gchar *d = str; + + if(str) + { + while( *s ) + { + if( !(*s==' ' || *s=='\t' || *s=='\n' || *s=='\r') ) + { + *d++ = *s; + } + s++; + } + *d = 0; + } +} + + +/*void strip_extra_spaces(char* str) { int i,x; for(i=x=1; str[i]; ++i) if(!isspace(str[i]) || (i>0 && !isspace(str[i-1]))) @@ -591,7 +638,7 @@ guint32 julian = 0; /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ -gchar *hb_util_filename_new_with_extension(gchar *filename, const gchar *extension) +gchar *hb_filename_new_with_extension(gchar *filename, const gchar *extension) { gchar *lastdot, *fwe; gchar *newfilename; @@ -695,7 +742,8 @@ GDate date; g_date_get_month(&date), g_date_get_year(&date) ); - } + } + break; default: g_sprintf(outstr, "%04d/%02d/%02d", g_date_get_year(&date),