]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/parse_conf.c
Remove SQLite2 scripts
[bacula/bacula] / bacula / src / lib / parse_conf.c
index 8bf7b18a8f4e8bad20dd26523a8cdbc21b51ff0a..b39eedf6bf0b12ebd284ac6dbea72d5c2a83ca3c 100644 (file)
@@ -206,11 +206,12 @@ static void init_resource(CONFIG *config, int type, RES_ITEM *items, int pass)
          } else if (items[i].handler == store_bool) {
             *(bool *)(items[i].value) = items[i].default_value != 0;
          } else if (items[i].handler == store_pint32 ||
-                    items[i].handler == store_int32) {
+                    items[i].handler == store_int32 ||
+                    items[i].handler == store_size32) {
             *(uint32_t *)(items[i].value) = items[i].default_value;
          } else if (items[i].handler == store_int64) {
             *(int64_t *)(items[i].value) = items[i].default_value;
-         } else if (items[i].handler == store_size) {
+         } else if (items[i].handler == store_size64) {
             *(uint64_t *)(items[i].value) = (uint64_t)items[i].default_value;
          } else if (items[i].handler == store_time) {
             *(utime_t *)(items[i].value) = (utime_t)items[i].default_value;
@@ -627,7 +628,7 @@ void store_int64(LEX *lc, RES_ITEM *item, int index, int pass)
 }
 
 /* Store a size in bytes */
-void store_size(LEX *lc, RES_ITEM *item, int index, int pass)
+static void store_size(LEX *lc, RES_ITEM *item, int index, int pass, bool size32)
 {
    int token;
    uint64_t uvalue;
@@ -656,7 +657,11 @@ void store_size(LEX *lc, RES_ITEM *item, int index, int pass)
          scan_err1(lc, _("expected a size number, got: %s"), lc->str);
          return;
       }
-      *(uint64_t *)(item->value) = uvalue;
+      if (size32) {
+         *(uint32_t *)(item->value) = (uint32_t)uvalue;
+      } else {
+         *(uint64_t *)(item->value) = uvalue;
+      }
       break;
    default:
       scan_err1(lc, _("expected a size, got: %s"), lc->str);
@@ -669,6 +674,18 @@ void store_size(LEX *lc, RES_ITEM *item, int index, int pass)
    Dmsg0(900, "Leave store_size\n");
 }
 
+/* Store a size in bytes */
+void store_size32(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+   store_size(lc, item, index, pass, true /* 32 bit */);
+}
+
+/* Store a size in bytes */
+void store_size64(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+   store_size(lc, item, index, pass, false /* not 32 bit */);
+}
+
 
 /* Store a time period in seconds */
 void store_time(LEX *lc, RES_ITEM *item, int index, int pass)
@@ -788,11 +805,11 @@ CONFIG *new_config_parser()
 void CONFIG::init(
    const char *cf,
    LEX_ERROR_HANDLER *scan_error,
-   int err_type,
+   int32_t err_type,
    void *vres_all,
-   int res_all_size,
-   int r_first,
-   int r_last,
+   int32_t res_all_size,
+   int32_t r_first,
+   int32_t r_last,
    RES_TABLE *resources,
    RES **res_head)
 {