Normally, we do a fuzzy-match for the keys
in JSON (presumably, there has been typos
and minor differences in the spelling of
keys in the past).
However, this can be wrong if there are
two rather similar keys. In that case,
we should always prefer the exact match.
Also, the exact match is faster, since
it's a map lookup (logarithmic) rather
than a linear search with Levenshtein
distance algorithm on each entry,
which is quadratic.
Change-Id: If88d13a305a0c67cc00c3f3f22c7dc472666a1ff
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This should take care e.g. for SharePoint user IDs, which have the
form of "domain\username", and the backslash must be escaped.
Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I75936070ad1661dc9b03e05a19b64159b0758018
To be able to locate them in the logs more easily; this is likely to
catch mistakes early in the development of new integrations.
Change-Id: I11c528d11e4a4e1d13f8d32085fa1bf1a163b779
Signed-off-by: Jan Holesovsky <kendy@collabora.com>
size_t in C and in C++ are not necessarily the same
type. The C++ size_t is in the std namespace. Since
we do include many C headers, and indeed some C++
runtime headers do define size_t for backwards
compatibility, it's easy to mix and match the two
types.
Also, 'using std::size_t;' isn't a great practice,
so removed.
This is not exhaustive, just some low-hanging cases.
Change-Id: I85a36b6fd1acd204274b1869de9bcb94c8b3cf13
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
More readable and typically more efficient.
Change-Id: I9bd5bfc91f4ac255bb8ae0987708fb8b56b398f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95285
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
LibreOffice core uses that, too, and we support an even more
restricted set of compilers.
Change-Id: I0d0e2c8608e323eb5ef0f35ee8c46d02ab49a745
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92467
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Better logging during wopi info parsing,
especially upon failures.
Refactored the code from Storage.cpp into
JsonUtil.hpp.
Minor optimizations.
Add unit-tests for the parsing logic.
Change-Id: Ifebc3f6b7030a6c7b3b399786633f6b5e8737478
Reviewed-on: https://gerrit.libreoffice.org/49927
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>