summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-08-26WIP on nightly: 3974869 syncsession.h: fix ↵master-nextSyncEvolution Nightly Testing1-5/+47
TDevInfResultsCommand::shrinkCommand()
2016-08-26index on nightly: 3974869 syncsession.h: fix ↵SyncEvolution Nightly Testing0-0/+0
TDevInfResultsCommand::shrinkCommand()
2016-08-26syncsession.h: fix TDevInfResultsCommand::shrinkCommand()Patrick Ohly1-1/+1
In (probably mostly unused code?) the previous boolean result of getIncomingState() was compared against the enum, which looks wrong. Probably getIncomingState() was meant to return the enum. gcc6 warned about this: synccommand.cpp:4277:36: error: comparison of constant '1' with boolean expression is always false [-Werror=bool-compare] fSessionP->getIncomingState()>psta_init, // alerted only if init complete
2016-08-26itemfield.cpp: gcc6/C++14 compatibilityPatrick Ohly1-2/+2
Recent gcc and/or C++14 changed the definition of abs() such that applying it to a 16bit integer resulted in a float, leading to: itemfield.cpp:1491:27: error: invalid operands of types '__gnu_cxx::__enable_if<true, double>::__type {aka double}' and 'const int' to binary 'operator%' (uInt16)(abs(moffs) % MinsPerHour)
2016-08-26Linux: avoid _BSD_SOURCE deprecation warning from gcc 6Patrick Ohly4-5/+5
This fixes: # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
2016-08-26Linux time zones: ask recent libical for portable timezone definitionsPatrick Ohly2-1/+9
libical 2.0 has an API call to enable the portable timezone definitions required by libsynthesis (one entry for summer, one for winter). When possible (= compiling without compatibility hack, libical recent enough) we should use that.
2016-08-26configure.in: avoid indention warnings from gcc 6Patrick Ohly1-2/+2
The source code was intentionally formatted by the upstream authors so that statements sometimes align with surrounding code even if indention according to program flow would be different. Instead of fixing large amounts of code, better just ignore this warning.
2015-03-03TCustomImplDS::getItemFromSyncSetItem: remove redundant NULL checklibsynthesis_3.4.0.47+syncevolution-1-5-1Patrick Ohly1-3/+2
Despite what the comment for the method said, the parameter was dereferenced unconditionally and thus was not allowed to be NULL. Fixing the comment and removing the redundant NULL check. Found with clang.
2015-03-03DLL API: fix potential va_start leakPatrick Ohly1-3/+4
va_start() may allocate resources and thus has to be matched by va_end(). Found with cppcheck 1.67.
2015-03-03vStringObjPrintf: fix potential va_start leakPatrick Ohly1-1/+2
va_start() may allocate resources and thus has to be matched by va_end(). Found with cppcheck 1.67.
2015-02-16platform_DLL.cpp: avoid redundant "this" pointer checkPatrick Ohly1-1/+1
clang 3.5.0 warns about checking the "this" pointer because it cannot be NULL. This safe-guard against incorrect usage of the class indeed seems to be impossible, so remove the check.
2015-02-16iso8601.cpp: fix abs(long) compiler warningPatrick Ohly1-1/+1
Implicit conversion of long to int when calling abs() triggers a compiler warning in clang 3.5.0.
2015-02-16MIME encoder: no quotation marks around TZID valuesPatrick Ohly1-1/+2
The / in TZID values like Europe/Paris caused the code from "MIME parser + encoder: no backslash quoting in parameter values" (8a7356c, libsynthesis_3.4.0.47+syncevolution-1-4-99-2~6) to quote the TZID value. The Funambol OneMedia iCalendar 2.0 parser fails to handle this; instead it imports events without applying the time zone. It is not necessary to use quotation marks around values containing a slash, so add the slash to the white list of characters which do no trigger quoting.
2014-10-30autotools: bump Linux/SyncEvolution sub-version for RELAXEDCOMPARE()libsynthesis_3.4.0.47+syncevolution-1-5Patrick Ohly1-1/+1
2014-10-30merge script: check order of entries in RELAXEDCOMPARE()Patrick Ohly1-51/+44
This stricter version of RELAXEDCOMPARE() reports a difference also when only the order of entries differs. This is easier to implement, faster at runtime (min(n,m) comparisons instead of (n*m)), and takes into account that the order may be relevant.
2014-10-30merge scripts: new RELAXEDCOMPARE(), enhanced MERGEFIELDS()Patrick Ohly3-6/+166
Caching mode in SyncEvolution only worked if the incoming item matched the stored one exactly. Otherwise changing the order of items (e.g. TEL followed by EMAIL instead of EMAIL followed by TEL) caused arrays to be different (because of the shared LABEL array), and that difference in the arrays led to rewriting items even if nothing changed. Because of the decode/encode step before storing a new item, caching only worked reliably when the incoming item was also decoded and encoded once, which is unnecessary overhead and only worked when using a storage with the same encoding as the local sync. A better solution is to use a more intelligent merge script: - check whether arrays are identical except for ordering (done with the new RELAXEDCOMPARE()) - ignore arrays which were found to be similar enough (by passing a new parameter listing these fields to MERGEFIELDS(). In essence, MERGEFIELDS() then is only asked to check the remaining fields or merge arrays if relevant differences were found. At the moment, RELAXEDCOMPARE() only checks that entries in the arrays match. It does not check that their order is the same. This could (should!) be added and would also make the comparison faster when there are differences (because it only needs to compare the next non-empty entries).
2014-09-10autotools: bump Linux/SyncEvolution sub-version for memory function pointers ↵libsynthesis_3.4.0.47+syncevolution-1-4-99-4Patrick Ohly1-1/+1
and bug fixes
2014-09-10engine: fix use-after-free bug when delaying command executionPatrick Ohly1-2/+6
In one particular case, a pending command that needs more data, the engine crashed because delayed command execution code path deleted the command still needed for the next chunk (found in Client::Sync::eds_contact_eds_memo::testLargeObject).
2014-09-04config: enable memory function pointers for Linux combi enginePatrick Ohly1-0/+3
SyncEvolution will intercept alloc/free during local sync to put message buffers into shared memory and thus needs this feature enabled.
2014-09-04SMLTK: call memory functions through pointersPatrick Ohly3-2/+24
This additional indirection allows users of the library to replace the default implementation from libc. The feature is optional. In libsynthesis it can be enabled in target_options.h. Users of libsynthesis do not have access to libmem.h, so they need to provide their own declaration of the function pointers.
2014-09-04SMLTK: use sane MemSize_t when stdint.h is availablePatrick Ohly1-0/+8
A signed long for the memory functions is inconsistent with systems that have a standard malloc/realloc. Better use size_t.
2014-09-04avoid assumptions about MemSize_t typePatrick Ohly4-7/+7
Some code only compiles cleanly when MemSize_t is signed. Otherwise there are signed/unsigned comparison and printf format warnings. Avoid those by casting the values which are known to be positive to MemSize_t or long in debug output.
2014-09-04SMLTK: eliminate redundant prototypes in sml.hPatrick Ohly1-7/+0
Some functions were defined in both sml.h and libmem.h. Let's use libmem.h as the authoritative place and eliminate the copies in sml.h. Will be necessary when enhancing libmem.h.
2014-09-04binfile: avoid unnecessary write and truncatePatrick Ohly1-2/+19
The goal is to leave binfile completely untouched, including its "last modified" time stamp, if nothing changes. There are cases where the upper layers will call TBinFileBase::updateRecord() and write the same data that already is in the file. Instead of catching those case-by-case, let's check at the lowest level. On btrfs (and possibly other file systems), ftruncate() bumps the "last modified" time stamp of a file even if the requested size matches the existing one. Avoid that by skipping the ftruncate() when the file already has the desired size.
2014-08-29binfileclient: avoid disk writes in changeLogPreflight()Patrick Ohly1-5/+19
During a normal sync where nothing changed, only the header gets updated. This change is not critical and thus does not have to be flushed to disk unless also some entries get added or updated. The advantage is that when SyncEvolution detects a sync where nothing changed on either side and skips the client's session shutdown, the .bfi is left unchanged, which reduces flash wearout. To detect item changes, a brute-force byte comparison is used. This requires less changes to the code and is less error-prone than adding "modified=true" to all places where "existingentries" gets modified.
2014-08-29syncsession: avoid unnecessary nonce updatePatrick Ohly1-2/+9
When the configure auth type needs no nonce, don't generate one and return NULL immediately, like newChallenge() would do. That avoids unnecessary disk writes for storing the new nonce, which is important for local syncs in IVI. It also avoids debug output about a challenge that would not get sent.
2014-07-22autotools: modernize AM_INIT_AUTOMAKE/AC_INITlibsynthesis_3.4.0.47+syncevolution-1-4-99-3Patrick Ohly1-3/+3
Package name and version should be passed to AC_INIT according to current Automake documentation. In addition, we need to pass subdir-objects as option to AM_INIT_AUTOMAKE to avoid warnings about the location of our object files (first seen with automake 1.14.1).
2014-07-22autotools: bump Linux/SyncEvolution sub-version for /dev/null binfilesPatrick Ohly1-1/+1
2014-07-22binfile: /dev/null datadir pathPatrick Ohly2-2/+79
When the client already knows that it is never going to sync again or the next sync will have to be a slow sync anyway, then the binfile client files are not needed. Suppressing writing of them is useful on devices with flash memory to avoid flash wearout. The specific use case is PBAP caching in a car's head unit. When setting "/dev/null" as datadir, the platform layer will avoid creating the files and instead keep their content in memory. This is required (and sufficient) for syncing once, which will close and later read from some files at least once. Therefore the data cannot be thrown away completely.
2014-07-22dead code removalPatrick Ohly3-26/+2
clang 3.4 warned about unused global variables.
2014-07-22binfile: avoid error logging of LOCERR_AGAINPatrick Ohly1-4/+12
Item operations returning LOCERR_AGAIN do not need to be logged as error. This will trigger logging elsewhere, so don't log it at all in the binfile layer.
2014-07-22ODBC: avoid clang warningPatrick Ohly1-1/+1
clang 3.4 points out that the ! in !aQuoteMode!=qm_none in quoteStringAppend() only gets applied to aQuoteMode. Explicit brackets silence the compiler warning without changing the expression. The compiler indeed points out some unusual code. The if branch is taken for aQuoteMode == qm_none (probably what was intended) because !qm_none != qm_none with qm_none == 0 and not taken for all other values where !aQuoteMode is false and thus equal to qm_none. It probably would be simpler to write "if (aQuoteMode == qm_none)" but I don't want to change the meaning of the code.
2014-07-14string fields: full comparePatrick Ohly1-3/+3
String fields also get used for arbitrary binary data, like photos. In that case we need to compare the entire std::string, not just the part before any embedded null byte. This gets done using std::string::compare. Case-insensitive comparison still uses C strucmp() and thus should never be used for non-string data.
2014-07-03fix asynchronous item updatePatrick Ohly1-2/+9
gcc 4.9 found a flaw in the code path for updating an item when the DB detects a duplicate: some variables where not preserved across function restarts.
2014-07-02stdlogicds: avoid implicit NULL->false conversionPatrick Ohly1-1/+1
gcc 4.9 warns about initializing a boolean with NULL. Probably should have been false to start with.
2014-07-02odbc: remove unused memberPatrick Ohly1-1/+0
fIsStringBLOB is only used in pluginapids. Found by gcc 4.9.
2014-07-02smltk: fix signed/unsigned comparisonPatrick Ohly1-1/+1
gcc 4.9 warns that "if (ext == 255)" is always false due to casting rules. Need to convert 255 into the same type as ext, as done elsewhere.
2014-07-02binfile: remove unused local variablesPatrick Ohly1-9/+3
gcc 4.9 warns about the unused local variables. sizeof() does not need real variables, so use a casted NULL pointer instead and get rid of the variables and the warning.
2014-07-02SDK: fix gcc 4.9 warningPatrick Ohly1-1/+1
gcc 4.9 warns about uninitialized tctx. It doesn't seem to notice that the code using it is not reached unless ISO8601StrToTimestamp() succeeds and initializes the variable first. Suppress the warning by initializing to zero first.
2014-07-01cppcheck annotationsPatrick Ohly3-0/+14
cppcheck 1.65 warns about uninitialized variables in the "retry function" code blocks. These are false positives because the code is only reached after initializing them and/or restoring unitialized variables would not matter. Have to add inline suppressions to get rid of the warnings.
2014-07-01SDK: avoid cppcheck warningPatrick Ohly1-2/+2
cppcheck 1.65 warned about uninitialized variables because it did not fully understand the indirect "if no file, then error, if no error, then use file" logic. Simplifying the code to check the file directly avoids the false positives and also is easier to read for humans.
2014-05-17autotools: bump Linux/SyncEvolution sub-version for URLENCODE/DECODE and ↵libsynthesis_3.4.0.47+syncevolution-1-4-99-2Patrick Ohly1-1/+1
sharedfield
2014-05-12mimedir parser: avoid reusing group tagPatrick Ohly1-2/+5
When two properties (TEL and X-ABLabel in this example) share the same group field, then storing the property where a group tag was used for the first time must not reuse unassigned group field entries. There was some logic for that already (see "someGroups"), but it failed to handle this case. This approach here uses brute-force instead of trying to me smart: the reuse check in the n<maxrep for loop will fail repeatedly at the beginning until reaching the end of the group field array.
2014-05-12logging: threaded logging when reusing loggerPatrick Ohly2-2/+12
In an app which starts a session with some already existing logger, the session logger doesn't have enough information (no output channel, no log path) to create thread-specific loggers. It must let the parent logger do that.
2014-05-12MIME parser + encoder: remove dead codePatrick Ohly1-4/+0
The variable assignment became redundant when removing the backslash escaping support for parameters in "MIME parser + encoder: no backslash quoting in parameter values".
2014-05-12scripting: fix memory leak in SWAP()Patrick Ohly1-0/+2
The temporary variable was never freed.
2014-05-09scripting: URL encode/decodePatrick Ohly3-0/+53
The URLDECODE() function unescapes all %XX sequences. URLENCODE() escapes everything which is not alphanumeric.
2014-05-06MIME parser + encoder: no backslash quoting in parameter valuesPatrick Ohly1-18/+42
RFC 2425 (MIME DIR) and RFC 6350 (vCard) do not describe backslash escaping for special characters in parameter values. Only the more limited quoted-string (double quotes at start and end, no line breaks, no double quotes inside value) is specified. The following two examples both contain a literal backslash: URL;X-ABLabel="Custom-label6 Backslash \":http://custom.com X-ABRELATEDNAMES;X-ABLabel="custom-label5 Umlaut ä Semicolon ; Backslash \ end of label":custom relationship This commit limits backslash escaping to parsing and generating property values. Backslashs in parameters are stored literally during parsing. A quoted string parameter value is used for every value that is more complex than alphanumeric plus underscore and hyphen. In particular spaces (while allowed in unquoted values) are only generated as part of quoted strings because the Evolution Data Server parser had problems with them (fixed in EDS 3.10).
2014-05-06profile: <parameter sharedfield>Patrick Ohly2-6/+58
Traditionally, the value of a property and its parameter values get stored in fields reserved for that property such that there is no overlap with other properties. In such a scenario it is enough to check for unused fields used for the property value, because the corresponding parameter fields are guaranteed to be available once a repetition is found. However, once the same field is used for different properties the check and creation becomes more complicated: when parsing properties, the shared field must also be checked. It is not enough for it to be empty, it also must not be in use at all, because otherwise a value might get added to the repetition used already by some other property. This check only makes sense (and only works) for array fields. It is disabled by default and needs to be enabled explicitly with the new parameter attribute "sharedfield". Storing values must ensure that the shared array field gets resized if the parameter was not set, otherwise the check would fail to detect used repetitions. The effect of using a shared field is that arrays contain a lot of unassigned values because index overlaps between otherwise unrelated properties get avoided. This feature was needed for converting between a profile with custom labels in a X-ABLabel property attached to various contact properties (ADR, TEL, X-ABDate, etc.) via group tags and a profile using a property parameter instead. The label array field is the shared field in this case.
2014-01-27debuglogger: close log file on execlibsynthesis_3.4.0.47+syncevolution-1-4-99-1libsynthesis_3.4.0.47+syncevolution-1-4-1libsynthesis_3.4.0.47+syncevolution-1-4libsynthesis_3.4.0.47+syncevolution-1-3-99-7-20140203Patrick Ohly1-4/+26
When using fork+exec on Linux, open files get inherited by the child process unless explicitly marked as FD_CLOEXEC. We should set that flag at least for files which remain open (like the log file when dbgflush_openclose is not active). A truly thread-safe approach would have to use open(O_CLOEXEC), but setting the flag later is sufficient for us. This change is limited to Linux to avoid interfering with other platforms.