X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fmeasure.c;h=65d9fdddf28934e1e0172027d7b3a46ca14d424b;hb=refs%2Fheads%2Fctables7;hp=35e5fb3f451814cad4197bda4529b55a34055dc0;hpb=d7a8159acf53f6bf70940d711b32348b6ae75f16;p=pspp diff --git a/src/output/measure.c b/src/output/measure.c index 35e5fb3f45..65d9fdddf2 100644 --- a/src/output/measure.c +++ b/src/output/measure.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2012, 2014 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2012, 2014, 2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +18,7 @@ #include "output/measure.h" +#include #include #include #include @@ -27,7 +28,6 @@ #include #include -#include "data/file-name.h" #include "libpspp/str.h" #include "gl/c-strcase.h" @@ -276,8 +276,7 @@ read_paper_conf (const char *file_name, int *h, int *v) fclose (file); ds_destroy (&line); - msg (ME, _("paper size file `%s' does not state a paper size"), - file_name); + msg (ME, _("file `%s' does not state a paper size"), file_name); return false; } @@ -297,15 +296,18 @@ get_default_paper_size (int *h, int *v) return read_paper_conf (getenv ("PAPERCONF"), h, v); #if HAVE_LC_PAPER - /* LC_PAPER is a non-standard glibc extension. */ - *h = (intptr_t) nl_langinfo(_NL_PAPER_WIDTH) * (72000 / 25.4); - *v = (intptr_t) nl_langinfo(_NL_PAPER_HEIGHT) * (72000 / 25.4); + /* LC_PAPER is a non-standard glibc extension. + The (int)(intptr_t) cast is for 64 Bit Systems where intptr_t + translates to 64 Bit long int but the upper 32 Bits have wrong + values. The result from nl_langinfo is integer (32 Bit) */ + *h = (int)(intptr_t) nl_langinfo(_NL_PAPER_WIDTH) * (72000 / 25.4); + *v = (int)(intptr_t) nl_langinfo(_NL_PAPER_HEIGHT) * (72000 / 25.4); if (*h > 0 && *v > 0) return true; #endif /* libpaper defaults to /etc/papersize. */ - if (fn_exists ("/etc/papersize")) + if (0 == access ("/etc/papersize", R_OK)) return read_paper_conf ("/etc/papersize", h, v); /* Can't find a default. */