Browse code

Use intptr_t when casting pointers to int.

Originally committed as revision 18192 to svn://svn.ffmpeg.org/ffmpeg/trunk

Ramiro Polla authored on 2009/03/26 10:34:02
Showing 4 changed files
... ...
@@ -4271,7 +4271,7 @@ int ff_check_alignment(void){
4271 4271
     static int did_fail=0;
4272 4272
     DECLARE_ALIGNED_16(int, aligned);
4273 4273
 
4274
-    if((long)&aligned & 15){
4274
+    if((intptr_t)&aligned & 15){
4275 4275
         if(!did_fail){
4276 4276
 #if HAVE_MMX || HAVE_ALTIVEC
4277 4277
             av_log(NULL, AV_LOG_ERROR,
... ...
@@ -3056,7 +3056,7 @@ void ff_mpeg4_init_partitions(MpegEncContext *s)
3056 3056
     uint8_t *start= pbBufPtr(&s->pb);
3057 3057
     uint8_t *end= s->pb.buf_end;
3058 3058
     int size= end - start;
3059
-    int pb_size = (((long)start + size/3)&(~3)) - (long)start;
3059
+    int pb_size = (((intptr_t)start + size/3)&(~3)) - (intptr_t)start;
3060 3060
     int tex_size= (size - 2*pb_size)&(~3);
3061 3061
 
3062 3062
     set_put_bits_buffer_size(&s->pb, pb_size);
... ...
@@ -25,7 +25,7 @@
25 25
 
26 26
 const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end)
27 27
 {
28
-    const uint8_t *a = p + 4 - ((long)p & 3);
28
+    const uint8_t *a = p + 4 - ((intptr_t)p & 3);
29 29
 
30 30
     for( end -= 3; p < a && p < end; p++ ) {
31 31
         if( p[0] == 0 && p[1] == 0 && p[2] == 1 )
... ...
@@ -53,38 +53,38 @@ static int file_open(URLContext *h, const char *filename, int flags)
53 53
     fd = open(filename, access, 0666);
54 54
     if (fd < 0)
55 55
         return AVERROR(ENOENT);
56
-    h->priv_data = (void *) fd;
56
+    h->priv_data = (void *) (intptr_t) fd;
57 57
     return 0;
58 58
 }
59 59
 
60 60
 static int file_read(URLContext *h, unsigned char *buf, int size)
61 61
 {
62
-    int fd = (int) h->priv_data;
62
+    int fd = (intptr_t) h->priv_data;
63 63
     return read(fd, buf, size);
64 64
 }
65 65
 
66 66
 static int file_write(URLContext *h, unsigned char *buf, int size)
67 67
 {
68
-    int fd = (int) h->priv_data;
68
+    int fd = (intptr_t) h->priv_data;
69 69
     return write(fd, buf, size);
70 70
 }
71 71
 
72 72
 /* XXX: use llseek */
73 73
 static int64_t file_seek(URLContext *h, int64_t pos, int whence)
74 74
 {
75
-    int fd = (int) h->priv_data;
75
+    int fd = (intptr_t) h->priv_data;
76 76
     return lseek(fd, pos, whence);
77 77
 }
78 78
 
79 79
 static int file_close(URLContext *h)
80 80
 {
81
-    int fd = (int) h->priv_data;
81
+    int fd = (intptr_t) h->priv_data;
82 82
     return close(fd);
83 83
 }
84 84
 
85 85
 static int file_get_handle(URLContext *h)
86 86
 {
87
-    return (int) h->priv_data;
87
+    return (intptr_t) h->priv_data;
88 88
 }
89 89
 
90 90
 URLProtocol file_protocol = {
... ...
@@ -116,7 +116,7 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
116 116
 #if HAVE_SETMODE
117 117
     setmode(fd, O_BINARY);
118 118
 #endif
119
-    h->priv_data = (void *) fd;
119
+    h->priv_data = (void *) (intptr_t) fd;
120 120
     h->is_streamed = 1;
121 121
     return 0;
122 122
 }