Commit 8ba71578 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

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)
parent d745218d
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):
......
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):
......
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):
......
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):
......
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):
......
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):
......
......@@ -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");
}
}
......@@ -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);
......
......@@ -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 {
......
......@@ -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;
}
......
......@@ -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);
......
#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;
}
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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 ());
......
......@@ -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);
......
......@@ -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);