More merges from resolve-shadow warnings:

utils/
  codecs/
  and a change I missed from formats/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@136408 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.1
Sean Bright 17 years ago
parent 8397209316
commit 6305009cfc

@ -46,7 +46,7 @@ $(LIBLPC10):
$(if $(filter codec_lpc10,$(EMBEDDED_MODS)),modules.link,codec_lpc10.so): $(LIBLPC10) $(if $(filter codec_lpc10,$(EMBEDDED_MODS)),modules.link,codec_lpc10.so): $(LIBLPC10)
$(LIBILBC): $(LIBILBC):
@$(MAKE) -C ilbc all ASTCFLAGS="$(filter-out -Wmissing-prototypes -Wmissing-declarations,$(ASTCFLAGS)) $(AST_NO_STRICT_OVERFLOW)" @$(MAKE) -C ilbc all ASTCFLAGS="$(filter-out -Wmissing-prototypes -Wmissing-declarations -Wshadow,$(ASTCFLAGS)) $(AST_NO_STRICT_OVERFLOW)"
$(if $(filter codec_ilbc,$(EMBEDDED_MODS)),modules.link,codec_ilbc.so): $(LIBILBC) $(if $(filter codec_ilbc,$(EMBEDDED_MODS)),modules.link,codec_ilbc.so): $(LIBILBC)

@ -362,12 +362,12 @@ static void drop_translator(int dst, int src)
static void unregister_translators(void) static void unregister_translators(void)
{ {
struct translator *cur; struct translator *current;
AST_LIST_LOCK(&translators); AST_LIST_LOCK(&translators);
while ((cur = AST_LIST_REMOVE_HEAD(&translators, entry))) { while ((current = AST_LIST_REMOVE_HEAD(&translators, entry))) {
ast_unregister_translator(&cur->t); ast_unregister_translator(&current->t);
ast_free(cur); ast_free(current);
} }
AST_LIST_UNLOCK(&translators); AST_LIST_UNLOCK(&translators);
} }

