Merge remote branch 'alanc/master'

This commit is contained in:
Keith Packard 2010-12-06 19:22:52 -08:00
commit 5de312a60d
13 changed files with 82 additions and 100 deletions

View file

@ -282,21 +282,31 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
static Bool
copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
{
confScreenPtr nscreen;
GDevPtr cptr = NULL;
xf86ConfigLayout.screens[i].screen = xnfcalloc(1, sizeof(confScreenRec));
if(!xf86ConfigLayout.screens[i].screen)
nscreen = malloc(sizeof(confScreenRec));
if (!nscreen)
return FALSE;
memcpy(xf86ConfigLayout.screens[i].screen, oscreen, sizeof(confScreenRec));
memcpy(nscreen, oscreen, sizeof(confScreenRec));
cptr = calloc(1, sizeof(GDevRec));
if (!cptr)
cptr = malloc(sizeof(GDevRec));
if (!cptr) {
free(nscreen);
return FALSE;
}
memcpy(cptr, odev, sizeof(GDevRec));
cptr->identifier = Xprintf("Autoconfigured Video Device %s", driver);
if (!cptr->identifier) {
free(cptr);
free(nscreen);
return FALSE;
}
cptr->driver = driver;
xf86ConfigLayout.screens[i].screen = nscreen;
/* now associate the new driver entry with the new screen entry */
xf86ConfigLayout.screens[i].screen->device = cptr;
cptr->myScreenSection = xf86ConfigLayout.screens[i].screen;

View file

@ -1190,7 +1190,7 @@ xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *forma
char *msg;
msg = Xprintf("%s: %s: %s", dev->drv->driverName, dev->name, format);
LogVMessageVerb(type, verb, "%s", msg);
LogVMessageVerb(type, verb, msg, args);
free(msg);
}

View file

@ -1643,8 +1643,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
new = xnfcalloc(1, sizeof(DisplayModeRec));
new->prev = last;
new->type = M_T_USERDEF;
new->name = xnfalloc(strlen(modeNames[i]) + 1);
strcpy(new->name, modeNames[i]);
new->name = xnfstrdup(modeNames[i]);
if (new->prev)
new->prev->next = new;
*endp = last = new;
@ -1716,10 +1715,9 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
p = xnfcalloc(1, sizeof(DisplayModeRec));
p->prev = last;
p->name = xnfalloc(strlen(r->name) + 1);
p->name = xnfstrdup(r->name);
if (!userModes)
p->type = M_T_USERDEF;
strcpy(p->name, r->name);
if (p->prev)
p->prev->next = p;
*endp = last = p;

View file

@ -1167,6 +1167,7 @@ videoPtrToDriverList(struct pci_device *dev,
return i; /* Number of entries added */
}
#ifdef __linux__
static int
xchomp(char *line)
{
@ -1183,7 +1184,6 @@ xchomp(char *line)
return 0;
}
#ifdef __linux__
/* This function is used to provide a workaround for binary drivers that
* don't export their PCI ID's properly. If distros don't end up using this
* feature it can and should be removed because the symbol-based resolution

View file

@ -406,21 +406,21 @@ FindModuleInSubdir(const char *dirpath, const char *module)
snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 2);
ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
sprintf(ret, "%s%s", dirpath, tmpBuf);
break;
}
snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 2);
ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
sprintf(ret, "%s%s", dirpath, tmpBuf);
break;
}
snprintf(tmpBuf, PATH_MAX, "%s.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 2);
ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
sprintf(ret, "%s%s", dirpath, tmpBuf);
break;
}

View file

@ -666,13 +666,11 @@ xf86OutputCreate (ScrnInfoPtr scrn,
Bool
xf86OutputRename (xf86OutputPtr output, const char *name)
{
int len = strlen(name) + 1;
char *newname = malloc(len);
char *newname = strdup(name);
if (!newname)
return FALSE; /* so sorry... */
strcpy (newname, name);
if (output->name && output->name != (char *) (output + 1))
free(output->name);
output->name = newname;

View file

@ -318,7 +318,7 @@ xf86EnableAGP(int screenNum, CARD32 mode)
if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) {
xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: "
"AGPIOC_SETUP with mode %x failed (%s)\n",
mode, strerror(errno));
(unsigned int) mode, strerror(errno));
return FALSE;
}

View file

@ -71,7 +71,6 @@ xf86OpenConsole(void)
int fd;
struct vt_mode VT;
struct vt_stat vtinfo;
int FreeVTslot;
MessageType from = X_PROBED;
#endif
@ -95,8 +94,8 @@ xf86OpenConsole(void)
}
else
{
if ((int)mmap(0, 0x1000, PROT_NONE,
MAP_FIXED | MAP_SHARED, fd, 0) == -1)
if (mmap(0, 0x1000, PROT_NONE,
MAP_FIXED | MAP_SHARED, fd, 0) == MAP_FAILED)
xf86Msg(X_WARNING,
"xf86OpenConsole: failed to protect page 0 (%s)\n",
strerror(errno));
@ -413,7 +412,7 @@ xf86ProcessArgument(int argc, char **argv, int i)
return 0;
}
void xf86UseMsg()
void xf86UseMsg(void)
{
#ifdef HAS_USL_VTS
ErrorF("vtX Use the specified VT number\n");

View file

@ -157,7 +157,7 @@ solUnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
if (munmap(Base, Size) != 0) {
xf86DrvMsgVerb(ScreenNum, X_WARNING, 0,
"solUnMapVidMem: failed to unmap %s"
" (0x%08lx,0x%lx) (%s)\n",
" (0x%p,0x%lx) (%s)\n",
apertureDevName, Base, Size,
strerror(errno));
}
@ -212,8 +212,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
(void)memcpy(Buf, (void *)(ptr + Offset), Len);
if (munmap((caddr_t)ptr, mlen) != 0) {
xf86MsgVerb(X_WARNING, 0,
"solUnMapVidMem: failed to unmap %s"
" (0x%08lx,0x%lx) (%s)\n",
"xf86ReadBIOS: failed to unmap %s (0x%p,0x%x) (%s)\n",
apertureDevName, ptr, mlen, strerror(errno));
}