static void topic_type_promote_tc_eps (Endpoint_t *ep, TPTC_t *tp, int dwriter) { unsigned char **tcp; for (; ep; ep = ep->next) { if (!entity_discovered (ep->entity.flags)) continue; if (dwriter) tcp = &((DiscoveredWriter_t *) ep)->dw_tc; else tcp = &((DiscoveredReader_t *) ep)->dr_tc; if (!*tcp || *tcp == (unsigned char *) ~0UL) continue; if ((tp->eq_tc && (*tcp == tp->eq_tc || vtc_equal (tp->eq_tc, *tcp))) || vtc_identical (tp->ts, *tcp)) { vtc_free (*tcp); *tcp = (unsigned char *) ~0UL; } } }
DDS_ReturnCode_t DDS_DomainParticipant_register_type (DDS_DomainParticipant dp, DDS_TypeSupport ts, const char *type_name) { TopicType_t *typep; TypeSupport_t *pts; DDS_ReturnCode_t ret; #ifdef DDS_TYPECODE unsigned char *vtc; #endif ctrc_begind (DCPS_ID, DCPS_DP_R_TYPE, &dp, sizeof (dp)); ctrc_contd (&ts, sizeof (ts)); ctrc_contd (type_name, strlen (type_name)); ctrc_endd (); prof_start (dcps_reg_type); /* Validate some required arguments. */ if (!ts) return (DDS_RETCODE_BAD_PARAMETER); if (!domain_ptr (dp, 1, &ret)) return (ret); if (!type_name && (type_name = DDS_TypeSupport_get_type_name (ts)) == NULL) return (DDS_RETCODE_BAD_PARAMETER); /* Search type name in participant type list. */ typep = type_lookup (dp, type_name); if (typep) { if ((pts = typep->type_support) != NULL) { #ifdef DDS_TYPECODE /* Type already learned from remote peers? */ if (pts->ts_prefer >= MODE_V_TC) { vtc = (unsigned char *) pts->ts_vtc; if (!vtc_identical (ts, vtc)) { /* Oops: already present in domain but incompatible - notify later when a topic is created. */ typep->flags |= EF_INC_TYPE; type_promote_tc (dp, typep, ts, NULL); } else { typep->flags &= ~EF_INC_TYPE; type_promote_tc (dp, typep, ts, vtc); } /* Replace with real type support.*/ xfree (typep->type_support); typep->type_support = (TypeSupport_t *) ts; vtc_free (vtc); } else /* Already defined: check compatibility. */ if (ts->ts_prefer != pts->ts_prefer || ts->ts_keys != pts->ts_keys || ts->ts_fksize != pts->ts_fksize || ts->ts_length != pts->ts_length || ts->ts_mkeysize != pts->ts_mkeysize) return (DDS_RETCODE_PRECONDITION_NOT_MET); else if (ts->ts_prefer == MODE_CDR) { if (!xt_type_equal (ts->ts_cdr, pts->ts_cdr)) return (DDS_RETCODE_PRECONDITION_NOT_MET); } else if (ts->ts_prefer == MODE_PL_CDR) { if (pts->ts_pl->builtin || ts->ts_pl->builtin || !xt_type_equal (ts->ts_pl->xtype, pts->ts_pl->xtype)) return (DDS_RETCODE_PRECONDITION_NOT_MET); } else #else if (pts != ts) #endif return (DDS_RETCODE_PRECONDITION_NOT_MET); } else { typep->type_support = (TypeSupport_t *) ts; typep->type_support->ts_users++; } } else { /* Doesn't exist yet -- allocate new type context. */ typep = type_create (dp, type_name, NULL); if (!typep) { warn_printf ("create_topic_type (%s): out of memory for topic type!\r\n", type_name); lock_release (dp->lock); return (DDS_RETCODE_OUT_OF_RESOURCES); } typep->type_support = (TypeSupport_t *) ts; typep->type_support->ts_users++; } typep->flags |= EF_LOCAL; typep->nrefs++; typep->nlrefs++; lock_release (dp->lock); prof_stop (dcps_reg_type, 1); return (DDS_RETCODE_OK); }
get_long_url_to_shorten(){ int rc=LR_PASS; int i=0; if( iURLSource_setting == 1 && nURLtoShorten_file_recs > 0 ){ for( nURLtoShorten_index=1; nURLtoShorten_index < nURLtoShorten_file_recs +1; nURLtoShorten_index++ ){ // Loop to skip data records marked No for usage. // Referencing data in file URLtoShorten.dat: if( stricmp( "N", lr_eval_string("{pURL_use}") ) == FOUND ){ lr_advance_param("pURL_long"); // Increment file one record. } // else fall through to use it. } lr_save_string(lr_eval_string("{pURL_use}"),"pURLtoShorten"); #ifdef USE_VTS }else if( iURLSource_setting == 2 ){ // (use VTS) // ENHANCEMENT: The alternative to this loop is to use an increment. // Scan through the VTS table from top to bottom. // If short_url is not blank in VTS table, it's alreadry processed, so skip to next row: for( i=1; i <= nVTS_row_count; i++ ){ rc = vtc_query_column(pvci, "web", i, &outvalue); // retrieve single field from a designated row. if( outvalue == NULL || sizeof( outvalue ) <= 0 ){ // there is no longURL, so skip that row; wi_startPrintingTrace(); lr_output_message(">> row %d \"web\" value is blank. Skipping to next row. rc=%d.", i, rc); wi_stopPrinting(); }else{ rc = vtc_query_column(pvci, "shorturl", i, &shorturl); // retrieve single field from a designated row. // FIXME: Why is rc=10111 ? if( shorturl == NULL || sizeof( shorturl ) <= 0 ){ // a blank cell, so it needs a shorturl. lr_save_string(outvalue,"pURLtoShorten"); wi_startPrintingTrace(); lr_output_message(">> row %d \"shorturl\" is needed for \"web\"=%s. rc=%d.", i, lr_eval_string("{pURLtoShorten}"), rc); wi_stopPrinting(); vtc_free(outvalue); rc=0; // FIXME: Why need to override rc=10111 again? break; // break out of loop for this script to get a shorturl for the web URL in VTS. }else{ // there is a shortURL already, so cycle back up to top for another // unless this is the last row in the table: if( i == nVTS_row_count ){ wi_startPrintingTrace(); lr_output_message(">> Last row at %d has a shorturl of \"%s\". So no more to process.", i, shorturl); wi_stopPrinting(); vtc_free(shorturl); rc = LR_FAIL; } } } } // for loop #endif // USE_VTS // ENHANCEMENT: else option to retrieve from on-line Google spreadsheet, etc. }else{ wi_startPrintingError(); lr_output_message(">> iURLSource_setting=%s is invalid.", iURLSource_setting); wi_stopPrinting(); rc=LR_FAIL; // This would be a programming error since editing occurred before this. } // if( iURLSource_setting return rc; } // get_long_url_to_shorten()