static OMX_ERRORTYPE os_register_type (tiz_os_t * ap_os, const tiz_os_type_init_f a_type_init_f, const char * a_type_name, const OMX_S32 a_type_id) { OMX_ERRORTYPE rc = OMX_ErrorInsufficientResources; void * p_obj = NULL; assert (ap_os); assert (ap_os->p_map); assert (a_type_init_f); assert (a_type_name); assert (strnlen (a_type_name, OMX_MAX_STRINGNAME_SIZE) < OMX_MAX_STRINGNAME_SIZE); assert (a_type_id >= 0); /* Call the type init function */ p_obj = a_type_init_f (ap_os, ap_os->p_hdl); if (p_obj) { /* Register the class or object type */ TIZ_TRACE (ap_os->p_hdl, "Registering type #[%d] : [%s] -> [%p] " "nameOf [%s]", a_type_id, a_type_name, p_obj, nameOf (p_obj)); rc = tiz_map_insert (ap_os->p_map, os_strndup (ap_os->p_soa, a_type_name, OMX_MAX_STRINGNAME_SIZE), p_obj, (OMX_U32 *) (&a_type_id)); } /* print_types (ap_os); */ return rc; }
os_result idl_genJavaHelperAddPackageRedirect ( const os_char *optarg) { idl_packageRedirect exists, redirect = NULL; os_char *colon; os_char *module = NULL; os_char *package = NULL; os_char *trim = NULL; os_result result = os_resultSuccess; assert (optarg != NULL); colon = os_index (optarg, ':'); if (colon != NULL) { if (colon == optarg) { module = NULL; } else { module = os_strndup (optarg, (size_t) (colon - optarg)); if (module != NULL) { if ((trim = os_str_trim (module, "./:")) != module) { os_free (module); } module = trim; } if (module == NULL) { result = os_resultFail; } else if (strlen (module) == 0) { os_free (module); module = NULL; } } package = os_strdup (colon + 1); if ((trim = os_str_trim (package, "./:")) != package) { os_free (package); } package = trim; if (strlen (package) == 0) { result = os_resultInvalid; } redirect = os_malloc (OS_SIZEOF (idl_packageRedirect)); if (result == os_resultSuccess) { redirect->module = module; redirect->package = package; exists = os_iterResolve ( idl_genJavaHelperPackageRedirects, &idl_genJavaHelperComparePackageRedirect, redirect); if (exists != NULL) { result = os_resultInvalid; } else { idl_genJavaHelperPackageRedirects = os_iterAppend ( idl_genJavaHelperPackageRedirects, redirect); /* idl_genJavaHelperPackageRedirect must be sorted */ os_iterSort ( idl_genJavaHelperPackageRedirects, &idl_genJavaHelperComparePackageRedirect, OS_FALSE); } } if (result != os_resultSuccess) { os_free (module); os_free (package); os_free (redirect); } } else { result = os_resultInvalid; } return result; }