From fe26b7c09f86650d19b4be388c155af081388a67 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 9 Apr 2002 23:28:19 +0000 Subject: portability fix: snprintf -> g_snprintf --- mixgtk/mixgtk_cmd_dispatcher.c | 6 +++--- mixgtk/mixgtk_device.c | 6 +++--- mixgtk/mixgtk_input.c | 8 ++++---- mixgtk/mixgtk_mixal.c | 10 +++++----- mixgtk/mixgtk_mixvm.c | 18 +++++++++--------- mixguile/xmixguile_cmd_dispatcher.c | 6 +++--- mixlib/mix_predicate.c | 18 +++++++++--------- mixlib/mix_vm_command.c | 6 +++--- mixlib/xmix_vm_command.c | 6 +++--- mixlib/xmix_vm_handlers.c | 8 ++++---- 10 files changed, 46 insertions(+), 46 deletions(-) diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c index 01e549b..7ed4a11 100644 --- a/mixgtk/mixgtk_cmd_dispatcher.c +++ b/mixgtk/mixgtk_cmd_dispatcher.c @@ -1,9 +1,9 @@ /* -*-c-*- -------------- mixgtk_cmd_dispatcher.c : * Implementation of the functions declared in mixgtk_cmd_dispatcher.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "2001-04-08 01:34:09 jao" + * $Id: mixgtk_cmd_dispatcher.c,v 1.15 2002/04/09 23:28:19 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -440,7 +440,7 @@ complete_command_ (void) NULL, NULL, NULL, "Completions:\n", -1); while (cmds) { - snprintf (BUFFER, 25, "%-12s", (const char*)cmds->data); + g_snprintf (BUFFER, 25, "%-12s", (const char*)cmds->data); ++k; gtk_text_insert (GTK_TEXT (dis_data_.log), NULL, NULL, NULL, BUFFER, -1); diff --git a/mixgtk/mixgtk_device.c b/mixgtk/mixgtk_device.c index b3d3b06..b3cf0c8 100644 --- a/mixgtk/mixgtk_device.c +++ b/mixgtk/mixgtk_device.c @@ -1,7 +1,7 @@ /* -*-c-*- ---------------- mixgtk_device.c : * actual types for mixgtk devices * ------------------------------------------------------------------ - * $Id: mixgtk_device.c,v 1.17 2002/03/29 16:30:49 jao Exp $ + * $Id: mixgtk_device.c,v 1.18 2002/04/09 23:28:19 jao Exp $ * ------------------------------------------------------------------ * Copyright (C) 2001, 2002 Free Software Foundation, Inc. * @@ -109,7 +109,7 @@ get_word_string_ (mix_word_t w, gboolean dec) enum {BUFF_SIZE = 17}; static gchar BUFFER[BUFF_SIZE] = { 0 }; if (dec) - snprintf (BUFFER, BUFF_SIZE, "%s%011ld", + g_snprintf (BUFFER, BUFF_SIZE, "%s%011ld", mix_word_is_negative (w)? "-" : "+", mix_word_magnitude (w)); else @@ -500,7 +500,7 @@ on_devapp_button_clicked () for (k = 0; k <= LAST_BIN_DEV_; ++k) mixgtk_device_set_format (k, IS_DEC (new_decs_, k)); decs_ = new_decs_; - snprintf (value, 20, "%d", decs_); + g_snprintf (value, 20, "%d", decs_); mixgtk_config_update (DEV_FORMAT_KEY_, value); } diff --git a/mixgtk/mixgtk_input.c b/mixgtk/mixgtk_input.c index 6a04a75..a516ced 100644 --- a/mixgtk/mixgtk_input.c +++ b/mixgtk/mixgtk_input.c @@ -1,9 +1,9 @@ /* -*-c-*- -------------- mixgtk_input.c : * Implementation of the functions declared in mixgtk_input.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "01/04/01 15:24:36 jose" + * $Id: mixgtk_input.c,v 1.5 2002/04/09 23:28:19 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,13 +72,13 @@ set_word_ (mix_word_t word) gint k; gint val = mix_word_magnitude (word); gboolean neg = mix_word_is_negative (word); - snprintf (BUFFER, SIZE, "%s%d", neg ? "-" : "", val); + g_snprintf (BUFFER, SIZE, "%s%d", neg ? "-" : "", val); gtk_entry_set_text (GTK_ENTRY (childs_[DEC_]), BUFFER); gtk_entry_set_text (GTK_ENTRY (childs_[SIGN_]), neg ? "-" : "+"); for (k = 1; k < 6; ++k) { mix_byte_t b = mix_word_get_byte (word, k); - snprintf (BUFFER, SIZE, "%d", (int)b); + g_snprintf (BUFFER, SIZE, "%d", (int)b); gtk_entry_set_text (GTK_ENTRY (childs_[SIGN_ + k]), BUFFER); } } diff --git a/mixgtk/mixgtk_mixal.c b/mixgtk/mixgtk_mixal.c index 22039e3..7c7c402 100644 --- a/mixgtk/mixgtk_mixal.c +++ b/mixgtk/mixgtk_mixal.c @@ -1,9 +1,9 @@ /* -*-c-*- -------------- mixgtk_mixal.c : * Implementation of the functions declared in mixgtk_mixal.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "2001-04-29 22:30:43 jao" + * $Id: mixgtk_mixal.c,v 1.14 2002/04/09 23:28:19 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,7 +64,7 @@ insert_symbol_ (gpointer symbol, gpointer value, gpointer list) gchar *text[] = {(gchar *)symbol, DEC, WORD}; mix_word_t w = (mix_word_t)GPOINTER_TO_INT (value); - snprintf (DEC, DEC_SIZE, "%s%ld", + g_snprintf (DEC, DEC_SIZE, "%s%ld", mix_word_is_negative (w)? "-" : "+", mix_word_magnitude (w)); mix_word_print_to_buffer (w, WORD); @@ -223,7 +223,7 @@ update_tips_ (const mix_symbol_table_t *table, if (mix_symbol_table_is_defined (table, tokens[k])) { mix_word_t val = mix_symbol_table_value (table, tokens[k]); - snprintf (BUFFER, SIZE, "[ %s = %s%ld ]", tokens[k], + g_snprintf (BUFFER, SIZE, "[ %s = %s%ld ]", tokens[k], mix_word_is_negative (val)? "-" : "+", mix_word_magnitude (val)); new_tip = g_strconcat (tip, " ", BUFFER, NULL); @@ -267,7 +267,7 @@ mixgtk_mixal_load_file (void) { const gchar *line = mix_src_file_get_line (file, k + 1); - snprintf (CONT, CONT_SIZE, "%03d: %s", k + 1, line); + g_snprintf (CONT, CONT_SIZE, "%03d: %s", k + 1, line); addr = mix_vm_get_lineno_address (vm_, k + 1); if (addr != MIX_VM_CELL_NO) { diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c index 0d776fc..351b58e 100644 --- a/mixgtk/mixgtk_mixvm.c +++ b/mixgtk/mixgtk_mixvm.c @@ -1,9 +1,9 @@ /* -*-c-*- -------------- mixgtk_mixvm.c : * Implementation of the functions declared in mixgtk_mixvm.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "2001-05-19 16:39:16 jao" + * $Id: mixgtk_mixvm.c,v 1.8 2002/04/09 23:28:19 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,7 +91,7 @@ update_register_ (mixgtk_widget_id_t reg) g_assert_not_reached (); } gtk_entry_set_text (reg_entries_[reg - MIXGTK_WIDGET_rA], BUFFER); - snprintf (BUFFER, 20, "%s%ld", mix_word_is_negative (tipval)? "-" : "", + g_snprintf (BUFFER, 20, "%s%ld", mix_word_is_negative (tipval)? "-" : "", mix_word_magnitude (tipval)); gtk_tooltips_set_tip (tips_, GTK_WIDGET (reg_entries_[reg - MIXGTK_WIDGET_rA]), @@ -254,7 +254,7 @@ mixgtk_mixvm_update_loc (void) g_assert (loc_entry_); locval = mix_vm_get_prog_count (vm_); - snprintf (BUFFER, SIZE, "%04d", mix_short_magnitude (locval)); + g_snprintf (BUFFER, SIZE, "%04d", mix_short_magnitude (locval)); gtk_entry_set_text (loc_entry_, BUFFER); } @@ -268,11 +268,11 @@ mixgtk_mixvm_update_times (void) g_assert (uptime_ && progtime_ && laptime_); mixgtk_cmd_dispatcher_get_times (&uptime, &progtime, &laptime); - snprintf (BUFFER, SIZE, "%d", uptime); + g_snprintf (BUFFER, SIZE, "%d", uptime); gtk_label_set_text (uptime_, BUFFER); - snprintf (BUFFER, SIZE, "%d", progtime); + g_snprintf (BUFFER, SIZE, "%d", progtime); gtk_label_set_text (progtime_, BUFFER); - snprintf (BUFFER, SIZE, "%d", laptime); + g_snprintf (BUFFER, SIZE, "%d", laptime); gtk_label_set_text (laptime_, BUFFER); } @@ -372,7 +372,7 @@ on_register_click (GtkWidget *w, GdkEvent *e, gpointer data) { if (w == GTK_WIDGET (reg_entries_[2 + k])) { - snprintf (BUFFER, SIZE, "Register I%d", k); + g_snprintf (BUFFER, SIZE, "Register I%d", k); mixgtk_input_short (BUFFER, mix_vm_get_rI (vm_, k), register_i_, GINT_TO_POINTER (k)); break; @@ -395,7 +395,7 @@ on_memory_cells_select_row (GtkCList *w, gint row, gint col, { enum {SIZE = 30}; static gchar BUFFER[SIZE]; - snprintf (BUFFER, SIZE, "Memory cell no. %d", row); + g_snprintf (BUFFER, SIZE, "Memory cell no. %d", row); mixgtk_input_word (BUFFER, mix_vm_get_addr_contents (vm_, mix_short_new (row)), mem_cell_, GINT_TO_POINTER (row)); diff --git a/mixguile/xmixguile_cmd_dispatcher.c b/mixguile/xmixguile_cmd_dispatcher.c index 4781851..78fbce2 100644 --- a/mixguile/xmixguile_cmd_dispatcher.c +++ b/mixguile/xmixguile_cmd_dispatcher.c @@ -1,9 +1,9 @@ /* -*-c-*- -------------- xmixguile_cmd_dispatcher.c : * Implementation of the functions declared in xmixguile_cmd_dispatcher.h * ------------------------------------------------------------------ - * $Id: xmixguile_cmd_dispatcher.c,v 1.8 2001/09/25 21:41:11 jao Exp $ + * $Id: xmixguile_cmd_dispatcher.c,v 1.9 2002/04/09 23:28:19 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -443,7 +443,7 @@ define_hook_procedure_ (SCM function) static gchar BUFFER[BUFF_SIZE]; static const gchar *PATTERN = "____mix__hook__%d____"; static int K = 0; - snprintf (BUFFER, BUFF_SIZE, PATTERN, K++); + g_snprintf (BUFFER, BUFF_SIZE, PATTERN, K++); /* gh_define (name, val) returns a pair: (symbol . symbol-value) */ return gh_cdr (gh_define ((char *)BUFFER, function)); } diff --git a/mixlib/mix_predicate.c b/mixlib/mix_predicate.c index 1406ef5..1ca2bd5 100644 --- a/mixlib/mix_predicate.c +++ b/mixlib/mix_predicate.c @@ -1,9 +1,9 @@ /* -*-c-*- -------------- mix_predicate.c : * Implementation of the functions declared in mix_predicate.h * ------------------------------------------------------------------ - * $Id: mix_predicate.c,v 1.3 2001/09/16 22:28:41 jao Exp $ + * $Id: mix_predicate.c,v 1.4 2002/04/09 23:28:19 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -173,36 +173,36 @@ mix_predicate_get_message (const mix_predicate_t *predicate) switch (predicate->type) { case MIX_PRED_REG_A: - snprintf (BUFFER, SIZE, "Register A changed to %s%ld", + g_snprintf (BUFFER, SIZE, "Register A changed to %s%ld", mix_word_is_negative (predicate->data.regA)? "-" : "+", mix_word_magnitude (predicate->data.regA)); break; case MIX_PRED_REG_X: - snprintf (BUFFER, SIZE, "Register X changed to %s%ld", + g_snprintf (BUFFER, SIZE, "Register X changed to %s%ld", mix_word_is_negative (predicate->data.regX)? "-" : "+", mix_word_magnitude (predicate->data.regX)); break; case MIX_PRED_REG_J: - snprintf (BUFFER, SIZE, "Register J changed to %d", + g_snprintf (BUFFER, SIZE, "Register J changed to %d", mix_short_magnitude (predicate->data.regI)); break; case MIX_PRED_REG_I1: case MIX_PRED_REG_I2: case MIX_PRED_REG_I3: case MIX_PRED_REG_I4: case MIX_PRED_REG_I5: case MIX_PRED_REG_I6: - snprintf (BUFFER, SIZE, "Register I%d changed to %s%d", + g_snprintf (BUFFER, SIZE, "Register I%d changed to %s%d", predicate->control, mix_short_is_negative (predicate->data.regI)? "-" : "+", mix_short_magnitude (predicate->data.regI)); break; case MIX_PRED_CMP: - snprintf (BUFFER, SIZE, "Comparison flag changed to %s", + g_snprintf (BUFFER, SIZE, "Comparison flag changed to %s", CMP_STRINGS[predicate->data.cmp]); break; case MIX_PRED_OVER: - snprintf (BUFFER, SIZE, "Overflow toggled %s", + g_snprintf (BUFFER, SIZE, "Overflow toggled %s", predicate->data.over ? "ON" : "OFF"); break; case MIX_PRED_MEM: - snprintf (BUFFER, SIZE, "Memory address %d changed to %s%ld", + g_snprintf (BUFFER, SIZE, "Memory address %d changed to %s%ld", predicate->control, mix_word_is_negative (predicate->data.mem)? "-" : "+", mix_word_magnitude (predicate->data.mem)); diff --git a/mixlib/mix_vm_command.c b/mixlib/mix_vm_command.c index 77005e5..81e0bb6 100644 --- a/mixlib/mix_vm_command.c +++ b/mixlib/mix_vm_command.c @@ -1,9 +1,9 @@ /* -*-c-*- -------------- mix_vm_command.c : * Implementation of the functions declared in mix_vm_command.h * ------------------------------------------------------------------ - * $Id: mix_vm_command.c,v 1.26 2001/09/16 22:32:12 jao Exp $ + * $Id: mix_vm_command.c,v 1.27 2002/04/09 23:28:19 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -631,7 +631,7 @@ mix_vm_cmd_dispatcher_get_src_file_line (const mix_vm_cmd_dispatcher_t *dis, enum {BUFF_SIZE = 256}; static gchar BUFFER[BUFF_SIZE]; int len = - snprintf (BUFFER, BUFF_SIZE, "%s", mix_src_file_get_line (file, line)); + g_snprintf (BUFFER, BUFF_SIZE, "%s", mix_src_file_get_line (file, line)); if (len > 0 && BUFFER[len - 1] == '\n') BUFFER[len - 1] = '\0'; return BUFFER; } diff --git a/mixlib/xmix_vm_command.c b/mixlib/xmix_vm_command.c index 32acc92..211c1bf 100644 --- a/mixlib/xmix_vm_command.c +++ b/mixlib/xmix_vm_command.c @@ -1,9 +1,9 @@ /* -*-c-*- -------------- xmix_vm_command.c : * Implementation of the functions declared in xmix_vm_command.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "01/08/26 15:27:53 jao" + * $Id: xmix_vm_command.c,v 1.3 2002/04/09 23:28:19 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ log_error_ (mix_vm_cmd_dispatcher_t *dis, const gchar *fmt, ...) { va_list args; va_start (args, fmt); - snprintf (BUFFER, BUFF_SIZE, "ERROR: %s\n", fmt); + g_snprintf (BUFFER, BUFF_SIZE, "ERROR: %s\n", fmt); vfprintf (dis->err, BUFFER, args); va_end (args); } diff --git a/mixlib/xmix_vm_handlers.c b/mixlib/xmix_vm_handlers.c index 2938bfc..e5bf909 100644 --- a/mixlib/xmix_vm_handlers.c +++ b/mixlib/xmix_vm_handlers.c @@ -1,9 +1,9 @@ /* -*-c-*- -------------- xmix_vm_handlers.c : * Implementation of the functions declared in xmix_vm_handlers.h * ------------------------------------------------------------------ - * $Id: xmix_vm_handlers.c,v 1.4 2001/09/17 23:26:43 jao Exp $ + * $Id: xmix_vm_handlers.c,v 1.5 2002/04/09 23:28:19 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1274,11 +1274,11 @@ cmd_pbt_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) if (line && file) { int j = 0; - snprintf (BUFFER, SIZE, "%s", mix_src_file_get_line (file, line)); + g_snprintf (BUFFER, SIZE, "%s", mix_src_file_get_line (file, line)); while (!isspace (BUFFER[j])) j++; BUFFER[j] = '\0'; } - if (strlen (BUFFER) == 0) snprintf (BUFFER, SIZE, "%d", address); + if (strlen (BUFFER) == 0) g_snprintf (BUFFER, SIZE, "%d", address); fprintf (dis->out, "#%d\t%s\tin %s%s:%d\n", k, BUFFER, name, MIX_SRC_DEFEXT, line); ++k; -- cgit v1.2.3