From a850e392bbad005ec4989cb1f49b4f31e36f8bf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Mon, 14 Aug 2000 22:18:29 +0200
Subject: [PATCH] Fixed a few warnings.

Rev: src/cyclic.h:1.4
Rev: src/program.h:1.101
Rev: src/svalue.c:1.86
---
 src/cyclic.h  |  5 +++--
 src/program.h |  4 ++--
 src/svalue.c  | 21 ++++++++++++++-------
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/cyclic.h b/src/cyclic.h
index 7a0fcd8ac7..2793a964c0 100644
--- a/src/cyclic.h
+++ b/src/cyclic.h
@@ -1,5 +1,5 @@
 /*
- * $Id: cyclic.h,v 1.3 1998/03/28 15:34:38 grubba Exp $
+ * $Id: cyclic.h,v 1.4 2000/08/14 20:18:29 grubba Exp $
  */
 #ifndef CYCLIC_H
 #define CYCLIC_H
@@ -22,7 +22,8 @@ typedef struct CYCLIC
   CYCLIC cyclic_struct__
 
 #define BEGIN_CYCLIC(A,B) \
-   begin_cyclic(&cyclic_struct__, &cyclic_identifier__, (void *)th_self(), (void *)(A), (void *)(B))
+   begin_cyclic(&cyclic_struct__, &cyclic_identifier__, \
+                (void *)(ptrdiff_t)th_self(), (void *)(A), (void *)(B))
 
 #define SET_CYCLIC_RET(RET) \
    cyclic_struct__.ret=(void *)(RET)
diff --git a/src/program.h b/src/program.h
index 5f3b463daf..6b812b6f8f 100644
--- a/src/program.h
+++ b/src/program.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: program.h,v 1.100 2000/08/10 14:51:16 grubba Exp $
+ * $Id: program.h,v 1.101 2000/08/14 20:09:58 grubba Exp $
  */
 #ifndef PROGRAM_H
 #define PROGRAM_H
@@ -125,7 +125,7 @@ struct program_state;
 union idptr
 {
   void (*c_fun)(INT32);
-  INT32 offset;
+  ptrdiff_t offset;
 };
 
 #define IDENTIFIER_PIKE_FUNCTION 1
diff --git a/src/svalue.c b/src/svalue.c
index 443a1730e5..d87557f9dd 100644
--- a/src/svalue.c
+++ b/src/svalue.c
@@ -24,7 +24,7 @@
 #include "queue.h"
 #include "bignum.h"
 
-RCSID("$Id: svalue.c,v 1.85 2000/07/28 17:16:55 hubbe Exp $");
+RCSID("$Id: svalue.c,v 1.86 2000/08/14 20:08:29 grubba Exp $");
 
 struct svalue dest_ob_zero = { T_INT, 0 };
 
@@ -258,7 +258,9 @@ PMOD_EXPORT void assign_svalues_no_free(struct svalue *to,
     size_t e;
     for(e=0;e<num;e++)
       if(!(type_hint & (1<<from[e].type)))
-	 fatal("Type hint lies (%ld %ld %d)!\n",(long)e,(long)type_hint,from[e].type);
+	 fatal("Type hint lies (%ld %ld %d)!\n",
+	       DO_NOT_WARN((long)e),
+	       (long)type_hint, from[e].type);
   }
 #endif
   if((type_hint & ((2<<MAX_REF_TYPE)-1)) == 0)
@@ -440,9 +442,13 @@ PMOD_EXPORT unsigned INT32 hash_svalue(struct svalue *s)
       break;
     }
 
-  default:      q=(unsigned INT32)((long)s->u.refs >> 2); break;
+  default:
+    q=DO_NOT_WARN((unsigned INT32)((ptrdiff_t)s->u.refs >> 2));
+    break;
   case T_INT:   q=s->u.integer; break;
-  case T_FLOAT: q=(unsigned INT32)(s->u.float_number * 16843009.731757771173); break;
+  case T_FLOAT:
+    q=DO_NOT_WARN((unsigned INT32)(s->u.float_number * 16843009.731757771173));
+    break;
   }
   q+=q % 997;
   q+=((q + s->type) * 9248339);
@@ -1211,7 +1217,7 @@ static void low_check_short_svalue(union anything *u, TYPE_T type)
 
 void check_short_svalue(union anything *u, TYPE_T type)
 {
-  if(type<=MAX_REF_TYPE && (3 & (long)(u->refs)))
+  if(type<=MAX_REF_TYPE && (3 & (ptrdiff_t)(u->refs)))
     fatal("Odd pointer! type=%d u->refs=%p\n",type,u->refs);
 
   check_refs2(u,type);
@@ -1221,7 +1227,7 @@ void check_short_svalue(union anything *u, TYPE_T type)
 void debug_check_svalue(struct svalue *s)
 {
   check_type(s->type);
-  if(s->type<=MAX_REF_TYPE && (3 & (long)(s->u.refs)))
+  if(s->type<=MAX_REF_TYPE && (3 & (ptrdiff_t)(s->u.refs)))
     fatal("Odd pointer! type=%d u->refs=%p\n",s->type,s->u.refs);
 
   check_refs(s);
@@ -1578,7 +1584,8 @@ PMOD_EXPORT INT32 pike_sizeof(struct svalue *s)
 {
   switch(s->type)
   {
-  case T_STRING: return s->u.string->len;
+  case T_STRING:
+    return DO_NOT_WARN((INT32)s->u.string->len);
   case T_ARRAY: return s->u.array->size;
   case T_MAPPING: return m_sizeof(s->u.mapping);
   case T_MULTISET: return l_sizeof(s->u.multiset);
-- 
GitLab