Hi

When compiling Vim-7.3a 2221:f5bd6753cdc4 on Linux x86_64
with gcc-4.5.0, I see the following warnings:

undo.c: In function ‘u_read_undo’:
undo.c:945:24: warning: cast to pointer from integer of different size
undo.c:946:24: warning: cast to pointer from integer of different size
undo.c:947:28: warning: cast to pointer from integer of different size
undo.c:948:28: warning: cast to pointer from integer of different size
undo.c:879:10: warning: ignoring return value of ‘fread’, declared
with attribute warn_unused_result

Warnings at lines 945, 946, 947, 948 were introduced recently
in changeset 2207:120502692d82.

Attached patch silences the warnings.

Regards
-- Dominique

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r f5bd6753cdc4 src/undo.c
--- a/src/undo.c	Fri May 28 22:06:46 2010 +0200
+++ b/src/undo.c	Sat May 29 14:33:40 2010 +0200
@@ -876,7 +876,11 @@
         goto error;
     }
 
-    fread(read_hash, UNDO_HASH_SIZE, 1, fp);
+    if (fread(read_hash, UNDO_HASH_SIZE, 1, fp) != 1)
+    {
+	EMSG2(_("E000: Incompatible undo file: %s"), file_name);
+	goto error;
+    }
     line_count = (linenr_T)get4c(fp);
     if (memcmp(hash, read_hash, UNDO_HASH_SIZE) != 0
 				  || line_count != curbuf->b_ml.ml_line_count)
@@ -942,10 +946,10 @@
         /* We're not actually trying to store pointers here. We're just storing
          * IDs so we can swizzle them into pointers later - hence the type
 	 * cast. */
-        uhp->uh_next = (u_header_T *)get4c(fp);
-        uhp->uh_prev = (u_header_T *)get4c(fp);
-        uhp->uh_alt_next = (u_header_T *)get4c(fp);
-        uhp->uh_alt_prev = (u_header_T *)get4c(fp);
+        uhp->uh_next = (u_header_T *)(long_u)get4c(fp);
+        uhp->uh_prev = (u_header_T *)(long_u)get4c(fp);
+        uhp->uh_alt_next = (u_header_T *)(long_u)get4c(fp);
+        uhp->uh_alt_prev = (u_header_T *)(long_u)get4c(fp);
         uhp->uh_seq = get4c(fp);
         if (uhp->uh_seq <= 0)
         {

Raspunde prin e-mail lui