From aed13e163839016ad105f24af5480e034ea561b6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 24 Apr 2014 08:42:15 +0200 Subject: fix warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/passphrase.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/passphrase.c b/src/passphrase.c index f1ce7b7..86cc54c 100644 --- a/src/passphrase.c +++ b/src/passphrase.c @@ -162,7 +162,7 @@ char* passphrase_read(void) #pragma GCC diagnostic ignored "-Wpedantic" xputchar(c); #pragma GCC diagnostic pop - *(rc + len++) = c; + *(rc + len++) = (char)c; point++; } #ifdef PASSPHRASE_INSERT @@ -180,14 +180,14 @@ char* passphrase_read(void) for (i = len; i > point; i--) *(rc + i) = *(rc + i - 1); len++; - *(rc + point++) = c; + *(rc + point++) = (char)c; } #endif #ifdef PASSPHRASE_OVERRIDE else { long n = 1; - char cn = c; + char cn = (char)c; while ((*(rc + point + n) & 0xC0) == 0x80) n++; for (i = point + n; i < len; i++) @@ -198,7 +198,7 @@ char* passphrase_read(void) n = 0; while (cn & 0x80) { - cn <<= 1; + cn = (char)(cn << 1); n++; } n = n ? n : 1; @@ -219,7 +219,7 @@ char* passphrase_read(void) #pragma GCC diagnostic ignored "-Wpedantic" xputchar(c); #pragma GCC diagnostic pop - *(rc + point++) = c; + *(rc + point++) = (char)c; } } #endif @@ -352,6 +352,12 @@ char* passphrase_read(void) } +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +/* Must positively absolutely not be flagged as possible to optimise away as it depends on configurations, + and programs that uses this library must not be forced to be recompiled if the library is reconfigured. */ + /** * Disable echoing and do anything else to the terminal settnings `passphrase_read` requires */ @@ -381,3 +387,5 @@ void passphrase_reenable_echo(void) #endif } +# pragma GCC diagnostic pop + -- cgit v1.2.3-70-g09d2