void CPKCS12Handler::AttachCertificateL(CX509Certificate* aCert, const TPKIKeyIdentifier& aKeyId) { LOG_("-> CPKCS12Handler::AttachCertificateL()"); TRequestStatus requestStatus; TAny* resArray(NULL); // Perform asynchronous PKI operation synchronously iPkiService->AttachCertificateL(aKeyId, DEFAULT_KEY_LEN, EPKIRSA, aCert->Encoding(), &resArray, requestStatus); User::WaitForRequest(requestStatus); iPkiService->Finalize(resArray); // Check for operation status TInt status = requestStatus.Int(); if (status != KErrNone) { LOG_1("<- CPKCS12Handler::AttachCertificateL() LEAVE: %d", status); User::Leave(status); } LOG_("<- CPKCS12Handler::AttachCertificateL() OK"); }
vector<long long> mergeSort(vector<long long>& sum,int n){ if(n>1){ int i=n/2,j=n-i; vector<long long> left; vector<long long> right; left.assign(sum.begin(),sum.begin()+i); right.assign(sum.begin()+i,sum.end()); vector<long long> resLeft=mergeSort(left,i); vector<long long> resRight=mergeSort(right,j); vector<long long> resArray(n,0); int low=0; int high=0; for(int pos=0;pos<right.size();pos++){ /*low=lower_bound(resLeft.begin(),resLeft.end(),resRight[pos]-l); high=lower_bound(resLeft.begin(),resLeft.end(),resRight[pos]-u); res+=(int)(low-high); if(high!=resLeft.end()&&*high==resRight[pos]-l) res++;*/ while ((low<resLeft.size())&&(resLeft[low]<resRight[pos]-u)) { low++; } while ((high<resLeft.size())&&(resLeft[high]<=resRight[pos]-l)) { high++; } res+=(high-low); } for(int pos=int(resArray.size())-1;pos>=0;pos--){ if(j==0||(i>0&&resRight[j-1]<resLeft[i-1])){ resArray[pos]=resLeft[i-1]; i--; }else{ resArray[pos]=resRight[j-1]; j--; } } return resArray; }else{ if(sum[0]>=l&&sum[0]<=u) res++; return sum; } }
/*! \internal RunL from CActive. */ void CHbDeviceDialogSymbianPrivate::RunL() { TInt completionCode = iStatus.Int(); int errorCode = SymToDeviceDialogError(completionCode); if (completionCode < KErrNone) { // Any Symbian error, stop requesting, sycnhoronous requests are stopped // in the end of the RunL iRequesting = EFalse; SetError(errorCode); if (CallDialogClosedObserver(errorCode)) { return; // observed deleted this object, do not touch it } } else { // Check that event is for latest device dialog. iDeviceDialogId was updated by server // during show() THbDeviceDialogSrvUpdateInfo &updateInfo = iUpdateInfo(); if (updateInfo.iDeviceDialogId == iDeviceDialogId()) { switch(updateInfo.iUpdateType) { case EHbDeviceDialogUpdateData: { if (completionCode == KErrNone && updateInfo.iInfo.iDataInfo.iDataSize > 0) { // Resize buffer and get new data synchronously delete iBuffer; iBuffer = NULL; iBuffer = HBufC8::NewL(updateInfo.iInfo.iDataInfo.iDataSize); iDataPtr.Set(iBuffer->Des()); completionCode = iHbSession.SendSyncRequest(EHbSrvUpdateData, iDataPtr); errorCode = SymToDeviceDialogError(completionCode); // data request failed if (completionCode < KErrNone) { iRequesting = EFalse; SetError(errorCode); if (CallDialogClosedObserver(errorCode)) { return; // observed deleted this object, do not touch it } } } if (completionCode == KErrNone) { // Signal data if there are connections. Otherwise keep a copy. QByteArray resArray((const char*)iDataPtr.Ptr(), iDataPtr.Size()); QDataStream stream(&resArray, QIODevice::ReadOnly); iDataReceived.clear(); QVariant var; stream >> var; QVariantMap varMap = var.toMap(); if (iObserver) { CHbSymbianVariantMap* symbianMap = HbSymbianVariantConverter::fromQVariantMapL(varMap); bool thisIsDeleted = CallDataReceivedObserver(*symbianMap); delete symbianMap; symbianMap = 0; if (thisIsDeleted) { // observer deleted this, do not touch anymore return; } } else { iDataReceived = varMap; } } break; } case EHbDeviceDialogUpdateClosed: // Signal possible cancelled error if (completionCode != KErrNone) { SetError(errorCode); } iRequesting = EFalse; if (CallDialogClosedObserver(errorCode)) { return; // observed deleted this object, do not touch it } break; default: break; } } }