Convert cvt code to use XNFasprintf()
Requires linking xprintf.c into standalone cvt utility Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
parent
d2c42b1027
commit
446482efaa
|
@ -279,15 +279,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
||||||
if (Interlaced)
|
if (Interlaced)
|
||||||
Mode->VTotal *= 2;
|
Mode->VTotal *= 2;
|
||||||
|
|
||||||
{
|
XNFasprintf(&Mode->name, "%dx%d", HDisplay, VDisplay);
|
||||||
char Name[256];
|
|
||||||
Name[0] = 0;
|
|
||||||
|
|
||||||
snprintf(Name, 256, "%dx%d", HDisplay, VDisplay);
|
|
||||||
|
|
||||||
Mode->name = xnfalloc(strlen(Name) + 1);
|
|
||||||
memcpy(Mode->name, Name, strlen(Name) + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Reduced)
|
if (Reduced)
|
||||||
Mode->Flags |= V_PHSYNC | V_NVSYNC;
|
Mode->Flags |= V_PHSYNC | V_NVSYNC;
|
||||||
|
|
|
@ -27,7 +27,10 @@ INCLUDES = $(XORG_INCS) \
|
||||||
-I$(top_srcdir)/hw/xfree86/parser
|
-I$(top_srcdir)/hw/xfree86/parser
|
||||||
|
|
||||||
# gah
|
# gah
|
||||||
cvt_SOURCES = cvt.c $(top_srcdir)/hw/xfree86/modes/xf86cvt.c
|
cvt_SOURCES = cvt.c \
|
||||||
|
$(top_srcdir)/hw/xfree86/modes/xf86cvt.c \
|
||||||
|
$(top_srcdir)/os/xprintf.c
|
||||||
|
|
||||||
cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
|
cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
|
||||||
|
|
||||||
man1_MANS = cvt.man
|
man1_MANS = cvt.man
|
||||||
|
|
|
@ -25,6 +25,24 @@
|
||||||
|
|
||||||
#include "xf86.h"
|
#include "xf86.h"
|
||||||
|
|
||||||
|
/* Error implementation used by the server code we built in */
|
||||||
|
void
|
||||||
|
Error(const char *str)
|
||||||
|
{
|
||||||
|
perror(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FatalError implementation used by the server code we built in */
|
||||||
|
void
|
||||||
|
FatalError(const char *f, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, f);
|
||||||
|
vfprintf(stderr, f, args);
|
||||||
|
va_end(args);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* xnfalloc implementation used by the server code we built in */
|
/* xnfalloc implementation used by the server code we built in */
|
||||||
pointer
|
pointer
|
||||||
XNFalloc(unsigned long n)
|
XNFalloc(unsigned long n)
|
||||||
|
|
Loading…
Reference in New Issue