Fix KW P1 related issues

Change-Id: Ifc3cb9dcabf2e07439fd596b5ad33b46ea562b3d
CRs-fixed: 2375836
This commit is contained in:
Yingjie Wang 2019-01-04 15:56:04 +08:00
parent 3203504a28
commit abfeea182d
3 changed files with 14 additions and 9 deletions

View file

@ -1999,8 +1999,10 @@ GnssAdapter::restartSessions()
} }
// get the LocationOptions that has the smallest interval, which should be the active one // get the LocationOptions that has the smallest interval, which should be the active one
TrackingOptions smallestIntervalOptions = {}; // size is zero until set for the first time TrackingOptions smallestIntervalOptions; // size is zero until set for the first time
TrackingOptions highestPowerTrackingOptions = {}; TrackingOptions highestPowerTrackingOptions;
memset(&smallestIntervalOptions, 0, sizeof(smallestIntervalOptions));
memset(&highestPowerTrackingOptions, 0, sizeof(highestPowerTrackingOptions));
for (auto it = mTrackingSessions.begin(); it != mTrackingSessions.end(); ++it) { for (auto it = mTrackingSessions.begin(); it != mTrackingSessions.end(); ++it) {
// size of zero means we havent set it yet // size of zero means we havent set it yet
if (0 == smallestIntervalOptions.size || if (0 == smallestIntervalOptions.size ||
@ -3022,8 +3024,8 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
loc_nmea_generate_pos(ulpLocation, locationExtended, mLocSystemInfo, loc_nmea_generate_pos(ulpLocation, locationExtended, mLocSystemInfo,
generate_nmea, nmeaArraystr); generate_nmea, nmeaArraystr);
stringstream ss; stringstream ss;
for (auto sentence : nmeaArraystr) { for (auto itor = nmeaArraystr.begin(); itor != nmeaArraystr.end(); ++itor) {
ss << sentence; ss << *itor;
} }
string s = ss.str(); string s = ss.str();
reportNmea(s.c_str(), s.length()); reportNmea(s.c_str(), s.length());
@ -3118,8 +3120,8 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
std::vector<std::string> nmeaArraystr; std::vector<std::string> nmeaArraystr;
loc_nmea_generate_sv(svNotify, nmeaArraystr); loc_nmea_generate_sv(svNotify, nmeaArraystr);
stringstream ss; stringstream ss;
for (auto sentence : nmeaArraystr) { for (auto itor = nmeaArraystr.begin(); itor != nmeaArraystr.end(); ++itor) {
ss << sentence; ss << *itor;
} }
string s = ss.str(); string s = ss.str();
reportNmea(s.c_str(), s.length()); reportNmea(s.c_str(), s.length());

View file

@ -219,8 +219,11 @@ void XtraSystemStatusObserver::notify(const list<IDataItemCore*>& dlist)
} }
inline ~HandleOsObserverUpdateMsg() { inline ~HandleOsObserverUpdateMsg() {
for (auto each : mDataItemList) { for (auto itor = mDataItemList.begin(); itor != mDataItemList.end(); ++itor) {
delete each; if (*itor != nullptr) {
delete *itor;
*itor = nullptr;
}
} }
} }

View file

@ -106,7 +106,7 @@ public:
// This class hides generated fd and destination address object from user. // This class hides generated fd and destination address object from user.
inline LocIpcSender(const char* destSocket): inline LocIpcSender(const char* destSocket):
LocIpcSender(std::make_shared<int>(::socket(AF_UNIX, SOCK_DGRAM, 0)), destSocket) { LocIpcSender(std::make_shared<int>(::socket(AF_UNIX, SOCK_DGRAM, 0)), destSocket) {
if (-1 == *mSocket) { if (mSocket != nullptr && -1 == *mSocket) {
mSocket = nullptr; mSocket = nullptr;
} }
} }