g_string_sprintf --> g_string_printf and g_string_sprintfa --> g_string_append_printf

svn path=/trunk/; revision=25276
This commit is contained in:
Bill Meier 2008-05-11 18:33:49 +00:00
parent 319f71c537
commit fe5c2d9820
14 changed files with 37 additions and 37 deletions

View File

@ -365,7 +365,7 @@ int PBE_decrypt_data(const char *object_identifier_id _U_, tvbuff_t *encrypted_t
name = g_string_new("");
oidname = oid_resolved_from_string(object_identifier_id);
g_string_sprintf(name, "Decrypted %s", oidname ? oidname : object_identifier_id);
g_string_printf(name, "Decrypted %s", oidname ? oidname : object_identifier_id);
/* add it as a new source */
add_new_data_source(actx->pinfo, clear_tvb, name->str);

View File

@ -359,7 +359,7 @@ get_runtime_pcap_version(GString *str)
{
g_string_append_printf(str, "with ");
#ifdef HAVE_PCAP_LIB_VERSION
g_string_sprintfa(str, pcap_lib_version());
g_string_append_printf(str, pcap_lib_version());
#else
g_string_append(str, "libpcap (version unknown)");
#endif

View File

@ -202,9 +202,9 @@ static gchar* dfilter_macro_resolve(gchar* name, gchar** args, const gchar** err
if (args) {
while (*parts) {
g_string_sprintfa(text,"%s%s",
args[*(arg_pos_p++)],
*(parts++));
g_string_append_printf(text,"%s%s",
args[*(arg_pos_p++)],
*(parts++));
}
}

View File

@ -69,13 +69,13 @@ static GPtrArray* g_ptr_array_join(GPtrArray* a, GPtrArray* b){
%syntax_error {
if (!TOKEN)
g_string_sprintfa(bd->error,"syntax error at end of file");
g_string_append_printf(bd->error,"syntax error at end of file");
else
g_string_sprintfa(bd->error,"syntax error in %s at or before '%s': \n", TOKEN->location,TOKEN->text);
g_string_append_printf(bd->error,"syntax error in %s at or before '%s': \n", TOKEN->location,TOKEN->text);
}
%parse_failure {
g_string_sprintfa(bd->error,"DTD parsing failure\n");
g_string_append_printf(bd->error,"DTD parsing failure\n");
}
%token_prefix TOKEN_

View File

@ -218,7 +218,7 @@ squoted ['][^\']*[']
<GET_ATTR_QUOTE>{get_attr_quote} { BEGIN GET_ATTR_VAL; }
<GET_ATTR_QUOTE>. {
g_string_sprintfa(build_data->error,
g_string_append_printf(build_data->error,
"error in wireshark:protocol xmpli at %s : could not find attribute value!",
location);
yyterminate();
@ -238,7 +238,7 @@ squoted ['][^\']*[']
}
if (! got_it) {
g_string_sprintfa(build_data->error,
g_string_append_printf(build_data->error,
"error in wireshark:protocol xmpli at %s : no such parameter %s!",
location, attr_name);
g_free(attr_name);

View File

@ -122,7 +122,7 @@ newline \n
%%
{entity} if (current) g_string_sprintfa(current,"%s\n%s\n",replace_entity(yytext),location());
{entity} if (current) g_string_append_printf(current,"%s\n%s\n",replace_entity(yytext),location());
{whitespace} if (current) g_string_append(current," ");
@ -138,7 +138,7 @@ newline \n
{newline} {
linenum++;
if (current) g_string_sprintfa(current,"%s\n",location());
if (current) g_string_append_printf(current,"%s\n",location());
}
@ -150,7 +150,7 @@ newline \n
<IN_QUOTE>{non_quote} |
<IN_QUOTE>{escaped_quote} g_string_append(current,yytext);
<NAMED_ENTITY>{system} {
g_string_sprintfa(error,"at %s:%u: file inclusion is not supported!", filename, linenum);
g_string_append_printf(error,"at %s:%u: file inclusion is not supported!", filename, linenum);
yyterminate();
}
<ENTITY_DONE>{special_stop} { current = output; g_string_append(current,"\n"); BEGIN OUTSIDE; }
@ -167,7 +167,7 @@ static gchar* replace_entity(gchar* entity) {
if (replacement) {
return replacement->str;
} else {
g_string_sprintfa(error,"dtd_preparse: in file '%s': entity %s does not exists\n", filename, entity);
g_string_append_printf(error,"dtd_preparse: in file '%s': entity %s does not exists\n", filename, entity);
return "";
}
@ -200,7 +200,7 @@ extern GString* dtd_preparse(const gchar* dname,const gchar* fname, GString* er
if (!yyin) {
if (err)
g_string_sprintfa(err, "Could not open file: '%s', error: %s",fullname,strerror(errno));
g_string_append_printf(err, "Could not open file: '%s', error: %s",fullname,strerror(errno));
return NULL;
}

View File

@ -189,7 +189,7 @@
<INCLUDE>[^[:blank:]\n]+ {
if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) {
g_string_sprintfa(error, "$INCLUDE files nested to deeply\n");
g_string_append_printf(error, "$INCLUDE files nested to deeply\n");
yyterminate();
}
@ -202,7 +202,7 @@
if (!yyin) {
if (errno) {
g_string_sprintfa(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], strerror(errno) );
g_string_append_printf(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], strerror(errno) );
yyterminate();
}
} else {
@ -258,7 +258,7 @@ void add_attribute(const gchar* name, const gchar* code, radius_attr_dissector_
v = g_hash_table_lookup(dict->vendors_by_name,vendor_name);
if (! v) {
g_string_sprintfa(error, "Vendor: '%s', does not exist in %s:%i \n", vendor_name, fullpaths[include_stack_ptr], linenums[include_stack_ptr] );
g_string_append_printf(error, "Vendor: '%s', does not exist in %s:%i \n", vendor_name, fullpaths[include_stack_ptr], linenums[include_stack_ptr] );
BEGIN JUNK;
return;
} else {
@ -385,7 +385,7 @@ gboolean radius_load_dictionary (radius_dictionary_t* d, gchar* dir, const gchar
yyin = eth_fopen(fullpaths[include_stack_ptr],"r");
if (!yyin) {
g_string_sprintfa(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], strerror(errno) );
g_string_append_printf(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], strerror(errno) );
g_free(fullpaths[include_stack_ptr]);
*err_str = error->str;
g_string_free(error,FALSE);

View File

@ -343,7 +343,7 @@ void lua_prime_all_fields(proto_tree* tree _U_) {
g_free(name);
g_string_sprintfa(fake_tap_filter," || %s",(*f)->abbrev);
g_string_append_printf(fake_tap_filter," || %s",(*f)->abbrev);
fake_tap = TRUE;
}

View File

@ -1604,7 +1604,7 @@ WSLUA_METAMETHOD DissectorTable_tostring(lua_State* L) {
switch(type) {
case FT_STRING:
{
g_string_sprintfa(s,"%s String:\n",dt->name);
g_string_append_printf(s,"%s String:\n",dt->name);
break;
}
case FT_UINT8:
@ -1613,7 +1613,7 @@ WSLUA_METAMETHOD DissectorTable_tostring(lua_State* L) {
case FT_UINT32:
{
int base = get_dissector_table_base(dt->name);
g_string_sprintfa(s,"%s Integer(%i):\n",dt->name,base);
g_string_append_printf(s,"%s Integer(%i):\n",dt->name,base);
break;
}
default:

View File

@ -952,9 +952,9 @@ rates_details(unsigned char *values, int length) {
/* reduce the screen estate by showing fractions only where required */
int_value = (int)float_value;
if(float_value == (float)int_value) {
g_string_sprintfa(Rates, "%.0f", float_value);
g_string_append_printf(Rates, "%.0f", float_value);
} else {
g_string_sprintfa(Rates, "%.1f", float_value);
g_string_append_printf(Rates, "%.1f", float_value);
}
}
i++;

View File

@ -98,10 +98,10 @@ static void configuration_error(mate_config* mc, const gchar* fmt, ...) {
current_frame = g_ptr_array_index(mc->config_stack,(guint)i);
g_string_sprintfa(mc->config_error,"%s%s at line %u",incl, current_frame->filename, current_frame->linenum);
g_string_append_printf(mc->config_error,"%s%s at line %u",incl, current_frame->filename, current_frame->linenum);
}
g_string_sprintfa(mc->config_error,": %s\n",error_buffer);
g_string_append_printf(mc->config_error,": %s\n",error_buffer);
THROW(MateConfigError);
@ -157,7 +157,7 @@ static gchar* recolonize(mate_config* mc, gchar* s) {
configuration_error(mc,"bad token %s",s);
}
g_string_sprintfa(str,":%.2X",v);
g_string_append_printf(str,":%.2X",v);
}
g_strfreev(vec);
@ -425,7 +425,7 @@ pdu_decl ::=
cfg->discard = DistcardPduData;
cfg->drop_unassigned = DropUnassigned;
g_string_sprintfa(mc->protos_filter,"||%s",Field->abbrev);
g_string_append_printf(mc->protos_filter,"||%s",Field->abbrev);
/* flip the transport_stack */
for (i = Stack->len - 1; Stack->len; i--) {
@ -494,7 +494,7 @@ last_extracted_statement(A) ::= . { A = mc->defaults.pdu.last_extracted; }
proto_stack(A) ::= proto_stack(B) SLASH field(C). {
int* hfidp = g_malloc(sizeof(int));
g_string_sprintfa(mc->fields_filter,"||%s",C->abbrev);
g_string_append_printf(mc->fields_filter,"||%s",C->abbrev);
*hfidp = C->id;
g_ptr_array_add(B,hfidp);
@ -505,7 +505,7 @@ proto_stack(A) ::= field(B). {
int* hfidp = g_malloc(sizeof(int));
*hfidp = B->id;
g_string_sprintfa(mc->fields_filter,"||%s",B->abbrev);
g_string_append_printf(mc->fields_filter,"||%s",B->abbrev);
A = g_ptr_array_new();
g_ptr_array_add(A,hfidp);

View File

@ -182,7 +182,7 @@ blk_cmnt_stop "*/"
yy_switch_to_buffer(include_stack[--include_stack_ptr] );
if (errno)
g_string_sprintfa(mc->config_error, "Mate parser: Could not open file: '%s': %s", yytext, strerror(errno) );
g_string_append_printf(mc->config_error, "Mate parser: Could not open file: '%s': %s", yytext, strerror(errno) );
} else {
@ -292,7 +292,7 @@ extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) {
yyin = eth_fopen(filename,"r");
if (!yyin) {
g_string_sprintfa(mc->config_error,"Mate parser: Could not open file: '%s', error: %s", filename, strerror(errno) );
g_string_append_printf(mc->config_error,"Mate parser: Could not open file: '%s', error: %s", filename, strerror(errno) );
return FALSE;
}
@ -327,7 +327,7 @@ extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) {
state = FALSE;
} CATCH_ALL {
state = FALSE;
g_string_sprintfa(mc->config_error,"An unexpected error occurred");
g_string_append_printf(mc->config_error,"An unexpected error occurred");
}
ENDTRY;

View File

@ -203,7 +203,7 @@ extern gchar* add_ranges(gchar* range,GPtrArray* range_ptr_arr) {
hfidp = g_malloc(sizeof(int));
*hfidp = hfi->id;
g_ptr_array_add(range_ptr_arr,(gpointer)hfidp);
g_string_sprintfa(matecfg->fields_filter, "||%s",ranges[i]);
g_string_append_printf(matecfg->fields_filter, "||%s",ranges[i]);
} else {
g_strfreev(ranges);
return g_strdup_printf("no such proto: '%s'",ranges[i]);;
@ -249,7 +249,7 @@ static void analyze_pdu_hfids(gpointer k, gpointer v, gpointer p) {
mate_cfg_pdu* cfg = p;
new_attr_hfri(cfg->name,cfg->my_hfids,(gchar*) v);
g_string_sprintfa(matecfg->fields_filter,"||%s",my_protoname(*(int*)k));
g_string_append_printf(matecfg->fields_filter,"||%s",my_protoname(*(int*)k));
}
static void analyze_transform_hfrs(gchar* name, GPtrArray* transforms, GHashTable* hfids) {

View File

@ -771,7 +771,7 @@ gchar* avpl_to_str(AVPL* avpl) {
for(c=avpl->null.next; c->avp; c = c->next) {
avp_s = avp_to_str(c->avp);
g_string_sprintfa(s," %s;",avp_s);
g_string_append_printf(s," %s;",avp_s);
g_free(avp_s);
}
@ -790,7 +790,7 @@ extern gchar* avpl_to_dotstr(AVPL* avpl) {
for(c=avpl->null.next; c->avp; c = c->next) {
avp_s = avp_to_str(c->avp);
g_string_sprintfa(s," .%s;",avp_s);
g_string_append_printf(s," .%s;",avp_s);
g_free(avp_s);
}