summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'ebassi/builder-content' into 'main'HEADmainPhilip Withnall2023-04-142-9/+29
|\ | | | | | | | | Add getter for GVDB table contents See merge request GNOME/gvdb!19
| * Add getter for GVDB table contentsEmmanuele Bassi2023-04-142-9/+29
|/ | | | | | | | | | | | The xdg-desktop-portal project is using GVDB as the basis for the permissions store. Each permission table is stores as a block of bytes inside another GVDB table, in order to isolate the permissions of each application. Currently, xdg-desktop-portal uses GVDB as a copy-paste library; the only missing API to avoid that, and switch GVDB to a proper subproject, is a way to extract the contents of a GVDB table into a GBytes buffer.
* Merge branch 'wip/pwithnall/meson' into 'main'Philip Withnall2022-06-156-0/+15
|\ | | | | | | | | build: Add very basic meson build system See merge request GNOME/gvdb!18
| * build: Add very basic meson build systemPhilip Withnall2022-06-146-0/+15
|/ | | | | | | | | | | | | | | | | | | | | | | | | This doesn’t build any files, but does expose the list of sources as a Meson variable so it can be used as a subproject from other projects. I thought about building a static library for gvdb, but this would cause problems for libgio (and gvdb’s use inside libgio is the motivation for making it subproject-able). gvdb depends on libgio types, such as `GCancellable`, but also is a dependency of parts of libgio, such as `GResource`. That circular dependency means that building a static library is non-trivial. There is an approach for achieving this, detailed by Eli Schwartz at https://gitlab.gnome.org/GNOME/gvdb/-/merge_requests/18#note_1474750, but that’s too much work for what I would like to achieve here. It can always be implemented in future, particularly if we add unit tests to gvdb (in this git repository) or if another project starts linking gvdb in using Meson subprojects rather than copy/paste. The files have to be moved to a `gvdb/` subdirectory to keep the include paths working correctly — code in GLib which uses gvdb uses `#include <gvdb/gvdb-builder.h>`. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* Merge branch 'nosigned' into 'master'Philip Withnall2021-10-121-3/+3
|\ | | | | | | | | Make number of buckets a gsize See merge request GNOME/gvdb!17
| * Make number of buckets a gsizeYegor Bychin2021-10-121-3/+3
|/
* Merge branch 'readme' into 'master'masterMichael Catanzaro2021-08-111-0/+25
|\ | | | | | | | | docs: Add README See merge request GNOME/gvdb!16
| * docs: Add READMEPhilip Withnall2021-08-111-0/+25
|/ | | | | | | Add a simple readme containing a brief braindump of how GVDB works and its strengths and weaknesses. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* Merge branch 'fix-scan-build-findings' into 'master'Philip Withnall2021-08-111-0/+1
|\ | | | | | | | | Fix scan-build findings See merge request GNOME/gvdb!14
| * Fix scan-build findingsfix-scan-build-findingsJan-Michael Brummer2021-01-081-0/+1
|/
* Merge remote-tracking branch 'fmartinsons/1735-fix-warnings'Philip Withnall2021-01-041-3/+5
|\
| * Fix warningsFrederic Martinsons2021-01-041-3/+5
|/ | | | | | Related: glib#1735 Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
* gvdb-reader: Reword a comment for clarityPhilip Withnall2020-06-231-1/+1
| | | | | | Avoid ableist phrases. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* gvdb-builder: Initialise some memory to zero in the bloom filterPhilip Withnall2020-03-181-0/+2
| | | | | | | | | | Until a bloom filter is implemented, we need to ensure that all the memory returned by `file_builder_allocate()` is initialised, since it’s not initialised at allocation time. Signed-off-by: Philip Withnall <withnall@endlessm.com> Fixes: #2
* Merge branch 'fix-symlink-issue'Philip Withnall2020-02-071-1/+1
|\ | | | | | | See https://gitlab.gnome.org/GNOME/gvdb/merge_requests/10
| * Do not replace file destinationfix-symlink-issueJan-Michael Brummer2020-02-071-1/+1
|/ | | | | | | Replacing file destination will also remove a symlink in case the user has moved the real file to another location. Fix this by removing G_FILE_CREATE_REPLACE_DESTINATION flag. See also: https://gitlab.gnome.org/GNOME/epiphany/issues/198
* Merge branch 'dilyan.palauzov/gvdb-add-out-doc' into HEADPhilip Withnall2019-07-231-1/+1
|\
| * Add (out) to an (optional) parameterДилян Палаузов2019-07-231-1/+1
|/ | | | | | … as it is not (inout). Closes !9
* Merge branch 'mcatanzaro/fix-write-contents-async' into 'master'Philip Withnall2019-06-281-1/+3
|\ | | | | | | | | Fix gvdb_table_write_contents_async() See merge request GNOME/gvdb!8
| * Fix gvdb_table_write_contents_async()Michael Catanzaro2019-06-271-1/+3
|/ | | | | | | It worked when I first wrote it, but I broke it during the late stages of code review. str is already freed here, so this is a use-after-free vulnerability for starters. It also causes the file saved to be always empty.
* Merge branch 'mcatanzaro/sign-compare' into 'master'Philip Withnall2019-06-241-4/+4
|\ | | | | | | | | Fix -Wsign-compare warning See merge request GNOME/gvdb!7
| * Fix -Wsign-compare warningMichael Catanzaro2019-06-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | [23/236] Compiling C object 'lib/76b5a...isc@sha/contrib_gvdb_gvdb-reader.c.o'. ../../../../Projects/epiphany/lib/contrib/gvdb/gvdb-reader.c: In function ‘gvdb_table_get_names’: ../../../../Projects/epiphany/lib/contrib/gvdb/gvdb-reader.c:428:27: warning: comparison of integer expressions of different signedness: ‘guint32’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’} [-Wsign-compare] 428 | else if (parent < n_names && names[parent] != NULL) | ^ To fix this, we have to change n_names to guint, and then also change the types of everything it's compared against. This seems to be safe since none of these should ever be negative.
* | Merge branch 'mcatanzaro/fb-free' into 'master'Philip Withnall2019-06-241-3/+9
|\ \ | |/ |/| | | | | Don't free FileBuilder in serialize function See merge request GNOME/gvdb!6
| * Don't free FileBuilder in serialize functionMichael Catanzaro2019-06-221-3/+9
|/ | | | | | | | It's confused both myself and Jan-Michael, when reviewing my changes to this code. It's weird for the serialize function to take ownership of the passed FileBuilder. Don't do that. We can also add a convenience free function.
* Merge branch 'mcatanzaro/write-contents-async' into 'master'Philip Withnall2019-06-212-0/+113
|\ | | | | | | | | Add gvdb_table_write_contents_async() See merge request GNOME/gvdb!4
| * Add some g_return checks to gvdb_table_write_contents()Michael Catanzaro2019-06-211-0/+4
| | | | | | | | | | | | I'm not auditing all the public functions in this file for precondition checks, but since I'm adding an async version of this function, it makes sense to ensure there are matching checks for the sync version.
| * Add gvdb_table_write_contents_async()Michael Catanzaro2019-06-212-0/+109
| | | | | | | | | | | | | | This is just an async version of gvdb_table_write_contents(). Future work: someone could write an async version of gvdb_table_new(), then sync I/O would no longer be required to construct a GvdbTable.
* | Remove trailing whitespaceMichael Catanzaro2019-06-211-1/+1
|/
* Merge branch 'mcatanzaro/license' into 'master'Philip Withnall2019-06-211-0/+504
|\ | | | | | | | | Add COPYING file to indicate the license See merge request GNOME/gvdb!5
| * Add COPYING file to indicate the licenseMichael Catanzaro2019-06-201-0/+504
|/
* Merge branch 'array-size' into 'master'Philip Withnall2019-02-251-1/+1
|\ | | | | | | | | Fix size of preallocated array See merge request GNOME/gvdb!3
| * Fix size of preallocated arrayPhilip Withnall2019-02-251-1/+1
|/ | | | | | | | | | | | | | | Commit 084e1d868 added a preallocation to an array to avoid reallocations later on, but neglected the fact that after N insertions into the array, there’s always a NULL terminator added to the end. Fix the preallocation to include that NULL terminator. This doesn’t change the correctness of the code, but should eliminate one reallocation. Spotted by Sebastian Dröge. See https://gitlab.gnome.org/GNOME/glib/merge_requests/674. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* Merge branch 'wip/lantw/use-weak-symbols-in-gvdb' into 'master'Michael Catanzaro2018-11-211-10/+25
|\ | | | | | | | | | | | | build: Use weak bindings in gvdb to fix linking with LLD Closes dconf#47 See merge request GNOME/gvdb!2
| * build: Use weak bindings in gvdb to fix linking with LLDTing-Wei Lan2018-11-221-10/+25
|/ | | | | | | | | Since tests/dconf-mock-gvdb.c has functions conflicting with the real gvdb and it is intended for the former to override the latter in tests, we have to make functions in gvdb library have weak bindings instead of the default strong bindings to avoid duplicate symbol errors. Fixes https://gitlab.gnome.org/GNOME/dconf/issues/47
* Merge branch '1454-follow-ups' into 'master'Georges Basile Stavracas Neto2018-08-162-6/+9
|\ | | | | | | | | Minor API fixes See merge request GNOME/gvdb!1
| * Preallocate a GPtrArray to avoid some reallocations later onPhilip Withnall2018-08-161-1/+1
| | | | | | | | | | | | Suggested by Georges Basile Stavracas Neto. Signed-off-by: Philip Withnall <withnall@endlessm.com>
| * Fix type of length returned by gvdb_table_get_names()Philip Withnall2018-08-162-3/+6
| | | | | | | | | | | | | | | | | | | | | | It should not be unsigned. The type in the on-disk format is gint32, so we need to return something at least as wide as that. However, we should not expose the implementation detail that the on-disk format is specifically gint32. Use a gsize, since that’s the normal type for array lengths — but check that we’re not on a platform where (somehow) gsize is smaller than gint32. Signed-off-by: Philip Withnall <withnall@endlessm.com>
| * Add missing introspection annotations to gvdb_table_get_names()Philip Withnall2018-08-161-2/+2
|/ | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
* docs: Clarify error values for empty files when loadingPhilip Withnall2018-08-131-1/+8
| | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
* docs: Use ‘Returns:’ instead of the invalid ‘@returns’Philip Withnall2018-08-131-8/+16
| | | | | | This is based on the commit 59a24ab5a3 in GLib. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* Update FSF’s addressPhilip Withnall2018-08-135-15/+5
| | | | | | (This is based on commit 892fc2e4 from dconf.) Signed-off-by: Philip Withnall <withnall@endlessm.com>
* gio/gvdb/: LGPLv2+ -> LGPLv2.1+Sébastien Wilmet2018-08-135-5/+5
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=776504
* Avoid calling Standard C string/array functions with NULL argumentsPhilip Withnall2018-08-131-1/+2
| | | | | | | | | | | | | | | | | | glibc string.h declares memcpy() with attribute(nonnull(1,2)), causing calls with NULL arguments to be treated as undefined behaviour. This is consistent with ISO C99 and C11, which state that passing 0 to string functions as an array length does not remove the requirement that the pointer to the array is a valid pointer. gcc -fsanitize=undefined catches this while running OSTree's test suite. Similarly, running the GLib test suite reports similar issues for qsort(), memmove(), memcmp(). (This is a partial cherry-pick of commit e5ed410c8c0fe823883 from GLib.) Signed-off-by: Simon McVittie <smcv@debian.org> Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510 Reviewed-by: Colin Walters
* doap: Update maintainers list to synchronise with GLibPhilip Withnall2018-08-131-3/+28
| | | | | | | | | GVDB is essentially part of GLib, so should have the same maintainer list. At least this way, it’s not just maintained by one absentee maintainer. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* reader: embrace GBytesRyan Lortie2012-11-092-129/+53
| | | | | | | Drop gvdb_table_new_from_data() and add gvdb_table_new_from_bytes(). Since the underlying backingstore of a GvdbTable is now always refcounted, drop the refcounting on GvdbTable itself.
* gvdb-reader: drop gvdb_table_walk()Ryan Lortie2012-07-092-146/+0
| | | | | | | | | | | | The attempt at the simple method for preventing unbounded recursion proved to be insufficient due to the existence of dconf databases in the wild that violated the rule (leading to the entire content of the database being scrapped). It also still had the ugly assert for less than 64 levels of recursion that could have been hit by a determined advisary. gvdb_table_get_names() allows the dconf-service to do everything it needs without the troubles associated with the walk approach.
* gvdb-reader.c: add gvdb_table_get_names()Ryan Lortie2012-07-092-1/+152
| | | | This function lists off all names that appear within a particular hash.
* remove a stray variableRyan Lortie2012-07-081-2/+0
| | | | | This was used to implement a much more complicated check which was dismissed in favour of the simple 'must follow in file' approach.
* gvdb-reader: robustness improvementsRyan Lortie2012-07-061-13/+36
| | | | | | | | | | | | Improve the robustness of gvdb-reader in two ways. First: ensure that the result of gvdb_table_has_value() always agrees with gvdb_table_get_value(). Those two could disagree in the case that the value was recorded as existing but pointed to an out-of-bounds region. Second: prevent gvdb_table_walk() from getting stuck in finite loops due to self-referential directories.
* more whitespace fixesRyan Lortie2012-07-051-5/+5
|