xserver: Branch 'master' - 2 commits
Alan Coopersmith
alanc at kemper.freedesktop.org
Tue Nov 25 15:54:10 PST 2008
hw/xfree86/common/xf86.h | 9 ++--
hw/xfree86/modes/xf86EdidModes.c | 4 +-
hw/xfree86/modes/xf86Modes.c | 16 ++++----
hw/xfree86/modes/xf86Modes.h | 15 ++++---
xkb/ddxLoad.c | 76 +++++++++++++++++++++------------------
5 files changed, 65 insertions(+), 55 deletions(-)
New commits:
commit d5f9a131a2d5bd33f82fdd4e809880b0ff792b45
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Tue Nov 25 15:46:39 2008 -0800
Fix const-mismatch warnings for DisplayModePtr's
Includes fixes for:
"xf86Config.c", line 2434: warning: argument #1 is incompatible with prototype:
prototype: pointer to struct _DisplayModeRec: "xf86.h", line 351
argument : pointer to const struct _DisplayModeRec
"xf86EdidModes.c", line 312: warning: argument #1 is incompatible with prototype:
prototype: pointer to struct _DisplayModeRec: "../../../hw/xfree86/common/xf86.h", line 351
argument : pointer to const struct _DisplayModeRec
"xf86EdidModes.c", line 438: warning: assignment type mismatch:
pointer to struct _DisplayModeRec "=" pointer to const struct _DisplayModeRec
"xf86Modes.c", line 701: warning: assignment type mismatch:
pointer to struct _DisplayModeRec "=" pointer to const struct _DisplayModeRec
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index e1f1b70..a32aa9b 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -344,13 +344,14 @@ void xf86PruneDriverModes(ScrnInfoPtr scrp);
void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
void xf86PrintModes(ScrnInfoPtr scrp);
void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
-double xf86ModeHSync(DisplayModePtr mode);
-double xf86ModeVRefresh(DisplayModePtr mode);
+double xf86ModeHSync(const DisplayModeRec *mode);
+double xf86ModeVRefresh(const DisplayModeRec *mode);
void xf86SetModeDefaultName(DisplayModePtr mode);
void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
-DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
+DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode);
DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
-Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
+Bool xf86ModesEqual(const DisplayModeRec *pMode1,
+ const DisplayModeRec *pMode2);
void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index bea2f7e..5ed61c1 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -418,7 +418,7 @@ MonitorStandardTimingLevel(xf86MonPtr DDC)
}
static int
-ModeRefresh(DisplayModePtr mode)
+ModeRefresh(const DisplayModeRec *mode)
{
return (int)(xf86ModeVRefresh(mode) + 0.5);
}
@@ -432,7 +432,7 @@ static DisplayModePtr
FindDMTMode(int hsize, int vsize, int refresh, Bool rb)
{
int i;
- DisplayModePtr ret;
+ const DisplayModeRec *ret;
for (i = 0; i < sizeof(DMTModes) / sizeof(DisplayModeRec); i++) {
ret = &DMTModes[i];
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 0fdfbdb..1522fa7 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -52,7 +52,7 @@ extern XF86ConfigPtr xf86configptr;
* Exact copy of xf86Mode.c's.
*/
_X_EXPORT double
-xf86ModeHSync(DisplayModePtr mode)
+xf86ModeHSync(const DisplayModeRec *mode)
{
double hsync = 0.0;
@@ -70,7 +70,7 @@ xf86ModeHSync(DisplayModePtr mode)
* Exact copy of xf86Mode.c's.
*/
_X_EXPORT double
-xf86ModeVRefresh(DisplayModePtr mode)
+xf86ModeVRefresh(const DisplayModeRec *mode)
{
double refresh = 0.0;
@@ -89,7 +89,7 @@ xf86ModeVRefresh(DisplayModePtr mode)
}
_X_EXPORT int
-xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
+xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation)
{
switch (rotation & 0xf) {
case RR_Rotate_0:
@@ -104,7 +104,7 @@ xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
}
_X_EXPORT int
-xf86ModeHeight (DisplayModePtr mode, Rotation rotation)
+xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation)
{
switch (rotation & 0xf) {
case RR_Rotate_0:
@@ -206,7 +206,7 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
* Allocates and returns a copy of pMode, including pointers within pMode.
*/
_X_EXPORT DisplayModePtr
-xf86DuplicateMode(DisplayModePtr pMode)
+xf86DuplicateMode(const DisplayModeRec *pMode)
{
DisplayModePtr pNew;
@@ -264,7 +264,7 @@ xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
* This isn't in xf86Modes.c, but it might deserve to be there.
*/
_X_EXPORT Bool
-xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
+xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2)
{
if (pMode1->Clock == pMode2->Clock &&
pMode1->HDisplay == pMode2->HDisplay &&
@@ -519,7 +519,7 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
}
Bool
-xf86ModeIsReduced(DisplayModePtr mode)
+xf86ModeIsReduced(const DisplayModeRec *mode)
{
if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) &&
((mode->HTotal - mode->HDisplay) == 160) &&
@@ -698,7 +698,7 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
for (i = 0; i < xf86NumDefaultModes; i++)
{
- DisplayModePtr defMode = &xf86DefaultModes[i];
+ const DisplayModeRec *defMode = &xf86DefaultModes[i];
if (!interlaceAllowed && (defMode->Flags & V_INTERLACE))
continue;
diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h
index af5987b..2fb6a37 100644
--- a/hw/xfree86/modes/xf86Modes.h
+++ b/hw/xfree86/modes/xf86Modes.h
@@ -40,22 +40,23 @@
#include "xf86Rename.h"
#endif
-double xf86ModeHSync(DisplayModePtr mode);
-double xf86ModeVRefresh(DisplayModePtr mode);
+double xf86ModeHSync(const DisplayModeRec *mode);
+double xf86ModeVRefresh(const DisplayModeRec *mode);
unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth);
int
-xf86ModeWidth (DisplayModePtr mode, Rotation rotation);
+xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation);
int
-xf86ModeHeight (DisplayModePtr mode, Rotation rotation);
+xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation);
-DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
+DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode);
DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
DisplayModePtr modeList);
void xf86SetModeDefaultName(DisplayModePtr mode);
void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
-Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
+Bool xf86ModesEqual(const DisplayModeRec *pMode1,
+ const DisplayModeRec *pMode2);
void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
@@ -65,7 +66,7 @@ DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins);
Bool
-xf86ModeIsReduced(DisplayModePtr mode);
+xf86ModeIsReduced(const DisplayModeRec *mode);
void
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
commit d5ad296869c38ab30136b5a293a0125b76aad994
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Tue Nov 25 14:12:26 2008 -0800
Remove duplication from code paths in XkbDDXCompileKeymapByNames
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 80da963..4d5dfb6 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -186,53 +186,61 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
char * nameRtrn,
int nameRtrnLen)
{
-FILE * out;
-char *buf = NULL, keymap[PATH_MAX],xkm_output_dir[PATH_MAX];
+ FILE * out;
+ char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
+
+ const char *emptystring = "";
+ const char *xkbbasedirflag = emptystring;
+ const char *xkbbindir = emptystring;
+ const char *xkbbindirsep = emptystring;
#ifdef WIN32
-char tmpname[PATH_MAX];
-#endif
+ /* WIN32 has no popen. The input must be stored in a file which is
+ used as input for xkbcomp. xkbcomp does not read from stdin. */
+ char tmpname[PATH_MAX];
+ const char *xkmfile = tmpname;
+#else
+ const char *xkmfile = "-";
+#endif
snprintf(keymap, sizeof(keymap), "server-%s", display);
XkbEnsureSafeMapName(keymap);
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
+
#ifdef WIN32
strcpy(tmpname, Win32TempDir());
strcat(tmpname, "\\xkb_XXXXXX");
(void) mktemp(tmpname);
#endif
- if (XkbBaseDirectory!=NULL) {
-#ifndef WIN32
- char *xkmfile = "-";
-#else
- /* WIN32 has no popen. The input must be stored in a file which is used as input
- for xkbcomp. xkbcomp does not read from stdin. */
- char *xkmfile = tmpname;
-#endif
- char *xkbbasedir = XkbBaseDirectory;
- char *xkbbindir = XkbBinDirectory;
-
- buf = Xprintf(
- "\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
- xkbbindir,
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
- xkbbasedir, xkmfile,
- PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
- xkm_output_dir,keymap);
+
+ if (XkbBaseDirectory != NULL) {
+ xkbbasedirflag = Xprintf("\"-R%s\"", XkbBaseDirectory);
}
- else {
-#ifndef WIN32
- char *xkmfile = "-";
-#else
- char *xkmfile = tmpname;
-#endif
- buf = Xprintf(
- "xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
- xkmfile,
- PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
- xkm_output_dir,keymap);
+
+ if (XkbBinDirectory != NULL) {
+ int ld = strlen(XkbBinDirectory);
+ int lps = strlen(PATHSEPARATOR);
+
+ xkbbindir = XkbBinDirectory;
+
+ if ((ld >= lps) &&
+ (strcmp(xkbbindir + ld - lps, PATHSEPARATOR) != 0)) {
+ xkbbindirsep = PATHSEPARATOR;
+ }
+ }
+
+ buf = Xprintf("\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
+ "-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
+ xkbbindir, xkbbindirsep,
+ ( (xkbDebugFlags < 2) ? 1 :
+ ((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ),
+ xkbbasedirflag, xkmfile,
+ PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
+ xkm_output_dir, keymap);
+
+ if (xkbbasedirflag != emptystring) {
+ xfree(xkbbasedirflag);
}
#ifndef WIN32
More information about the xorg-commit
mailing list