KW warnings

dlsym on gps_geofence_get_interface should check NULL,
and gmtime return should also check NULL

Change-Id: I23ab17f016ad9f4667ac197c12f016433c48af90
CRs-Fixed: 674884
This commit is contained in:
Kevin Tang 2014-06-03 16:13:59 -07:00 committed by Matt Filetto
parent f1007a32c1
commit f0567dad27
2 changed files with 7 additions and 4 deletions

View File

@ -521,7 +521,7 @@ const GpsGeofencingInterface* get_geofence_interface(void)
}
dlerror(); /* Clear any existing error */
get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface");
if ((error = dlerror()) != NULL) {
if ((error = dlerror()) != NULL && NULL != get_gps_geofence_interface) {
LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error);
goto exit;
}

View File

@ -119,14 +119,17 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
unsigned char generate_nmea)
{
ENTRY_LOG();
time_t utcTime(location.gpsLocation.timestamp/1000);
tm * pTm = gmtime(&utcTime);
if (NULL == pTm) {
LOC_LOGE("gmtime failed");
return;
}
char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
char* pMarker = sentence;
int lengthRemaining = sizeof(sentence);
int length = 0;
time_t utcTime(location.gpsLocation.timestamp/1000);
tm * pTm = gmtime(&utcTime);
int utcYear = pTm->tm_year % 100; // 2 digit year
int utcMonth = pTm->tm_mon + 1; // tm_mon starts at zero
int utcDay = pTm->tm_mday;