==================================================================================================*/
SmsPluginParamCodec::SmsPluginParamCodec()
{
-
-
}
SmsPluginParamCodec::~SmsPluginParamCodec()
{
-
-
}
SMS_TON_T ton;
- *ppParam = new char[MAX_ADD_PARAM_LEN];
+ char *tempParam = new char[MAX_ADD_PARAM_LEN];
+ if (tempParam == NULL)
+ return 0;
+
+ memset(tempParam, 0x00, sizeof(char)*MAX_ADD_PARAM_LEN);
/* Set Address Length */
if (temp[0] == '+') {
- (*ppParam)[offset++] = strlen(temp) - 1;
+ tempParam[offset++] = strlen(temp) - 1;
temp++;
ton = SMS_TON_INTERNATIONAL;
} else {
- (*ppParam)[offset++] = strlen(temp);
+ tempParam[offset++] = strlen(temp);
ton = pAddress->ton;
}
/* Set TON, NPI */
- (*ppParam)[offset++] = 0x80 + (ton << 4) + pAddress->npi;
+ tempParam[offset++] = 0x80 + (ton << 4) + pAddress->npi;
- MSG_DEBUG("Address length is %d.", (*ppParam)[0]);
+ MSG_DEBUG("Address length is %d.", tempParam[0]);
MSG_DEBUG("pAddress->ton : %d.", ton);
MSG_DEBUG("pAddress->npi : %d.", pAddress->npi);
- length = convertDigitToBcd(temp, strlen(temp), (unsigned char *) &((*ppParam)[offset]));
+ length = convertDigitToBcd(temp, strlen(temp), (unsigned char *) &(tempParam[offset]));
offset += length;
+ *ppParam = tempParam;
+
return offset ;
}
int SmsPluginParamCodec::encodeDCS(const SMS_DCS_S *pDCS, char **ppParam)
{
- *ppParam = new char;
+ *ppParam = new char[MAX_DCS_PARAM_LEN];
**ppParam = 0x00;
switch (pDCS->codingGroup) {
- case SMS_GROUP_GENERAL:
- {
+ case SMS_GROUP_GENERAL: {
if (pDCS->msgClass != SMS_MSG_CLASS_NONE)
**ppParam = 0x10 + pDCS->msgClass;
}
break;
- case SMS_GROUP_CODING_CLASS:
- {
+ case SMS_GROUP_CODING_CLASS: {
**ppParam = 0xF0 + pDCS->msgClass;
}
break;
return 0;
}
- return 1;
+ return MAX_DCS_PARAM_LEN;
}
char* tmpAddress = new char[MAX_ADDRESS_LEN];
int tmplength = 0;
- tmplength = SmsPluginUDCodec::unpack7bitChar(&(pTpdu[offset]), (addrLen*4 )/7, 0, tmpAddress);
+ tmplength = SmsPluginUDCodec::unpack7bitChar(&(pTpdu[offset]), (addrLen*4)/7, 0, tmpAddress);
- MSG_LANG_INFO_S langInfo = {0,};
+ MSG_LANG_INFO_S langInfo = {0, };
langInfo.bSingleShift = false;
langInfo.bLockingShift = false;
convertBcdToDigit(&(pTpdu[offset]), bcdLen, &((pAddress->address)[0]));
}
- offset += bcdLen;
+ offset += bcdLen;
/* MSG_DEBUG("address [%s]", pAddress->address);
*/
MSG_DEBUG("timezone : %d", time_stamp->time.absolute.timeZone);
char displayTime[32];
- struct tm * timeTM;
+ struct tm timeTM;
+ memset(&timeTM, 0x00, sizeof(tm));
struct tm timeinfo;
memset(&timeinfo, 0x00, sizeof(tm));
rawtime -= (time_stamp->time.absolute.timeZone * (3600/4));
- timeTM = localtime(&rawtime);
+ localtime_r(&rawtime, &timeTM);
memset(displayTime, 0x00, sizeof(displayTime));
- strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
+ strftime(displayTime, 32, "%Y-%02m-%02d %T %z", &timeTM);
MSG_DEBUG("displayTime [%s]", displayTime);
/* timezone value is tiemzone + daylight. So should not add daylight */
rawtime -= timezone;
#endif
- timeTM = localtime(&rawtime);
+ memset(&timeTM, 0x00, sizeof(tm));
+ localtime_r(&rawtime, &timeTM);
memset(displayTime, 0x00, sizeof(displayTime));
- strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
+ strftime(displayTime, 32, "%Y-%02m-%02d %T %z", &timeTM);
MSG_DEBUG("displayTime [%s]", displayTime);
} else {
rawtime = time(NULL);