comparison file.c @ 396:96f8086bc2ba libavformat

warning patrol
author mellum
date Wed, 24 Mar 2004 23:32:48 +0000
parents c7a3987b4462
children 9cff946a8bb8
comparison
equal deleted inserted replaced
395:c1ed10f3b052 396:96f8086bc2ba
48 access |= O_BINARY; 48 access |= O_BINARY;
49 #endif 49 #endif
50 fd = open(filename, access, 0666); 50 fd = open(filename, access, 0666);
51 if (fd < 0) 51 if (fd < 0)
52 return -ENOENT; 52 return -ENOENT;
53 h->priv_data = (void *)fd; 53 h->priv_data = (void *)(size_t)fd;
54 return 0; 54 return 0;
55 } 55 }
56 56
57 static int file_read(URLContext *h, unsigned char *buf, int size) 57 static int file_read(URLContext *h, unsigned char *buf, int size)
58 { 58 {
59 int fd = (int)h->priv_data; 59 int fd = (size_t)h->priv_data;
60 return read(fd, buf, size); 60 return read(fd, buf, size);
61 } 61 }
62 62
63 static int file_write(URLContext *h, unsigned char *buf, int size) 63 static int file_write(URLContext *h, unsigned char *buf, int size)
64 { 64 {
65 int fd = (int)h->priv_data; 65 int fd = (size_t)h->priv_data;
66 return write(fd, buf, size); 66 return write(fd, buf, size);
67 } 67 }
68 68
69 /* XXX: use llseek */ 69 /* XXX: use llseek */
70 static offset_t file_seek(URLContext *h, offset_t pos, int whence) 70 static offset_t file_seek(URLContext *h, offset_t pos, int whence)
71 { 71 {
72 int fd = (int)h->priv_data; 72 int fd = (size_t)h->priv_data;
73 #ifdef CONFIG_WIN32 73 #ifdef CONFIG_WIN32
74 return _lseeki64(fd, pos, whence); 74 return _lseeki64(fd, pos, whence);
75 #else 75 #else
76 return lseek(fd, pos, whence); 76 return lseek(fd, pos, whence);
77 #endif 77 #endif
78 } 78 }
79 79
80 static int file_close(URLContext *h) 80 static int file_close(URLContext *h)
81 { 81 {
82 int fd = (int)h->priv_data; 82 int fd = (size_t)h->priv_data;
83 return close(fd); 83 return close(fd);
84 } 84 }
85 85
86 URLProtocol file_protocol = { 86 URLProtocol file_protocol = {
87 "file", 87 "file",
104 fd = 0; 104 fd = 0;
105 } 105 }
106 #if defined(CONFIG_WIN32) || defined(CONFIG_OS2) || defined(__CYGWIN__) 106 #if defined(CONFIG_WIN32) || defined(CONFIG_OS2) || defined(__CYGWIN__)
107 setmode(fd, O_BINARY); 107 setmode(fd, O_BINARY);
108 #endif 108 #endif
109 h->priv_data = (void *)fd; 109 h->priv_data = (void *)(size_t)fd;
110 return 0; 110 return 0;
111 } 111 }
112 112
113 static int pipe_read(URLContext *h, unsigned char *buf, int size) 113 static int pipe_read(URLContext *h, unsigned char *buf, int size)
114 { 114 {
115 int fd = (int)h->priv_data; 115 int fd = (size_t)h->priv_data;
116 return read(fd, buf, size); 116 return read(fd, buf, size);
117 } 117 }
118 118
119 static int pipe_write(URLContext *h, unsigned char *buf, int size) 119 static int pipe_write(URLContext *h, unsigned char *buf, int size)
120 { 120 {
121 int fd = (int)h->priv_data; 121 int fd = (size_t)h->priv_data;
122 return write(fd, buf, size); 122 return write(fd, buf, size);
123 } 123 }
124 124
125 static int pipe_close(URLContext *h) 125 static int pipe_close(URLContext *h)
126 { 126 {