AT&T Unix PC : 16-signed-size-t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On UnixPC, size_t is a *signed* type, unlike on all other platforms.

Thus the SSIZE_MAX macro doesn't work on UnixPC as on other platforms
(because right-shift of signed quantities pad with value of leftmost
bit, rather than always shifting a zero in)

This replacement works ok (and obviously works for unsigned size_t
too)

After having applied this one, dash should work on UnixPC for basic
tasks, the next 2 are optional features.

Regards,

Alain

diff -X ../exclude.txt -urN dash-0.5.12+16-monitor-mode/src/system.h
dash-0.5.12+17-signed-size-t/src/system.h
--- dash-0.5.12+16-monitor-mode/src/system.h	2024-11-10
14:53:08.438618562 +0000
+++ dash-0.5.12+17-signed-size-t/src/system.h	2024-11-10
14:53:08.446618751 +0000
@@ -31,7 +31,7 @@
 #include <sys/types.h>

 #ifndef SSIZE_MAX
-#define SSIZE_MAX ((ssize_t)((size_t)-1 >> 1))
+#define SSIZE_MAX ((((1L << (sizeof(ssize_t)*8-2))-1)<<1)+1)
 #endif

 static inline void sigclearmask(void)




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux