aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/utils/cvt/cvt.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-09 05:23:48 +0000
committermarha <marha@users.sourceforge.net>2009-09-09 05:23:48 +0000
commit81f91c615982e50bb62708201569c33a3cd3d973 (patch)
tree4f32ecc48a3b7b5e76642f3792338263c53879bd /xorg-server/hw/xfree86/utils/cvt/cvt.c
parentb571a562410f565af2bdde52d9f7f9a23ffae04f (diff)
parenta915739887477b28d924ecc8417ee107d125bd6c (diff)
downloadvcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.gz
vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.bz2
vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.zip
svn merge https://vcxsrv.svn.sourceforge.net/svnroot/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/hw/xfree86/utils/cvt/cvt.c')
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/cvt.c66
1 files changed, 56 insertions, 10 deletions
diff --git a/xorg-server/hw/xfree86/utils/cvt/cvt.c b/xorg-server/hw/xfree86/utils/cvt/cvt.c
index fee4f7c3e..cf0a479f2 100644
--- a/xorg-server/hw/xfree86/utils/cvt/cvt.c
+++ b/xorg-server/hw/xfree86/utils/cvt/cvt.c
@@ -25,6 +25,34 @@
#include "xf86.h"
+/* xnfalloc implementation used by the server code we built in */
+pointer
+XNFalloc(unsigned long n)
+{
+ pointer r;
+
+ r = malloc(n);
+ if (!r) {
+ perror("malloc failed");
+ exit(1);
+ }
+ return r;
+}
+
+/* xnfcalloc implementation used by the server code we built in */
+pointer
+XNFcalloc(unsigned long n)
+{
+ pointer r;
+
+ r = calloc(1, n);
+ if (!r) {
+ perror("calloc failed");
+ exit(1);
+ }
+ return r;
+}
+
/*
* Quickly check wether this is a CVT standard mode.
*/
@@ -174,7 +202,7 @@ main (int argc, char *argv[])
if ((argc < 3) || (argc > 7)) {
PrintUsage(argv[0]);
- return 0;
+ return 1;
}
/* This doesn't filter out bad flags properly. Bad flags get passed down
@@ -191,15 +219,30 @@ main (int argc, char *argv[])
else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) {
PrintUsage(argv[0]);
return 0;
- } else if (!HDisplay)
+ } else if (!HDisplay) {
HDisplay = atoi(argv[n]);
- else if (!VDisplay)
+ if (!HDisplay) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
+ else if (!VDisplay) {
VDisplay = atoi(argv[n]);
- else if (!VRefresh)
+ if (!VDisplay) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
+ else if (!VRefresh) {
VRefresh = atof(argv[n]);
+ if (!VRefresh) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
else {
PrintUsage(argv[0]);
- return 0;
+ return 1;
}
}
@@ -218,11 +261,14 @@ main (int argc, char *argv[])
HDisplay += 8;
}
- if (Reduced && (VRefresh != 60.0)) {
- fprintf(stderr, "\nERROR: 60Hz refresh rate required for reduced"
- " blanking.\n");
- PrintUsage(argv[0]);
- return 0;
+ if (Reduced) {
+ if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) {
+ fprintf(stderr,
+ "\nERROR: Multiple of 60Hz refresh rate required for "
+ " reduced blanking.\n");
+ PrintUsage(argv[0]);
+ return 0;
+ }
}
IsCVT = CVTCheckStandard(HDisplay, VDisplay, VRefresh, Reduced, Verbose);