Commit Graph

655 Commits

Author SHA1 Message Date
Gioacchino Mazzurco
aef87fb1f8
Multiple improvements in debugging helpers
Add variadic style macro helpers that make debugging code disappear completely
  (also the paramethers evaluation) when debugging level is lower
Chained style << is now atomic like variadic style, still can't benefit
  of paramethers eveluation stripping
Reduced to minimum the difference between Android and other platform
  debugging code
Port debugging code to new helpers, expecially a few corner cases to
  test it, and as examples of how to use it.
2020-06-01 00:53:58 +02:00
Gioacchino Mazzurco
c1c303218c
Change raw memory JSON representation
Fix bug reported by b1rdG
The new way permits to add more formats in the future without breaking
  retro-compatibility again.
Add support for RsJson in rsdebug for Android
2020-05-28 23:01:04 +02:00
sehraf
f186422833
fix RawMemoryWrapper serialisation to json, reported by b1rdG 2020-05-17 23:43:03 +02:00
csoler
dc03f8ff49
imprved readability of the logic in rstlvidset serialization 2020-05-16 13:13:48 +02:00
Gioacchino Mazzurco
6fc89c2d37
RawMemoryWrapper DESERIALIZE warn if got non null ptr 2020-04-27 20:22:50 +02:00
csoler
76e9387467
fixed deserialiser for rawWrapper causing crashes when wrapper memory is not initialized properly by the client 2020-04-26 14:19:44 +02:00
Gioacchino Mazzurco
a4950aca66
Safer checks in type serializer 2020-04-14 12:24:58 +02:00
Gioacchino Mazzurco
0187bf2f2f
Suppress eccessive VLQ debugging 2020-04-14 12:17:03 +02:00
Gioacchino Mazzurco
a0da5a3120
Improve debugging 2020-04-14 12:17:02 +02:00
Gioacchino Mazzurco
d666e58403
Fix regression in sequence container FROM_JSON 2020-04-14 12:17:02 +02:00
Gioacchino Mazzurco
fc5ad40c90
Add C++14 template types helpers that seems missing in TravisCI MacOSX 2020-04-14 12:17:02 +02:00
Gioacchino Mazzurco
da66719b83
Fix Android compilation 2020-04-14 12:17:02 +02:00
Gioacchino Mazzurco
5610cc8600
Fix memory management and deprecated removal from serialization
Fix missing RsDiscPgpKeyItem initialization
Fix inconsistent new[]/delete[] usage in RsDiscPgpKeyItem and
  PGPHandler::exportPublicKey which now consistently uses malloc/free
Remove deprecated RsGenericSerializer::FORMAT_*
Move from deprecated RsServiceSerializer::SERIALIZATION_FLAG_* to
  RsSerializationFlags
Solve a bunch of compiler warnings
Stricter checks in SerializeContext costructor
2020-04-14 12:17:01 +02:00
Gioacchino Mazzurco
39bde58c29
Many serialization and related stuff improvements
Fix bug in array-like containers serialization which could cause almost infinite
  loop on malformed input
Implement VLQ integer serialization
Unify sequence containers serialization code
Add support for VLQ serialization also for string size
Use VLQ compression for file links
Add templated function to fix endiannes for all integer types
Use bitset to print flags in binary form
Unify serialization code for integral types
Serialize 64bit integers types to JSON object with both string and integer
  representation, so it is posible to have this representation also for
  containers types like std::vetor or std::map this breaks retrocompatibility
  but is necessary to support clients written in languages which doesn't have
  64 bit integers support such as JavaScript or Dart
2020-04-14 12:17:01 +02:00
Gioacchino Mazzurco
5dbbe1ffd7
Improve debugabbility of JSON API
JSON API server uses standardized error handling based on
  std::error_condition for a few method, this improve debugabbility both
  from library size and from API client side
JSON API auth token are now more flexible, now the only proibition is using
  colon character ':' in user name
Implemented TO_JSON operation for std::error_condition
Avoid unkown serial job handling code duplication via fatalUnknownSerialJob
Usability improvement in t_RsLogger
Disable compilation of now unused is_alphanumeric
2020-01-27 21:22:49 +01:00
Gioacchino Mazzurco
3bb42ca799
Fix wrong rapidjson include on Appveyor 2019-11-28 01:38:49 +01:00
Gioacchino Mazzurco
3a26ccf6a5
Implement deep indexing for files through Xapian
ATM it support extracting metadata only from OGG files.
The system has been designed to be easly extensible to more file formats
  registering more indexer functions which just need to extract metadata
  from a certain type of file and feed it to Xapian.
