summaryrefslogtreecommitdiff
path: root/specs/libX11
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2017-01-01 20:57:58 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2017-01-03 08:50:52 +1000
commit663f47075fe67bab4f99bc5d186c49175d4a4334 (patch)
treefa85d08dd6aed04f6800ec767e4d5ca25717d215 /specs/libX11
parent28f4b989b52fcf45c7e75a878d8d9c2583cd6b3c (diff)
downloadxorg-lib-libX11-663f47075fe67bab4f99bc5d186c49175d4a4334.tar.gz
specs/libX11: Update Portability Considerations for the 21st century
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'specs/libX11')
-rw-r--r--specs/libX11/AppC.xml21
1 files changed, 15 insertions, 6 deletions
diff --git a/specs/libX11/AppC.xml b/specs/libX11/AppC.xml
index bac148cb..8eb1e004 100644
--- a/specs/libX11/AppC.xml
+++ b/specs/libX11/AppC.xml
@@ -3213,9 +3213,8 @@ You must pass back the same pointer and size that were returned by
<title>Portability Considerations</title>
<para>
<!-- .LP -->
-Many machine architectures,
-including many of the more recent <acronym>RISC</acronym> architectures,
-do not correctly access data at unaligned locations;
+Many machine architectures
+do not correctly or efficiently access data at unaligned locations;
their compilers pad out structures to preserve this characteristic.
Many other machines capable of unaligned references pad inside of structures
as well to preserve alignment, because accessing aligned data is
@@ -3229,7 +3228,9 @@ All requests <emphasis remap='I'>must</emphasis> be a multiple of 32 bits in len
the natural alignment in the data stream.
You must pad structures out to 32-bit boundaries.
Pad information does not have to be zeroed unless you want to
-preserve such fields for future use in your protocol requests.
+preserve such fields for future use in your protocol requests,
+but it is recommended to zero it to avoid inadvertant data leakage
+and improve compressability.
Floating point varies radically between machines and should be
avoided completely if at all possible.
</para>
@@ -3266,7 +3267,7 @@ take on values larger than the maximum 16-bit
</para>
<para>
<!-- .LP -->
-The library currently assumes that a
+The library has always assumed that a
<type>char</type>
is 8 bits, a
<type>short</type>
@@ -3274,7 +3275,15 @@ is 16 bits, an
<type>int</type>
is 16 or 32 bits, and a
<type>long</type>
-is 32 bits.
+is 32 bits.
+Unfortunately, this assumption remains on machines where a <type>long</type>
+can hold 64-bits, and many functions and structures require unnecessarily
+large fields to avoid breaking compatibility with existing code. Special
+care must be taken with arrays of values that are transmitted in the
+protocol as CARD32 or INT32 but have to be converted to arrays of 64-bit
+<type>long</type> when passed to or from client applications.
+</para>
+<para>
The
<function>PackData</function>
macro is a half-hearted attempt to deal with the possibility of 32 bit shorts.