comparison src/sound.c @ 2372:2927c2c26fe6

[gaim-migrate @ 2385] reformatting. nothing else. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 27 Sep 2001 19:17:11 +0000
parents 25e7c2a68ed2
children cd81f1f2c896
comparison
equal deleted inserted replaced
2371:db02399a9ad7 2372:2927c2c26fe6
200 #ifdef ARTSC_SOUND 200 #ifdef ARTSC_SOUND
201 201
202 static int play_artsc(unsigned char *data, int size) 202 static int play_artsc(unsigned char *data, int size)
203 { 203 {
204 arts_stream_t stream; 204 arts_stream_t stream;
205 guint16* lineardata; 205 guint16 *lineardata;
206 int result = 1; 206 int result = 1;
207 int error; 207 int error;
208 int i; 208 int i;
209 209
210 lineardata = g_malloc(size * 2); 210 lineardata = g_malloc(size * 2);
241 } 241 }
242 242
243 static int artsc_play_file(char *file) 243 static int artsc_play_file(char *file)
244 { 244 {
245 struct stat stat_buf; 245 struct stat stat_buf;
246 unsigned char* buf = NULL; 246 unsigned char *buf = NULL;
247 int result = 0; 247 int result = 0;
248 int fd = -1; 248 int fd = -1;
249 249
250 fd = open(file, O_RDONLY); 250 fd = open(file, O_RDONLY);
251 if (fd < 0) 251 if (fd < 0)
261 goto out; 261 goto out;
262 262
263 buf = g_malloc(stat_buf.st_size); 263 buf = g_malloc(stat_buf.st_size);
264 if (!buf) 264 if (!buf)
265 goto out; 265 goto out;
266 266
267 if (read(fd, buf, stat_buf.st_size) < 0) 267 if (read(fd, buf, stat_buf.st_size) < 0)
268 goto out; 268 goto out;
269 269
270 result = play_artsc(buf, stat_buf.st_size); 270 result = play_artsc(buf, stat_buf.st_size);
271 271
272 out: 272 out:
273 if (buf) g_free(buf); 273 if (buf)
274 if (fd != -1) close(fd); 274 g_free(buf);
275 if (fd != -1)
276 close(fd);
275 return result; 277 return result;
276 } 278 }
277 279
278 #endif /* ARTSC_SOUND */ 280 #endif /* ARTSC_SOUND */
279 281