Merge remote branch 'alanc/master'
This commit is contained in:
commit
519d243f0c
2
COPYING
2
COPYING
|
@ -15,11 +15,11 @@ Copyright © 2006 Nokia Corporation
|
||||||
Copyright © 2006-2008 Peter Hutterer
|
Copyright © 2006-2008 Peter Hutterer
|
||||||
Copyright © 2006 Adam Jackson
|
Copyright © 2006 Adam Jackson
|
||||||
Copyright © 2009-2010 NVIDIA Corporation
|
Copyright © 2009-2010 NVIDIA Corporation
|
||||||
|
Copyright © 1987, 2003-2006, 2008-2010 Oracle and/or its affiliates.
|
||||||
Copyright © 1999 Keith Packard
|
Copyright © 1999 Keith Packard
|
||||||
Copyright © 2007-2009 Red Hat, Inc.
|
Copyright © 2007-2009 Red Hat, Inc.
|
||||||
Copyright © 2005-2008 Daniel Stone
|
Copyright © 2005-2008 Daniel Stone
|
||||||
Copyright © 2006-2009 Simon Thum
|
Copyright © 2006-2009 Simon Thum
|
||||||
Copyright © 1987, 2003-2006, 2008-2009 Sun Microsystems, Inc.
|
|
||||||
Copyright © 2006 Luc Verhaegen
|
Copyright © 2006 Luc Verhaegen
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
13
config/hal.c
13
config/hal.c
|
@ -63,10 +63,8 @@ device_removed(LibHalContext *ctx, const char *udi)
|
||||||
{
|
{
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
value = malloc(strlen(udi) + 5); /* "hal:" + NULL */
|
if (asprintf (&value, "hal:%s", udi) == -1)
|
||||||
if (!value)
|
|
||||||
return;
|
return;
|
||||||
sprintf(value, "hal:%s", udi);
|
|
||||||
|
|
||||||
remove_devices("hal", value);
|
remove_devices("hal", value);
|
||||||
|
|
||||||
|
@ -200,7 +198,9 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
"config/hal: getting usb.product_id on %s "
|
"config/hal: getting usb.product_id on %s "
|
||||||
"returned %04x\n", parent, usb_product);
|
"returned %04x\n", parent, usb_product);
|
||||||
if (usb_vendor && usb_product)
|
if (usb_vendor && usb_product)
|
||||||
attrs.usb_id = Xprintf("%04x:%04x", usb_vendor, usb_product);
|
if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_product)
|
||||||
|
== -1)
|
||||||
|
attrs.usb_id = NULL;
|
||||||
|
|
||||||
free(parent);
|
free(parent);
|
||||||
}
|
}
|
||||||
|
@ -226,12 +226,11 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
add_option(&options, "driver", driver);
|
add_option(&options, "driver", driver);
|
||||||
add_option(&options, "name", name);
|
add_option(&options, "name", name);
|
||||||
|
|
||||||
config_info = malloc(strlen(udi) + 5); /* "hal:" and NULL */
|
if (asprintf (&config_info, "hal:%s", udi) == -1) {
|
||||||
if (!config_info) {
|
config_info = NULL;
|
||||||
LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
|
LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
sprintf(config_info, "hal:%s", udi);
|
|
||||||
|
|
||||||
/* Check for duplicate devices */
|
/* Check for duplicate devices */
|
||||||
if (device_is_duplicate(config_info))
|
if (device_is_duplicate(config_info))
|
||||||
|
|
|
@ -108,8 +108,10 @@ device_added(struct udev_device *udev_device)
|
||||||
|
|
||||||
/* construct USB ID in lowercase hex - "0000:ffff" */
|
/* construct USB ID in lowercase hex - "0000:ffff" */
|
||||||
if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
|
if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
|
||||||
attrs.usb_id = Xprintf("%04x:%04x", usb_vendor, usb_model);
|
if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model)
|
||||||
if (attrs.usb_id)
|
== -1)
|
||||||
|
attrs.usb_id = NULL;
|
||||||
|
else
|
||||||
LOG_PROPERTY(path, "PRODUCT", product);
|
LOG_PROPERTY(path, "PRODUCT", product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,9 +129,10 @@ device_added(struct udev_device *udev_device)
|
||||||
LOG_PROPERTY(path, "ID_INPUT.tags", tags_prop);
|
LOG_PROPERTY(path, "ID_INPUT.tags", tags_prop);
|
||||||
attrs.tags = xstrtokenize(tags_prop, ",");
|
attrs.tags = xstrtokenize(tags_prop, ",");
|
||||||
|
|
||||||
config_info = Xprintf("udev:%s", syspath);
|
if (asprintf(&config_info, "udev:%s", syspath) == -1) {
|
||||||
if (!config_info)
|
config_info = NULL;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
}
|
||||||
|
|
||||||
if (device_is_duplicate(config_info)) {
|
if (device_is_duplicate(config_info)) {
|
||||||
LogMessage(X_WARNING, "config/udev: device %s already added. "
|
LogMessage(X_WARNING, "config/udev: device %s already added. "
|
||||||
|
@ -217,8 +220,7 @@ device_removed(struct udev_device *device)
|
||||||
char *value;
|
char *value;
|
||||||
const char *syspath = udev_device_get_syspath(device);
|
const char *syspath = udev_device_get_syspath(device);
|
||||||
|
|
||||||
value = Xprintf("udev:%s", syspath);
|
if (asprintf(&value, "udev:%s", syspath) == -1)
|
||||||
if (!value)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
remove_devices("udev", value);
|
remove_devices("udev", value);
|
||||||
|
|
|
@ -203,7 +203,7 @@ dnl Checks for library functions.
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
|
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
|
||||||
strtol getopt getopt_long vsnprintf walkcontext backtrace \
|
strtol getopt getopt_long vsnprintf walkcontext backtrace \
|
||||||
getisax getzoneid shmctl64 strcasestr ffs])
|
getisax getzoneid shmctl64 strcasestr ffs vasprintf])
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
dnl Old HAS_* names used in os/*.c.
|
dnl Old HAS_* names used in os/*.c.
|
||||||
AC_CHECK_FUNC([getdtablesize],
|
AC_CHECK_FUNC([getdtablesize],
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
/* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
|
/* Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -2524,9 +2524,11 @@ AllocDevicePair (ClientPtr client, char* name,
|
||||||
if (!pointer)
|
if (!pointer)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
pointer->name = calloc(strlen(name) + strlen(" pointer") + 1, sizeof(char));
|
if (asprintf(&pointer->name, "%s pointer", name) == -1) {
|
||||||
strcpy(pointer->name, name);
|
pointer->name = NULL;
|
||||||
strcat(pointer->name, " pointer");
|
RemoveDevice(pointer, FALSE);
|
||||||
|
return BadAlloc;
|
||||||
|
}
|
||||||
|
|
||||||
pointer->public.processInputProc = ProcessOtherEvent;
|
pointer->public.processInputProc = ProcessOtherEvent;
|
||||||
pointer->public.realInputProc = ProcessOtherEvent;
|
pointer->public.realInputProc = ProcessOtherEvent;
|
||||||
|
@ -2547,9 +2549,12 @@ AllocDevicePair (ClientPtr client, char* name,
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyboard->name = calloc(strlen(name) + strlen(" keyboard") + 1, sizeof(char));
|
if (asprintf(&keyboard->name, "%s keyboard", name) == -1) {
|
||||||
strcpy(keyboard->name, name);
|
keyboard->name = NULL;
|
||||||
strcat(keyboard->name, " keyboard");
|
RemoveDevice(keyboard, FALSE);
|
||||||
|
RemoveDevice(pointer, FALSE);
|
||||||
|
return BadAlloc;
|
||||||
|
}
|
||||||
|
|
||||||
keyboard->public.processInputProc = ProcessOtherEvent;
|
keyboard->public.processInputProc = ProcessOtherEvent;
|
||||||
keyboard->public.realInputProc = ProcessOtherEvent;
|
keyboard->public.realInputProc = ProcessOtherEvent;
|
||||||
|
|
|
@ -75,7 +75,7 @@ Equipment Corporation.
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
/* XSERVER_DTRACE additions:
|
/* XSERVER_DTRACE additions:
|
||||||
* Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1817,7 +1817,9 @@ SetDefaultFontPath(char *path)
|
||||||
start = end;
|
start = end;
|
||||||
}
|
}
|
||||||
if (!start) {
|
if (!start) {
|
||||||
temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : "");
|
if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "")
|
||||||
|
== -1)
|
||||||
|
temp_path = NULL;
|
||||||
} else {
|
} else {
|
||||||
temp_path = strdup(path);
|
temp_path = strdup(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ Equipment Corporation.
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright © 2003-2005 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2003-2005, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -73,7 +73,7 @@ Equipment Corporation.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
/* XSERVER_DTRACE additions:
|
/* XSERVER_DTRACE additions:
|
||||||
* Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 1987 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 1987, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -297,8 +297,8 @@ copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
|
||||||
}
|
}
|
||||||
memcpy(cptr, odev, sizeof(GDevRec));
|
memcpy(cptr, odev, sizeof(GDevRec));
|
||||||
|
|
||||||
cptr->identifier = Xprintf("Autoconfigured Video Device %s", driver);
|
if (asprintf(&cptr->identifier, "Autoconfigured Video Device %s", driver)
|
||||||
if (!cptr->identifier) {
|
== -1) {
|
||||||
free(cptr);
|
free(cptr);
|
||||||
free(nscreen);
|
free(nscreen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -208,9 +208,7 @@ xf86ValidateFontPath(char *path)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p1 = xnfalloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
|
XNFasprintf(&p1, "%s%s", dir_elem, DIR_FILE);
|
||||||
strcpy(p1, dir_elem);
|
|
||||||
strcat(p1, DIR_FILE);
|
|
||||||
flag = stat(p1, &stat_buf);
|
flag = stat(p1, &stat_buf);
|
||||||
if (flag == 0)
|
if (flag == 0)
|
||||||
if (!S_ISREG(stat_buf.st_mode))
|
if (!S_ISREG(stat_buf.st_mode))
|
||||||
|
@ -585,12 +583,11 @@ configFiles(XF86ConfFilesPtr fileconf)
|
||||||
else if (fileconf && fileconf->file_fontpath) {
|
else if (fileconf && fileconf->file_fontpath) {
|
||||||
pathFrom = X_CONFIG;
|
pathFrom = X_CONFIG;
|
||||||
if (xf86Info.useDefaultFontPath) {
|
if (xf86Info.useDefaultFontPath) {
|
||||||
defaultFontPath = Xprintf("%s%s%s",
|
if (asprintf(&defaultFontPath, "%s%s%s", fileconf->file_fontpath,
|
||||||
fileconf->file_fontpath,
|
*temp_path ? "," : "", temp_path) == -1)
|
||||||
*temp_path ? "," : "", temp_path);
|
defaultFontPath = NULL;
|
||||||
if (defaultFontPath != NULL) {
|
else
|
||||||
must_copy = FALSE;
|
must_copy = FALSE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
defaultFontPath = fileconf->file_fontpath;
|
defaultFontPath = fileconf->file_fontpath;
|
||||||
|
|
|
@ -205,12 +205,9 @@ configureScreenSection (int screennum)
|
||||||
int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
|
int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
|
||||||
parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
|
parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
|
||||||
|
|
||||||
ptr->scrn_identifier = malloc(18);
|
XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum);
|
||||||
sprintf(ptr->scrn_identifier, "Screen%d", screennum);
|
XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum);
|
||||||
ptr->scrn_monitor_str = malloc(19);
|
XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum);
|
||||||
sprintf(ptr->scrn_monitor_str, "Monitor%d", screennum);
|
|
||||||
ptr->scrn_device_str = malloc(16);
|
|
||||||
sprintf(ptr->scrn_device_str, "Card%d", screennum);
|
|
||||||
|
|
||||||
for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
|
for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
|
||||||
{
|
{
|
||||||
|
@ -256,14 +253,13 @@ optionTypeToString(OptionValueType type)
|
||||||
static XF86ConfDevicePtr
|
static XF86ConfDevicePtr
|
||||||
configureDeviceSection (int screennum)
|
configureDeviceSection (int screennum)
|
||||||
{
|
{
|
||||||
char identifier[16];
|
|
||||||
OptionInfoPtr p;
|
OptionInfoPtr p;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
|
parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
|
||||||
|
|
||||||
/* Move device info to parser structure */
|
/* Move device info to parser structure */
|
||||||
sprintf(identifier, "Card%d", screennum);
|
if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1)
|
||||||
ptr->dev_identifier = strdup(identifier);
|
ptr->dev_identifier = NULL;
|
||||||
ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
|
ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
|
||||||
ptr->dev_busid = DevToConfig[screennum].GDev.busID;
|
ptr->dev_busid = DevToConfig[screennum].GDev.busID;
|
||||||
ptr->dev_driver = DevToConfig[screennum].GDev.driver;
|
ptr->dev_driver = DevToConfig[screennum].GDev.driver;
|
||||||
|
@ -306,10 +302,8 @@ configureDeviceSection (int screennum)
|
||||||
int len = strlen(ptr->dev_comment) + strlen(prefix) +
|
int len = strlen(ptr->dev_comment) + strlen(prefix) +
|
||||||
strlen(middle) + strlen(suffix) + 1;
|
strlen(middle) + strlen(suffix) + 1;
|
||||||
|
|
||||||
optname = malloc(strlen(p->name) + 2 + 1);
|
if (asprintf(&optname, "\"%s\"", p->name) == -1)
|
||||||
if (!optname)
|
|
||||||
break;
|
break;
|
||||||
sprintf(optname, "\"%s\"", p->name);
|
|
||||||
|
|
||||||
len += max(20, strlen(optname));
|
len += max(20, strlen(optname));
|
||||||
len += strlen(opttype);
|
len += strlen(opttype);
|
||||||
|
@ -370,16 +364,14 @@ configureLayoutSection (void)
|
||||||
aptr->adj_x = 0;
|
aptr->adj_x = 0;
|
||||||
aptr->adj_y = 0;
|
aptr->adj_y = 0;
|
||||||
aptr->adj_scrnum = scrnum;
|
aptr->adj_scrnum = scrnum;
|
||||||
aptr->adj_screen_str = xnfalloc(18);
|
XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum);
|
||||||
sprintf(aptr->adj_screen_str, "Screen%d", scrnum);
|
|
||||||
if (scrnum == 0) {
|
if (scrnum == 0) {
|
||||||
aptr->adj_where = CONF_ADJ_ABSOLUTE;
|
aptr->adj_where = CONF_ADJ_ABSOLUTE;
|
||||||
aptr->adj_refscreen = NULL;
|
aptr->adj_refscreen = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aptr->adj_where = CONF_ADJ_RIGHTOF;
|
aptr->adj_where = CONF_ADJ_RIGHTOF;
|
||||||
aptr->adj_refscreen = xnfalloc(18);
|
XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1);
|
||||||
sprintf(aptr->adj_refscreen, "Screen%d", scrnum - 1);
|
|
||||||
}
|
}
|
||||||
ptr->lay_adjacency_lst =
|
ptr->lay_adjacency_lst =
|
||||||
(XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst,
|
(XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst,
|
||||||
|
@ -443,8 +435,7 @@ configureMonitorSection (int screennum)
|
||||||
{
|
{
|
||||||
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
|
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
|
||||||
|
|
||||||
ptr->mon_identifier = malloc(19);
|
XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
|
||||||
sprintf(ptr->mon_identifier, "Monitor%d", screennum);
|
|
||||||
ptr->mon_vendor = strdup("Monitor Vendor");
|
ptr->mon_vendor = strdup("Monitor Vendor");
|
||||||
ptr->mon_modelname = strdup("Monitor Model");
|
ptr->mon_modelname = strdup("Monitor Model");
|
||||||
|
|
||||||
|
@ -491,11 +482,9 @@ configureDDCMonitorSection (int screennum)
|
||||||
|
|
||||||
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
|
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
|
||||||
|
|
||||||
ptr->mon_identifier = malloc(19);
|
XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
|
||||||
sprintf(ptr->mon_identifier, "Monitor%d", screennum);
|
|
||||||
ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
|
ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
|
||||||
ptr->mon_modelname = malloc(12);
|
XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
|
||||||
sprintf(ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
|
|
||||||
|
|
||||||
/* features in centimetres, we want millimetres */
|
/* features in centimetres, we want millimetres */
|
||||||
mon_width = 10 * ConfiguredMonitor->features.hsize ;
|
mon_width = 10 * ConfiguredMonitor->features.hsize ;
|
||||||
|
|
|
@ -1193,9 +1193,13 @@ xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *forma
|
||||||
{
|
{
|
||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
msg = Xprintf("%s: %s: %s", dev->drv->driverName, dev->name, format);
|
if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format)
|
||||||
LogVMessageVerb(type, verb, msg, args);
|
== -1) {
|
||||||
free(msg);
|
LogVMessageVerb(type, verb, "%s", args);
|
||||||
|
} else {
|
||||||
|
LogVMessageVerb(type, verb, msg, args);
|
||||||
|
free(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print input driver message, with verbose level specified directly */
|
/* Print input driver message, with verbose level specified directly */
|
||||||
|
@ -1280,11 +1284,8 @@ xf86LogInit(void)
|
||||||
/* Get the log file name */
|
/* Get the log file name */
|
||||||
if (xf86LogFileFrom == X_DEFAULT) {
|
if (xf86LogFileFrom == X_DEFAULT) {
|
||||||
/* Append the display number and ".log" */
|
/* Append the display number and ".log" */
|
||||||
lf = malloc(strlen(xf86LogFile) + strlen("%s") +
|
if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
|
||||||
strlen(LOGSUFFIX) + 1);
|
|
||||||
if (!lf)
|
|
||||||
FatalError("Cannot allocate space for the log file name\n");
|
FatalError("Cannot allocate space for the log file name\n");
|
||||||
sprintf(lf, "%s%%s" LOGSUFFIX, xf86LogFile);
|
|
||||||
xf86LogFile = lf;
|
xf86LogFile = lf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -536,8 +536,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
|
|
||||||
for (i = 0; i < xf86NumScreens; i++) {
|
for (i = 0; i < xf86NumScreens; i++) {
|
||||||
if (xf86Screens[i]->name == NULL) {
|
if (xf86Screens[i]->name == NULL) {
|
||||||
xf86Screens[i]->name = xnfalloc(strlen("screen") + 10 + 1);
|
XNFasprintf(&xf86Screens[i]->name, "screen%d", i);
|
||||||
sprintf(xf86Screens[i]->name, "screen%d", i);
|
|
||||||
xf86MsgVerb(X_WARNING, 0,
|
xf86MsgVerb(X_WARNING, 0,
|
||||||
"Screen driver %d has no name set, using `%s'.\n",
|
"Screen driver %d has no name set, using `%s'.\n",
|
||||||
i, xf86Screens[i]->name);
|
i, xf86Screens[i]->name);
|
||||||
|
|
|
@ -638,13 +638,10 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
||||||
newn = n + 2;
|
newn = n + 2;
|
||||||
} else {
|
} else {
|
||||||
free(n);
|
free(n);
|
||||||
n = malloc(strlen(p->name) + 2 + 1);
|
if (asprintf(&n, "No%s", p->name) == -1) {
|
||||||
if (!n) {
|
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
strcpy(n, "No");
|
|
||||||
strcat(n, p->name);
|
|
||||||
newn = n;
|
newn = n;
|
||||||
}
|
}
|
||||||
if ((s = xf86findOptionValue(options, newn)) != NULL) {
|
if ((s = xf86findOptionValue(options, newn)) != NULL) {
|
||||||
|
|
|
@ -97,11 +97,8 @@ void DoShowOptions (void) {
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pSymbol = malloc(
|
XNFasprintf(&pSymbol, "%sModuleData",
|
||||||
strlen(xf86DriverList[i]->driverName) + strlen("ModuleData") + 1
|
xf86DriverList[i]->driverName);
|
||||||
);
|
|
||||||
strcpy (pSymbol, xf86DriverList[i]->driverName);
|
|
||||||
strcat (pSymbol, "ModuleData");
|
|
||||||
initData = LoaderSymbol (pSymbol);
|
initData = LoaderSymbol (pSymbol);
|
||||||
if (initData) {
|
if (initData) {
|
||||||
XF86ModuleVersionInfo *vers = initData->vers;
|
XF86ModuleVersionInfo *vers = initData->vers;
|
||||||
|
@ -111,6 +108,9 @@ void DoShowOptions (void) {
|
||||||
);
|
);
|
||||||
for (p = pOption; p->name != NULL; p++) {
|
for (p = pOption; p->name != NULL; p++) {
|
||||||
const char *opttype = optionTypeToSting(p->type);
|
const char *opttype = optionTypeToSting(p->type);
|
||||||
|
/* XXX: Why overallocate by 2 bytes?
|
||||||
|
* Otherwise, this would be strdup()
|
||||||
|
*/
|
||||||
char *optname = malloc(strlen(p->name) + 2 + 1);
|
char *optname = malloc(strlen(p->name) + 2 + 1);
|
||||||
if (!optname) {
|
if (!optname) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1347,9 +1347,9 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
|
||||||
|
|
||||||
pVideo = (struct pci_device *) busData;
|
pVideo = (struct pci_device *) busData;
|
||||||
|
|
||||||
GDev->busID = xnfalloc(16);
|
|
||||||
xf86FormatPciBusNumber(pVideo->bus, busnum);
|
xf86FormatPciBusNumber(pVideo->bus, busnum);
|
||||||
sprintf(GDev->busID, "PCI:%s:%d:%d", busnum, pVideo->dev, pVideo->func);
|
XNFasprintf(&GDev->busID, "PCI:%s:%d:%d",
|
||||||
|
busnum, pVideo->dev, pVideo->func);
|
||||||
|
|
||||||
GDev->chipID = pVideo->device_id;
|
GDev->chipID = pVideo->device_id;
|
||||||
GDev->chipRev = pVideo->revision;
|
GDev->chipRev = pVideo->revision;
|
||||||
|
|
|
@ -706,11 +706,9 @@ xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec *GDev)
|
||||||
sparcPromClose();
|
sparcPromClose();
|
||||||
}
|
}
|
||||||
if (promPath) {
|
if (promPath) {
|
||||||
GDev->busID = xnfalloc(strlen(promPath) + 6);
|
XNFasprintf(&GDev->busID, "SBUS:%s", promPath);
|
||||||
sprintf(GDev->busID, "SBUS:%s", promPath);
|
|
||||||
free(promPath);
|
free(promPath);
|
||||||
} else {
|
} else {
|
||||||
GDev->busID = xnfalloc(12);
|
XNFsprintf(&GDev->busID, "SBUS:fb%d", sBus->fbNum);
|
||||||
sprintf(GDev->busID, "SBUS:fb%d", sBus->fbNum);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,11 +146,8 @@ extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
|
||||||
for (i = 0; extensionModules[i].name != NULL; i++) {
|
for (i = 0; extensionModules[i].name != NULL; i++) {
|
||||||
if (opts) {
|
if (opts) {
|
||||||
char *s;
|
char *s;
|
||||||
s = (char *)malloc(strlen(extensionModules[i].name) + 5);
|
if (Xasprinf(&s, "omit%s", extensionModules[i].name) != -1) {
|
||||||
if (s) {
|
|
||||||
pointer o;
|
pointer o;
|
||||||
strcpy(s, "omit");
|
|
||||||
strcat(s, extensionModules[i].name);
|
|
||||||
o = xf86FindOption(opts, s);
|
o = xf86FindOption(opts, s);
|
||||||
free(s);
|
free(s);
|
||||||
if (o) {
|
if (o) {
|
||||||
|
|
|
@ -2426,13 +2426,10 @@ DRICreatePCIBusID(const struct pci_device * dev)
|
||||||
{
|
{
|
||||||
char *busID;
|
char *busID;
|
||||||
|
|
||||||
busID = malloc(20);
|
if (asprintf(&busID, "pci:%04x:%02x:%02x.%d",
|
||||||
if (busID == NULL)
|
dev->domain, dev->bus, dev->dev, dev->func) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus,
|
|
||||||
dev->dev, dev->func);
|
|
||||||
|
|
||||||
return busID;
|
return busID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -406,22 +406,22 @@ FindModuleInSubdir(const char *dirpath, const char *module)
|
||||||
|
|
||||||
snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
|
snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
|
||||||
if (strcmp(direntry->d_name, tmpBuf) == 0) {
|
if (strcmp(direntry->d_name, tmpBuf) == 0) {
|
||||||
ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
|
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
|
||||||
sprintf(ret, "%s%s", dirpath, tmpBuf);
|
ret = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
|
snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
|
||||||
if (strcmp(direntry->d_name, tmpBuf) == 0) {
|
if (strcmp(direntry->d_name, tmpBuf) == 0) {
|
||||||
ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
|
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
|
||||||
sprintf(ret, "%s%s", dirpath, tmpBuf);
|
ret = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(tmpBuf, PATH_MAX, "%s.so", module);
|
snprintf(tmpBuf, PATH_MAX, "%s.so", module);
|
||||||
if (strcmp(direntry->d_name, tmpBuf) == 0) {
|
if (strcmp(direntry->d_name, tmpBuf) == 0) {
|
||||||
ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
|
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
|
||||||
sprintf(ret, "%s%s", dirpath, tmpBuf);
|
ret = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -933,16 +933,14 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
|
||||||
* now check if the special data object <modulename>ModuleData is
|
* now check if the special data object <modulename>ModuleData is
|
||||||
* present.
|
* present.
|
||||||
*/
|
*/
|
||||||
p = malloc(strlen(name) + strlen("ModuleData") + 1);
|
if (asprintf(&p, "%sModuleData", name) == -1) {
|
||||||
if (!p) {
|
p = NULL;
|
||||||
if (errmaj)
|
if (errmaj)
|
||||||
*errmaj = LDR_NOMEM;
|
*errmaj = LDR_NOMEM;
|
||||||
if (errmin)
|
if (errmin)
|
||||||
*errmin = 0;
|
*errmin = 0;
|
||||||
goto LoadModule_fail;
|
goto LoadModule_fail;
|
||||||
}
|
}
|
||||||
strcpy(p, name);
|
|
||||||
strcat(p, "ModuleData");
|
|
||||||
initdata = LoaderSymbol(p);
|
initdata = LoaderSymbol(p);
|
||||||
if (initdata) {
|
if (initdata) {
|
||||||
ModuleSetupProc setup;
|
ModuleSetupProc setup;
|
||||||
|
|
|
@ -253,6 +253,7 @@ cat > sdksyms.c << EOF
|
||||||
|
|
||||||
/* include/Makefile.am */
|
/* include/Makefile.am */
|
||||||
#include "XIstubs.h"
|
#include "XIstubs.h"
|
||||||
|
#include "Xprintf.h"
|
||||||
#include "closestr.h"
|
#include "closestr.h"
|
||||||
#include "closure.h"
|
#include "closure.h"
|
||||||
#include "colormap.h"
|
#include "colormap.h"
|
||||||
|
|
|
@ -510,7 +510,6 @@ static void
|
||||||
xf86OutputSetMonitor (xf86OutputPtr output)
|
xf86OutputSetMonitor (xf86OutputPtr output)
|
||||||
{
|
{
|
||||||
char *option_name;
|
char *option_name;
|
||||||
static const char monitor_prefix[] = "monitor-";
|
|
||||||
char *monitor;
|
char *monitor;
|
||||||
|
|
||||||
if (!output->name)
|
if (!output->name)
|
||||||
|
@ -521,10 +520,7 @@ xf86OutputSetMonitor (xf86OutputPtr output)
|
||||||
output->options = xnfalloc (sizeof (xf86OutputOptions));
|
output->options = xnfalloc (sizeof (xf86OutputOptions));
|
||||||
memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
|
memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
|
||||||
|
|
||||||
option_name = xnfalloc (strlen (monitor_prefix) +
|
XNFasprintf(&option_name, "monitor-%s", output->name);
|
||||||
strlen (output->name) + 1);
|
|
||||||
strcpy (option_name, monitor_prefix);
|
|
||||||
strcat (option_name, output->name);
|
|
||||||
monitor = xf86findOptionValue (output->scrn->options, option_name);
|
monitor = xf86findOptionValue (output->scrn->options, option_name);
|
||||||
if (!monitor)
|
if (!monitor)
|
||||||
monitor = output->name;
|
monitor = output->name;
|
||||||
|
|
|
@ -132,8 +132,8 @@ xf86SetModeDefaultName(DisplayModePtr mode)
|
||||||
|
|
||||||
free(mode->name);
|
free(mode->name);
|
||||||
|
|
||||||
mode->name = XNFprintf("%dx%d%s", mode->HDisplay, mode->VDisplay,
|
XNFasprintf(&mode->name, "%dx%d%s", mode->HDisplay, mode->VDisplay,
|
||||||
interlaced ? "i" : "");
|
interlaced ? "i" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/ Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
/ Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||||
/
|
/
|
||||||
/ Permission is hereby granted, free of charge, to any person obtaining a
|
/ Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
/ copy of this software and associated documentation files (the "Software"),
|
/ copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/ Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
/ Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||||
/
|
/
|
||||||
/ Permission is hereby granted, free of charge, to any person obtaining a
|
/ Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
/ copy of this software and associated documentation files (the "Software"),
|
/ copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
/* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Copyright © 2000 VA Linux Systems, Inc.
|
* Copyright © 2000 VA Linux Systems, Inc.
|
||||||
* Copyright © 2001 The XFree86 Project, Inc.
|
* Copyright © 2001 The XFree86 Project, Inc.
|
||||||
*/
|
*/
|
||||||
/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
/* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* XFree86 Project.
|
* XFree86 Project.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
/* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
|
/* Copyright (c) 2004-2005, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
/* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -61,8 +61,8 @@
|
||||||
#include "xf86Parser.h"
|
#include "xf86Parser.h"
|
||||||
#include "xf86tokens.h"
|
#include "xf86tokens.h"
|
||||||
#include "Configint.h"
|
#include "Configint.h"
|
||||||
#include <math.h>
|
|
||||||
#include <X11/Xfuncproto.h>
|
#include <X11/Xfuncproto.h>
|
||||||
|
#include "Xprintf.h"
|
||||||
|
|
||||||
extern LexRec val;
|
extern LexRec val;
|
||||||
|
|
||||||
|
@ -143,9 +143,8 @@ xf86parseFlagsSection (void)
|
||||||
} else {
|
} else {
|
||||||
if (tokentype != NUMBER)
|
if (tokentype != NUMBER)
|
||||||
Error (NUMBER_MSG, tmp);
|
Error (NUMBER_MSG, tmp);
|
||||||
valstr = malloc(16);
|
if (asprintf(&valstr, "%d", val.num) == -1)
|
||||||
if (valstr)
|
valstr = NULL;
|
||||||
sprintf(valstr, "%d", val.num);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ptr->flg_option_lst = xf86addNewOption
|
ptr->flg_option_lst = xf86addNewOption
|
||||||
|
@ -426,13 +425,9 @@ char *
|
||||||
xf86uLongToString(unsigned long i)
|
xf86uLongToString(unsigned long i)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
int l;
|
|
||||||
|
|
||||||
l = ceil(log10((double)i) + 2.5);
|
if (asprintf(&s, "%lu", i) == -1)
|
||||||
s = malloc(l);
|
|
||||||
if (!s)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
sprintf(s, "%lu", i);
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ libxf86config_internal_la_SOURCES = \
|
||||||
$(INTERNAL_SOURCES)
|
$(INTERNAL_SOURCES)
|
||||||
|
|
||||||
libxf86config_a_SOURCES = \
|
libxf86config_a_SOURCES = \
|
||||||
|
$(TOP_SRCDIR)/os/xprintf.c \
|
||||||
$(INTERNAL_SOURCES)
|
$(INTERNAL_SOURCES)
|
||||||
libxf86config_a_CFLAGS = $(AM_CFLAGS)
|
libxf86config_a_CFLAGS = $(AM_CFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#include "xf86Parser.h"
|
#include "xf86Parser.h"
|
||||||
#include "xf86tokens.h"
|
#include "xf86tokens.h"
|
||||||
#include "Configint.h"
|
#include "Configint.h"
|
||||||
|
#include "Xprintf.h"
|
||||||
|
|
||||||
extern LexRec val;
|
extern LexRec val;
|
||||||
|
|
||||||
|
@ -99,8 +100,8 @@ static xf86ConfigSymTabRec ZMapTab[] =
|
||||||
XF86ConfInputPtr
|
XF86ConfInputPtr
|
||||||
xf86parsePointerSection (void)
|
xf86parsePointerSection (void)
|
||||||
{
|
{
|
||||||
char *s, *s1, *s2;
|
char *s;
|
||||||
int l;
|
unsigned long val1;
|
||||||
int token;
|
int token;
|
||||||
parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
|
parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
|
||||||
|
|
||||||
|
@ -184,17 +185,12 @@ xf86parsePointerSection (void)
|
||||||
case NUMBER:
|
case NUMBER:
|
||||||
if (val.num < 0)
|
if (val.num < 0)
|
||||||
Error (ZAXISMAPPING_MSG, NULL);
|
Error (ZAXISMAPPING_MSG, NULL);
|
||||||
s1 = xf86uLongToString(val.num);
|
val1 = val.num;
|
||||||
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
|
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
|
||||||
free(s1);
|
|
||||||
Error (ZAXISMAPPING_MSG, NULL);
|
Error (ZAXISMAPPING_MSG, NULL);
|
||||||
}
|
}
|
||||||
s2 = xf86uLongToString(val.num);
|
if (asprintf(&s, "%ul %ul", val1, val.num) == -1)
|
||||||
l = strlen(s1) + 1 + strlen(s2) + 1;
|
s = NULL;
|
||||||
s = malloc(l);
|
|
||||||
sprintf(s, "%s %s", s1, s2);
|
|
||||||
free(s1);
|
|
||||||
free(s2);
|
|
||||||
break;
|
break;
|
||||||
case XAXIS:
|
case XAXIS:
|
||||||
s = strdup("x");
|
s = strdup("x");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
# copy of this software and associated documentation files (the "Software"),
|
# copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -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)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
# copy of this software and associated documentation files (the "Software"),
|
# copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -356,8 +356,8 @@ VBESetModeNames(DisplayModePtr pMode)
|
||||||
pMode->VDisplay > 10000 || pMode->VDisplay < 0) {
|
pMode->VDisplay > 10000 || pMode->VDisplay < 0) {
|
||||||
pMode->name = strdup("BADMODE");
|
pMode->name = strdup("BADMODE");
|
||||||
} else {
|
} else {
|
||||||
pMode->name = xnfalloc(4 + 1 + 4 + 1);
|
XNFasprintf(&pMode->name, "%dx%d",
|
||||||
sprintf(pMode->name, "%dx%d", pMode->HDisplay, pMode->VDisplay);
|
pMode->HDisplay, pMode->VDisplay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pMode = pMode->next;
|
pMode = pMode->next;
|
||||||
|
|
|
@ -221,9 +221,10 @@ if (fDebugProcMsg) \
|
||||||
{ \
|
{ \
|
||||||
char *pszTemp; \
|
char *pszTemp; \
|
||||||
int iLength; \
|
int iLength; \
|
||||||
pszTemp = Xprintf (str, ##__VA_ARGS__); \
|
if (asprintf (&pszTemp, str, ##__VA_ARGS__) != -1) { \
|
||||||
MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \
|
MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \
|
||||||
free(pszTemp); \
|
free (pszTemp); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define DEBUG_MSG(str,...)
|
#define DEBUG_MSG(str,...)
|
||||||
|
|
|
@ -341,11 +341,10 @@ winExitDlgProc (HWND hDialog, UINT message,
|
||||||
winInitDialog (hDialog);
|
winInitDialog (hDialog);
|
||||||
|
|
||||||
/* Format the connected clients string */
|
/* Format the connected clients string */
|
||||||
pszConnectedClients = Xprintf (CONNECTED_CLIENTS_FORMAT,
|
if (asprintf (&pszConnectedClients, CONNECTED_CLIENTS_FORMAT,
|
||||||
(s_pScreenPriv->iConnectedClients == 1) ? "is" : "are",
|
(s_pScreenPriv->iConnectedClients == 1) ? "is" : "are",
|
||||||
s_pScreenPriv->iConnectedClients,
|
s_pScreenPriv->iConnectedClients,
|
||||||
(s_pScreenPriv->iConnectedClients == 1) ? "" : "s");
|
(s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1)
|
||||||
if (!pszConnectedClients)
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -101,12 +101,15 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
|
||||||
char * pszErrorF = NULL;
|
char * pszErrorF = NULL;
|
||||||
char * pszMsgBox = NULL;
|
char * pszMsgBox = NULL;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
int size;
|
||||||
|
|
||||||
va_start(args, uType);
|
va_start(args, uType);
|
||||||
pszErrorF = Xvprintf(pszError, args);
|
size = vasprintf (&pszErrorF, pszError, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
if (!pszErrorF)
|
if (size == -1) {
|
||||||
|
pszErrorF = NULL;
|
||||||
goto winMessageBoxF_Cleanup;
|
goto winMessageBoxF_Cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
#define MESSAGEBOXF \
|
#define MESSAGEBOXF \
|
||||||
"%s\n" \
|
"%s\n" \
|
||||||
|
@ -117,15 +120,18 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
|
||||||
"XWin was started with the following command-line:\n\n" \
|
"XWin was started with the following command-line:\n\n" \
|
||||||
"%s\n"
|
"%s\n"
|
||||||
|
|
||||||
pszMsgBox = Xprintf (MESSAGEBOXF,
|
size = asprintf (&pszMsgBox, MESSAGEBOXF,
|
||||||
pszErrorF, XVENDORNAME,
|
pszErrorF, XVENDORNAME,
|
||||||
XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT,
|
XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH,
|
||||||
BUILDERADDR,
|
XORG_VERSION_SNAP, XORG_VERSION_CURRENT,
|
||||||
BUILDERSTRING,
|
BUILDERADDR,
|
||||||
g_pszCommandLine);
|
BUILDERSTRING,
|
||||||
|
g_pszCommandLine);
|
||||||
|
|
||||||
if (!pszMsgBox)
|
if (size == -1) {
|
||||||
|
pszMsgBox = NULL;
|
||||||
goto winMessageBoxF_Cleanup;
|
goto winMessageBoxF_Cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* Display the message box string */
|
/* Display the message box string */
|
||||||
MessageBox (NULL,
|
MessageBox (NULL,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
if XORG
|
if XORG
|
||||||
sdk_HEADERS = \
|
sdk_HEADERS = \
|
||||||
XIstubs.h \
|
XIstubs.h \
|
||||||
|
Xprintf.h \
|
||||||
callback.h \
|
callback.h \
|
||||||
closestr.h \
|
closestr.h \
|
||||||
closure.h \
|
closure.h \
|
||||||
|
|
69
include/Xprintf.h
Normal file
69
include/Xprintf.h
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the next
|
||||||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
* Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XPRINTF_H
|
||||||
|
#define XPRINTF_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <X11/Xfuncproto.h>
|
||||||
|
|
||||||
|
#ifndef _X_RESTRICT_KYWD
|
||||||
|
# if defined(restrict) /* assume autoconf set it correctly */ || \
|
||||||
|
(defined(__STDC__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */
|
||||||
|
# define _X_RESTRICT_KYWD restrict
|
||||||
|
# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
|
||||||
|
# define _X_RESTRICT_KYWD __restrict__
|
||||||
|
# else
|
||||||
|
# define _X_RESTRICT_KYWD
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These functions provide a portable implementation of the common (but not
|
||||||
|
* yet universal) asprintf & vasprintf routines to allocate a buffer big
|
||||||
|
* enough to sprintf the arguments to. The XNF variants terminate the server
|
||||||
|
* if the allocation fails.
|
||||||
|
* The buffer allocated is returned in the pointer provided in the first
|
||||||
|
* argument. The return value is the size of the allocated buffer, or -1
|
||||||
|
* on failure.
|
||||||
|
*/
|
||||||
|
extern _X_EXPORT int Xasprintf (char **ret,
|
||||||
|
const char * _X_RESTRICT_KYWD fmt,
|
||||||
|
...) _X_ATTRIBUTE_PRINTF(2,3);
|
||||||
|
extern _X_EXPORT int Xvasprintf (char **ret,
|
||||||
|
const char * _X_RESTRICT_KYWD fmt,
|
||||||
|
va_list va) _X_ATTRIBUTE_PRINTF(2,0);
|
||||||
|
extern _X_EXPORT int XNFasprintf (char **ret,
|
||||||
|
const char * _X_RESTRICT_KYWD fmt,
|
||||||
|
...) _X_ATTRIBUTE_PRINTF(2,3);
|
||||||
|
extern _X_EXPORT int XNFvasprintf (char **ret,
|
||||||
|
const char * _X_RESTRICT_KYWD fmt,
|
||||||
|
va_list va) _X_ATTRIBUTE_PRINTF(2,0);
|
||||||
|
|
||||||
|
#if !defined(HAVE_ASPRINTF) && !defined(HAVE_VASPRINTF)
|
||||||
|
# define asprintf Xasprintf
|
||||||
|
# define vasprintf Xvasprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* XPRINTF_H */
|
|
@ -243,6 +243,9 @@
|
||||||
/* Define to 1 if you have the `vprintf' function. */
|
/* Define to 1 if you have the `vprintf' function. */
|
||||||
#undef HAVE_VPRINTF
|
#undef HAVE_VPRINTF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vasprintf' function. */
|
||||||
|
#undef HAVE_VASPRINTF
|
||||||
|
|
||||||
/* Support IPv6 for TCP connections */
|
/* Support IPv6 for TCP connections */
|
||||||
#undef IPv6
|
#undef IPv6
|
||||||
|
|
||||||
|
|
12
include/os.h
12
include/os.h
|
@ -264,10 +264,14 @@ extern _X_EXPORT char *Xstrdup(const char *s);
|
||||||
*/
|
*/
|
||||||
extern _X_EXPORT char *XNFstrdup(const char *s);
|
extern _X_EXPORT char *XNFstrdup(const char *s);
|
||||||
|
|
||||||
extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
|
/* Include new X*asprintf API */
|
||||||
extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va);
|
#include "Xprintf.h"
|
||||||
extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
|
|
||||||
extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va);
|
/* Older api deprecated in favor of the asprintf versions */
|
||||||
|
extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED;
|
||||||
|
extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED;
|
||||||
|
extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED;
|
||||||
|
extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED;
|
||||||
|
|
||||||
typedef void (*OsSigHandlerPtr)(int /* sig */);
|
typedef void (*OsSigHandlerPtr)(int /* sig */);
|
||||||
typedef int (*OsSigWrapperPtr)(int /* sig */);
|
typedef int (*OsSigWrapperPtr)(int /* sig */);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 1987 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 1987, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -54,7 +54,7 @@ SOFTWARE.
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright © 2004 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
12
os/log.c
12
os/log.c
|
@ -177,10 +177,8 @@ LogInit(const char *fname, const char *backup)
|
||||||
char *logFileName = NULL;
|
char *logFileName = NULL;
|
||||||
|
|
||||||
if (fname && *fname) {
|
if (fname && *fname) {
|
||||||
logFileName = malloc(strlen(fname) + strlen(display) + 1);
|
if (asprintf(&logFileName, fname, display) == -1)
|
||||||
if (!logFileName)
|
|
||||||
FatalError("Cannot allocate space for the log file name\n");
|
FatalError("Cannot allocate space for the log file name\n");
|
||||||
sprintf(logFileName, fname, display);
|
|
||||||
|
|
||||||
if (backup && *backup) {
|
if (backup && *backup) {
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
@ -189,13 +187,9 @@ LogInit(const char *fname, const char *backup)
|
||||||
char *suffix;
|
char *suffix;
|
||||||
char *oldLog;
|
char *oldLog;
|
||||||
|
|
||||||
oldLog = malloc(strlen(logFileName) + strlen(backup) +
|
if ((asprintf(&suffix, backup, display) == -1) ||
|
||||||
strlen(display) + 1);
|
(asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
|
||||||
suffix = malloc(strlen(backup) + strlen(display) + 1);
|
|
||||||
if (!oldLog || !suffix)
|
|
||||||
FatalError("Cannot allocate space for the log file name\n");
|
FatalError("Cannot allocate space for the log file name\n");
|
||||||
sprintf(suffix, backup, display);
|
|
||||||
sprintf(oldLog, "%s%s", logFileName, suffix);
|
|
||||||
free(suffix);
|
free(suffix);
|
||||||
if (rename(logFileName, oldLog) == -1) {
|
if (rename(logFileName, oldLog) == -1) {
|
||||||
FatalError("Cannot move old log file \"%s\" to \"%s\"\n",
|
FatalError("Cannot move old log file \"%s\" to \"%s\"\n",
|
||||||
|
|
166
os/xprintf.c
166
os/xprintf.c
|
@ -1,5 +1,12 @@
|
||||||
/*
|
/**
|
||||||
* printf routines which xalloc their buffer
|
* @file
|
||||||
|
*
|
||||||
|
* @section DESCRIPTION
|
||||||
|
*
|
||||||
|
* These functions provide a portable implementation of the common (but not
|
||||||
|
* yet universal) asprintf & vasprintf routines to allocate a buffer big
|
||||||
|
* enough to sprintf the arguments to. The XNF variants terminate the server
|
||||||
|
* if the allocation fails.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2004 Alexander Gottwald
|
* Copyright (c) 2004 Alexander Gottwald
|
||||||
|
@ -26,6 +33,29 @@
|
||||||
* holders shall not be used in advertising or otherwise to promote the sale,
|
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||||
* use or other dealings in this Software without prior written authorization.
|
* use or other dealings in this Software without prior written authorization.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the next
|
||||||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
* Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,6 +65,13 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef asprintf
|
||||||
|
# undef asprintf
|
||||||
|
#endif
|
||||||
|
#ifdef vasprintf
|
||||||
|
# undef vasprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef va_copy
|
#ifndef va_copy
|
||||||
# ifdef __va_copy
|
# ifdef __va_copy
|
||||||
# define va_copy __va_copy
|
# define va_copy __va_copy
|
||||||
|
@ -43,10 +80,22 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *
|
/**
|
||||||
Xvprintf(const char *format, va_list va)
|
* Varargs sprintf that allocates a string buffer the right size for
|
||||||
|
* the pattern & data provided and prints the requested data to it.
|
||||||
|
*
|
||||||
|
* @param ret Pointer to which the newly allocated buffer is written
|
||||||
|
* (contents undefined on error)
|
||||||
|
* @param format printf style format string
|
||||||
|
* @param va variable argument list
|
||||||
|
* @return size of allocated buffer, or -1 on error.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
Xvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va)
|
||||||
{
|
{
|
||||||
char *ret;
|
#ifdef HAVE_VASPRINTF
|
||||||
|
return vasprintf(ret, format, va);
|
||||||
|
#else
|
||||||
int size;
|
int size;
|
||||||
va_list va2;
|
va_list va2;
|
||||||
|
|
||||||
|
@ -54,12 +103,94 @@ Xvprintf(const char *format, va_list va)
|
||||||
size = vsnprintf(NULL, 0, format, va2);
|
size = vsnprintf(NULL, 0, format, va2);
|
||||||
va_end(va2);
|
va_end(va2);
|
||||||
|
|
||||||
ret = (char *)malloc(size + 1);
|
*ret = malloc(size + 1);
|
||||||
if (ret == NULL)
|
if (*ret == NULL)
|
||||||
return NULL;
|
return -1;
|
||||||
|
|
||||||
vsnprintf(ret, size + 1, format, va);
|
vsnprintf(*ret, size + 1, format, va);
|
||||||
ret[size] = 0;
|
ret[size] = 0;
|
||||||
|
return size;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_VASPRINTF
|
||||||
|
# define vasprintf Xvasprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sprintf that allocates a string buffer the right size for
|
||||||
|
* the pattern & data provided and prints the requested data to it.
|
||||||
|
*
|
||||||
|
* @param ret Pointer to which the newly allocated buffer is written
|
||||||
|
* (contents undefined on error)
|
||||||
|
* @param format printf style format string
|
||||||
|
* @param ... arguments for specified format
|
||||||
|
* @return size of allocated buffer, or -1 on error.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
Xasprintf(char ** ret, const char * _X_RESTRICT_KYWD format, ...)
|
||||||
|
{
|
||||||
|
int size;
|
||||||
|
va_list va;
|
||||||
|
va_start(va, format);
|
||||||
|
size = vasprintf(ret, format, va);
|
||||||
|
va_end(va);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Varargs sprintf that allocates a string buffer the right size for
|
||||||
|
* the pattern & data provided and prints the requested data to it.
|
||||||
|
* On failure, issues a FatalError message and aborts the server.
|
||||||
|
*
|
||||||
|
* @param ret Pointer to which the newly allocated buffer is written
|
||||||
|
* (contents undefined on error)
|
||||||
|
* @param format printf style format string
|
||||||
|
* @param va variable argument list
|
||||||
|
* @return size of allocated buffer
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
XNFvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va)
|
||||||
|
{
|
||||||
|
int size = vasprintf(ret, format, va);
|
||||||
|
if ((size == -1) || (*ret == NULL)) {
|
||||||
|
Error("XNFvasprintf");
|
||||||
|
FatalError("XNFvasprintf failed");
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sprintf that allocates a string buffer the right size for
|
||||||
|
* the pattern & data provided and prints the requested data to it.
|
||||||
|
* On failure, issues a FatalError message and aborts the server.
|
||||||
|
*
|
||||||
|
* @param ret Pointer to which the newly allocated buffer is written
|
||||||
|
* (contents undefined on error)
|
||||||
|
* @param format printf style format string
|
||||||
|
* @param ... arguments for specified format
|
||||||
|
* @return size of allocated buffer
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
XNFasprintf(char ** ret, const char * _X_RESTRICT_KYWD format, ...)
|
||||||
|
{
|
||||||
|
int size;
|
||||||
|
va_list va;
|
||||||
|
va_start(va, format);
|
||||||
|
size = XNFvasprintf(ret, format, va);
|
||||||
|
va_end(va);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Old api, now deprecated, may be removed in the future */
|
||||||
|
char *
|
||||||
|
Xvprintf(const char *format, va_list va)
|
||||||
|
{
|
||||||
|
char *ret;
|
||||||
|
|
||||||
|
if (vasprintf(&ret, format, va) == -1)
|
||||||
|
ret = NULL;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +199,8 @@ char *Xprintf(const char *format, ...)
|
||||||
char *ret;
|
char *ret;
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
ret = Xvprintf(format, va);
|
if (vasprintf(&ret, format, va) == -1)
|
||||||
|
ret = NULL;
|
||||||
va_end(va);
|
va_end(va);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -77,19 +209,9 @@ char *
|
||||||
XNFvprintf(const char *format, va_list va)
|
XNFvprintf(const char *format, va_list va)
|
||||||
{
|
{
|
||||||
char *ret;
|
char *ret;
|
||||||
int size;
|
|
||||||
va_list va2;
|
|
||||||
|
|
||||||
va_copy(va2, va);
|
XNFvasprintf(&ret, format, va);
|
||||||
size = vsnprintf(NULL, 0, format, va2);
|
|
||||||
va_end(va2);
|
|
||||||
|
|
||||||
ret = (char *)xnfalloc(size + 1);
|
|
||||||
if (ret == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
vsnprintf(ret, size + 1, format, va);
|
|
||||||
ret[size] = 0;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +220,7 @@ char *XNFprintf(const char *format, ...)
|
||||||
char *ret;
|
char *ret;
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
ret = XNFvprintf(format, va);
|
XNFvasprintf(&ret, format, va);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,11 @@
|
||||||
#include "xace.h"
|
#include "xace.h"
|
||||||
#include "protocol-versions.h"
|
#include "protocol-versions.h"
|
||||||
|
|
||||||
|
#ifdef PANORAMIX
|
||||||
|
#include "panoramiX.h"
|
||||||
|
#include "panoramiXsrv.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAVE_STDINT_H
|
#if HAVE_STDINT_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#elif !defined(UINT32_MAX)
|
#elif !defined(UINT32_MAX)
|
||||||
|
@ -2651,9 +2656,6 @@ SProcRenderDispatch (ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
#include "panoramiX.h"
|
|
||||||
#include "panoramiXsrv.h"
|
|
||||||
|
|
||||||
#define VERIFY_XIN_PICTURE(pPicture, pid, client, mode) {\
|
#define VERIFY_XIN_PICTURE(pPicture, pid, client, mode) {\
|
||||||
int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\
|
int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\
|
||||||
XRT_PICTURE, client, mode);\
|
XRT_PICTURE, client, mode);\
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -156,34 +156,45 @@ char tmpname[PATH_MAX];
|
||||||
#endif
|
#endif
|
||||||
if (XkbBaseDirectory!=NULL) {
|
if (XkbBaseDirectory!=NULL) {
|
||||||
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
|
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
|
||||||
buf = Xprintf("%s/%s.dir",XkbBaseDirectory,componentDirs[what]);
|
if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
|
||||||
in= fopen(buf,"r");
|
componentDirs[what]) == -1)
|
||||||
|
buf = NULL;
|
||||||
|
else
|
||||||
|
in = fopen(buf,"r");
|
||||||
}
|
}
|
||||||
if (!in) {
|
if (!in) {
|
||||||
haveDir= FALSE;
|
haveDir= FALSE;
|
||||||
free(buf);
|
free(buf);
|
||||||
buf = Xprintf(
|
if (asprintf
|
||||||
"'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
|
(&buf,
|
||||||
XkbBinDirectory,XkbBaseDirectory,componentDirs[what],(long)
|
"'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
|
||||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
XkbBinDirectory, XkbBaseDirectory, componentDirs[what],
|
||||||
file W32_tmpfile
|
(long) ((xkbDebugFlags < 2) ? 1 :
|
||||||
);
|
((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
|
||||||
|
file W32_tmpfile
|
||||||
|
) == -1)
|
||||||
|
buf = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
|
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
|
||||||
buf = Xprintf("%s.dir",componentDirs[what]);
|
if (asprintf(&buf, "%s.dir", componentDirs[what]) == -1)
|
||||||
in= fopen(buf,"r");
|
buf = NULL;
|
||||||
|
else
|
||||||
|
in = fopen(buf,"r");
|
||||||
}
|
}
|
||||||
if (!in) {
|
if (!in) {
|
||||||
haveDir= FALSE;
|
haveDir= FALSE;
|
||||||
free(buf);
|
free(buf);
|
||||||
buf = Xprintf(
|
if (asprintf
|
||||||
"xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
|
(&buf,
|
||||||
componentDirs[what],(long)
|
"xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
|
||||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
componentDirs[what],
|
||||||
file W32_tmpfile
|
(long) ((xkbDebugFlags < 2) ? 1 :
|
||||||
);
|
((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
|
||||||
|
file W32_tmpfile
|
||||||
|
) == -1)
|
||||||
|
buf = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status= Success;
|
status= Success;
|
||||||
|
|
|
@ -210,7 +210,8 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (XkbBaseDirectory != NULL) {
|
if (XkbBaseDirectory != NULL) {
|
||||||
xkbbasedirflag = Xprintf("\"-R%s\"", XkbBaseDirectory);
|
if (asprintf(&xkbbasedirflag, "\"-R%s\"", XkbBaseDirectory) == -1)
|
||||||
|
xkbbasedirflag = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XkbBinDirectory != NULL) {
|
if (XkbBinDirectory != NULL) {
|
||||||
|
@ -225,14 +226,16 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = Xprintf("\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
|
if (asprintf(&buf,
|
||||||
|
"\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
|
||||||
"-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
|
"-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
|
||||||
xkbbindir, xkbbindirsep,
|
xkbbindir, xkbbindirsep,
|
||||||
( (xkbDebugFlags < 2) ? 1 :
|
((xkbDebugFlags < 2) ? 1 :
|
||||||
((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ),
|
((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)),
|
||||||
xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
|
xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
|
||||||
PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
|
PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
|
||||||
xkm_output_dir, keymap);
|
xkm_output_dir, keymap) == -1)
|
||||||
|
buf = NULL;
|
||||||
|
|
||||||
free(xkbbasedirflag);
|
free(xkbbasedirflag);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user