The system has been integrated into existent file search system to
  through generric search requests and results, it keep a good level of
  retro-compatibility due to some tricks.
The indexing system is released under AGPLv3  so when libretroshare is compiled
  with deep search enabled AGPLv3 must be honored instead of LGPLv3-or-later.
Cleaned up the debian copyright file using non-deprecated license
  code-names.
2019-10-26 15:57:38 +02:00
Gioacchino Mazzurco
6aa85ea292
Fix a couple of warning in JSON serializer 2019-09-09 09:08:00 +02:00
Gioacchino Mazzurco
202cee687e
Implement workaround to JavaScript 53bit int issue
JavaScript represents all numbers in a double like manner thus it
  treats 64 bit integers in an unsafe manner, to workaroud this problem
  provide an alternative strin representation in JSON serialization
  format so JavaScript clients can access the correct value someway.
As JSON have no probles with 64 bits integers keep supporting the integer
  representation too.
See https://stackoverflow.com/a/34989371
2019-08-23 13:41:46 +02:00
Gioacchino Mazzurco
7642216912
Safer rsids API
Deprecate unsafe costructor, substituted by fromBufferUnsafe which explicitely
  marked suggest the caller to pay attention.
Use enum class for id types instead of constants
Make size constants more private
Use internal Id_t alias to avoid huge template lines
Remove and deprecate oguly names in favor of consistent names
2019-05-02 09:55:53 +02:00
defnax
2233af4702
Merge branch 'Attach-picture-for-Posted-links' into master 2019-03-20 11:01:21 +01:00
defnax
c7e4986710 fixed serialization of posts with images
fix by cyril
2019-03-19 23:23:49 +01:00
Phenom
e7fa5556b0 Fix warnings for a lot of destructor called on non-final 'xxx' that has
virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]

In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/
8.2.1/../../../../include/c++/8.2.1/algorithm:62:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/
8.2.1/../../../../include/c++/8.2.1/bits/stl_algo.h:62:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/
8.2.1/../../../../include/c++/8.2.1/bits/stl_tempbuf.h:60:
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/
8.2.1/bits/stl_construct.h:98:7: warning: destructor called on non-final
'xxx' that has virtual functions but non-virtual destructor [-Wdelete-
non-virtual-dtor]
    { __pointer->~_Tp(); }
      ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/
8.2.1/bits/stl_construct.h:108:11: note: in instantiation of function
template specialization 'std::_Destroy<xxx>' requested here
            std::_Destroy(std::__addressof(*__first));
                 ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/
8.2.1/bits/stl_construct.h:137:2: note: in instantiation of function
template specialization 'std::_Destroy_aux<false>::__destroy<xxx *>'
requested here
        __destroy(__first, __last);
        ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/
8.2.1/bits/stl_construct.h:206:7: note: in instantiation of function
template specialization 'std::_Destroy<xxx *>' requested here
      _Destroy(__first, __last);
      ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/
8.2.1/bits/stl_vector.h:567:7: note: in instantiation of function
template specialization 'std::_Destroy<xxx *, xxx>' requested here
        std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
             ^
../../../trunk/libretroshare/src/retroshare/xxx:*:*: note: in
instantiation of member function 'std::vector<xxx, std::allocator<xxx>
>::~vector' requested here
        Something():
        ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/
8.2.1/bits/stl_construct.h:98:19: note: qualify call to silence this
warning
    { __pointer->~_Tp(); }
                  ^
2019-02-14 20:40:52 +01:00
csoler
ad45a7781c
removed test for unsigned long in serialization, and added back pragma to avoid strict aliasing error in rstypes.h 2019-01-25 14:23:08 +01:00
csoler
8ecddc3fa5
compilation experiment 2019-01-25 09:45:21 +01:00
Gioacchino Mazzurco
97633ec8db
Fix crash if JSON object deserialization
In case an object was expected while another type was got RsSerializable
JSON deserialization code was crashing, this commit solve the crash in
this not so corner case
2019-01-10 19:06:35 +01:00
csoler
a802e494f8
Merge pull request #1401 from G10h4ck/forum_api
0.6.5 Safer forum API
2018-11-20 21:45:45 +01:00
csoler
ddca91b0c9
moved some files to unfinished and deleted soem unused files 2018-11-11 14:24:48 +01:00
Gioacchino Mazzurco
72dd985162
Deprecate TLV items, to avoid temptation to use them in new code 2018-11-10 16:28:15 +01:00
Gioacchino Mazzurco
f84824271f
Implement ostream operator<< for RsSerializable
So it is not necessary to define it for each class we want to print in
  debug
