/**************************************************************************** Name : cpa_mds_dec Description : This function decodes an events sent to CPA. Arguments : cb : CPA control Block. info : Info for decoding Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE Notes : None. ******************************************************************************/ static uint32_t cpa_mds_dec(CPA_CB *cb, MDS_CALLBACK_DEC_INFO *dec_info) { CPSV_EVT *msg_ptr = NULL; EDU_ERR ederror = 0; uint32_t rc = NCSCC_RC_SUCCESS; uint8_t local_data[20]; uint8_t *pstream; bool is_valid_msg_fmt = false; TRACE_ENTER(); if (dec_info->i_fr_svc_id == NCSMDS_SVC_ID_CPND) { is_valid_msg_fmt = m_NCS_MSG_FORMAT_IS_VALID(dec_info->i_msg_fmt_ver, CPA_WRT_CPND_SUBPART_VER_MIN, CPA_WRT_CPND_SUBPART_VER_MAX, cpa_cpnd_msg_fmt_table); } else if (dec_info->i_fr_svc_id == NCSMDS_SVC_ID_CPD) { is_valid_msg_fmt = m_NCS_MSG_FORMAT_IS_VALID(dec_info->i_msg_fmt_ver, CPA_WRT_CPD_SUBPART_VER_MIN, CPA_WRT_CPD_SUBPART_VER_MAX, cpa_cpd_msg_fmt_table); } if (is_valid_msg_fmt) { msg_ptr = m_MMGR_ALLOC_CPSV_EVT(NCS_SERVICE_ID_CPA); if (!msg_ptr) return NCSCC_RC_FAILURE; memset(msg_ptr, 0, sizeof(CPSV_EVT)); dec_info->o_msg = (NCSCONTEXT)msg_ptr; pstream = ncs_dec_flatten_space(dec_info->io_uba, local_data, 8); msg_ptr->type = ncs_decode_32bit(&pstream); if (msg_ptr->type == CPSV_EVT_TYPE_CPA) { /* For Events Write/Read Call EDU VER_EXEC*/ rc = m_NCS_EDU_VER_EXEC(&cb->edu_hdl, FUNC_NAME(CPSV_EVT), dec_info->io_uba, EDP_OP_TYPE_DEC, (CPSV_EVT **)&dec_info->o_msg, &ederror, dec_info->i_msg_fmt_ver); goto free; /* if(msg_ptr->info.cpa.type == CPA_EVT_ND2A_CKPT_DATA_RSP) */ } /* if( msg_ptr->type == CPSV_EVT_TYPE_CPA) */ /* For all Other Cases Other Than CPA( Read / Write Rsp Follow EDU rules */ rc = m_NCS_EDU_EXEC(&cb->edu_hdl, FUNC_NAME(CPSV_EVT), dec_info->io_uba, EDP_OP_TYPE_DEC, (CPSV_EVT **)&dec_info->o_msg, &ederror); free: if (rc != NCSCC_RC_SUCCESS) { m_MMGR_FREE_CPSV_EVT(dec_info->o_msg, NCS_SERVICE_ID_CPA); } TRACE_LEAVE(); return rc; } else { TRACE_4("CPA:Processing failed for mds_dec "); TRACE_LEAVE(); return NCSCC_RC_FAILURE; } }
int tc_send_config_setup() { global_send_data.thread_num = TC_THREAD_DEFAULT_NUM; global_send_data.thread_stack = TC_THREAD_DEFALUT_STACK; TC_CONFIG_ADD("send_thread_num", &global_send_data.thread_num, FUNC_NAME(INT)); TC_CONFIG_ADD("send_stack_size", &global_send_data.thread_stack, FUNC_NAME(INT)); return TC_OK; }
bool CDynamicSCardReader::Load(LPCTSTR pszFileName) { m_hLib = ::LoadLibrary(pszFileName); if (m_hLib == NULL) { SetError(TEXT("ライブラリをロードできません。")); return false; } typedef LONG (WINAPI *SCardEstablishContextFunc)(DWORD, LPCVOID, LPCVOID, LPSCARDCONTEXT); typedef LONG (WINAPI *SCardListReadersFunc)(SCARDCONTEXT, LPCTSTR, LPTSTR, LPDWORD); SCardEstablishContextFunc pEstablishContext; SCardListReadersFunc pListReaders; if (!GetLibraryFunc(m_hLib, pEstablishContext, "SCardEstablishContext") || !GetLibraryFunc(m_hLib, pListReaders, FUNC_NAME("SCardListReaders")) || !GetLibraryFunc(m_hLib, m_pSCardReleaseContext, "SCardReleaseContext") || !GetLibraryFunc(m_hLib, m_pSCardConnect, FUNC_NAME("SCardConnect")) || !GetLibraryFunc(m_hLib, m_pSCardDisconnect, "SCardDisconnect") || !GetLibraryFunc(m_hLib, m_pSCardTransmit, "SCardTransmit")) { ::FreeLibrary(m_hLib); m_hLib = NULL; SetError(TEXT("関数のアドレスを取得できません。")); return false; } if (pEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &m_SCardContext) != SCARD_S_SUCCESS) { ::FreeLibrary(m_hLib); m_hLib = NULL; SetError(TEXT("コンテキストを確立できません。")); return false; } // カードリーダを列挙する DWORD dwBuffLength = 0; if (pListReaders(m_SCardContext, NULL, NULL, &dwBuffLength) == SCARD_S_SUCCESS) { m_pReaderList = new TCHAR[dwBuffLength]; if (pListReaders(m_SCardContext, NULL, m_pReaderList, &dwBuffLength) == SCARD_S_SUCCESS) { if (!CheckReaderList(m_pReaderList, dwBuffLength)) { Unload(); SetError(TEXT("カードリーダのリストが不正です。")); return false; } } else { delete [] m_pReaderList; m_pReaderList = NULL; } } return true; }
/**************************************************************************** Name : cpa_mds_dec Description : This function decodes an events sent to CPA. Arguments : cb : CPA control Block. info : Info for decoding Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE Notes : None. ******************************************************************************/ static uns32 cpa_mds_dec(CPA_CB *cb, MDS_CALLBACK_DEC_INFO *dec_info) { CPSV_EVT *msg_ptr = NULL; EDU_ERR ederror = 0; uns32 rc = NCSCC_RC_SUCCESS; uns8 local_data[20]; uns8 *pstream; NCS_BOOL is_valid_msg_fmt = FALSE; if (dec_info->i_fr_svc_id == NCSMDS_SVC_ID_CPND) { is_valid_msg_fmt = m_NCS_MSG_FORMAT_IS_VALID(dec_info->i_msg_fmt_ver, CPA_WRT_CPND_SUBPART_VER_MIN, CPA_WRT_CPND_SUBPART_VER_MAX, cpa_cpnd_msg_fmt_table); } else if (dec_info->i_fr_svc_id == NCSMDS_SVC_ID_CPD) { is_valid_msg_fmt = m_NCS_MSG_FORMAT_IS_VALID(dec_info->i_msg_fmt_ver, CPA_WRT_CPD_SUBPART_VER_MIN, CPA_WRT_CPD_SUBPART_VER_MAX, cpa_cpd_msg_fmt_table); } if (is_valid_msg_fmt) { msg_ptr = m_MMGR_ALLOC_CPSV_EVT(NCS_SERVICE_ID_CPA); if (!msg_ptr) return NCSCC_RC_FAILURE; memset(msg_ptr, 0, sizeof(CPSV_EVT)); dec_info->o_msg = (NCSCONTEXT)msg_ptr; pstream = ncs_dec_flatten_space(dec_info->io_uba, local_data, 8); msg_ptr->type = ncs_decode_32bit(&pstream); if (msg_ptr->type == CPSV_EVT_TYPE_CPA) { msg_ptr->info.cpa.type = ncs_decode_32bit(&pstream); if (msg_ptr->info.cpa.type == CPA_EVT_ND2A_CKPT_DATA_RSP) { ncs_dec_skip_space(dec_info->io_uba, 8); rc = cpsv_data_access_rsp_decode(&msg_ptr->info.cpa.info.sec_data_rsp, dec_info->io_uba); goto free; } /* if(msg_ptr->info.cpa.type == CPA_EVT_ND2A_CKPT_DATA_RSP) */ } /* if( msg_ptr->type == CPSV_EVT_TYPE_CPA) */ /* For all Other Cases Other Than CPA( Read / Write Rsp Follow EDU rules */ rc = m_NCS_EDU_EXEC(&cb->edu_hdl, FUNC_NAME(CPSV_EVT), dec_info->io_uba, EDP_OP_TYPE_DEC, (CPSV_EVT **)&dec_info->o_msg, &ederror); free: if (rc != NCSCC_RC_SUCCESS) { m_MMGR_FREE_CPSV_EVT(dec_info->o_msg, NCS_SERVICE_ID_CPA); } return rc; } else { m_LOG_CPA_CCL(CPA_PROC_FAILED, NCSFL_LC_CKPT_MGMT, NCSFL_SEV_INFO, "mds_dec", __FILE__, __LINE__); return NCSCC_RC_FAILURE; } }
CONTAINER_NAME CONCAT_2(creer_ensemble_, TYPE_LOWER)(void) { CONTAINER_NAME ptrContainer = gosh_alloc(*ptrContainer); ptrContainer->data = gosh_alloc(*ptrContainer->data); ptrContainer->data->tete = NULL; ptrContainer->next = FUNC_NAME(next); ptrContainer->createIterateur = FUNC_NAME(createIterateur); ptrContainer->vide = FUNC_NAME(vide); ptrContainer->ajouter = FUNC_NAME(ajouter); ptrContainer->appartient = FUNC_NAME(appartient); ptrContainer->supprimer_tete = FUNC_NAME(supprimer_tete); ptrContainer->nombre_elements = FUNC_NAME(nombre_elements); ptrContainer->get = FUNC_NAME(get); return ptrContainer; }
static void _dump_node_basic(QSP_ARG_DECL Vec_Expr_Node *enp) { Tree_Code code; int i; const char *s; if( enp==NULL ) return; /* print the node "name", and a code that tells about shape knowledge */ // Temporarily print to stderr instead of stdout for debugging... prt_node(enp,msg_str); prt_msg_frag(msg_str); if( SHOWING_LHS_REFS ){ sprintf(msg_str,"\t%d",VN_LHS_REFS(enp)); prt_msg_frag(msg_str); } if( SHOWING_COST ){ if( VN_SHAPE(enp) != NULL ){ sprintf(msg_str,"\t%d", SHP_N_MACH_ELTS(VN_SHAPE(enp))); } prt_msg_frag(msg_str); sprintf(msg_str,"\t%d\t%d", VN_FLOPS(enp),VN_N_MATH(enp)); prt_msg_frag(msg_str); } if( IS_CURDLED(enp) ){ sprintf(msg_str,"\t%s (curdled!?)", NNAME(enp)); prt_msg(msg_str); return; } sprintf(msg_str,"\t%s", NNAME(enp)); prt_msg_frag(msg_str); /* print the special op-dependent args in human-readable form */ code = VN_CODE(enp); if( code==T_DYN_OBJ || code == T_UNDEF || code == T_PROTO || code==T_POINTER || code==T_FUNCPTR || code==T_STR_PTR ){ sprintf(msg_str,"\t%s",VN_STRING(enp)); prt_msg_frag(msg_str); if( code == T_POINTER ){ Identifier *idp; /* We don't use get_set_ptr() here because we don't want an error msg... */ idp = id_of(VN_STRING(enp)); if( idp != NULL && IS_POINTER(idp) && POINTER_IS_SET(idp) ){ if( PTR_REF(ID_PTR(idp)) == NULL ){ /* how could this ever happen??? */ prt_msg_frag("->???"); } else { Data_Obj *dp; dp = REF_OBJ(PTR_REF(ID_PTR(idp))); sprintf(msg_str,"->%s",OBJ_NAME(dp)); prt_msg_frag(msg_str); } } } } else if( code == T_STATIC_OBJ ){ sprintf(msg_str,"\t%s",OBJ_NAME(VN_OBJ(enp))); prt_msg_frag(msg_str); #ifdef SCALARS_NOT_OBJECTS } else if( code == T_SCALAR_VAR ){ sprintf(msg_str,"\t%s",VN_STRING(enp)); prt_msg_frag(msg_str); #endif // SCALARS_NOT_OBJECTS } else if ( code == T_FUNCREF ){ Subrt *srp; srp=VN_SUBRT(enp); sprintf(msg_str,"\t%s",SR_NAME(srp)); prt_msg_frag(msg_str); } else if( code == T_SIZE_FN ){ sprintf(msg_str,"\t%s",FUNC_NAME(VN_FUNC_PTR(enp))); prt_msg_frag(msg_str); } #ifdef NOT_YET else if(code == T_CALL_NATIVE ){ // was kw_token??? // curr_native_func_tbl... sprintf(msg_str,"\t%s",FUNC_NAME(VN_FUNC_PTR(enp))); prt_msg_frag(msg_str); } #endif /* NOT_YET */ else if(code == T_TYPECAST ){ // BUG not how we do precision any more!!! //sprintf(msg_str," %s",NAME_FOR_PREC_CODE(VN_INTVAL(enp))); if( VN_SHAPE(enp) == NULL ) error1("CAUTIOUS: null node shape for typecast node!?"); else { sprintf(msg_str," %s",PREC_NAME(VN_PREC_PTR(enp))); prt_msg_frag(msg_str); } } else if( code == T_SUBRT_DECL || code == T_SCRIPT ){ Subrt *srp; srp=VN_SUBRT(enp); sprintf(msg_str,"\t%s",SR_NAME(srp)); prt_msg_frag(msg_str); } else if( code==T_DECL_STAT ){ //sprintf(msg_str," %s",NAME_FOR_PREC_CODE(VN_INTVAL(enp))); sprintf(msg_str," %s",PREC_NAME(VN_DECL_PREC(enp))); prt_msg_frag(msg_str); } else if( IS_DECL(code) ){ sprintf(msg_str," %s",VN_STRING(enp)); prt_msg_frag(msg_str); } else if( code==T_ADVISE ){ /* BUG need to elim yylex_qsp */ s=eval_string(VN_CHILD(enp,0)); sprintf(msg_str,"\t\"%s\"",s); prt_msg_frag(msg_str); } else if( code==T_WARN ){ /* BUG need to elim yylex_qsp */ s=eval_string(VN_CHILD(enp,0)); sprintf(msg_str,"\t\"%s\"",s); prt_msg_frag(msg_str); } else if( code==T_STRING ){ sprintf(msg_str,"\t\"%s\"",VN_STRING(enp)); prt_msg_frag(msg_str); } else if( code == T_LABEL || code ==T_GO_BACK || code == T_GO_FWD ){ sprintf(msg_str," %s",VN_STRING(enp)); prt_msg_frag(msg_str); } else if( code==T_LIT_DBL ){ sprintf(msg_str," %g",VN_DBLVAL(enp)); prt_msg_frag(msg_str); } else if( code == T_MATH0_FN ){ sprintf(msg_str," %s",FUNC_NAME(VN_FUNC_PTR(enp))); prt_msg_frag(msg_str); } else if( code == T_MATH1_FN ){ sprintf(msg_str," %s",FUNC_NAME(VN_FUNC_PTR(enp))); prt_msg_frag(msg_str); } else if( code == T_MATH2_FN ){ sprintf(msg_str," %s",FUNC_NAME(VN_FUNC_PTR(enp))); prt_msg_frag(msg_str); } else if ( code == T_MATH0_VFN || code == T_MATH1_VFN || code == T_MATH2_VFN || code == T_MATH2_VSFN || code == T_CHAR_VFN /* BUG? shouldn't there bre a VSFN2 ??? */ || code == T_VS_FUNC || code == T_VV_FUNC ){ sprintf(msg_str," %s",VF_NAME(FIND_VEC_FUNC(VN_VFUNC_CODE(enp)))); prt_msg_frag(msg_str); } else if( code==T_CALLFUNC ){ assert(VN_SUBRT(enp)!=NULL); sprintf(msg_str," %s", SR_NAME(VN_SUBRT(enp))); prt_msg_frag(msg_str); } else if( code==T_LIT_INT ){ sprintf(msg_str," %"PRId64, VN_INTVAL(enp) ); prt_msg_frag(msg_str); } else if( code==T_ASSIGN ){ prt_msg_frag("\t"); } else if( code==T_MAXVAL ){ prt_msg_frag("\t"); } else if( code==T_MINVAL ){ prt_msg_frag("\t"); } else if( code==T_RAMP ){ prt_msg_frag("\t"); } /* Now print the addresses of the child nodes */ if( VN_CHILD(enp,0)!=NULL){ sprintf(msg_str,"\t\tn%d",VN_SERIAL(VN_CHILD(enp,0))); prt_msg_frag(msg_str); } for(i=1;i<MAX_CHILDREN(enp);i++){ if( VN_CHILD(enp,i)!=NULL){ sprintf(msg_str,", n%d",VN_SERIAL(VN_CHILD(enp,i))); prt_msg_frag(msg_str); } } prt_msg(""); if( SHOWING_SHAPES && VN_SHAPE(enp) != NULL ){ prt_msg_frag("\t"); if( OWNS_SHAPE(enp) ){ sprintf(msg_str,"* 0x%lx ",(u_long)VN_SHAPE(enp)); prt_msg_frag(msg_str); } else { sprintf(msg_str,"@ 0x%lx ",(u_long)VN_SHAPE(enp)); prt_msg_frag(msg_str); } prt_msg_frag("\t"); describe_shape(VN_SHAPE(enp)); } if( SHOWING_RESOLVERS && VN_RESOLVERS(enp)!=NULL ){ Node *np; Vec_Expr_Node *enp2; prt_msg("\tResolvers:"); np=QLIST_HEAD(VN_RESOLVERS(enp)); while(np!=NULL){ enp2=(Vec_Expr_Node *)NODE_DATA(np); sprintf(msg_str,"\t\t%s",node_desc(enp2)); prt_msg(msg_str); np=NODE_NEXT(np); } } }
/**************************************************************************** Name : cpa_mds_enc Description : This function encodes an events sent from CPA to remote CPND. Arguments : cb : CPA control Block. info : Info for encoding Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE Notes : None. ******************************************************************************/ static uint32_t cpa_mds_enc(CPA_CB *cb, MDS_CALLBACK_ENC_INFO *enc_info) { CPSV_EVT *pevt = NULL; EDU_ERR ederror = 0; NCS_UBAID *io_uba = enc_info->io_uba; uint32_t rc = NCSCC_RC_SUCCESS; uint8_t *pstream = NULL; TRACE_ENTER(); /* Get the Msg Format version from the SERVICE_ID & RMT_SVC_PVT_SUBPART_VERSION */ if (enc_info->i_to_svc_id == NCSMDS_SVC_ID_CPND) { /* This is special case to handle the 4.2 deployed node upgrade , the 4.2 has inconsistency between `enc_info->i_rem_svc_pvt_ver` ( CPND_MDS_PVT_SUBPART_VERSION /CPA_MDS_PVT_SUBPART_VERSION ) and `cpa_cpnd_msg_fmt_table` ( CPND_WRT_CPND_SUBPART_VER_RANGE / CPND_WRT_CPA_SUBPART_VER_RANGE) For all other up coming version `m_NCS_ENC_MSG_FMT_GET` logic works fine */ if (enc_info->i_rem_svc_pvt_ver <= 3) /* opensaf 4.2 CPND_MDS_PVT_SUBPART_VERSION was 3 but CPND_WRT_CPND_SUBPART_VER_RANGE was 2 */ enc_info->o_msg_fmt_ver = cpa_cpnd_msg_fmt_table[enc_info->i_rem_svc_pvt_ver - 2]; else /* m_NCS_ENC_MSG_FMT_GET call is equal to cpa_cpnd_msg_fmt_table[enc_info->i_rem_svc_pvt_ver - 1] */ enc_info->o_msg_fmt_ver = m_NCS_ENC_MSG_FMT_GET(enc_info->i_rem_svc_pvt_ver, CPA_WRT_CPND_SUBPART_VER_MIN, CPA_WRT_CPND_SUBPART_VER_MAX, cpa_cpnd_msg_fmt_table); } if (enc_info->o_msg_fmt_ver) { pevt = (CPSV_EVT *)enc_info->i_msg; if (pevt->type == CPSV_EVT_TYPE_CPND) { if (pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_WRITE) { pstream = ncs_enc_reserve_space(io_uba, 12); if (!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE, "Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream, pevt->type); /* CPSV_EVT Type */ ncs_encode_32bit(&pstream, pevt->info.cpnd.error); /* cpnd_evt error This is for backword compatible purpose with EDU enc/dec with 3.0.2 */ ncs_encode_32bit(&pstream, pevt->info.cpnd.type); /* cpnd_evt SubType */ ncs_enc_claim_space(io_uba, 12); rc = cpsv_ckpt_access_encode(&pevt->info.cpnd.info.ckpt_write, io_uba); TRACE_LEAVE(); return rc; } else if (pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_READ) { pstream = ncs_enc_reserve_space(io_uba, 12); if (!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE, "Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream, pevt->type); /* CPSV_EVT Type */ ncs_encode_32bit(&pstream, pevt->info.cpnd.error); /* cpnd_evt error This is for backword compatible purpose with EDU enc/dec with 3.0.2 */ ncs_encode_32bit(&pstream, pevt->info.cpnd.type); /* cpnd_evt SubType */ ncs_enc_claim_space(io_uba, 12); rc = cpsv_ckpt_access_encode(&pevt->info.cpnd.info.ckpt_read, io_uba); TRACE_LEAVE(); return rc; } else if(pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_REFCNTSET) { if(enc_info->o_msg_fmt_ver < 2) { TRACE_LEAVE(); return NCSCC_RC_FAILURE; } else { pstream = ncs_enc_reserve_space(io_uba, 12); if(!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE,"Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream , pevt->type); ncs_encode_32bit(&pstream , pevt->info.cpnd.error); ncs_encode_32bit(&pstream , pevt->info.cpnd.type); ncs_enc_claim_space(io_uba, 12); rc = cpsv_ref_cnt_encode(io_uba,&pevt->info.cpnd.info.refCntsetReq); TRACE_LEAVE(); return rc; } } } /* For all other cases call EDU othen than Write/Read API's */ rc = m_NCS_EDU_EXEC(&cb->edu_hdl, FUNC_NAME(CPSV_EVT), enc_info->io_uba, EDP_OP_TYPE_ENC, pevt, &ederror); TRACE_LEAVE(); return rc; } else { /* Drop The Message As Msg Fmt Version Not understandable */ TRACE_4("cpa api processing failed in mds_enc "); return NCSCC_RC_FAILURE; } }
/**************************************************************************** Name : cpa_mds_enc Description : This function encodes an events sent from CPA to remote CPND. Arguments : cb : CPA control Block. info : Info for encoding Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE Notes : None. ******************************************************************************/ static uns32 cpa_mds_enc(CPA_CB *cb, MDS_CALLBACK_ENC_INFO *enc_info) { CPSV_EVT *pevt = NULL; EDU_ERR ederror = 0; NCS_UBAID *io_uba = enc_info->io_uba; uns32 rc = NCSCC_RC_SUCCESS; uns8 *pstream = NULL; /* Get the Msg Format version from the SERVICE_ID & RMT_SVC_PVT_SUBPART_VERSION */ if (enc_info->i_to_svc_id == NCSMDS_SVC_ID_CPND) { enc_info->o_msg_fmt_ver = m_NCS_ENC_MSG_FMT_GET(enc_info->i_rem_svc_pvt_ver, CPA_WRT_CPND_SUBPART_VER_MIN, CPA_WRT_CPND_SUBPART_VER_MAX, cpa_cpnd_msg_fmt_table); } if (enc_info->o_msg_fmt_ver) { pevt = (CPSV_EVT *)enc_info->i_msg; if (pevt->type == CPSV_EVT_TYPE_CPND) { if (pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_WRITE) { pstream = ncs_enc_reserve_space(io_uba, 12); if (!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE, "Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream, pevt->type); /* CPSV_EVT Type */ ncs_encode_32bit(&pstream, pevt->info.cpnd.error); /* cpnd_evt error This is for backword compatible purpose with EDU enc/dec with 3.0.2 */ ncs_encode_32bit(&pstream, pevt->info.cpnd.type); /* cpnd_evt SubType */ ncs_enc_claim_space(io_uba, 12); rc = cpsv_ckpt_access_encode(&pevt->info.cpnd.info.ckpt_write, io_uba); return rc; } else if (pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_READ) { pstream = ncs_enc_reserve_space(io_uba, 12); if (!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE, "Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream, pevt->type); /* CPSV_EVT Type */ ncs_encode_32bit(&pstream, pevt->info.cpnd.error); /* cpnd_evt error This is for backword compatible purpose with EDU enc/dec with 3.0.2 */ ncs_encode_32bit(&pstream, pevt->info.cpnd.type); /* cpnd_evt SubType */ ncs_enc_claim_space(io_uba, 12); rc = cpsv_ckpt_access_encode(&pevt->info.cpnd.info.ckpt_read, io_uba); return rc; } else if(pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_REFCNTSET) { if(enc_info->o_msg_fmt_ver < 2) return NCSCC_RC_FAILURE; else { pstream = ncs_enc_reserve_space(io_uba, 12); if(!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE,"Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream , pevt->type); ncs_encode_32bit(&pstream , pevt->info.cpnd.error); ncs_encode_32bit(&pstream , pevt->info.cpnd.type); ncs_enc_claim_space(io_uba, 12); rc = cpsv_ref_cnt_encode(io_uba,&pevt->info.cpnd.info.refCntsetReq); return rc; } } } /* For all other cases call EDU othen than Write/Read API's */ rc = m_NCS_EDU_EXEC(&cb->edu_hdl, FUNC_NAME(CPSV_EVT), enc_info->io_uba, EDP_OP_TYPE_ENC, pevt, &ederror); return rc; } else { /* Drop The Message As Msg Fmt Version Not understandable */ m_LOG_CPA_CCL(CPA_PROC_FAILED, NCSFL_LC_CKPT_MGMT, NCSFL_SEV_ERROR, "mds_enc", __FILE__, __LINE__); return NCSCC_RC_FAILURE; } }
mlib_status __mlib_ImageColorOrderedDither8x8( mlib_image *dst, const mlib_image *src, const mlib_s32 *dmask, mlib_s32 scale, const void *colormap) { mlib_status stat; mlib_s32 src_nch; mlib_type src_dtype, dst_dtype; mlib_s32 method; MLIB_IMAGE_CHECK(src); MLIB_IMAGE_CHECK(dst); MLIB_IMAGE_SIZE_EQUAL(src, dst); MLIB_IMAGE_HAVE_CHAN(dst, 1); MLIB_IMAGE_AND_COLORMAP_ARE_COMPAT(src, colormap); if (dmask == NULL || colormap == NULL) return (MLIB_NULLPOINTER); src_dtype = mlib_ImageGetType(src); dst_dtype = mlib_ImageGetType(dst); src_nch = mlib_ImageGetChannels(src); if (scale < 0) { stat = MLIB_OUTOFRANGE; } else { method = mlib_ImageGetMethod(colormap); if (method != LUT_COLOR_CUBE_SEARCH) { if (method == LUT_COLOR_DIMENSIONS) { mlib_s32 dmask1[64], dmask2[64], dmask3[64], *pmask[4]; mlib_s32 i, j; for (j = 0; j < 8; j++) { for (i = 0; i < 8; i++) { dmask3[8 * (7 - j) + (7 - i)] = dmask2[8 * (7 - j) + i] = dmask1[8 * j + (7 - i)] = dmask[8 * j + i]; } } pmask[0] = (void *)dmask; pmask[1] = dmask1; pmask[2] = dmask2; pmask[3] = dmask3; return __mlib_ImageColorOrderedDitherMxN(dst, src, (const mlib_s32 **)pmask, 8, 8, scale, colormap); } return (MLIB_FAILURE); } else { switch (src_dtype) { case MLIB_BYTE: switch (dst_dtype) { case MLIB_BYTE: switch (src_nch) { case 3: stat = FUNC_NAME(3_8_8) (src, dst, dmask, scale, colormap); break; case 4: stat = FUNC_NAME(4_8_8) (src, dst, dmask, scale, colormap); break; default: stat = MLIB_FAILURE; break; } break; case MLIB_SHORT: /* * convert wid from * pixels to bytes */ switch (src_nch) { case 3: stat = FUNC_NAME(3_8_16) (src, dst, dmask, scale, colormap); break; case 4: stat = FUNC_NAME(4_8_16) (src, dst, dmask, scale, colormap); break; default: stat = MLIB_FAILURE; break; } break; case MLIB_BIT: default: stat = MLIB_FAILURE; break; } break; case MLIB_SHORT: /* * convert wid from pixels to * bytes */ switch (dst_dtype) { case MLIB_BYTE: switch (src_nch) { case 3: stat = FUNC_NAME(3_16_8) (src, dst, dmask, scale, colormap); break; case 4: stat = FUNC_NAME(4_16_8) (src, dst, dmask, scale, colormap); break; default: stat = MLIB_FAILURE; break; } break; case MLIB_SHORT: /* * convert wid from * pixels to bytes */ switch (src_nch) { case 3: stat = FUNC_NAME(3_16_16) (src, dst, dmask, scale, colormap); break; case 4: stat = FUNC_NAME(4_16_16) (src, dst, dmask, scale, colormap); break; default: stat = MLIB_FAILURE; break; } break; case MLIB_BIT: default: stat = MLIB_FAILURE; break; } break; case MLIB_BIT: default: stat = MLIB_FAILURE; break; } } } return (stat); }