/** * gst_encoding_list_available_categories: * * Lists all #GstEncodingTarget categories present on disk. * * Returns: (transfer full) (element-type gchar*): A list * of #GstEncodingTarget categories. */ GList * gst_encoding_list_available_categories (void) { GList *res = NULL; GList *tmp1, *tmp2; gchar *topdir; /* First try user-local categories */ topdir = g_build_filename (g_get_user_data_dir (), "gstreamer-" GST_API_VERSION, GST_ENCODING_TARGET_DIRECTORY, NULL); res = get_categories (topdir); g_free (topdir); /* Extend with system-wide categories */ topdir = g_build_filename (GST_DATADIR, "gstreamer-" GST_API_VERSION, GST_ENCODING_TARGET_DIRECTORY, NULL); tmp1 = get_categories (topdir); g_free (topdir); for (tmp2 = tmp1; tmp2; tmp2 = tmp2->next) { gchar *name = (gchar *) tmp2->data; if (!g_list_find_custom (res, name, (GCompareFunc) g_strcmp0)) res = g_list_append (res, (gpointer) name); else g_free (name); } g_list_free (tmp1); return res; }
BOOST_SYSTEM_DECL error_category const & error_category::find_category(char const * name) { std::vector<error_category const *>::const_iterator iter = get_categories().begin(); std::vector<error_category const *>::const_iterator end = get_categories().end(); for (; iter != end; ++iter) if (strcmp((*iter)->name(), name) == 0) return **iter; assert(false); return get_generic_category(); }
void record_category_info(GDesktopAppInfo* info) { char* id = dentry_get_id(info); GList* categories = get_categories(info); _append_to_category(id, categories); g_free(id); g_list_free(categories); }
BOOST_SYSTEM_DECL void error_category::unregister_category(error_category const & cat) { std::vector<error_category const *> & categories = get_categories(); categories.erase(std::remove(categories.begin(), categories.end(), &cat), categories.end()); if (categories.empty()) { // ÊÍ·ÅÄÚ²¿´æ´¢ std::vector<error_category const *>().swap(categories); } }
int main(int argc, char *argv[]) { int pkgfmt = 0; /* Makes more sense as a pointer, but */ /* 18N is compromised. */ char file[PATH_MAX+1], *abi_sym_ptr, *vfstab_file = NULL; char *all_pkgs[4] = {"all", NULL}; char **category = NULL; char *catg_arg = NULL; int c; int n = 0; char *prog, *Rvalue = NULL, *dvalue = NULL; int dbcreate = 0; int pathtype; /* initialize locale mechanism */ #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ #define TEXT_DOMAIN "SYS_TEST" #endif (void) textdomain(TEXT_DOMAIN); /* determine program name */ prog = set_prog_name(argv[0]); /* establish installation root directory */ if (!set_inst_root(getenv("PKG_INSTALL_ROOT"))) { progerr(gettext(ERR_ROOT_SET)); quit(1); } /* check if not ABI compliant mode */ abi_sym_ptr = getenv("PKG_NONABI_SYMLINKS"); if (abi_sym_ptr && strncasecmp(abi_sym_ptr, "TRUE", 4) == 0) { set_nonABI_symlinks(); } /* bugId 4012147 */ if ((uniTmp = getenv("PKG_NO_UNIFIED")) != NULL) map_client = 0; while ((c = getopt(argc, argv, "Y:R:e:p:d:nLli:vaV:Mm:cqxfQP:?")) != EOF) { switch (c) { case 'p': pathlist[npaths] = strtok(optarg, " , "); if (pathlist[npaths++] == NULL) { progerr(gettext(ERR_POPTION)); quit(1); } while (pathlist[npaths] = strtok(NULL, " , ")) { if (npaths++ >= MAXPATHS) { progerr(gettext(ERR_MAXPATHS), MAXPATHS); quit(1); } } break; case 'd': dvalue = optarg; dflag = 1; break; case 'n': nflag++; break; case 'M': map_client = 0; break; /* * Allow admin to establish the client filesystem using a * vfstab-like file of stable format. */ case 'V': vfstab_file = flex_device(optarg, 2); map_client = 1; break; case 'f': #if 0 if (getuid()) { progerr(gettext(ERR_NOTROOT), prog); quit(1); } #endif fflag++; break; case 'i': setpathlist(optarg); break; case 'v': vflag++; break; case 'l': lflag++; break; case 'L': Lflag++; break; case 'x': if (aflag < 0) aflag = 0; if (cflag < 0) cflag = 0; xflag++; break; case 'q': qflag++; break; case 'a': if (cflag < 0) cflag = 0; aflag = 1; break; case 'c': if (aflag < 0) aflag = 0; cflag = 1; break; case 'e': envfile = optarg; break; case 'm': mapfile = optarg; break; case 'R': Rvalue = optarg; Rflag = 1; break; case 'Y': catg_arg = strdup(optarg); if ((category = get_categories(catg_arg)) == NULL) { progerr(gettext(ERR_CAT_INV), catg_arg); quit(1); } else if (is_not_valid_length(category)) { progerr(gettext(ERR_CAT_LNGTH)); quit(1); } break; case 'Q': dbcreate++; break; case 'P': ppathlist[npaths] = strtok(optarg, " , "); if ((ppathlist[npaths] == NULL) || (ppathlist[npaths][0] == '-')) { progerr(gettext(ERR_PARTIAL_POPTION)); quit(1); } npaths++; while (ppathlist[npaths] = strtok(NULL, " , ")) { if (npaths++ >= MAXPATHS) { progerr(gettext(ERR_MAXPATHS), MAXPATHS); quit(1); } } break; default: usage(); } } /* Check for incompatible options */ if (dflag && Rflag) usage(); /* Check for root dir and device dir if set */ if (Rflag) { if (!set_inst_root(Rvalue)) { progerr(gettext(ERR_ROOT_CMD)); quit(1); } } if (dflag) device = flex_device(dvalue, 1); if (lflag || Lflag) { /* we're only supposed to list information */ if ((cflag >= 0) || (aflag >= 0) || qflag || xflag || fflag || nflag || vflag) usage(); } set_PKGpaths(get_inst_root()); if (catg_arg != NULL && device == NULL) { if (argc - optind) { usage(); } pkg = gpkglist(pkgdir, all_pkgs, category); if (pkg == NULL) { progerr(gettext(ERR_CAT_FND), catg_arg); quit(1); } else { for (pkgcnt = 0; pkg[pkgcnt] != NULL; pkgcnt++); } } else if (catg_arg != NULL && optind < argc) { usage(); } else { pkg = &argv[optind]; pkgcnt = (argc - optind); } environ = NULL; /* Sever the parent environment. */ if (vcfile() == 0) { quit(99); } errflg = 0; if (mapfile) { /* check for incompatible options */ if (device || pkgcnt) usage(); put_path_params(); /* Restore what's needed. */ /* send pathtype if partial path */ pathtype = (ppathlist[0] != NULL) ? 1 : 0; if (checkmap(0, (device != NULL), mapfile, envfile, NULL, NULL, pathtype)) errflg++; } else if (device) { /* check for incompatible options */ if ((cflag >= 0) || (aflag >= 0)) usage(); if (qflag || xflag || nflag || envfile) usage(); tmpdir = NULL; if ((spooldir = devattr(device, "pathname")) == NULL) spooldir = device; if (isdir(spooldir)) { char template[] = "/var/tmp/spoolXXXXXX"; close(mkstemp(template));
BOOST_SYSTEM_DECL void error_category::register_category(error_category const & cat) { get_categories().push_back(&cat); }