summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2024-04-24backends: maemo: fix syntax error and automakeHEADmasterMerlijn Wajer2-3/+3
commit e88bfa62 ("C++: automatically determine iterator types") broke the validity of the MaemoCalendarSource.cpp by accident. Also add the necessary dbus CFLAGS/LIBS flags to ensure successful compilation commit e88bfa62143bbbf020c234303c941385c7c19014 Author: Patrick Ohly <patrick.ohly@intel.com> AuthorDate: Wed Jan 31 17:28:28 2018 +0100 Commit: Patrick Ohly <patrick.ohly@intel.com> CommitDate: Sat Dec 5 21:28:08 2020 +0100 C++: automatically determine iterator types
2021-03-21Revert "C++: instantiate some templates once in libsyncevolution"Patrick Ohly2-13/+0
This reverts commit 7d527c6dd8d55b0c8a7d001d5ae71627f38b1beb. It causes link errors on Fedora, see https://bugzilla.redhat.com/show_bug.cgi?id=1926932 This might be a compiler bug, but as this is a not particular important size optimization, removing it is the easiest fix. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06C++: better types for loop variablesPatrick Ohly19-31/+31
This addresses two different warnings from Fedora Rawhide: /srv/runtests/work/sources/syncevolution/src/syncevo/SyncContext.cpp: In member function 'std::string SyncEvo::XMLFiles::get(SyncEvo::XMLFiles::Category)': /srv/runtests/work/sources/syncevolution/src/syncevo/SyncContext.cpp:2390:28: error: loop variable 'entry' of type 'const StringPair&' {aka 'const std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&'} binds to a temporary constructed from type 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' [-Werror=range-loop-construct] 2390 | for (const StringPair &entry: m_files[category]) { | ^~~~~ /srv/runtests/work/sources/syncevolution/src/syncevo/SyncContext.cpp:2390:28: note: use non-reference type 'const StringPair' {aka 'const std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'} to make the copy explicit or 'const std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&' to prevent copying This fails because StringPair has non-const members. By using "auto", we get rid of the need to define and pick exactly the right type. /srv/runtests/work/sources/syncevolution/src/syncevo/SyncConfig.cpp: In member function 'void SyncEvo::SyncConfig::removeSyncSource(const string&)': /srv/runtests/work/sources/syncevolution/src/syncevo/SyncConfig.cpp:2552:36: error: loop variable 'peer' creates a copy from type 'const string' {aka 'const std::__cxx11::basic_string<char>'} [-Werror=range-loop-construct] 2552 | for (const std::string peer: m_tree->getChildren(m_contextPath + "/peers")) { | ^~~~ /srv/runtests/work/sources/syncevolution/src/syncevo/SyncConfig.cpp:2552:36: note: use reference type to prevent copying 2552 | for (const std::string peer: m_tree->getChildren(m_contextPath + "/peers")) { | ^~~~ | & We could have used "auto" also instead of "std::string", but here it doesn't save that much typing and is more readable. We just have to use a reference. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06GTK UI: avoid G_TYPE_INSTANCE_GET_PRIVATEPatrick Ohly2-6/+6
G_TYPE_INSTANCE_GET_PRIVATE was deprecated. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06test: remove unchecked dynamic castPatrick Ohly1-2/+2
Recent g++ on Fedora Rawhide warns that the dynamic cast result is used without NULL check. We know that the cast must succeed, so a static cast is more appropriate. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06gnome: remove libsecret include hackPatrick Ohly1-2/+0
Some older version of libsecret.h lacked `extern "C"`. Adding that manually now causes compile errors on Fedora Rawhide and thus has to be removed: /usr/include/c++/11/type_traits:480:3: error: template with C linkage 480 | template<typename _Tp> | ^~~~~~~~ /srv/runtests/work/sources/syncevolution/src/backends/gnome/GNOMEPlatform.cpp:24:1: note: 'extern "C"' linkage started here 24 | extern "C" { | ^~~~~~~~~~ In file included from /usr/include/glib-2.0/glib/gmacros.h:241, from /usr/lib64/glib-2.0/include/glibconfig.h:9, from /usr/include/glib-2.0/glib/gtypes.h:32, from /usr/include/glib-2.0/glib/galloca.h:32, from /usr/include/glib-2.0/glib.h:30, from /usr/include/libsecret-1/libsecret/secret.h:18, from /srv/runtests/work/sources/syncevolution/src/backends/gnome/GNOMEPlatform.cpp:25: Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06akonadi: avoid link error on Fedora RawhidePatrick Ohly1-1/+1
At least on Fedora Rawhide -lkdeui and -lkdecore are not found and not needed. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-01-24build: boost::placeholdersMilan Crha5-13/+13
On Fedora, Boost placeholders are now in their own namespace. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-22GTK3 sync-ui: drop dependency on libuniquePatrick Ohly1-98/+21
The builtin GtkApplication support is almost equivalent and allows getting rid of the deprecated libunique which isn't available anymore in recent Linux distros. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-22build: only link against libcppunit if neededPatrick Ohly1-2/+8
The --as-needed linker flag didn't work anymore on recent Linux distros, with the result that libcppunit became a library dependency of the syncevolution binaries although they didn't need it. A better approach anyway is to only link the lib when it is expected to be used (unit testing or in client-test). Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-18tde: fix "make dist" issuePatrick Ohly1-4/+14
"make dist" tries to include all source files in the archive, which does not work for the generated files.
2020-12-06tdepim: various changesdeloptes14-482/+117
Submitted by deloptes via private email. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05OBEX: additional debug outputPatrick Ohly1-1/+5
This shows more clearly when OBEX function calls are made, which is relevant for libopenobex2 (OBEX_HandleInput must be called after OBEX_Request).
2020-12-05EDS: avoid dead code warnings when disabledPatrick Ohly2-0/+4
2020-12-05test: fix compiler warning about return code of symlinkPatrick Ohly1-2/+4
2020-12-05EDS: EDS 3.33.2, libecal 2.0 supportMilan Crha6-27/+356
Developed originally by Milan Crha for Fedora, copied and updated by Patrick Ohly. From Milan: There are going to be made huge libecal API changes, as huge as it deserved a version bump from 1.2 to 2.0, and together with it a small libebook API changes, most likely being part of the evolution-data- server 3.33.2 release, which is planned for May 20. More about this can be found here: https://mail.gnome.org/archives/desktop-devel-list/2019-April/msg00016.html Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05SyncSource.h: fix compiler warningPatrick Ohly1-0/+1
Clang complained about "exec" being uninitialized. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05c++: add missing va_endPatrick Ohly1-0/+1
Found via cppcheck. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05c++: avoid slicing exceptionPatrick Ohly1-3/+3
Newer clang (or was it gcc?) warn about catching exceptions by value which have virtual methods. This shouldn't have mattered here because the exception values where not really used, but using a const reference is better nonetheless. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05gdbus: replace helper class with normal glib classesPatrick Ohly5-220/+20
The signond pipe helper class uses deprecated glib methods. Not sure whether that wasn't an option at the time that it was written, but nowadays glib has classes which can be used instead. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: automatically determine iterator typesPatrick Ohly40-117/+115
Having to specify the type of an iterator is annoying and does not really add clarity to the code. With C++11 we can use "auto" instead and in some cases remove helper typedefs. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: instantiate some templates once in libsyncevolutionPatrick Ohly2-0/+13
This saves some space (total number of blocks for SyncEvolution object files when building statically down from 421588 to 413300) and presumably also build times (not measured). However, it did not work for all templates, leading to link errors when trying to add std::map and std::pair of strings. It probably also does not make sense for templates where only some functionality is used. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05util.h: remove unused ToString()Patrick Ohly2-12/+2
It pulled sstream into many compilation units. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: avoid NULLPatrick Ohly113-807/+807
NULL is ambiguous (can be integer and pointer) and using it as terminator for vararg list of pointers without explicit casting to a pointer was downright incorrect. nullptr fixes that. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: replace BOOST_TYPEOFPatrick Ohly3-11/+6
decltype does the same thing. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: remove more boost headers (tuple, assign, utility)Patrick Ohly15-69/+58
Several headers were no longer needed resp. could be replaced by more specific ones like noncopyable.hpp. boost::assign mostly can be replaced with initialization lists and boost::tuple with std::tuple. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: replace pcrecpp with std::regexPatrick Ohly15-100/+193
This allows us to get rid of an external dependency. Mostly std::regex works, but there are limitations that have to be worked around: - no multiline support in C++11 - conversion of groups to non-string types has to be done manually While at it, use raw strings to get rid of excessive backslash escaping. pcrecpp::StringPiece was used as a general-purpose utility class. Now we have our own implementation. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: avoid boost::scope_ptr/array and plain pointersPatrick Ohly32-362/+278
std::unique_ptr usually can be used instead. std::vector also works for arrays and even has a data() method as part of the official API in C++11. For historic reasons, the functions creating SyncSources returned plain pointers. We are breaking the API now, so we might as well fix that. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05src/async.patch: remove obsolete patchPatrick Ohly1-532/+0
This was committed to SVN, probably because it might have become relevant again. Now it is long obsolete. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: replace boost::shared_ptr, boost::function, boost::bindPatrick Ohly148-3452/+2986
We can use std::shared_ptr and std::function instead now. Lambdas are usually a better alternative to boost/std::bind. The downside is the need to explicitly specify parameters completely. When inlining callbacks entirely with lambdas, duplication of that parameter list can be avoided. Whenever possible, use std::make_shared to construct objects that are tracked by std::shared_ptr. Some objects need a std::weak_ptr during object destruction. For that we have to use our own implementation of std::enable_shared_from_this, with a matching creator function. The additional benefit is that we can get rid of explicit static "create" methods by making that create function a friend. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: avoid "using namespace std"Patrick Ohly24-327/+305
It saved some typing, but isn't good style. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: simpler for loopsPatrick Ohly61-480/+413
boost/foreach.hpp is no longer needed, range-based loops work the same. With some helpers, even reverse iteration and boost::make_split_iterator() can be handled the same way. "auto" makes it possible to avoid explicitly spelling out the expected type. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: lambdas instead of static methodsPatrick Ohly10-178/+135
Lambdas without variable capture are guaranteed to be compatible with plain C functions, so we can use them as callbacks. That keeps the code closer together and avoids having to declare helper methods as part of the public class. In some cases the static method is the actual code, in which case only "nothrow()" gets replaced with "noexcept" because it's cleaner and to mark that the code was looked at and intentionally left as-is. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: more modern timeout.hPatrick Ohly1-44/+44
Universal references and template methods make it possible to pass through arbitrary callbacks right through to the point where we need to create a std::function for a plain-C lambda. Boost is not needed anymore. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: variadic connectSignal()Patrick Ohly3-133/+54
By specifying the list of signal types as template parameters it becomes possible to use a single implementation. Lambdas can replace explicit callback methods. The reimplementation is more flexible and does not enforce the use of a boost::function. This matches how connectSignal() was used in practice. Thanks to universal references, the boost::bind instances get moved directly into the allocated instances that are attached to the signal handler. The downside is that the call syntax changes slightly, because partially specifying template parameters does not work. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: variadic templates in D-Bus bindingsPatrick Ohly25-3462/+503
Using templates with a varying number of types allows removing duplicated code for the different cases. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05SyncSource.h: variadic templatesPatrick Ohly1-381/+31
The OperationWrapperSwitch class can be reduced to just two cases, which reduces code duplication considerably. Conditional compilation with "if constexpr" could be used to eliminate the helper class entirely, but that's C++17. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05C++: use lambdas instead of boost::lambda, std::exception_ptrPatrick Ohly8-64/+25
The code becomes a lot more readable. One can also set breakpoints inside the callbacks. Exception handling in GRunInMain() is better now, with the ability to rethrow arbitrary exceptions thanks to std::exception_ptr. Only some usage of boost::lambda in the Akonadi backend remains. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05syncevo-dbus-server: remove virtual address book featurePatrick Ohly32-14507/+0
This aspect of syncevo-dbus-server had been developed for use in an IVI head unit. It's currently neither used nor tested and no longer compiles (timeout.h moved, API changes in libfolks). Instead of trying to keep it working while enhancing the usage of C++, removing it entirely is easier. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05gdbus: remove old libdbus-based implementationPatrick Ohly16-8699/+0
GIO D-Bus is a more modern and capable implementation. The older one was only needed on certain old Linux distros (Maemo) which did not have a recent enough glib. The reason for removing the old one is that it allows making API incompatible changes for the C++ D-Bus binding without having to do that in two places. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05connection.cpp: better check for obex-bt:// URLsPatrick Ohly1-1/+1
cppcheck started complaining about std::string::find() being inefficient. boost::starts_with() would indeed be better, but even simpler and more readable is a whole-string comparison. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05installcheck-local.sh: test with C++14Patrick Ohly1-3/+4
Some header files use C++14 features. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05SuspendFlags: restore printing of messagesPatrick Ohly1-0/+1
Commit 5bafef3957bc32a2deb5a917c7773fcd92e8b953 (included in v1.4) broke the printing of the messages about Ctrl-C handling, in particular the hint that using it quickly will switch from suspending to aborting. The message code was getting overwritten by a new default case due to a missing break. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05installcheck-local.sh: test with C++11Patrick Ohly1-2/+5
Some header files use C++11 features. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05timeout.h: include glib.hPatrick Ohly1-0/+2
The header file is not usable without glib. Users of it need to be aware of that. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05installcheck-local.sh: test with glib enabledPatrick Ohly1-2/+2
At least timeout.h only works with glib, and that's okay. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05SoupTransportAgent: fix disabled SSL checkingPatrick Ohly1-4/+5
The SoupTransportAgent modernization in 1.5.3 led to SSL checking always being enabled because the default changed from disabled to enabled and SyncEvolution did not set it. Worse, in older versions it probably (untested) was always disabled because it was not enabled either. Now the checking of SSL is always set explicitly and thus always mirrors the SyncEvolution configuration. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05sync: avoid setenv()Patrick Ohly6-44/+79
set/getenv() are not thread-safe, and a recent bug report via private email shows that this does cause segfaults: Thread 4 (Thread 19251): .... Thread 1 (Thread 19311): ... In this case, DLT was used and the setenv call was setting the LIBSYNTHESIS_<context> variables. The solution is to avoid setenv() in code which might run in parallel to other threads: - DLT-related variables are set at the beginning of syncevo-dbus-server startup which then gets inherited by syncevo-dbus-helper and in the environment prepared for syncevo-local-sync (because the latter might run with a different log level) - the default for SYNCEVOLUTION_PBAP_SYNC is now "incremental" everywhere and SyncContext is told about the special mode where it needs to keep photo data differently, i.e. setting SYNCEVOLUTION_PBAP_SYNC in dbus-sync.cpp for PBAP syncing is no longer necessary Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05signon: fix pcrecpp build flagsPatrick Ohly1-2/+2
Dropping the pcrecpp build hacks in the nightly testing showed that the flags for normal linking and compilation were missing. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05test: convert scripts to Python3Patrick Ohly1-0/+2
This is the result of 2to3, with the interpreter path updated manually, tabs replaced by spaces and some obsolete packages removed. Required because the current nightly build host no longer has Python2 installed. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>