2018-11-10 16:24:47 +01:00
Gioacchino Mazzurco
2bb24075c4
Print warning also when serializing negative rstime_t 2018-10-16 16:19:23 +02:00
G10h4ck
03cdd6c7b6
Merge pull request #1363 from G10h4ck/jsonapi
New cross-platform target retroshare-service
2018-10-16 16:06:09 +02:00
sehraf
e6febe0297
remove debug output 2018-10-12 18:20:55 +02:00
G10h4ck
047ae7f723
Merge branch 'master' into jsonapi 2018-10-10 22:23:28 +02:00
csoler
18eee374f1
Merge pull request #1361 from sehraf/pr_jsonfy-rsMsg
[jsonapi] add most remaining functions of rsMsg
2018-10-10 22:04:32 +02:00
Gioacchino Mazzurco
a47eec14e4
Print a warning if deserialized rstime_t is negative 2018-10-10 21:54:50 +02:00
Gioacchino Mazzurco
2139090f5d
Fix bug in JSON t_RsFlags32 deserialization
If the member was not present in the JSON it was zeroed while it should
be left untouched in that case.
This was discovered because in JSON API defualt argument value for
methods wasn't onored for t_RsFlags32 arguments.
2018-10-09 22:43:15 +02:00
Gioacchino Mazzurco
329050a9c2
Use safer rstime_t instead of time_t
Avoid problems to serialization on different platforms, without breaking
nested STL containers serialization.

The conversion have been made with sed, and checked with grep, plus
kdiff3 visual ispection, plus rutime tests, so it should be fine.
2018-10-07 13:07:06 +02:00
sehraf
137bd9cd6d
jsonapi: fix nested std types 2018-10-06 23:50:29 +02:00
Gioacchino Mazzurco
341a68ce07
rstypeserializer fix uninitialized variable usage 2018-10-05 01:23:17 +02:00
sehraf
897c8e0a8a
jsonapi: more rsMsg functions 2018-10-04 22:43:13 +02:00
sehraf
70678ad508
jsonapi: fix std::map<T,U> 2018-10-04 22:43:13 +02:00
csoler
5c2f714ada
merged with upstream/master 2018-08-30 14:50:16 +02:00
Gioacchino Mazzurco
dd55ddea95
Add more consistency checks to serialization code
As suggested by Cyril
2018-08-28 15:20:41 +02:00
sehraf
c754435944
fix deserialisation and improve PRINT job 2018-08-25 17:10:01 +02:00
sehraf
4d03b906b8
convert values properly to string 2018-08-25 16:51:49 +02:00
Gioacchino Mazzurco
afb92999d8
Enable JSON conversion for RsGxsImage via MemBlockProxy 2018-08-24 00:31:25 +02:00
Gioacchino Mazzurco
3b72f912e4
Improve API
Manually expose /rsFiles/getFileData to stream/preview files
Automatically expose a bunch of methods via JSON API
Implement serial_process for std::pair
2018-08-23 01:39:26 +02:00
Gioacchino Mazzurco
4b6f751b09
Implement JSON API generation for async API calls
Move JSON helpers to util/rsjson.* for better usability
Implement JSON ostream manipulator to print compact and pretty JSON
Use lambdas for API wrappers, integrate better and avoid namespace
  pollution
Removed experimental JSON API for notify client wrapper, notifications
  can be implemented automatically with moderns async API calls
Implement and automatically expose to JSON API
  RsGxsChannels::turtleSearchRequest(
        const std::string& matchString,
        const std::function<void (const RsGxsGroupSummary&)>& multiCallback,
        std::time_t maxWait )
2018-08-16 23:48:21 +02:00
csoler
5b1c150acb
added background for post pinning and logic to edit others posts 2018-08-12 15:30:07 +02:00