@ -349,105 +349,105 @@ static inline void conv66(gsm_byte * d, wav_byte * c) {
} }
#define writeGSM_33(c1) { \ #define writeGSM_33(c1) { \
gsm_byte *c = (c1); \ gsm_byte *__c = (c1); \
*c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */ \ *__c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */ \
| ((LARc[0] >> 2) & 0xF); \ | ((LARc[0] >> 2) & 0xF); \
*c++ = ((LARc[0] & 0x3) << 6) \ *__c++ = ((LARc[0] & 0x3) << 6) \
| (LARc[1] & 0x3F); \ | (LARc[1] & 0x3F); \
*c++ = ((LARc[2] & 0x1F) << 3) \ *__c++ = ((LARc[2] & 0x1F) << 3) \
| ((LARc[3] >> 2) & 0x7); \ | ((LARc[3] >> 2) & 0x7); \
*c++ = ((LARc[3] & 0x3) << 6) \ *__c++ = ((LARc[3] & 0x3) << 6) \
| ((LARc[4] & 0xF) << 2) \ | ((LARc[4] & 0xF) << 2) \
| ((LARc[5] >> 2) & 0x3); \ | ((LARc[5] >> 2) & 0x3); \
*c++ = ((LARc[5] & 0x3) << 6) \ *__c++ = ((LARc[5] & 0x3) << 6) \
| ((LARc[6] & 0x7) << 3) \ | ((LARc[6] & 0x7) << 3) \
| (LARc[7] & 0x7); \ | (LARc[7] & 0x7); \
*c++ = ((Nc[0] & 0x7F) << 1) \ *__c++ = ((Nc[0] & 0x7F) << 1) \
| ((bc[0] >> 1) & 0x1); \ | ((bc[0] >> 1) & 0x1); \
*c++ = ((bc[0] & 0x1) << 7) \ *__c++ = ((bc[0] & 0x1) << 7) \
| ((Mc[0] & 0x3) << 5) \ | ((Mc[0] & 0x3) << 5) \
| ((xmaxc[0] >> 1) & 0x1F); \ | ((xmaxc[0] >> 1) & 0x1F); \
*c++ = ((xmaxc[0] & 0x1) << 7) \ *__c++ = ((xmaxc[0] & 0x1) << 7) \
| ((xmc[0] & 0x7) << 4) \ | ((xmc[0] & 0x7) << 4) \
| ((xmc[1] & 0x7) << 1) \ | ((xmc[1] & 0x7) << 1) \
| ((xmc[2] >> 2) & 0x1); \ | ((xmc[2] >> 2) & 0x1); \
*c++ = ((xmc[2] & 0x3) << 6) \ *__c++ = ((xmc[2] & 0x3) << 6) \
| ((xmc[3] & 0x7) << 3) \ | ((xmc[3] & 0x7) << 3) \
| (xmc[4] & 0x7); \ | (xmc[4] & 0x7); \
*c++ = ((xmc[5] & 0x7) << 5) /* 10 */ \ *__c++ = ((xmc[5] & 0x7) << 5) /* 10 */ \
| ((xmc[6] & 0x7) << 2) \ | ((xmc[6] & 0x7) << 2) \
| ((xmc[7] >> 1) & 0x3); \ | ((xmc[7] >> 1) & 0x3); \
*c++ = ((xmc[7] & 0x1) << 7) \ *__c++ = ((xmc[7] & 0x1) << 7) \
| ((xmc[8] & 0x7) << 4) \ | ((xmc[8] & 0x7) << 4) \
| ((xmc[9] & 0x7) << 1) \ | ((xmc[9] & 0x7) << 1) \
| ((xmc[10] >> 2) & 0x1); \ | ((xmc[10] >> 2) & 0x1); \
*c++ = ((xmc[10] & 0x3) << 6) \ *__c++ = ((xmc[10] & 0x3) << 6) \
| ((xmc[11] & 0x7) << 3) \ | ((xmc[11] & 0x7) << 3) \
| (xmc[12] & 0x7); \ | (xmc[12] & 0x7); \
*c++ = ((Nc[1] & 0x7F) << 1) \ *__c++ = ((Nc[1] & 0x7F) << 1) \
| ((bc[1] >> 1) & 0x1); \ | ((bc[1] >> 1) & 0x1); \
*c++ = ((bc[1] & 0x1) << 7) \ *__c++ = ((bc[1] & 0x1) << 7) \
| ((Mc[1] & 0x3) << 5) \ | ((Mc[1] & 0x3) << 5) \
| ((xmaxc[1] >> 1) & 0x1F); \ | ((xmaxc[1] >> 1) & 0x1F); \
*c++ = ((xmaxc[1] & 0x1) << 7) \ *__c++ = ((xmaxc[1] & 0x1) << 7) \
| ((xmc[13] & 0x7) << 4) \ | ((xmc[13] & 0x7) << 4) \
| ((xmc[14] & 0x7) << 1) \ | ((xmc[14] & 0x7) << 1) \
| ((xmc[15] >> 2) & 0x1); \ | ((xmc[15] >> 2) & 0x1); \
*c++ = ((xmc[15] & 0x3) << 6) \ *__c++ = ((xmc[15] & 0x3) << 6) \
| ((xmc[16] & 0x7) << 3) \ | ((xmc[16] & 0x7) << 3) \
| (xmc[17] & 0x7); \ | (xmc[17] & 0x7); \
*c++ = ((xmc[18] & 0x7) << 5) \ *__c++ = ((xmc[18] & 0x7) << 5) \
| ((xmc[19] & 0x7) << 2) \ | ((xmc[19] & 0x7) << 2) \
| ((xmc[20] >> 1) & 0x3); \ | ((xmc[20] >> 1) & 0x3); \
*c++ = ((xmc[20] & 0x1) << 7) \ *__c++ = ((xmc[20] & 0x1) << 7) \
| ((xmc[21] & 0x7) << 4) \ | ((xmc[21] & 0x7) << 4) \
| ((xmc[22] & 0x7) << 1) \ | ((xmc[22] & 0x7) << 1) \
| ((xmc[23] >> 2) & 0x1); \ | ((xmc[23] >> 2) & 0x1); \
*c++ = ((xmc[23] & 0x3) << 6) \ *__c++ = ((xmc[23] & 0x3) << 6) \
| ((xmc[24] & 0x7) << 3) \ | ((xmc[24] & 0x7) << 3) \
| (xmc[25] & 0x7); \ | (xmc[25] & 0x7); \
*c++ = ((Nc[2] & 0x7F) << 1) /* 20 */ \ *__c++ = ((Nc[2] & 0x7F) << 1) /* 20 */ \
| ((bc[2] >> 1) & 0x1); \ | ((bc[2] >> 1) & 0x1); \
*c++ = ((bc[2] & 0x1) << 7) \ *__c++ = ((bc[2] & 0x1) << 7) \
| ((Mc[2] & 0x3) << 5) \ | ((Mc[2] & 0x3) << 5) \
| ((xmaxc[2] >> 1) & 0x1F); \ | ((xmaxc[2] >> 1) & 0x1F); \
*c++ = ((xmaxc[2] & 0x1) << 7) \ *__c++ = ((xmaxc[2] & 0x1) << 7) \
| ((xmc[26] & 0x7) << 4) \ | ((xmc[26] & 0x7) << 4) \
| ((xmc[27] & 0x7) << 1) \ | ((xmc[27] & 0x7) << 1) \
| ((xmc[28] >> 2) & 0x1); \ | ((xmc[28] >> 2) & 0x1); \
*c++ = ((xmc[28] & 0x3) << 6) \ *__c++ = ((xmc[28] & 0x3) << 6) \
| ((xmc[29] & 0x7) << 3) \ | ((xmc[29] & 0x7) << 3) \
| (xmc[30] & 0x7); \ | (xmc[30] & 0x7); \
*c++ = ((xmc[31] & 0x7) << 5) \ *__c++ = ((xmc[31] & 0x7) << 5) \
| ((xmc[32] & 0x7) << 2) \ | ((xmc[32] & 0x7) << 2) \
| ((xmc[33] >> 1) & 0x3); \ | ((xmc[33] >> 1) & 0x3); \
*c++ = ((xmc[33] & 0x1) << 7) \ *__c++ = ((xmc[33] & 0x1) << 7) \
| ((xmc[34] & 0x7) << 4) \ | ((xmc[34] & 0x7) << 4) \
| ((xmc[35] & 0x7) << 1) \ | ((xmc[35] & 0x7) << 1) \
| ((xmc[36] >> 2) & 0x1); \ | ((xmc[36] >> 2) & 0x1); \
*c++ = ((xmc[36] & 0x3) << 6) \ *__c++ = ((xmc[36] & 0x3) << 6) \
| ((xmc[37] & 0x7) << 3) \ | ((xmc[37] & 0x7) << 3) \
| (xmc[38] & 0x7); \ | (xmc[38] & 0x7); \
*c++ = ((Nc[3] & 0x7F) << 1) \ *__c++ = ((Nc[3] & 0x7F) << 1) \
| ((bc[3] >> 1) & 0x1); \ | ((bc[3] >> 1) & 0x1); \
*c++ = ((bc[3] & 0x1) << 7) \ *__c++ = ((bc[3] & 0x1) << 7) \
| ((Mc[3] & 0x3) << 5) \ | ((Mc[3] & 0x3) << 5) \
| ((xmaxc[3] >> 1) & 0x1F); \ | ((xmaxc[3] >> 1) & 0x1F); \
*c++ = ((xmaxc[3] & 0x1) << 7) \ *__c++ = ((xmaxc[3] & 0x1) << 7) \
| ((xmc[39] & 0x7) << 4) \ | ((xmc[39] & 0x7) << 4) \
| ((xmc[40] & 0x7) << 1) \ | ((xmc[40] & 0x7) << 1) \
| ((xmc[41] >> 2) & 0x1); \ | ((xmc[41] >> 2) & 0x1); \
*c++ = ((xmc[41] & 0x3) << 6) /* 30 */ \ *__c++ = ((xmc[41] & 0x3) << 6) /* 30 */ \
| ((xmc[42] & 0x7) << 3) \ | ((xmc[42] & 0x7) << 3) \
| (xmc[43] & 0x7); \ | (xmc[43] & 0x7); \
*c++ = ((xmc[44] & 0x7) << 5) \ *__c++ = ((xmc[44] & 0x7) << 5) \
| ((xmc[45] & 0x7) << 2) \ | ((xmc[45] & 0x7) << 2) \
| ((xmc[46] >> 1) & 0x3); \ | ((xmc[46] >> 1) & 0x3); \
*c++ = ((xmc[46] & 0x1) << 7) \ *__c++ = ((xmc[46] & 0x1) << 7) \
| ((xmc[47] & 0x7) << 4) \ | ((xmc[47] & 0x7) << 4) \
| ((xmc[48] & 0x7) << 1) \ | ((xmc[48] & 0x7) << 1) \
| ((xmc[49] >> 2) & 0x1); \ | ((xmc[49] >> 2) & 0x1); \
*c++ = ((xmc[49] & 0x3) << 6) \ *__c++ = ((xmc[49] & 0x3) << 6) \
| ((xmc[50] & 0x7) << 3) \ | ((xmc[50] & 0x7) << 3) \
| (xmc[51] & 0x7); \ | (xmc[51] & 0x7); \
} }

