本文整理汇总了C++中bstrdup函数的典型用法代码示例。如果您正苦于以下问题:C++ bstrdup函数的具体用法?C++ bstrdup怎么用?C++ bstrdup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bstrdup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: update_settings
static bool update_settings(struct obs_x264 *obsx264, obs_data_t *settings)
{
char *preset = bstrdup(obs_data_get_string(settings, "preset"));
char *profile = bstrdup(obs_data_get_string(settings, "profile"));
char *tune = bstrdup(obs_data_get_string(settings, "tune"));
const char *opts = obs_data_get_string(settings, "x264opts");
char **paramlist;
bool success = true;
paramlist = strlist_split(opts, ' ', false);
blog(LOG_INFO, "---------------------------------");
if (!obsx264->context) {
override_base_params(obsx264, paramlist,
&preset, &profile, &tune);
if (preset && *preset) info("preset: %s", preset);
if (profile && *profile) info("profile: %s", profile);
if (tune && *tune) info("tune: %s", tune);
success = reset_x264_params(obsx264, preset, tune);
}
if (success) {
update_params(obsx264, settings, paramlist);
if (opts && *opts)
info("custom settings: %s", opts);
if (!obsx264->context)
apply_x264_profile(obsx264, profile);
}
obsx264->params.b_repeat_headers = false;
strlist_free(paramlist);
bfree(preset);
bfree(profile);
bfree(tune);
return success;
}
开发者ID:ipaste,项目名称:tblive,代码行数:43,代码来源:obs-x264.c
示例2: get_items
/* retreive a simple list (.pool, .client) and store it into items */
void get_items(const char *what)
{
init_items();
UA_sock->fsend("%s", what);
while (UA_sock->recv() > 0) {
strip_trailing_junk(UA_sock->msg);
items->list.append(bstrdup(UA_sock->msg));
}
}
开发者ID:aussendorf,项目名称:bareos,代码行数:11,代码来源:console.c
示例3: do_shell_expansion
int do_shell_expansion(char *name, int name_len)
{
char *src = bstrdup(name);
ExpandEnvironmentStrings(src, name, name_len);
free(src);
return 1;
}
开发者ID:eneuhauss,项目名称:bareos,代码行数:10,代码来源:util.c
示例4: do_extract
static void do_extract(char *devname)
{
struct stat statp;
enable_backup_privileges(NULL, 1);
jcr = setup_jcr("bextract", devname, bsr, director, VolumeName, 1); /* acquire for read */
if (!jcr) {
exit(1);
}
dev = jcr->read_dcr->dev;
if (!dev) {
exit(1);
}
dcr = jcr->read_dcr;
/* Make sure where directory exists and that it is a directory */
if (stat(where, &statp) < 0) {
berrno be;
Emsg2(M_ERROR_TERM, 0, _("Cannot stat %s. It must exist. ERR=%s\n"),
where, be.bstrerror());
}
if (!S_ISDIR(statp.st_mode)) {
Emsg1(M_ERROR_TERM, 0, _("%s must be a directory.\n"), where);
}
free(jcr->where);
jcr->where = bstrdup(where);
attr = new_attr(jcr);
compress_buf = get_memory(compress_buf_size);
acl_data.last_fname = get_pool_memory(PM_FNAME);
xattr_data.last_fname = get_pool_memory(PM_FNAME);
read_records(dcr, record_cb, mount_next_read_volume);
/* If output file is still open, it was the last one in the
* archive since we just hit an end of file, so close the file.
*/
if (is_bopen(&bfd)) {
set_attributes(jcr, attr, &bfd);
}
free_attr(attr);
free_pool_memory(acl_data.last_fname);
free_pool_memory(xattr_data.last_fname);
clean_device(jcr->dcr);
dev->term();
free_dcr(dcr);
free_jcr(jcr);
printf(_("%u files restored.\n"), num_files);
return;
}
开发者ID:eneuhauss,项目名称:bareos,代码行数:55,代码来源:bextract.c
示例5: a_assert
char_t *umGetAccessLimit(char_t *url)
{
char_t *urlRet, *urlCheck, *lastChar;
int len;
a_assert(url && *url);
urlRet = NULL;
urlCheck = bstrdup(B_L, url);
a_assert(urlCheck);
len = gstrlen(urlCheck);
/*
* Scan back through URL to see if there is a "parent" access limit
*/
while (len && !urlRet) {
if (umAccessLimitExists(urlCheck)) {
urlRet = bstrdup(B_L, urlCheck);
} else {
/*
* Trim the end portion of the URL to the previous directory marker
*/
lastChar = urlCheck + len;
lastChar--;
while ((lastChar >= urlCheck) && ((*lastChar == '/') ||
(*lastChar == '\\'))) {
*lastChar = 0;
lastChar--;
}
while ((lastChar >= urlCheck) && (*lastChar != '/') &&
(*lastChar != '\\')) {
*lastChar = 0;
lastChar--;
}
len = gstrlen(urlCheck);
}
}
bfree (B_L, urlCheck);
return urlRet;
}
开发者ID:challinan,项目名称:webserver-demo,代码行数:42,代码来源:um.c
示例6: memset
static inline IISQLDA *INGgetDescriptor(int numCols, const char *query)
{
/* # line 99 "myingres.sc" */
char *stmt;
/* # line 101 "myingres.sc" */
int i;
IISQLDA *sqlda;
sqlda = (IISQLDA *)malloc(IISQDA_HEAD_SIZE + (numCols * IISQDA_VAR_SIZE));
memset(sqlda, 0, (IISQDA_HEAD_SIZE + (numCols * IISQDA_VAR_SIZE)));
sqlda->sqln = numCols;
stmt = bstrdup(query);
/* # line 112 "myingres.sc" */ /* prepare */
{
IIsqInit(&sqlca);
IIsqPrepare(0,(char *)"s2",sqlda,0,stmt);
}
/* # line 114 "myingres.sc" */ /* host code */
for (i = 0; i < sqlda->sqld; ++i) {
/*
* Negative type indicates nullable columns, so an indicator
* is allocated, otherwise it's null
*/
if (sqlda->sqlvar[i].sqltype > 0) {
sqlda->sqlvar[i].sqlind = NULL;
} else {
sqlda->sqlvar[i].sqlind = (short *)malloc(sizeof(short));
}
/*
* Alloc space for variable like indicated in sqllen
* for date types sqllen is always 0 -> allocate by type
*/
switch (abs(sqlda->sqlvar[i].sqltype)) {
case IISQ_TSW_TYPE:
sqlda->sqlvar[i].sqldata = (char *)malloc(IISQ_TSW_LEN);
break;
case IISQ_TSWO_TYPE:
sqlda->sqlvar[i].sqldata = (char *)malloc(IISQ_TSWO_LEN);
break;
case IISQ_TSTMP_TYPE:
sqlda->sqlvar[i].sqldata = (char *)malloc(IISQ_TSTMP_LEN);
break;
default:
/*
* plus one to avoid zero mem allocs
*/
sqlda->sqlvar[i].sqldata = (char *)malloc(sqlda->sqlvar[i].sqllen + 1);
break;
}
}
free(stmt);
return sqlda;
}
开发者ID:AlD,项目名称:bareos,代码行数:54,代码来源:myingres.c
示例7: get_restore_client_name
/*
* This is where we pick up a client name to restore to.
*/
static int get_restore_client_name(UAContext *ua, RESTORE_CTX &rx)
{
int i;
/*
* Try command line argument
*/
i = find_arg_with_value(ua, NT_("restoreclient"));
if (i >= 0) {
if (!is_name_valid(ua->argv[i], &ua->errmsg)) {
ua->error_msg("%s argument: %s", ua->argk[i], ua->errmsg);
return 0;
}
rx.RestoreClientName = bstrdup(ua->argv[i]);
return 1;
}
rx.RestoreClientName = bstrdup(rx.ClientName);
return 1;
}
开发者ID:pstray,项目名称:bareos,代码行数:23,代码来源:ua_restore.c
示例8: a_assert
char_t *websCalcOpaque(webs_t wp)
{
char_t *opaque;
a_assert(wp);
/*
* Temporary stub!
*/
opaque = bstrdup(B_L, T("5ccc069c403ebaf9f0171e9517f40e41"));
return opaque;
}
开发者ID:dulton,项目名称:goahead-1,代码行数:11,代码来源:websda.c
示例9: obs_open_module
int obs_open_module(obs_module_t **module, const char *path,
const char *data_path)
{
struct obs_module mod = {0};
int errorcode;
if (!module || !path || !obs)
return MODULE_ERROR;
blog(LOG_INFO, "---------------------------------");
mod.module = os_dlopen(path);
if (!mod.module) {
blog(LOG_WARNING, "Module '%s' not found", path);
return MODULE_FILE_NOT_FOUND;
}
errorcode = load_module_exports(&mod, path);
if (errorcode != MODULE_SUCCESS)
return errorcode;
mod.bin_path = bstrdup(path);
mod.file = strrchr(mod.bin_path, '/');
mod.file = (!mod.file) ? mod.bin_path : (mod.file + 1);
mod.mod_name = get_module_name(mod.file);
mod.data_path = bstrdup(data_path);
mod.next = obs->first_module;
if (mod.file) {
blog(LOG_INFO, "Loading module: %s", mod.file);
}
*module = bmemdup(&mod, sizeof(mod));
obs->first_module = (*module);
mod.set_pointer(*module);
if (mod.set_locale)
mod.set_locale(obs->locale);
return MODULE_SUCCESS;
}
开发者ID:AhmedAbdulSalam5,项目名称:obs-studio,代码行数:41,代码来源:obs-module.c
示例10: handlePluginEvent
/*
* Handle an event that was generated in Bareos
*/
static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
{
bRC retval;
plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;
if (!p_ctx) {
return bRC_Error;
}
switch (event->eventType) {
case bEventLevel:
p_ctx->backup_level = (int64_t)value;
retval = bRC_OK;
break;
case bEventRestoreCommand:
/*
* Fall-through wanted
*/
case bEventBackupCommand:
/*
* Fall-through wanted
*/
case bEventPluginCommand:
retval = parse_plugin_definition(ctx, value);
break;
case bEventNewPluginOptions:
/*
* Free any previous value.
*/
if (p_ctx->plugin_options) {
free(p_ctx->plugin_options);
p_ctx->plugin_options = NULL;
}
retval = parse_plugin_definition(ctx, value);
/*
* Save that we got a plugin override.
*/
p_ctx->plugin_options = bstrdup((char *)value);
break;
case bEventEndRestoreJob:
retval = end_restore_job(ctx, value);
break;
default:
Jmsg(ctx, M_FATAL, "mssqlvdi-fd: unknown event=%d\n", event->eventType);
Dmsg(ctx, dbglvl, "mssqlvdi-fd: unknown event=%d\n", event->eventType);
retval = bRC_Error;
break;
}
return retval;
}
开发者ID:karcaw,项目名称:bareos-contrib,代码行数:56,代码来源:mssqlvdi-fd.c
示例11: is_on_read_volume_list
/*
* Check if volume name is on read volume list.
*/
bool is_on_read_volume_list(JCR *jcr, const char *VolumeName)
{
VOLRES vol, *fvol;
lock_read_volumes();
vol.vol_name = bstrdup(VolumeName);
fvol = (VOLRES *)read_vol_list->binary_search(&vol, compare_by_volumename);
free(vol.vol_name);
unlock_read_volumes();
return fvol != NULL;
}
开发者ID:aAnsgarWuestenhagen,项目名称:bareos,代码行数:15,代码来源:vol_mgr.c
示例12: pgsqllibinit
/*
* curently it assigns argv[0] into program_name variable only, future enchancement possible
*/
void pgsqllibinit ( int argc, char * argv[] ){
char * prg;
char * nprg;
char * dirtmp;
prg = bstrdup ( argv[0] );
nprg = basename ( prg );
program_name = bstrdup ( nprg );
FREE ( prg );
dirtmp = MALLOC ( PATH_MAX );
if ( realpath ( argv[0], dirtmp ) == NULL ){
/* error in resolving path */
FREE ( dirtmp );
dirtmp = argv[0];
}
program_directory = bstrdup ( dirtmp );
FREE ( dirtmp );
}
开发者ID:bareos,项目名称:contrib-pgsql-plugin,代码行数:24,代码来源:pgsqllib.c
示例13: dstr_printf
/* ensures that names are never blank */
static inline char *dup_name(const char *name)
{
if (!name || !*name) {
struct dstr unnamed = {0};
dstr_printf(&unnamed, "__unnamed%004lld",
obs->data.unnamed_index++);
return unnamed.array;
} else {
return bstrdup(name);
}
}
开发者ID:Lexsus,项目名称:obs-studio,代码行数:13,代码来源:obs.c
示例14: handlePluginEvent
/*
* Handle an event that was generated in Bareos
*/
static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
{
bRC retval = bRC_OK;
struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext;
if (!p_ctx) {
return bRC_Error;
}
switch (event->eventType) {
case bEventJobStart:
Dmsg(ctx, dbglvl, "bpipe-fd: JobStart=%s\n", (char *)value);
break;
case bEventRestoreCommand:
/*
* Fall-through wanted
*/
case bEventBackupCommand:
/*
* Fall-through wanted
*/
case bEventEstimateCommand:
/*
* Fall-through wanted
*/
case bEventPluginCommand:
retval = parse_plugin_definition(ctx, value);
break;
case bEventNewPluginOptions:
/*
* Free any previous value.
*/
if (p_ctx->plugin_options) {
free(p_ctx->plugin_options);
p_ctx->plugin_options = NULL;
}
retval = parse_plugin_definition(ctx, value);
/*
* Save that we got a plugin override.
*/
p_ctx->plugin_options = bstrdup((char *)value);
break;
default:
Jmsg(ctx, M_FATAL, "bpipe-fd: unknown event=%d\n", event->eventType);
Dmsg(ctx, dbglvl, "bpipe-fd: unknown event=%d\n", event->eventType);
retval = bRC_Error;
break;
}
return retval;
}
开发者ID:dl5rcw,项目名称:bareos,代码行数:56,代码来源:bpipe-fd.c
示例15: Dmsg3
/* Initialize internal socket structure.
* This probably should be done in net_open
*/
BSOCK *init_bsock(JCR * jcr, int sockfd, const char *who, const char *host, int port,
struct sockaddr *client_addr)
{
Dmsg3(100, "who=%s host=%s port=%d\n", who, host, port);
BSOCK *bsock = (BSOCK *)malloc(sizeof(BSOCK));
memset(bsock, 0, sizeof(BSOCK));
bsock->m_fd = sockfd;
bsock->tls = NULL;
bsock->errors = 0;
bsock->m_blocking = 1;
bsock->msg = get_pool_memory(PM_BSOCK);
bsock->errmsg = get_pool_memory(PM_MESSAGE);
bsock->set_who(bstrdup(who));
bsock->set_host(bstrdup(host));
bsock->set_port(port);
memset(&bsock->peer_addr, 0, sizeof(bsock->peer_addr));
memcpy(&bsock->client_addr, client_addr, sizeof(bsock->client_addr));
bsock->timeout = BSOCK_TIMEOUT;
bsock->set_jcr(jcr);
return bsock;
}
开发者ID:rkorzeniewski,项目名称:bacula,代码行数:24,代码来源:bnet.c
示例16: store_plugin
/* Store reader info */
static void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass)
{
lex_get_token(lc, T_NAME);
if (pass == 1) {
/*
* Pickup plugin command
*/
res_incexe.current_opts->plugin = bstrdup(lc->str);
}
scan_to_eol(lc);
}
开发者ID:eneuhauss,项目名称:bareos,代码行数:13,代码来源:inc_conf.c
示例17: store_base
/* Store Base info */
static void store_base(LEX *lc, RES_ITEM *item, int index, int pass)
{
lex_get_token(lc, T_NAME);
if (pass == 1) {
/*
* Pickup Base Job Name
*/
res_incexe.current_opts->base.append(bstrdup(lc->str));
}
scan_to_eol(lc);
}
开发者ID:eneuhauss,项目名称:bareos,代码行数:13,代码来源:inc_conf.c
示例18: websBuildWhitelist
/*
* Build or rebuild whitelist
*/
int websBuildWhitelist(void)
{
if (websDefaultDir == NULL || *websDefaultDir == '\0') {
return -1;
}
websDeleteWhitelistRecursive(whitelist);
whitelist = balloc(B_L, sizeof(fileNode_t));
memset(whitelist, 0x0, sizeof(fileNode_t));
whitelist->name = bstrdup(B_L, "/");
whitelist->flags |= WHITELIST_DIR;
return websBuildWhitelistRecursive(websDefaultDir, whitelist, 0);
}
开发者ID:morrisxd,项目名称:PMC,代码行数:15,代码来源:default.c
示例19: store_dir
/*
* Store a directory name at specified address. Note, we do
* shell expansion except if the string begins with a vertical
* bar (i.e. it will likely be passed to the shell later).
*/
void store_dir(LEX *lc, RES_ITEM *item, int index, int pass)
{
lex_get_token(lc, T_STRING);
if (pass == 1) {
if (lc->str[0] != '|') {
do_shell_expansion(lc->str, sizeof(lc->str));
}
*(item->value) = bstrdup(lc->str);
}
scan_to_eol(lc);
set_bit(index, res_all.hdr.item_present);
}
开发者ID:halgandd,项目名称:bacula,代码行数:17,代码来源:parse_conf.c
示例20: free
/**
* Update an entry in the cache.
* This function should be called with a write lock on the mntent_cache.
*/
static mntent_cache_entry_t *update_mntent_mapping(uint32_t dev,
const char *special,
const char *mountpoint,
const char *fstype,
const char *mntopts)
{
mntent_cache_entry_t lookup, *mce;
lookup.dev = dev;
mce = (mntent_cache_entry_t *)mntent_cache_entries->binary_search(&lookup, compare_mntent_mapping);
if (mce) {
/*
* See if the info changed.
*/
if (!bstrcmp(mce->special, special)) {
free(mce->special);
mce->special = bstrdup(special);
}
if (!bstrcmp(mce->mountpoint, mountpoint)) {
free(mce->mountpoint);
mce->mountpoint = bstrdup(mountpoint);
}
if (!bstrcmp(mce->fstype, fstype)) {
free(mce->fstype);
mce->fstype = bstrdup(fstype);
}
if (!bstrcmp(mce->mntopts, mntopts)) {
free(mce->mntopts);
mce->mntopts = bstrdup(mntopts);
}
} else {
mce = add_mntent_mapping(dev, special, mountpoint, fstype, mntopts);
}
mce->validated = true;
return mce;
}
开发者ID:AlD,项目名称:bareos,代码行数:44,代码来源:mntent_cache.c
注:本文中的bstrdup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论