diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2014-01-08 05:01:01 -0800 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2014-01-08 05:01:01 -0800 |
commit | d89d803eee538bada7d7b2acd81ec28d28a83619 (patch) | |
tree | c8ddee0d5fb1a28cfd57813e90b1bef04eff3be5 | |
parent | c018d7a53b42e84fe8a6a124a9cebfd147d4b940 (diff) |
binfileimplclient: simplify code flow analysis
When the first if check fails, the second one also fails and
thus it and its code only need to be executed when the first
one succeeds.
This is irrelevant for performance. The reason for changing it is
that it avoids a false positive in cppcheck.
-rwxr-xr-x | src/sysync/binfileimplclient.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/sysync/binfileimplclient.cpp b/src/sysync/binfileimplclient.cpp index 4dce870..961e014 100755 --- a/src/sysync/binfileimplclient.cpp +++ b/src/sysync/binfileimplclient.cpp @@ -1642,45 +1642,45 @@ sInt32 TBinfileClientConfig::newProfile(const char *aProfileName, bool aSetDefau // copy from template profile, if any if (aTemplateProfile>=0) { aTemplateProfile=getProfile(aTemplateProfile,templateprofile); - } - if (aTemplateProfile>=0) { - // copy user config - profile.encoding=templateprofile.encoding; - #ifndef HARD_CODED_SERVER_URI - strncpy(profile.serverURI,templateprofile.serverURI,maxurisiz); // if hardcoded, don't copy from template - #endif - strncpy(profile.serverUser,templateprofile.serverUser,maxupwsiz); - strncpy(profile.transportUser,templateprofile.transportUser,maxupwsiz); - strncpy(profile.socksHost,templateprofile.socksHost,maxurisiz); - strncpy(profile.proxyHost,templateprofile.proxyHost,maxurisiz); - strncpy(profile.proxyUser,templateprofile.proxyUser,maxupwsiz); - // additional proxy flags - profile.useProxy=templateprofile.useProxy; - profile.useConnectionProxy=templateprofile.useConnectionProxy; - // improved URI settings - strncpy(profile.URIpath,templateprofile.URIpath,maxpathsiz); - profile.protocol=templateprofile.protocol; - // feature flags - profile.readOnlyFlags = 0; // no read-only flags by default - profile.featureFlags=templateprofile.featureFlags; // inherit features - profile.dsAvailFlags=templateprofile.dsAvailFlags; // inherit datastore availability - // extras - profile.transpFlags=templateprofile.transpFlags; // inherit transport related flags - profile.profileFlags=templateprofile.profileFlags; // inherit general profile flags - // Note: do not copy profileExtra1/2 and profileData - as these are too app specific - // local DB profile (not used in PPC, only for Outlook client) - strncpy(profile.localDBProfileName,templateprofile.localDBProfileName,localDBpathMaxLen); - // autosync settings - profile.AutoSyncLevel[0]=templateprofile.AutoSyncLevel[0]; - profile.AutoSyncLevel[1]=templateprofile.AutoSyncLevel[1]; - profile.AutoSyncLevel[2]=templateprofile.AutoSyncLevel[2]; - // timed sync settings - profile.TimedSyncMobilePeriod=templateprofile.TimedSyncMobilePeriod; - profile.TimedSyncCradledPeriod=templateprofile.TimedSyncCradledPeriod; - /* %%% do not copy IPP settings, these should be provisioned by the SyncML server - // IPP settings (not available in all clients, but present in all profile records - profile.ippSettings=templateprofile.ippSettings; - */ + if (aTemplateProfile>=0) { + // copy user config + profile.encoding=templateprofile.encoding; + #ifndef HARD_CODED_SERVER_URI + strncpy(profile.serverURI,templateprofile.serverURI,maxurisiz); // if hardcoded, don't copy from template + #endif + strncpy(profile.serverUser,templateprofile.serverUser,maxupwsiz); + strncpy(profile.transportUser,templateprofile.transportUser,maxupwsiz); + strncpy(profile.socksHost,templateprofile.socksHost,maxurisiz); + strncpy(profile.proxyHost,templateprofile.proxyHost,maxurisiz); + strncpy(profile.proxyUser,templateprofile.proxyUser,maxupwsiz); + // additional proxy flags + profile.useProxy=templateprofile.useProxy; + profile.useConnectionProxy=templateprofile.useConnectionProxy; + // improved URI settings + strncpy(profile.URIpath,templateprofile.URIpath,maxpathsiz); + profile.protocol=templateprofile.protocol; + // feature flags + profile.readOnlyFlags = 0; // no read-only flags by default + profile.featureFlags=templateprofile.featureFlags; // inherit features + profile.dsAvailFlags=templateprofile.dsAvailFlags; // inherit datastore availability + // extras + profile.transpFlags=templateprofile.transpFlags; // inherit transport related flags + profile.profileFlags=templateprofile.profileFlags; // inherit general profile flags + // Note: do not copy profileExtra1/2 and profileData - as these are too app specific + // local DB profile (not used in PPC, only for Outlook client) + strncpy(profile.localDBProfileName,templateprofile.localDBProfileName,localDBpathMaxLen); + // autosync settings + profile.AutoSyncLevel[0]=templateprofile.AutoSyncLevel[0]; + profile.AutoSyncLevel[1]=templateprofile.AutoSyncLevel[1]; + profile.AutoSyncLevel[2]=templateprofile.AutoSyncLevel[2]; + // timed sync settings + profile.TimedSyncMobilePeriod=templateprofile.TimedSyncMobilePeriod; + profile.TimedSyncCradledPeriod=templateprofile.TimedSyncCradledPeriod; + /* %%% do not copy IPP settings, these should be provisioned by the SyncML server + // IPP settings (not available in all clients, but present in all profile records + profile.ippSettings=templateprofile.ippSettings; + */ + } } #ifndef HARD_CODED_SERVER_URI // override with config-defined fixed server URL, if any |