samsung: libril: some code cleanup

Change-Id: Ie79369fce7d6c8832c3256c402a485090c177e61
tirimbino
Daniel Hillenbrand 12 years ago
parent 40b78381e3
commit ea4af61a1b
  1. 14
      ril/xmm6260/libril/ril.cpp
  2. 118
      ril/xmm6262/libril/ril.cpp

@ -632,7 +632,6 @@ dispatchDial (Parcel &p, RequestInfo *pRI) {
} }
if (s_callbacks.version < 3) { // Remove when partners upgrade to version 3 if (s_callbacks.version < 3) { // Remove when partners upgrade to version 3
ALOGE("dispatchDial: s_callbacks.version < 3");
uusPresent = 0; uusPresent = 0;
sizeOfDial = sizeof(dial) - sizeof(RIL_UUS_Info *); sizeOfDial = sizeof(dial) - sizeof(RIL_UUS_Info *);
} else { } else {
@ -1518,8 +1517,17 @@ static int responseCallList(Parcel &p, void *response, size_t responselen) {
p.writeInt32(p_cur->numberPresentation); p.writeInt32(p_cur->numberPresentation);
writeStringToParcel(p, p_cur->name); writeStringToParcel(p, p_cur->name);
p.writeInt32(p_cur->namePresentation); p.writeInt32(p_cur->namePresentation);
p.writeInt32(0); /* UUS Information is absent */ // Remove when partners upgrade to version 3
if ((s_callbacks.version < 3) || (p_cur->uusInfo == NULL || p_cur->uusInfo->uusData == NULL)) {
p.writeInt32(0); /* UUS Information is absent */
} else {
RIL_UUS_Info *uusInfo = p_cur->uusInfo;
p.writeInt32(1); /* UUS Information is present */
p.writeInt32(uusInfo->uusType);
p.writeInt32(uusInfo->uusDcs);
p.writeInt32(uusInfo->uusLength);
p.write(uusInfo->uusData, uusInfo->uusLength);
}
appendPrintBuf("%s[id=%d,%s,toa=%d,", appendPrintBuf("%s[id=%d,%s,toa=%d,",
printBuf, printBuf,
p_cur->index, p_cur->index,

@ -1037,51 +1037,49 @@ dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI) {
goto invalid; goto invalid;
} }
{ RIL_GSM_BroadcastSmsConfigInfo gsmBci[num];
RIL_GSM_BroadcastSmsConfigInfo gsmBci[num]; RIL_GSM_BroadcastSmsConfigInfo *gsmBciPtrs[num];
RIL_GSM_BroadcastSmsConfigInfo *gsmBciPtrs[num];
startRequest; startRequest;
for (int i = 0 ; i < num ; i++ ) { for (int i = 0 ; i < num ; i++ ) {
gsmBciPtrs[i] = &gsmBci[i]; gsmBciPtrs[i] = &gsmBci[i];
status = p.readInt32(&t); status = p.readInt32(&t);
gsmBci[i].fromServiceId = (int) t; gsmBci[i].fromServiceId = (int) t;
status = p.readInt32(&t); status = p.readInt32(&t);
gsmBci[i].toServiceId = (int) t; gsmBci[i].toServiceId = (int) t;
status = p.readInt32(&t); status = p.readInt32(&t);
gsmBci[i].fromCodeScheme = (int) t; gsmBci[i].fromCodeScheme = (int) t;
status = p.readInt32(&t); status = p.readInt32(&t);
gsmBci[i].toCodeScheme = (int) t; gsmBci[i].toCodeScheme = (int) t;
status = p.readInt32(&t); status = p.readInt32(&t);
gsmBci[i].selected = (uint8_t) t; gsmBci[i].selected = (uint8_t) t;
appendPrintBuf("%s [%d: fromServiceId=%d, toServiceId =%d, \ appendPrintBuf("%s [%d: fromServiceId=%d, toServiceId =%d, \
fromCodeScheme=%d, toCodeScheme=%d, selected =%d]", printBuf, i, fromCodeScheme=%d, toCodeScheme=%d, selected =%d]", printBuf, i,
gsmBci[i].fromServiceId, gsmBci[i].toServiceId, gsmBci[i].fromServiceId, gsmBci[i].toServiceId,
gsmBci[i].fromCodeScheme, gsmBci[i].toCodeScheme, gsmBci[i].fromCodeScheme, gsmBci[i].toCodeScheme,
gsmBci[i].selected); gsmBci[i].selected);
} }
closeRequest; closeRequest;
if (status != NO_ERROR) { if (status != NO_ERROR) {
goto invalid; goto invalid;
} }
s_callbacks.onRequest(pRI->pCI->requestNumber, s_callbacks.onRequest(pRI->pCI->requestNumber,
gsmBciPtrs, gsmBciPtrs,
num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *), num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *),
pRI); pRI);
#ifdef MEMSET_FREED #ifdef MEMSET_FREED
memset(gsmBci, 0, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo)); memset(gsmBci, 0, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo));
memset(gsmBciPtrs, 0, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *)); memset(gsmBciPtrs, 0, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *));
#endif #endif
}
return; return;
@ -1101,43 +1099,41 @@ dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI) {
goto invalid; goto invalid;
} }
{ RIL_CDMA_BroadcastSmsConfigInfo cdmaBci[num];
RIL_CDMA_BroadcastSmsConfigInfo cdmaBci[num]; RIL_CDMA_BroadcastSmsConfigInfo *cdmaBciPtrs[num];
RIL_CDMA_BroadcastSmsConfigInfo *cdmaBciPtrs[num];
startRequest; startRequest;
for (int i = 0 ; i < num ; i++ ) { for (int i = 0 ; i < num ; i++ ) {
cdmaBciPtrs[i] = &cdmaBci[i]; cdmaBciPtrs[i] = &cdmaBci[i];
status = p.readInt32(&t); status = p.readInt32(&t);
cdmaBci[i].service_category = (int) t; cdmaBci[i].service_category = (int) t;
status = p.readInt32(&t); status = p.readInt32(&t);
cdmaBci[i].language = (int) t; cdmaBci[i].language = (int) t;
status = p.readInt32(&t); status = p.readInt32(&t);
cdmaBci[i].selected = (uint8_t) t; cdmaBci[i].selected = (uint8_t) t;
appendPrintBuf("%s [%d: service_category=%d, language =%d, \ appendPrintBuf("%s [%d: service_category=%d, language =%d, \
entries.bSelected =%d]", printBuf, i, cdmaBci[i].service_category, entries.bSelected =%d]", printBuf, i, cdmaBci[i].service_category,
cdmaBci[i].language, cdmaBci[i].selected); cdmaBci[i].language, cdmaBci[i].selected);
} }
closeRequest; closeRequest;
if (status != NO_ERROR) { if (status != NO_ERROR) {
goto invalid; goto invalid;
} }
s_callbacks.onRequest(pRI->pCI->requestNumber, s_callbacks.onRequest(pRI->pCI->requestNumber,
cdmaBciPtrs, cdmaBciPtrs,
num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *), num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *),
pRI); pRI);
#ifdef MEMSET_FREED #ifdef MEMSET_FREED
memset(cdmaBci, 0, num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo)); memset(cdmaBci, 0, num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo));
memset(cdmaBciPtrs, 0, num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *)); memset(cdmaBciPtrs, 0, num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *));
#endif #endif
}
return; return;
@ -2360,8 +2356,6 @@ static void sendSimStatusAppInfo(Parcel &p, int num_apps, RIL_AppStatus appStatu
} }
static int responseSimStatus(Parcel &p, void *response, size_t responselen) { static int responseSimStatus(Parcel &p, void *response, size_t responselen) {
int i;
if (response == NULL && responselen != 0) { if (response == NULL && responselen != 0) {
ALOGE("invalid response: NULL"); ALOGE("invalid response: NULL");
return RIL_ERRNO_INVALID_RESPONSE; return RIL_ERRNO_INVALID_RESPONSE;

Loading…
Cancel
Save