int numFields, i;
struct ast_str *sql = ast_str_thread_get(&sql_buf, 16);
struct ast_str *buf = ast_str_thread_get(&scratch_buf, 16);
- const char *initfield = NULL;
+ char *initfield = NULL;
char *stringp;
char *chunk;
char *op;
struct ast_variable *v;
char *lang;
char *x;
+ const char *y;
char *rule = NULL;
char *rule_head = NULL;
int ret = 0;
return 0;
/* skip up to two prefixes to get the value */
- if ( (x = strchr(s, ':')) )
- s = x + 1;
- if ( (x = strchr(s, ':')) )
- s = x + 1;
+ if ( (y = strchr(s, ':')) )
+ s = y + 1;
+ if ( (y = strchr(s, ':')) )
+ s = y + 1;
ast_debug(2, "value is <%s>\n", s);
n = ast_var_assign("SAY", s);
if (!n) {
static int create_destination_directory(const char *path)
{
int res;
- char directory[PATH_MAX], *file_sep;
+ char *path_copy = ast_strdupa(path), directory[PATH_MAX], *file_sep;
- if (!(file_sep = strrchr(path, '/'))) {
+ if (!(file_sep = strrchr(path_copy, '/'))) {
/* No directory to create */
return 0;
}
*file_sep = '\0';
/* Absolute path? */
- if (path[0] == '/') {
- res = ast_mkdir(path, 0777);
+ if (path_copy[0] == '/') {
+ res = ast_mkdir(path_copy, 0777);
*file_sep = '/';
return res;
}
if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) && valid_config(cfg)) {
while ((category = ast_category_browse(cfg, category))) {
if (!strcasecmp(category, vmu->context)) {
- char *value = NULL;
+ const char *value = NULL;
char *new = NULL;
if (!(tmp = ast_variable_retrieve(cfg, category, vmu->mailbox))) {
ast_log(AST_LOG_WARNING, "We could not find the mailbox.\n");
};
if (!ast_strlen_zero(content_type)) {
- sep = strchr(content_type, '/');
+ char *content_type_copy = ast_strdupa(content_type);
+ sep = strchr(content_type_copy, '/');
if (sep) {
*sep = '\0';
- body.type = content_type;
+ body.type = content_type_copy;
body.subtype = ++sep;
}
}
int x;
int len;
unsigned int flags = 0;
- char *e;
+ const char *e;
while(buf && *buf) {
e = strchr(buf, ',');
if (e)
const char *lang,
ast_waitstream_fr_cb cb)
{
+ char *file_copy = ast_strdupa(file);
char *breaks = NULL;
char *end = NULL;
int blen = 2;
}
}
- if ((end = strchr(file, ':'))) {
+ if ((end = strchr(file_copy, ':'))) {
if (!strcasecmp(end, ":end")) {
*end = '\0';
end++;
for (;;) {
ast_stopstream(chan);
- res = ast_streamfile(chan, file, lang);
+ res = ast_streamfile(chan, file_copy, lang);
if (!res) {
if (pause_restart_point) {
ast_seekstream(ast_channel_stream(chan), pause_restart_point, SEEK_SET);
{
struct ast_cc_agent *agent = data;
struct cc_generic_agent_pvt *generic_pvt = agent->private_data;
- const char *interface = S_OR(ast_get_cc_agent_dialstring(agent->cc_params), ast_strdupa(agent->device_name));
+ char *interface = ast_strdupa(S_OR(ast_get_cc_agent_dialstring(agent->cc_params), agent->device_name));
const char *tech;
char *target;
int reason;
int ast_variables_match(const struct ast_variable *left, const struct ast_variable *right)
{
- char *op;
+ const char *op;
if (left == right) {
return 1;
}
for (field = right; field; field = field->next) {
- char *space = strrchr(field->name, ' ');
+ const char *space = strrchr(field->name, ' ');
const struct ast_variable *old;
char * name = (char *)field->name;
struct ast_comment *cmt;
for (cmt = comment; cmt; cmt = cmt->next) {
- const char *line = cmt->cmt;
+ char *line = ast_strdupa(cmt->cmt);
char *nl;
while ((nl = strchr(line, '\n')) != NULL) {
char *record_offset;
while (1) {
- record_offset = memchr(search_base, record[0], remaining_size);
+ record_offset = memchr((void *)search_base, record[0], remaining_size);
ast_assert(record_offset != NULL);
ast_assert(search_base + remaining_size - record_offset >= record_size);
* 32 characters
*/
while (1) {
- char *plus_pos = memchr(current_pos, '+', end_of_services - current_pos);
+ const char *plus_pos = memchr(current_pos, '+', end_of_services - current_pos);
uint8_t current_size = plus_pos ? plus_pos - current_pos : end_of_services - current_pos;
int i;
}
while (1) {
- char *backslash_pos = memchr(ptr, '\\', end - ptr);
+ const char *backslash_pos = memchr(ptr, '\\', end - ptr);
if (!backslash_pos) {
break;
}
*/
ast_copy_string(apex, suffix, sizeof(apex));
/* ISN rewrite */
- if ((context->options & ENUMLOOKUP_OPTIONS_ISN) && (p1 = strchr(number, '*'))) {
+ if ((context->options & ENUMLOOKUP_OPTIONS_ISN) && (p1 = strchr((char *)number, '*'))) {
*p1++ = '\0';
ast_copy_string(left, number, sizeof(left));
ast_copy_string(middle, p1, sizeof(middle) - 1);
static struct logchannel *make_logchannel(const char *channel, const char *components, int lineno, int dynamic)
{
struct logchannel *chan;
- char *facility;
+ const char *facility;
struct ast_tm tm;
struct timeval now = ast_tvnow();
char datestring[256];
RAII_VAR(struct event_filter_entry *, filter_entry,
ao2_t_alloc(sizeof(*filter_entry), event_filter_destructor, "event_filter allocation"),
ao2_cleanup);
- char *options_start = NULL;
+ const char *options_start = NULL;
SCOPE_ENTER(3, "manager_add_filter(%s, %s, %p, %p)", criteria, filter_pattern, includefilters, excludefilters);
if (!filter_entry) {
ast_str_reset(substr3);
/* Determine how much simply needs to be copied to the output buf. */
- nextthing = strchr(whereweare, '$');
+ nextthing = strchr((char *)whereweare, '$');
if (nextthing) {
pos = nextthing - whereweare;
switch (nextthing[1]) {
int len;
/* Determine how much simply needs to be copied to the output buf. */
- nextthing = strchr(whereweare, '$');
+ nextthing = strchr((char *)whereweare, '$');
if (nextthing) {
pos = nextthing - whereweare;
switch (nextthing[1]) {
{
int res = 0;
char fn[512] = "";
- char* s = 0;
+ const char* s = 0;
const char* remaining = fn;
if (!num) {
static struct ast_taskprocessor *__allocate_taskprocessor(const char *name, struct ast_taskprocessor_listener *listener)
{
struct ast_taskprocessor *p;
- char *subsystem_separator;
+ const char *subsystem_separator;
size_t subsystem_length = 0;
size_t name_length;
char *ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
{
char *e;
- char *q;
+ const char *q;
s = ast_strip(s);
if ((q = strchr(beg_quotes, *s)) && *q != '\0') {
int dspsilence = 0;
int silence = 0; /* amount of silence to allow */
int gotsilence = 0; /* did we timeout for silence? */
- char *silencestr = NULL;
+ const char *silencestr = NULL;
RAII_VAR(struct ast_format *, rfmt, NULL, ao2_cleanup);
struct ast_silence_generator *silgen = NULL;
{
char *new_name = NULL;
char *new_value = NULL;
- char *like_pos = strstr(name, " LIKE");
+ const char *like_pos = strstr(name, " LIKE");
ast_debug(2, "name='%s' value='%s'\n", name, value);
const char *table_name, const struct ast_variable *fields)
{
char *op;
- const char *initfield = NULL;
+ char *initfield = NULL;
struct ast_variable **vars =
realtime_ldap_base_ap(NULL, basedn, table_name, fields);
struct ast_config *cfg = NULL;
char coltitle[256];
struct ast_str *sql = ast_str_thread_get(&sql_buf, SQL_BUF_SIZE);
struct ast_str *rowdata = ast_str_thread_get(&rowdata_buf, 128);
- const char *initfield;
+ char *initfield;
char *op;
const struct ast_variable *field = fields;
char *stringp;
struct ast_str *sql = ast_str_thread_get(&sql_buf, 100);
struct ast_str *escapebuf = ast_str_thread_get(&escapebuf_buf, 100);
const struct ast_variable *field = fields;
- const char *initfield = NULL;
+ char *initfield = NULL;
char *stringp;
char *chunk;
char *op;
}
} else if (!strcasecmp(data, "t38gateway") || !strcasecmp(data, "gateway") ||
!strcasecmp(data, "t38_gateway") || !strcasecmp(data, "faxgateway")) {
- const char *val = ast_skip_blanks(value);
+ char *val = ast_strdupa(ast_skip_blanks(value));
char *timeout = strchr(val, ',');
if (timeout) {
ast_log(LOG_WARNING, "Unsupported value '%s' passed to FAXOPT(%s).\n", value, data);
}
} else if (!strcasecmp(data, "faxdetect")) {
- const char *val = ast_skip_blanks(value);
+ char *val = ast_strdupa(ast_skip_blanks(value));
char *timeout = strchr(val, ',');
unsigned int fdtimeout = 0;
int flags;
metadata = ast_bucket_file_metadata_get(bucket_file, "cache-control");
if (metadata) {
- char *str_max_age;
+ const char *str_max_age;
str_max_age = strstr(metadata->value, "s-maxage");
if (!str_max_age) {
if (str_max_age) {
unsigned int max_age;
- char *equal = strchr(str_max_age, '=');
+ const char *equal = strchr(str_max_age, '=');
if (equal && (sscanf(equal + 1, "%30u", &max_age) == 1)) {
actual_expires.tv_sec += max_age;
}
}
ast_debug(1, "Got a Content-Length of %d\n", content_len);
} else if (!strcasecmp(var->name, "Content-Type")) {
- boundary_marker = strstr(var->value, "boundary=");
+ boundary_marker = strstr((char *)var->value, "boundary=");
if (boundary_marker) {
boundary_marker += strlen("boundary=");
}
{
struct ast_vector_string *files = obj;
char *full_path;
- char *extension;
+ const char *extension;
/* Skip files that starts with a dot */
if (*filename == '.') {
ast_string_field_set(profile, staticdir, v->value);
} else {
struct phoneprov_file *pp_file;
- char *file_extension;
+ const char *file_extension;
char value_copy[strlen(v->value) + 1];
AST_DECLARE_APP_ARGS(args,
char *data = NULL;
char *app = NULL;
void *free_ptr = NULL;
- char *paren;
+ const char *paren;
const char *context_name;
if (!context || ast_strlen_zero(exten) || ast_strlen_zero(application)) {
static char *pjsip_enable_logger_host(int fd, const char *arg, unsigned int add_host)
{
const char *host = arg;
- char *mask;
+ const char *mask;
struct ast_sockaddr address;
int error = 0;
}
body.type = ast_str_buffer(content_type);
- if ((p = strchr(body.type, '/'))) {
+ if ((p = strchr((char *)body.type, '/'))) {
*p++ = '\0';
body.subtype = p;
}
continue;
}
- sep = strchr(var->value,',');
+ sep = strchr((char *)var->value,',');
if (sep) {
*sep = '\0';
sep++;
config_expires = current_time + cfg->vcfg_common.max_cache_entry_age;
if (!ast_strlen_zero(cache_control_header)) {
- char *str_max_age;
+ const char *str_max_age;
str_max_age = strstr(cache_control_header, "s-maxage");
if (!str_max_age) {
if (str_max_age) {
unsigned int m;
- char *equal = strchr(str_max_age, '=');
+ const char *equal = strchr(str_max_age, '=');
if (equal && !ast_str_to_uint(equal + 1, &m)) {
max_age_hdr = current_time + m;
}
RAII_VAR(char *, jwt_encoded, NULL, ast_free);
RAII_VAR(jwt_t *, jwt, NULL, jwt_free);
RAII_VAR(struct ast_json *, grants, NULL, ast_json_unref);
- char *p = NULL;
+ const char *p = NULL;
char *grants_str = NULL;
const char *x5u;
const char *ppt_header = NULL;
ast_free(filepath);
- dot = strrchr(recording->file, '.');
+ dot = strrchr((char *)recording->file, '.');
*dot = '\0';
recording->format = dot + 1;
#define ast_test_flag64(p,flag) ({ \
typeof ((p)->flags) __p = (p)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
- (void) (&__p == &__x); \
+ (void) (&__p == (typeof(__p)*)&__x); \
((p)->flags & SWAP64_32(flag)); \
})
pos = strlen(whereweare);
nextvar = NULL;
nextexp = NULL;
- nextthing = strchr(whereweare, '$');
+ nextthing = (char *)strchr(whereweare, '$');
if (nextthing) {
switch (nextthing[1]) {
case '{':