Use g_printf instead of system printf. (#99327)

2002-12-15  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkcalendar.c:
	* gtk/gtkfilesel.c:
	* gtk/gtkfontsel.c:
	* gtk/gtkhruler.c:
	* gtk/gtkinputdialog.c:
	* gtk/gtkprogress.c:
	* gtk/gtktreemodel.c:
	* gtk/gtkvruler.c:
	* gtk/queryimmodules.c:
	* gtk/theme-bits/decompose-bits.c:
	* gdk-pixbuf/gdk-pixbuf-csource.c:
	* gdk-pixbuf/make-inline-pixbuf.c:
	* gdk-pixbuf/queryloaders.c:
	* gdk/gdkkeynames.c:
	* gdk/gdkrgb.c:
	* gdk/linux-fb/gdkfbmanager.c:
	* gdk/win32/gdkevents-win32.c:
	* gdk/win32/gdkmain-win32.c:
	* gdk/win32/gdkproperty-win32.c:
	* gdk/x11/gdkmain-x11.c: Use g_printf instead of system
	printf.  (#99327)
This commit is contained in:
Matthias Clasen 2002-12-15 01:49:01 +00:00 committed by Matthias Clasen
parent d745218d72
commit 8ba71578f2
26 changed files with 270 additions and 136 deletions

View File

@ -1,5 +1,27 @@
2002-12-15 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c:
* gtk/gtkfilesel.c:
* gtk/gtkfontsel.c:
* gtk/gtkhruler.c:
* gtk/gtkinputdialog.c:
* gtk/gtkprogress.c:
* gtk/gtktreemodel.c:
* gtk/gtkvruler.c:
* gtk/queryimmodules.c:
* gtk/theme-bits/decompose-bits.c:
* gdk-pixbuf/gdk-pixbuf-csource.c:
* gdk-pixbuf/make-inline-pixbuf.c:
* gdk-pixbuf/queryloaders.c:
* gdk/gdkkeynames.c:
* gdk/gdkrgb.c:
* gdk/linux-fb/gdkfbmanager.c:
* gdk/win32/gdkevents-win32.c:
* gdk/win32/gdkmain-win32.c:
* gdk/win32/gdkproperty-win32.c:
* gdk/x11/gdkmain-x11.c: Use g_printf instead of system
printf. (#99327)
* gtk/gtkcontainer.c (gtk_container_class_install_child_property):
(gtk_container_child_get_valist):
(gtk_container_child_get_property):

View File

@ -1,5 +1,27 @@
2002-12-15 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c:
* gtk/gtkfilesel.c:
* gtk/gtkfontsel.c:
* gtk/gtkhruler.c:
* gtk/gtkinputdialog.c:
* gtk/gtkprogress.c:
* gtk/gtktreemodel.c:
* gtk/gtkvruler.c:
* gtk/queryimmodules.c:
* gtk/theme-bits/decompose-bits.c:
* gdk-pixbuf/gdk-pixbuf-csource.c:
* gdk-pixbuf/make-inline-pixbuf.c:
* gdk-pixbuf/queryloaders.c:
* gdk/gdkkeynames.c:
* gdk/gdkrgb.c:
* gdk/linux-fb/gdkfbmanager.c:
* gdk/win32/gdkevents-win32.c:
* gdk/win32/gdkmain-win32.c:
* gdk/win32/gdkproperty-win32.c:
* gdk/x11/gdkmain-x11.c: Use g_printf instead of system
printf. (#99327)
* gtk/gtkcontainer.c (gtk_container_class_install_child_property):
(gtk_container_child_get_valist):
(gtk_container_child_get_property):

View File

@ -1,5 +1,27 @@
2002-12-15 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c:
* gtk/gtkfilesel.c:
* gtk/gtkfontsel.c:
* gtk/gtkhruler.c:
* gtk/gtkinputdialog.c:
* gtk/gtkprogress.c:
* gtk/gtktreemodel.c:
* gtk/gtkvruler.c:
* gtk/queryimmodules.c:
* gtk/theme-bits/decompose-bits.c:
* gdk-pixbuf/gdk-pixbuf-csource.c:
* gdk-pixbuf/make-inline-pixbuf.c:
* gdk-pixbuf/queryloaders.c:
* gdk/gdkkeynames.c:
* gdk/gdkrgb.c:
* gdk/linux-fb/gdkfbmanager.c:
* gdk/win32/gdkevents-win32.c:
* gdk/win32/gdkmain-win32.c:
* gdk/win32/gdkproperty-win32.c:
* gdk/x11/gdkmain-x11.c: Use g_printf instead of system
printf. (#99327)
* gtk/gtkcontainer.c (gtk_container_class_install_child_property):
(gtk_container_child_get_valist):
(gtk_container_child_get_property):

View File

@ -1,5 +1,27 @@
2002-12-15 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c:
* gtk/gtkfilesel.c:
* gtk/gtkfontsel.c:
* gtk/gtkhruler.c:
* gtk/gtkinputdialog.c:
* gtk/gtkprogress.c:
* gtk/gtktreemodel.c:
* gtk/gtkvruler.c:
* gtk/queryimmodules.c:
* gtk/theme-bits/decompose-bits.c:
* gdk-pixbuf/gdk-pixbuf-csource.c:
* gdk-pixbuf/make-inline-pixbuf.c:
* gdk-pixbuf/queryloaders.c:
* gdk/gdkkeynames.c:
* gdk/gdkrgb.c:
* gdk/linux-fb/gdkfbmanager.c:
* gdk/win32/gdkevents-win32.c:
* gdk/win32/gdkmain-win32.c:
* gdk/win32/gdkproperty-win32.c:
* gdk/x11/gdkmain-x11.c: Use g_printf instead of system
printf. (#99327)
* gtk/gtkcontainer.c (gtk_container_class_install_child_property):
(gtk_container_child_get_valist):
(gtk_container_child_get_property):

View File

@ -1,5 +1,27 @@
2002-12-15 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c:
* gtk/gtkfilesel.c:
* gtk/gtkfontsel.c:
* gtk/gtkhruler.c:
* gtk/gtkinputdialog.c:
* gtk/gtkprogress.c:
* gtk/gtktreemodel.c:
* gtk/gtkvruler.c:
* gtk/queryimmodules.c:
* gtk/theme-bits/decompose-bits.c:
* gdk-pixbuf/gdk-pixbuf-csource.c:
* gdk-pixbuf/make-inline-pixbuf.c:
* gdk-pixbuf/queryloaders.c:
* gdk/gdkkeynames.c:
* gdk/gdkrgb.c:
* gdk/linux-fb/gdkfbmanager.c:
* gdk/win32/gdkevents-win32.c:
* gdk/win32/gdkmain-win32.c:
* gdk/win32/gdkproperty-win32.c:
* gdk/x11/gdkmain-x11.c: Use g_printf instead of system
printf. (#99327)
* gtk/gtkcontainer.c (gtk_container_class_install_child_property):
(gtk_container_child_get_valist):
(gtk_container_child_get_property):

View File

@ -1,5 +1,27 @@
2002-12-15 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c:
* gtk/gtkfilesel.c:
* gtk/gtkfontsel.c:
* gtk/gtkhruler.c:
* gtk/gtkinputdialog.c:
* gtk/gtkprogress.c:
* gtk/gtktreemodel.c:
* gtk/gtkvruler.c:
* gtk/queryimmodules.c:
* gtk/theme-bits/decompose-bits.c:
* gdk-pixbuf/gdk-pixbuf-csource.c:
* gdk-pixbuf/make-inline-pixbuf.c:
* gdk-pixbuf/queryloaders.c:
* gdk/gdkkeynames.c:
* gdk/gdkrgb.c:
* gdk/linux-fb/gdkfbmanager.c:
* gdk/win32/gdkevents-win32.c:
* gdk/win32/gdkmain-win32.c:
* gdk/win32/gdkproperty-win32.c:
* gdk/x11/gdkmain-x11.c: Use g_printf instead of system
printf. (#99327)
* gtk/gtkcontainer.c (gtk_container_class_install_child_property):
(gtk_container_child_get_valist):
(gtk_container_child_get_property):

View File

@ -21,7 +21,7 @@
#include "../gtk/gtkversion.h" /* versioning */
#include "gdk-pixbuf.h"
#include "gdk-pixdata.h"
#include <stdio.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
@ -64,7 +64,7 @@ print_csource (FILE *f_out,
gen_type | gen_ctype |
(with_decoder ? GDK_PIXDATA_DUMP_RLE_DECODER : 0));
fprintf (f_out, "%s\n", gstring->str);
g_fprintf (f_out, "%s\n", gstring->str);
g_free (free_me);
}
@ -93,7 +93,7 @@ main (int argc,
pixbuf = gdk_pixbuf_new_from_file (argv[1], &error);
if (!pixbuf)
{
fprintf (stderr, "failed to load \"%s\": %s\n",
g_fprintf (stderr, "failed to load \"%s\": %s\n",
argv[1],
error->message);
g_error_free (error);
@ -118,7 +118,7 @@ main (int argc,
pixbuf = gdk_pixbuf_new_from_file (*p, &error);
if (!pixbuf)
{
fprintf (stderr, "failed to load \"%s\": %s\n",
g_fprintf (stderr, "failed to load \"%s\": %s\n",
*p,
error->message);
g_error_free (error);
@ -255,32 +255,32 @@ print_blurb (FILE *bout,
{
if (!print_help)
{
fprintf (bout, "%s version ", PRG_NAME);
fprintf (bout, "%u.%u.%u", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
fprintf (bout, "\n");
fprintf (bout, "%s comes with ABSOLUTELY NO WARRANTY.\n", PRG_NAME);
fprintf (bout, "You may redistribute copies of %s under the terms of\n", PRG_NAME);
fprintf (bout, "the GNU Lesser General Public License which can be found in the\n");
fprintf (bout, "%s source package. Sources, examples and contact\n", PKG_NAME);
fprintf (bout, "information are available at %s\n", PKG_HTTP_HOME);
g_fprintf (bout, "%s version ", PRG_NAME);
g_fprintf (bout, "%u.%u.%u", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
g_fprintf (bout, "\n");
g_fprintf (bout, "%s comes with ABSOLUTELY NO WARRANTY.\n", PRG_NAME);
g_fprintf (bout, "You may redistribute copies of %s under the terms of\n", PRG_NAME);
g_fprintf (bout, "the GNU Lesser General Public License which can be found in the\n");
g_fprintf (bout, "%s source package. Sources, examples and contact\n", PKG_NAME);
g_fprintf (bout, "information are available at %s\n", PKG_HTTP_HOME);
}
else
{
fprintf (bout, "Usage: %s [options] [image]\n", PRG_NAME);
fprintf (bout, " %s [options] --build-list [[name image]...]\n", PRG_NAME);
fprintf (bout, " --stream generate pixbuf data stream\n");
fprintf (bout, " --struct generate GdkPixdata structure\n");
fprintf (bout, " --macros generate image size/pixel macros\n");
fprintf (bout, " --rle use one byte run-length-encoding\n");
fprintf (bout, " --raw provide raw image data copy\n");
fprintf (bout, " --extern generate extern symbols\n");
fprintf (bout, " --static generate static symbols\n");
fprintf (bout, " --decoder provide rle decoder\n");
fprintf (bout, " --name=identifier C macro/variable name\n");
fprintf (bout, " --build-list parse (name, image) pairs\n");
fprintf (bout, " -h, --help show this help message\n");
fprintf (bout, " -v, --version print version informations\n");
fprintf (bout, " --g-fatal-warnings make warnings fatal (abort)\n");
g_fprintf (bout, "Usage: %s [options] [image]\n", PRG_NAME);
g_fprintf (bout, " %s [options] --build-list [[name image]...]\n", PRG_NAME);
g_fprintf (bout, " --stream generate pixbuf data stream\n");
g_fprintf (bout, " --struct generate GdkPixdata structure\n");
g_fprintf (bout, " --macros generate image size/pixel macros\n");
g_fprintf (bout, " --rle use one byte run-length-encoding\n");
g_fprintf (bout, " --raw provide raw image data copy\n");
g_fprintf (bout, " --extern generate extern symbols\n");
g_fprintf (bout, " --static generate static symbols\n");
g_fprintf (bout, " --decoder provide rle decoder\n");
g_fprintf (bout, " --name=identifier C macro/variable name\n");
g_fprintf (bout, " --build-list parse (name, image) pairs\n");
g_fprintf (bout, " -h, --help show this help message\n");
g_fprintf (bout, " -v, --version print version informations\n");
g_fprintf (bout, " --g-fatal-warnings make warnings fatal (abort)\n");
}
}

View File

@ -22,7 +22,7 @@
#include <config.h>
#include "gdk-pixbuf-private.h"
#include <stdio.h>
#include <glib/gprintf.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
@ -38,7 +38,7 @@ output_int (FILE *outfile, guint32 num, const char *comment)
bytes[2] = num >> 8;
bytes[3] = num;
fprintf(outfile, " /* %s (%u) */\n 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x,\n",
g_fprintf (outfile, " /* %s (%u) */\n 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x,\n",
comment, num,
bytes[0], bytes[1], bytes[2], bytes[3]);
}
@ -46,7 +46,7 @@ output_int (FILE *outfile, guint32 num, const char *comment)
void
output_bool (FILE *outfile, gboolean val, const char *comment)
{
fprintf(outfile, " /* %s (%s) */\n 0x%.2x,\n",
g_fprintf (outfile, " /* %s (%s) */\n 0x%.2x,\n",
comment,
val ? "TRUE" : "FALSE",
val ? 1 : 0);
@ -67,7 +67,7 @@ output_pixbuf (FILE *outfile, gboolean ext_symbols,
if (ext_symbols)
modifier = "";
fprintf (outfile, "%sconst guchar ", modifier);
g_fprintf (outfile, "%sconst guchar ", modifier);
fputs (varname, outfile);
fputs ("[] =\n", outfile);
fputs ("{\n", outfile);
@ -117,9 +117,9 @@ output_pixbuf (FILE *outfile, gboolean ext_symbols,
if (has_alpha)
fprintf(outfile, " 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x", r, g, b, a);
g_fprintf (outfile, " 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x", r, g, b, a);
else
fprintf(outfile, " 0x%.2x, 0x%.2x, 0x%.2x", r, g, b);
g_fprintf (outfile, " 0x%.2x, 0x%.2x, 0x%.2x", r, g, b);
if (p != end)
fputs (",", outfile);
@ -141,7 +141,7 @@ output_pixbuf (FILE *outfile, gboolean ext_symbols,
void
usage (void)
{
fprintf (stderr, "Usage: make-inline-pixbuf [--extern-symbols] OUTFILE varname1 imagefile1 varname2 imagefile2 ...\n");
g_fprintf (stderr, "Usage: make-inline-pixbuf [--extern-symbols] OUTFILE varname1 imagefile1 varname2 imagefile2 ...\n");
exit (1);
}
@ -171,7 +171,7 @@ main (int argc, char **argv)
outfile = fopen (argv[i], "w");
if (outfile == NULL)
{
fprintf (stderr, "Failed to open output file `%s': %s\n",
g_fprintf (stderr, "Failed to open output file `%s': %s\n",
argv[i], strerror (errno));
exit (1);
}
@ -199,7 +199,7 @@ main (int argc, char **argv)
if (pixbuf == NULL)
{
fprintf (stderr, "%s\n", error->message);
g_fprintf (stderr, "%s\n", error->message);
fclose (outfile);
remove (outfilename);
exit (1);

View File

@ -25,6 +25,7 @@
#include <config.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <gmodule.h>
#include <errno.h>
@ -32,7 +33,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include "gdk-pixbuf/gdk-pixbuf.h"
#include "gdk-pixbuf/gdk-pixbuf-private.h"
@ -49,7 +49,7 @@ static void
print_escaped (const char *str)
{
gchar *tmp = g_strescape (str, "");
printf ("\"%s\" ", tmp);
g_printf ("\"%s\" ", tmp);
g_free (tmp);
}
@ -78,30 +78,30 @@ query_module (const char *dir, const char *file)
g_module_symbol (module, "fill_info", (gpointer *) &fill_info) &&
g_module_symbol (module, "fill_vtable", (gpointer *) &fill_vtable)) {
GdkPixbufFormat *info;
printf("\"%s\"\n", path);
g_printf("\"%s\"\n", path);
info = g_new0 (GdkPixbufFormat, 1);
(*fill_info) (info);
printf("\"%s\" %d \"%s\" \"%s\"\n",
g_printf ("\"%s\" %d \"%s\" \"%s\"\n",
info->name, info->flags,
info->domain ? info->domain : GETTEXT_PACKAGE, info->description);
for (mime = info->mime_types; *mime; mime++) {
printf("\"%s\" ", *mime);
g_printf ("\"%s\" ", *mime);
}
printf("\"\"\n");
g_printf ("\"\"\n");
for (ext = info->extensions; *ext; ext++) {
printf("\"%s\" ", *ext);
g_printf ("\"%s\" ", *ext);
}
printf("\"\"\n");
g_printf ("\"\"\n");
for (pattern = info->signature; pattern->prefix; pattern++) {
print_escaped (pattern->prefix);
print_escaped (pattern->mask ? (const char *)pattern->mask : "");
printf ("%d\n", pattern->relevance);
g_printf ("%d\n", pattern->relevance);
}
printf ("\n");
g_printf ("\n");
g_free (info);
}
else {
fprintf (stderr, "Cannot load loader %s\n", path);
g_fprintf (stderr, "Cannot load loader %s\n", path);
}
if (module)
g_module_close (module);
@ -112,7 +112,7 @@ int main (int argc, char **argv)
{
gint i;
printf ("# GdkPixbuf Image Loader Modules file\n"
g_printf ("# GdkPixbuf Image Loader Modules file\n"
"# Automatically generated file, do not edit\n"
"#\n");
@ -125,7 +125,7 @@ int main (int argc, char **argv)
if (path == NULL || *path == '\0')
path = PIXBUF_LIBDIR;
printf ("# LoaderDir = %s\n#\n", path);
g_printf ("# LoaderDir = %s\n#\n", path);
dir = g_dir_open (path, 0, NULL);
if (dir) {
@ -141,7 +141,7 @@ int main (int argc, char **argv)
g_dir_close (dir);
}
#else
printf ("# dynamic loading of modules not supported\n");
g_printf ("# dynamic loading of modules not supported\n");
#endif
}
else {

View File

@ -24,7 +24,7 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <stdio.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include "gdkkeysyms.h"
@ -1360,7 +1360,7 @@ gdk_keyval_name (guint keyval)
/* Check for directly encoded 24-bit UCS characters: */
if ((keyval & 0xff000000) == 0x01000000)
{
sprintf (buf, "U+%.04X", (keyval & 0x00ffffff));
g_sprintf (buf, "U+%.04X", (keyval & 0x00ffffff));
return buf;
}
@ -1378,7 +1378,7 @@ gdk_keyval_name (guint keyval)
}
else if (keyval != 0)
{
sprintf (buf, "%#x", keyval);
g_sprintf (buf, "%#x", keyval);
return buf;
}

View File

@ -52,6 +52,7 @@
#include "gdkrgb.h"
#include "gdkscreen.h"
#include <glib/gprintf.h>
typedef struct _GdkRgbInfo GdkRgbInfo;
typedef struct _GdkRgbCmapInfo GdkRgbCmapInfo;
@ -283,7 +284,7 @@ gdk_rgb_try_colormap (GdkRgbInfo *image_info, gboolean force,
{
char tmp_str[80];
sprintf (tmp_str,
g_snprintf (tmp_str, 80,
"%d %d %d colormap failed (in gdk_colors_alloc)\n",
nr, ng, nb);
return gdk_rgb_cmap_fail (tmp_str, cmap, pixels);
@ -312,7 +313,7 @@ gdk_rgb_try_colormap (GdkRgbInfo *image_info, gboolean force,
{
char tmp_str[80];
sprintf (tmp_str, "%d %d %d colormap failed\n",
g_snprintf (tmp_str, 80, "%d %d %d colormap failed\n",
nr, ng, nb);
return gdk_rgb_cmap_fail (tmp_str,
cmap, pixels);

View File

@ -1,4 +1,5 @@
#include <glib.h>
#include <glib/gprintf.h>
#include <sys/types.h>
#include <sys/socket.h>
@ -9,7 +10,6 @@
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include "gdkfbmanager.h"
@ -33,7 +33,7 @@ int create_master_socket (void)
if (fd < 0)
{
printf ("Error creating socket: %s\n", strerror(errno));
g_fprintf (stderr, "Error creating socket: %s\n", strerror(errno));
return -1;
}
@ -44,7 +44,7 @@ int create_master_socket (void)
if (bind(fd, (struct sockaddr *)&addr, sizeof (addr)) < 0)
{
printf ("Unable to bind socket: %s\n", strerror(errno));
g_fprintf (stderr, "Unable to bind socket: %s\n", strerror (errno));
close (fd);
return -1;
}
@ -52,7 +52,7 @@ int create_master_socket (void)
if (listen (fd, 10) < 0)
{
printf ("Unable to listen on socket: %s\n", strerror(errno));
g_fprintf (stderr, "Unable to listen on socket: %s\n", strerror (errno));
close (fd);
return -1;
}

View File

@ -36,7 +36,7 @@
/* Do use SetCapture, it works now. Thanks to jpe@archaeopteryx.com */
#define USE_SETCAPTURE 1
#include <stdio.h>
#include <glib/gprintf.h>
#include "gdk.h"
#include "gdkprivate-win32.h"
@ -318,7 +318,7 @@ _gdk_events_init (void)
while (latin_locale == NULL && i < G_N_ELEMENTS (latin_languages))
{
char id[9];
sprintf (id, "%08x", MAKELANGID (latin_languages[i++], SUBLANG_DEFAULT));
g_sprintf (id, "%08x", MAKELANGID (latin_languages[i++], SUBLANG_DEFAULT));
latin_locale = LoadKeyboardLayout (id, KLF_NOTELLSHELL|KLF_SUBSTITUTE_OK);
}
}
@ -451,7 +451,7 @@ event_mask_string (GdkEventMask mask)
*p = '\0';
#define BIT(x) \
if (mask & GDK_##x##_MASK) \
p += sprintf (p, "%s" #x, (p > bfr ? " " : ""))
p += g_sprintf (p, "%s" #x, (p > bfr ? " " : ""))
BIT (EXPOSURE);
BIT (POINTER_MOTION);
BIT (POINTER_MOTION_HINT);
@ -1613,14 +1613,14 @@ decode_key_lparam (LPARAM lParam)
char *p = buf;
if (HIWORD (lParam) & KF_UP)
p += sprintf (p, "KF_UP ");
p += g_sprintf (p, "KF_UP ");
if (HIWORD (lParam) & KF_REPEAT)
p += sprintf (p, "KF_REPEAT ");
p += g_sprintf (p, "KF_REPEAT ");
if (HIWORD (lParam) & KF_ALTDOWN)
p += sprintf (p, "KF_ALTDOWN ");
p += g_sprintf (p, "KF_ALTDOWN ");
if (HIWORD (lParam) & KF_EXTENDED)
p += sprintf (p, "KF_EXTENDED ");
p += sprintf (p, "sc:%d rep:%d", LOBYTE (HIWORD (lParam)), LOWORD (lParam));
p += g_sprintf (p, "KF_EXTENDED ");
p += g_sprintf (p, "sc:%d rep:%d", LOBYTE (HIWORD (lParam)), LOWORD (lParam));
return buf;
}

View File

@ -27,7 +27,7 @@
#include "config.h"
#include <stdio.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
@ -294,7 +294,7 @@ _gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
(pep[i].peFlags == PC_EXPLICIT ? " PC_EXPLICIT" :
(pep[i].peFlags == PC_NOCOLLAPSE ? " PC_NOCOLLAPSE" :
(pep[i].peFlags == PC_RESERVED ? " PC_RESERVED" :
(sprintf (buf, " %d", pep[i].peFlags), buf))))));
(g_sprintf (buf, " %d", pep[i].peFlags), buf))))));
}
void
@ -497,7 +497,7 @@ _gdk_win32_gcvalues_mask_to_string (GdkGCValuesMask mask)
#define BIT(x) \
if (mask & GDK_GC_##x) \
(bufp += sprintf (bufp, "%s" #x, s), s = "|")
(bufp += g_sprintf (bufp, "%s" #x, s), s = "|")
BIT (FOREGROUND);
BIT (BACKGROUND);

View File

@ -27,7 +27,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <glib/gprintf.h>
#include "gdkscreen.h"
#include "gdkproperty.h"
@ -359,7 +359,7 @@ gdk_property_change (GdkWindow *window,
rtf = g_string_append (rtf, "\\uNNNNN ");
rtf->len -= 6; /* five digits and a space */
q = rtf->str + rtf->len;
n = sprintf (q, "%d ", g_utf8_get_char (p));
n = g_sprintf (q, "%d ", g_utf8_get_char (p));
g_assert (n <= 6);
rtf->len += n;

View File

@ -26,7 +26,7 @@
#include "config.h"
#include <stdio.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@ -531,9 +531,9 @@ gdk_x_error (Display *display,
#ifdef G_ENABLE_DEBUG
g_error ("%s", msg);
#else /* !G_ENABLE_DEBUG */
fprintf (stderr, "%s\n", msg);
g_fprintf (stderr, "%s\n", msg);
exit(1);
exit (1);
#endif /* G_ENABLE_DEBUG */
}
_gdk_error_code = error->error_code;
@ -572,7 +572,7 @@ gdk_x_io_error (Display *display)
*/
if (errno == EPIPE)
{
fprintf (stderr,
g_fprintf (stderr,
"The application '%s' lost its connection to the display %s;\n"
"most likely the X server was shut down or you killed/destroyed\n"
"the application.\n",
@ -581,7 +581,7 @@ gdk_x_io_error (Display *display)
}
else
{
fprintf (stderr, "%s: Fatal IO error %d (%s) on X server %s.\n",
g_fprintf (stderr, "%s: Fatal IO error %d (%s) on X server %s.\n",
g_get_prgname (),
errno, g_strerror (errno),
display ? DisplayString (display) : gdk_get_display_arg_name ());

View File

@ -37,7 +37,7 @@
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <glib/gprintf.h>
#include "gtkcalendar.h"
#include "gtkmarshalers.h"
@ -1211,7 +1211,7 @@ gtk_calendar_size_request (GtkWidget *widget,
private_data->max_year_width = 0;
for (i=0; i<10; i++)
{
sprintf (buffer, "%d%d%d%d", i,i,i,i);
g_snprintf (buffer, sizeof (buffer), "%d%d%d%d", i,i,i,i);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
private_data->max_year_width = MAX (private_data->max_year_width,
@ -1243,7 +1243,7 @@ gtk_calendar_size_request (GtkWidget *widget,
for (i = 0; i < 9; i++)
{
sprintf (buffer, "%d%d", i, i);
g_snprintf (buffer, sizeof (buffer), "%d%d", i, i);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
private_data->min_day_width = MAX (private_data->min_day_width,
@ -1274,7 +1274,7 @@ gtk_calendar_size_request (GtkWidget *widget,
if (calendar->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
for (i = 0; i < 9; i++)
{
sprintf (buffer, "%d%d", i, i);
g_snprintf (buffer, sizeof (buffer), "%d%d", i, i);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
private_data->max_week_char_width = MAX (private_data->max_week_char_width,
@ -1496,7 +1496,7 @@ gtk_calendar_paint_header (GtkWidget *widget)
0, 0, header_width, private_data->header_h);
sprintf (buffer, "%d", calendar->year);
g_snprintf (buffer, sizeof (buffer), "%d", calendar->year);
layout = gtk_widget_create_pango_layout (widget, buffer);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
@ -1517,7 +1517,7 @@ gtk_calendar_paint_header (GtkWidget *widget)
gdk_draw_layout (private_data->header_win, gc, x, y, layout);
/* Draw month */
sprintf (buffer, "%s", default_monthname[calendar->month]);
g_snprintf (buffer, sizeof (buffer), "%s", default_monthname[calendar->month]);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
@ -1617,7 +1617,7 @@ gtk_calendar_paint_day_names (GtkWidget *widget)
day = i;
if (calendar->display_flags & GTK_CALENDAR_WEEK_START_MONDAY)
day= (day+1)%7;
sprintf (buffer, "%s", default_abbreviated_dayname[day]);
g_snprintf (buffer, sizeof (buffer), "%s", default_abbreviated_dayname[day]);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
@ -1714,7 +1714,7 @@ gtk_calendar_paint_week_numbers (GtkWidget *widget)
((calendar->day[row][6] < 15 && row > 3 ? 1 : 0)
+ calendar->month) % 12 + 1, calendar->day[row][6]));
sprintf (buffer, "%d", week);
g_snprintf (buffer, sizeof (buffer), "%d", week);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
@ -1850,7 +1850,7 @@ gtk_calendar_paint_day (GtkWidget *widget,
}
sprintf (buffer, "%d", day);
g_snprintf (buffer, sizeof (buffer), "%d", day);
layout = gtk_widget_create_pango_layout (widget, buffer);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);

View File

@ -803,7 +803,7 @@ gtk_file_selection_init (GtkFileSelection *filesel)
{
gchar err_buf[256];
sprintf (err_buf, _("Folder unreadable: %s"), cmpl_strerror (cmpl_errno));
g_snprintf (err_buf, sizeof (err_buf), _("Folder unreadable: %s"), cmpl_strerror (cmpl_errno));
gtk_label_set_text (GTK_LABEL (filesel->selection_text), err_buf);
}
@ -2023,7 +2023,7 @@ win32_gtk_add_drives_to_dir_list (GtkListStore *model)
if ((tolower (textPtr[0]) != 'a') && (tolower (textPtr[0]) != 'b'))
{
/* Build the actual displayable string */
sprintf (formatBuffer, "%c:\\", toupper (textPtr[0]));
g_snprintf (formatBuffer, sizeof (formatBuffer), "%c:\\", toupper (textPtr[0]));
/* Add to the list */
gtk_list_store_append (model, &iter);
@ -2201,7 +2201,7 @@ gtk_file_selection_abort (GtkFileSelection *fs)
{
gchar err_buf[256];
sprintf (err_buf, _("Folder unreadable: %s"), cmpl_strerror (cmpl_errno));
g_snprintf (err_buf, sizeof (err_buf), _("Folder unreadable: %s"), cmpl_strerror (cmpl_errno));
/* BEEP gdk_beep(); */
@ -2835,7 +2835,7 @@ open_ref_dir (gchar *text_to_complete,
if (text_to_complete[0] == '/' && text_to_complete[1] == '/')
{
char root_dir[5];
sprintf (root_dir, "//%c", text_to_complete[2]);
g_snprintf (root_dir, sizeof (root_dir), "//%c", text_to_complete[2]);
new_dir = open_dir (root_dir, cmpl_state);

View File

@ -30,7 +30,7 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <glib/gprintf.h>
#include <string.h>
#include "gdk/gdk.h"
@ -907,7 +907,7 @@ gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
/* Set the entry to the new size, rounding to 1 digit,
* trimming of trailing 0's and a trailing period
*/
sprintf (buffer, "%.1f", fontsel->size / (1.0 * PANGO_SCALE));
g_snprintf (buffer, sizeof (buffer), "%.1f", fontsel->size / (1.0 * PANGO_SCALE));
if (strchr (buffer, '.'))
{
p = buffer + strlen (buffer) - 1;

View File

@ -25,7 +25,7 @@
*/
#include <math.h>
#include <stdio.h>
#include <glib/gprintf.h>
#include <string.h>
#include "gtkhruler.h"
@ -201,7 +201,7 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
* for the scale looks consistent with an accompanying vruler
*/
scale = ceil (ruler->max_size / ruler->metric->pixels_per_unit);
sprintf (unit_str, "%d", scale);
g_snprintf (unit_str, sizeof (unit_str), "%d", scale);
text_width = strlen (unit_str) * digit_height + 1;
for (scale = 0; scale < MAXIMUM_SCALES; scale++)
@ -250,7 +250,7 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
/* draw label */
if (i == 0)
{
sprintf (unit_str, "%d", (int) cur);
g_snprintf (unit_str, sizeof (unit_str), "%d", (int) cur);
pango_layout_set_text (layout, unit_str, -1);
pango_layout_get_extents (layout, &logical_rect, NULL);

View File

@ -32,7 +32,7 @@
*/
#include <stdio.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "gtkbutton.h"
@ -602,7 +602,7 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDevice *info)
menu_item = gtk_menu_item_new_with_label (_("none"));
else
{
sprintf (buffer,"%d",j+1);
g_snprintf (buffer, sizeof (buffer), "%d", j+1);
menu_item = gtk_menu_item_new_with_label (buffer);
}
g_signal_connect (menu_item, "activate",
@ -731,7 +731,7 @@ gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDevice *info)
/* create the label */
sprintf (buffer, "%d", i+1);
g_snprintf (buffer, sizeof (buffer), "%d", i+1);
label = gtk_label_new (buffer);
gtk_table_attach (GTK_TABLE (inputd->keys_list), label, 0, 1, i, i+1,
0, 0, 2, 2);

View File

@ -24,7 +24,7 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <stdio.h>
#include <glib/gprintf.h>
#include <math.h>
#include <string.h>
#include "gtkprogress.h"
@ -429,11 +429,11 @@ gtk_progress_build_string (GtkProgress *progress,
case 'P':
if (digits)
{
sprintf (fmt, "%%.%df", digits);
sprintf (tmp, fmt, 100 * percentage);
g_snprintf (fmt, sizeof (fmt), "%%.%df", digits);
g_snprintf (tmp, sizeof (tmp), fmt, 100 * percentage);
}
else
sprintf (tmp, "%.0f", 100 * percentage);
g_snprintf (tmp, sizeof (tmp), "%.0f", 100 * percentage);
strcat (buf, tmp);
dest = &(buf[strlen (buf)]);
src++;
@ -442,11 +442,11 @@ gtk_progress_build_string (GtkProgress *progress,
case 'V':
if (digits)
{
sprintf (fmt, "%%.%df", digits);
sprintf (tmp, fmt, value);
g_snprintf (fmt, sizeof (fmt), "%%.%df", digits);
g_snprintf (tmp, sizeof (tmp), fmt, value);
}
else
sprintf (tmp, "%.0f", value);
g_snprintf (tmp, sizeof (tmp), "%.0f", value);
strcat (buf, tmp);
dest = &(buf[strlen (buf)]);
src++;
@ -455,11 +455,11 @@ gtk_progress_build_string (GtkProgress *progress,
case 'L':
if (digits)
{
sprintf (fmt, "%%.%df", digits);
sprintf (tmp, fmt, progress->adjustment->lower);
g_snprintf (fmt, sizeof (fmt), "%%.%df", digits);
g_snprintf (tmp, sizeof (tmp), fmt, progress->adjustment->lower);
}
else
sprintf (tmp, "%.0f", progress->adjustment->lower);
g_snprintf (tmp, sizeof (tmp), "%.0f", progress->adjustment->lower);
strcat (buf, tmp);
dest = &(buf[strlen (buf)]);
src++;
@ -468,11 +468,11 @@ gtk_progress_build_string (GtkProgress *progress,
case 'U':
if (digits)
{
sprintf (fmt, "%%.%df", digits);
sprintf (tmp, fmt, progress->adjustment->upper);
g_snprintf (fmt, sizeof (fmt), "%%.%df", digits);
g_snprintf (tmp, sizeof (tmp), fmt, progress->adjustment->upper);
}
else
sprintf (tmp, "%.0f", progress->adjustment->upper);
g_snprintf (tmp, sizeof (tmp), "%.0f", progress->adjustment->upper);
strcat (buf, tmp);
dest = &(buf[strlen (buf)]);
src++;

View File

@ -18,9 +18,9 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <gobject/gvaluecollector.h>
#include "gtktreemodel.h"
#include "gtktreeview.h"
@ -274,13 +274,13 @@ gtk_tree_path_to_string (GtkTreePath *path)
return NULL;
ptr = retval = (gchar *) g_new0 (char *, path->depth*8);
sprintf (retval, "%d", path->indices[0]);
g_sprintf (retval, "%d", path->indices[0]);
while (*ptr != '\000')
ptr++;
for (i = 1; i < path->depth; i++)
{
sprintf (ptr, ":%d", path->indices[i]);
g_sprintf (ptr, ":%d", path->indices[i]);
while (*ptr != '\000')
ptr++;
}

View File

@ -25,10 +25,11 @@
*/
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "gtkvruler.h"
#include <glib/gprintf.h>
#define RULER_WIDTH 14
#define MINIMUM_INCR 5
@ -198,7 +199,7 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
* leaves sufficient room for drawing the ruler.
*/
scale = ceil (ruler->max_size / ruler->metric->pixels_per_unit);
sprintf (unit_str, "%d", scale);
g_snprintf (unit_str, sizeof (unit_str), "%d", scale);
text_height = strlen (unit_str) * digit_height + 1;
for (scale = 0; scale < MAXIMUM_SCALES; scale++)
@ -246,7 +247,7 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
/* draw label */
if (i == 0)
{
sprintf (unit_str, "%d", (int) cur);
g_snprintf (unit_str, sizeof (unit_str), "%d", (int) cur);
for (j = 0; j < (int) strlen (unit_str); j++)
{

View File

@ -22,6 +22,7 @@
#include "config.h"
#include <glib.h>
#include <glib/gprintf.h>
#include <gmodule.h>
#include <errno.h>
@ -29,7 +30,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#ifdef G_OS_WIN32
#define SOEXT ".dll"
@ -73,7 +73,7 @@ static void
print_escaped (const char *str)
{
char *tmp = escape_string (str);
printf ("\"%s\" ", tmp);
g_printf ("\"%s\" ", tmp);
g_free (tmp);
}
@ -99,7 +99,7 @@ query_module (const char *dir, const char *name)
if (!module)
{
fprintf(stderr, "Cannot load module %s: %s\n", path, g_module_error());
g_fprintf (stderr, "Cannot load module %s: %s\n", path, g_module_error());
error = TRUE;
}
@ -131,8 +131,8 @@ query_module (const char *dir, const char *name)
}
else
{
fprintf (stderr, "%s does not export GTK+ IM module API: %s\n", path,
g_module_error());
g_fprintf (stderr, "%s does not export GTK+ IM module API: %s\n", path,
g_module_error ());
error = TRUE;
}
@ -150,7 +150,7 @@ int main (int argc, char **argv)
char *path;
gboolean error = FALSE;
printf ("# GTK+ Input Method Modules file\n"
g_printf ("# GTK+ Input Method Modules file\n"
"# Automatically generated file, do not edit\n"
"#\n");
@ -161,7 +161,7 @@ int main (int argc, char **argv)
path = gtk_rc_get_im_module_path ();
printf ("# ModulesPath = %s\n#\n", path);
g_printf ("# ModulesPath = %s\n#\n", path);
dirs = pango_split_file_list (path);

View File

@ -1,5 +1,5 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <stdio.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
@ -11,15 +11,15 @@ output_byte (guchar byte,
{
if (online == BYTES_PER_OUTPUT_LINE)
{
printf (",\n ");
g_printf (",\n ");
online = 0;
}
else if (online)
{
printf (",");
g_printf (",");
}
printf ("0x%02x", byte);
g_printf ("0x%02x", byte);
return online + 1;
}
@ -46,8 +46,8 @@ do_part (GdkPixbuf *pixbuf,
color3 = pixels + part3_index * n_channels;
pixels += rowstride;
printf ("static const guchar %s_%s_bits[] = {\n", base_name, part_name);
printf (" ");
g_printf ("static const guchar %s_%s_bits[] = {\n", base_name, part_name);
g_printf (" ");
while (height--)
{
@ -81,7 +81,7 @@ do_part (GdkPixbuf *pixbuf,
pixels += rowstride;
}
printf ("};\n");
g_printf ("};\n");
}
typedef enum {
@ -114,7 +114,7 @@ int main (int argc, char **argv)
if (argc != 3)
{
fprintf (stderr, "%s: Usage: %s FILE BASE\n", progname, progname);
g_fprintf (stderr, "%s: Usage: %s FILE BASE\n", progname, progname);
exit (1);
}
@ -123,23 +123,23 @@ int main (int argc, char **argv)
pixbuf = gdk_pixbuf_new_from_file (argv[1], &error);
if (!pixbuf)
{
fprintf (stderr, "%s: cannot open file '%s': %s\n", progname, argv[1], error->message);
g_fprintf (stderr, "%s: cannot open file '%s': %s\n", progname, argv[1], error->message);
exit (1);
}
if (gdk_pixbuf_get_width (pixbuf) < PART_LAST)
{
fprintf (stderr, "%s: source image must be at least %d pixels wide\n", progname, PART_LAST);
g_fprintf (stderr, "%s: source image must be at least %d pixels wide\n", progname, PART_LAST);
exit (1);
}
if (gdk_pixbuf_get_height (pixbuf) < 1)
{
fprintf (stderr, "%s: source image must be at least 1 pixel height\n", progname);
g_fprintf (stderr, "%s: source image must be at least 1 pixel height\n", progname);
exit (1);
}
printf ("/*\n * Extracted from %s, width=%d, height=%d\n */\n", argv[1],
g_printf ("/*\n * Extracted from %s, width=%d, height=%d\n */\n", argv[1],
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf) - 1);
for (i = 0; i < PART_LAST; i++)