librazor/dump.c
changeset 478 8e4bf84a7bb8
parent 457 51a084acef49
     1.1 --- a/librazor/dump.c	Fri Oct 17 10:08:28 2014 +0100
     1.2 +++ b/librazor/dump.c	Thu Jul 07 11:04:10 2016 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (C) 2014  J. Ali Harlow <ali@juiblex.co.uk>
     1.6 + * Copyright (C) 2014, 2016  J. Ali Harlow <ali@juiblex.co.uk>
     1.7   *
     1.8   * This program is free software; you can redistribute it and/or modify
     1.9   * it under the terms of the GNU General Public License as published by
    1.10 @@ -356,11 +356,11 @@
    1.11  }
    1.12  
    1.13  RAZOR_EXPORT int
    1.14 -razor_dump_database(FILE *fp, const char *root, const char *filename,
    1.15 +razor_dump_database(FILE *fp, const char *root_uri, const char *filename,
    1.16  		    struct razor_error **error)
    1.17  {
    1.18  	int i;
    1.19 -	char *s, *path, *data;
    1.20 +	char *s, *uri, *data;
    1.21  	struct array pool = { 0, };
    1.22  	struct array string_pool = { 0, };
    1.23  	struct array file_string_pool = { 0, };
    1.24 @@ -377,11 +377,14 @@
    1.25  	if (!filename)
    1.26  		filename = "system.rzdb";
    1.27  
    1.28 -	s = razor_concat(razor_get_database_path(), "/", filename, NULL);
    1.29 -	path = razor_path_add_root(s, root);
    1.30 -	free(s);
    1.31 -	contents = razor_file_get_contents(path, &length, 0, error);
    1.32 -	free(path);
    1.33 +	uri = razor_resolve_database_file(root_uri, filename, error);
    1.34 +
    1.35 +	if (!uri)
    1.36 +		return -1;
    1.37 +
    1.38 +	contents = razor_uri_get_contents(uri, &length, 0, error);
    1.39 +
    1.40 +	free(uri);
    1.41  
    1.42  	if (!contents)
    1.43  		return -1;
    1.44 @@ -482,7 +485,7 @@
    1.45  
    1.46  	fprintf(fp, "%05lX EOF\n", (unsigned long)n);
    1.47  
    1.48 -	razor_file_free_contents(contents, length);
    1.49 +	razor_uri_free_contents(contents, length);
    1.50  
    1.51  	return 0;
    1.52  }