@ -626,7 +626,7 @@ static int manage_calls(char *host)
return 0; return 0;
} }
static int login(char *hostname) static int manager_login(char *hostname)
{ {
newtComponent form; newtComponent form;
newtComponent cancel; newtComponent cancel;
@ -756,7 +756,7 @@ int main(int argc, char *argv[])
newtCls(); newtCls();
newtDrawRootText(0, 0, "Asterisk Manager (C)2002, Linux Support Services, Inc."); newtDrawRootText(0, 0, "Asterisk Manager (C)2002, Linux Support Services, Inc.");
newtPushHelpLine("Welcome to the Asterisk Manager!"); newtPushHelpLine("Welcome to the Asterisk Manager!");
if (login(argv[1])) { if (manager_login(argv[1])) {
newtFinished(); newtFinished();
exit(1); exit(1);
} }

@ -1247,7 +1247,7 @@ static unsigned int safe_system_level = 0;
static void *safe_system_prev_handler; static void *safe_system_prev_handler;
/*! \brief NULL handler so we can collect the child exit status */ /*! \brief NULL handler so we can collect the child exit status */
static void null_sig_handler(int signal) static void null_sig_handler(int sig)
{ {
} }
@ -2639,8 +2639,8 @@ struct ast_switch {
}; };
static char *config = "extensions.conf"; static char *config_filename = "extensions.conf";
static char *registrar = "conf2ael"; static char *global_registrar = "conf2ael";
static char userscontext[AST_MAX_EXTENSION] = "default"; static char userscontext[AST_MAX_EXTENSION] = "default";
static int static_config = 0; static int static_config = 0;
static int write_protect_config = 1; static int write_protect_config = 1;
@ -3791,9 +3791,9 @@ static struct ast_config *config_text_file_load(const char *database, const char
} }
if (process_buf) { if (process_buf) {
char *buf = ast_strip(process_buf); char *stripped_process_buf = ast_strip(process_buf);
if (!ast_strlen_zero(buf)) { if (!ast_strlen_zero(stripped_process_buf)) {
if (process_text_line(cfg, &cat, buf, lineno, filename, withcomments, suggested_include_file)) { if (process_text_line(cfg, &cat, stripped_process_buf, lineno, filename, withcomments, suggested_include_file)) {
cfg = NULL; cfg = NULL;
break; break;
} }
@ -5249,16 +5249,16 @@ int localized_context_add_switch2(struct ast_context *con, const char *value,
static struct ast_context *__ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar, int existsokay) static struct ast_context *__ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar, int existsokay)
{ {
struct ast_context *tmp, **local_contexts; struct ast_context *tmp, **loc_contexts;
int length = sizeof(struct ast_context) + strlen(name) + 1; int length = sizeof(struct ast_context) + strlen(name) + 1;
if (!extcontexts) { if (!extcontexts) {
ast_wrlock_contexts(); ast_wrlock_contexts();
local_contexts = &contexts; loc_contexts = &contexts;
} else } else
local_contexts = extcontexts; loc_contexts = extcontexts;
for (tmp = *local_contexts; tmp; tmp = tmp->next) { for (tmp = *loc_contexts; tmp; tmp = tmp->next) {
if (!strcasecmp(tmp->name, name)) { if (!strcasecmp(tmp->name, name)) {
if (!existsokay) { if (!existsokay) {
ast_log(LOG_WARNING, "Tried to register context '%s', already in use\n", name); ast_log(LOG_WARNING, "Tried to register context '%s', already in use\n", name);
@ -5275,10 +5275,10 @@ static struct ast_context *__ast_context_create(struct ast_context **extcontexts
strcpy(tmp->name, name); strcpy(tmp->name, name);
tmp->root = NULL; tmp->root = NULL;
tmp->registrar = registrar; tmp->registrar = registrar;
tmp->next = *local_contexts; tmp->next = *loc_contexts;
tmp->includes = NULL; tmp->includes = NULL;
tmp->ignorepats = NULL; tmp->ignorepats = NULL;
*local_contexts = tmp; *loc_contexts = tmp;
if (option_debug) if (option_debug)
ast_log(LOG_DEBUG, "Registered context '%s'\n", tmp->name); ast_log(LOG_DEBUG, "Registered context '%s'\n", tmp->name);
if (option_verbose > 2) if (option_verbose > 2)
@ -5916,7 +5916,7 @@ static int pbx_load_config(const char *config_file)
/* All categories but "general" or "globals" are considered contexts */ /* All categories but "general" or "globals" are considered contexts */
if (!strcasecmp(cxt, "general") || !strcasecmp(cxt, "globals")) if (!strcasecmp(cxt, "general") || !strcasecmp(cxt, "globals"))
continue; continue;
con=ast_context_find_or_create(&local_contexts,NULL,cxt, registrar); con=ast_context_find_or_create(&local_contexts,NULL,cxt, global_registrar);
if (con == NULL) if (con == NULL)
continue; continue;
@ -6004,7 +6004,7 @@ static int pbx_load_config(const char *config_file)
lastpri = ipri; lastpri = ipri;
if (!ast_opt_dont_warn && !strcmp(realext, "_.")) if (!ast_opt_dont_warn && !strcmp(realext, "_."))
ast_log(LOG_WARNING, "The use of '_.' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X.' instead at line %d\n", v->lineno); ast_log(LOG_WARNING, "The use of '_.' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X.' instead at line %d\n", v->lineno);
if (ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl, strdup(data), ast_free, registrar)) { if (ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl, strdup(data), ast_free, global_registrar)) {
ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno); ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
} }
} }
@ -6013,12 +6013,12 @@ static int pbx_load_config(const char *config_file)
} else if (!strcasecmp(v->name, "include")) { } else if (!strcasecmp(v->name, "include")) {
memset(realvalue, 0, sizeof(realvalue)); memset(realvalue, 0, sizeof(realvalue));
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1); pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
if (ast_context_add_include2(con, realvalue, registrar)) if (ast_context_add_include2(con, realvalue, global_registrar))
ast_log(LOG_WARNING, "Unable to include context '%s' in context '%s'\n", v->value, cxt); ast_log(LOG_WARNING, "Unable to include context '%s' in context '%s'\n", v->value, cxt);
} else if (!strcasecmp(v->name, "ignorepat")) { } else if (!strcasecmp(v->name, "ignorepat")) {
memset(realvalue, 0, sizeof(realvalue)); memset(realvalue, 0, sizeof(realvalue));
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1); pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
if (ast_context_add_ignorepat2(con, realvalue, registrar)) if (ast_context_add_ignorepat2(con, realvalue, global_registrar))
ast_log(LOG_WARNING, "Unable to include ignorepat '%s' in context '%s'\n", v->value, cxt); ast_log(LOG_WARNING, "Unable to include ignorepat '%s' in context '%s'\n", v->value, cxt);
} else if (!strcasecmp(v->name, "switch") || !strcasecmp(v->name, "lswitch") || !strcasecmp(v->name, "eswitch")) { } else if (!strcasecmp(v->name, "switch") || !strcasecmp(v->name, "lswitch") || !strcasecmp(v->name, "eswitch")) {
char *stringp= realvalue; char *stringp= realvalue;
@ -6033,7 +6033,7 @@ static int pbx_load_config(const char *config_file)
data = strsep(&stringp, ""); /* XXX what for ? */ data = strsep(&stringp, ""); /* XXX what for ? */
if (!data) if (!data)
data = ""; data = "";
if (ast_context_add_switch2(con, appl, data, !strcasecmp(v->name, "eswitch"), registrar)) if (ast_context_add_switch2(con, appl, data, !strcasecmp(v->name, "eswitch"), global_registrar))
ast_log(LOG_WARNING, "Unable to include switch '%s' in context '%s'\n", v->value, cxt); ast_log(LOG_WARNING, "Unable to include switch '%s' in context '%s'\n", v->value, cxt);
} else { } else {
ast_log(LOG_WARNING, "==!!== Unknown directive: %s at line %d -- IGNORING!!!\n", v->name, v->lineno); ast_log(LOG_WARNING, "==!!== Unknown directive: %s at line %d -- IGNORING!!!\n", v->name, v->lineno);
@ -6193,12 +6193,12 @@ int localized_pbx_load_module(void)
{ {
struct ast_context *con; struct ast_context *con;
if(!pbx_load_config(config)) if(!pbx_load_config(config_filename))
return -1 /* AST_MODULE_LOAD_DECLINE*/; return -1 /* AST_MODULE_LOAD_DECLINE*/;
/* pbx_load_users(); */ /* does this affect the dialplan? */ /* pbx_load_users(); */ /* does this affect the dialplan? */
ast_merge_contexts_and_delete(&local_contexts, registrar); ast_merge_contexts_and_delete(&local_contexts, global_registrar);
for (con = NULL; (con = ast_walk_contexts(con));) for (con = NULL; (con = ast_walk_contexts(con));)
ast_context_verify_includes(con); ast_context_verify_includes(con);

@ -1008,7 +1008,7 @@ double double2db( double value)
return 6.0 * log( value / 32767) / log( 2); return 6.0 * log( value / 32767) / log( 2);
} }
void readawaysamples( FILE *in, size_t size) void readawaysamples( FILE *input, size_t size)
{ {
short *buffer; short *buffer;
int samplesread, count; int samplesread, count;
@ -1023,8 +1023,8 @@ void readawaysamples( FILE *in, size_t size)
else else
count = size; count = size;
samplesread = fread( buffer, sizeof(*buffer), count, in); samplesread = fread( buffer, sizeof(*buffer), count, input);
if (ferror( in) != 0) if (ferror( input) != 0)
fatalperror("Error reading input file"); fatalperror("Error reading input file");
size -= samplesread; size -= samplesread;
} }

@ -410,19 +410,19 @@ static float mutevol = 0;
#endif #endif
#ifndef __Darwin__ #ifndef __Darwin__
static int mutedlevel(int orig, int mutelevel) static int mutedlevel(int orig, int level)
{ {
int l = orig >> 8; int l = orig >> 8;
int r = orig & 0xff; int r = orig & 0xff;
l = (float)(mutelevel) * (float)(l) / 100.0; l = (float)(level) * (float)(l) / 100.0;
r = (float)(mutelevel) * (float)(r) / 100.0; r = (float)(level) * (float)(r) / 100.0;
return (l << 8) | r; return (l << 8) | r;
#else #else
static float mutedlevel(float orig, float mutelevel) static float mutedlevel(float orig, float level)
{ {
float master = orig; float master = orig;
master = mutelevel * master / 100.0; master = level * master / 100.0;
return master; return master;
#endif #endif

@ -321,83 +321,82 @@ static void rxqcheck (char *dir, char *queue, char *process)
fclose (f); fclose (f);
/* set up user data variables */ /* set up user data variables */
{ {
char temp[481]; char tmp[481];
int n, int n, x;
p; for (n = 0, x = 0; x < udl; x++)
for (n = 0, p = 0; p < udl; p++)
{ {
unsigned short v = ud[p]; unsigned short v = ud[x];
if (v) if (v)
{ {
if (v < 0x80) if (v < 0x80)
temp[n++] = v; tmp[n++] = v;
else if (v < 0x800) else if (v < 0x800)
{ {
temp[n++] = (0xC0 + (v >> 6)); tmp[n++] = (0xC0 + (v >> 6));
temp[n++] = (0x80 + (v & 0x3F)); tmp[n++] = (0x80 + (v & 0x3F));
} else } else
{ {
temp[n++] = (0xE0 + (v >> 12)); tmp[n++] = (0xE0 + (v >> 12));
temp[n++] = (0x80 + ((v >> 6) & 0x3F)); tmp[n++] = (0x80 + ((v >> 6) & 0x3F));
temp[n++] = (0x80 + (v & 0x3F)); tmp[n++] = (0x80 + (v & 0x3F));
} }
} }
} }
temp[n] = 0; tmp[n] = 0;
setenv ("ud", temp, 1); setenv ("ud", tmp, 1);
for (n = 0, p = 0; p < udl; p++) for (n = 0, x = 0; x < udl; x++)
{ {
unsigned short v = ud[p]; unsigned short v = ud[x];
if (v < ' ' || v == '\\') if (v < ' ' || v == '\\')
{ {
temp[n++] = '\\'; tmp[n++] = '\\';
if (v == '\\') if (v == '\\')
temp[n++] = '\\'; tmp[n++] = '\\';
else if (v == '\n') else if (v == '\n')
temp[n++] = 'n'; tmp[n++] = 'n';
else if (v == '\r') else if (v == '\r')
temp[n++] = 'r'; tmp[n++] = 'r';
else if (v == '\t') else if (v == '\t')
temp[n++] = 't'; tmp[n++] = 't';
else if (v == '\f') else if (v == '\f')
temp[n++] = 'f'; tmp[n++] = 'f';
else else
{ {
temp[n++] = '0' + (v >> 6); tmp[n++] = '0' + (v >> 6);
temp[n++] = '0' + ((v >> 3) & 7); tmp[n++] = '0' + ((v >> 3) & 7);
temp[n++] = '0' + (v & 7); tmp[n++] = '0' + (v & 7);
} }
} else if (v < 0x80) } else if (v < 0x80)
temp[n++] = v; tmp[n++] = v;
else if (v < 0x800) else if (v < 0x800)
{ {
temp[n++] = (0xC0 + (v >> 6)); tmp[n++] = (0xC0 + (v >> 6));
temp[n++] = (0x80 + (v & 0x3F)); tmp[n++] = (0x80 + (v & 0x3F));
} else } else
{ {
temp[n++] = (0xE0 + (v >> 12)); tmp[n++] = (0xE0 + (v >> 12));
temp[n++] = (0x80 + ((v >> 6) & 0x3F)); tmp[n++] = (0x80 + ((v >> 6) & 0x3F));
temp[n++] = (0x80 + (v & 0x3F)); tmp[n++] = (0x80 + (v & 0x3F));
} }
} }
temp[n] = 0; tmp[n] = 0;
setenv ("ude", temp, 1); setenv ("ude", tmp, 1);
for (p = 0; p < udl && ud[p] < 0x100; p++); for (x = 0; x < udl && ud[x] < 0x100; x++);
if (p == udl) if (x == udl)
{ {
for (n = 0, p = 0; p < udl; p++) for (n = 0, x = 0; x < udl; x++)
{ {
sprintf (temp + n, "%02X", ud[p]); sprintf (tmp + n, "%02X", ud[x]);
n += 2; n += 2;
} }
setenv ("ud8", temp, 1); setenv ("ud8", tmp, 1);
} }
for (n = 0, p = 0; p < udl; p++) for (n = 0, x = 0; x < udl; x++)
{ {
sprintf (temp + n, "%04X", ud[p]); sprintf (tmp + n, "%04X", ud[x]);
n += 4; n += 4;
} }
setenv ("ud16", temp, 1); setenv ("ud16", tmp, 1);
} }
/* run the command */ /* run the command */
system (process); system (process);

Loading…
Cancel
Save