]> Dogcows Code - chaz/homebank/blobdiff - src/hb-misc.c
import homebank-5.1.7
[chaz/homebank] / src / hb-misc.c
index 8424ecaa5504cdf81797e16709db2e30365042ed..179e213ada4216026bbf1872be0a74a306a70fe0 100644 (file)
@@ -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),
This page took 0.022334 seconds and 4 git commands to generate.