* @param limit string representation of limit (eg. 1M)
* @return numeric value of limit
*/
-gsize parse_limit (const gchar *limit, guint len);
+guint64 parse_limit (const gchar *limit, guint len);
/**
* Parse time
return NULL;
}
-gsize
+guint64
parse_limit (const gchar *limit, guint len)
{
- gsize result = 0;
+ guint64 result = 0;
const gchar *err_str;
if (!limit || *limit == '\0' || len == 0) {
}
errno = 0;
- result = strtoul (limit, (gchar **)&err_str, 10);
+ result = strtoull (limit, (gchar **)&err_str, 10);
if (*err_str != '\0') {
/* Megabytes */
gsize *dest;
dest = (gsize *)G_STRUCT_MEMBER_P (dest_struct, offset);
- *dest = parse_limit (data, -1);
+ *dest = (gsize)parse_limit (data, -1);
return TRUE;
}
+/* Guint64 variant */
+gboolean
+xml_handle_size_64 (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset)
+{
+ guint64 *dest;
+
+ dest = (guint64 *)G_STRUCT_MEMBER_P (dest_struct, offset);
+ *dest = parse_limit (data, -1);
+
+ return TRUE;
+}
+
gboolean
xml_handle_seconds (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset)
{
/* Numeric params */
gboolean xml_handle_size (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset);
+gboolean xml_handle_size_64 (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset);
gboolean xml_handle_double (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset);
gboolean xml_handle_seconds (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset);
gboolean xml_handle_int (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset);