Debian Codegraph @

libretro-common/streams/file_stream.c

raw symbols SCIP
1 /* Copyright (C) 2010-2016 The RetroArch team
2 *
3 * ---------------------------------------------------------------------------------------
4 * The following license statement only applies to this file (file_stream.c).
5 * ---------------------------------------------------------------------------------------
6 *
7 * Permission is hereby granted, free of charge,
8 * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <errno.h>
27
28 #if defined(_WIN32)
29 # ifdef _MSC_VER
30 # define setmode _setmode
31 # endif
32 # ifdef _XBOX
33 # include <xtl.h>
34 # define INVALID_FILE_ATTRIBUTES -1
35 # else
36 # include <io.h>
37 # include <fcntl.h>
38 # include <direct.h>
39 # include <windows.h>
40 # endif
41 #elif defined(VITA)
42 # include <psp2/io/fcntl.h>
43 # include <psp2/io/dirent.h>
44
45 #define PSP_O_RDONLY PSP2_O_RDONLY
46 #define PSP_O_RDWR PSP2_O_RDWR
47 #define PSP_O_CREAT PSP2_O_CREAT
48 #define PSP_O_WRONLY PSP2_O_WRONLY
49 #define PSP_O_TRUNC PSP2_O_TRUNC
50 #else
51 # if defined(PSP)
52 # include <pspiofilemgr.h>
53 # endif
54 # include <sys/types.h>
55 # include <sys/stat.h>
56 # include <dirent.h>
57 # include <unistd.h>
58 #endif
59
60 #ifdef __CELLOS_LV2__
61 #include <cell/cell_fs.h>
62 #else
63 #include <fcntl.h>
64 #endif
65
66 #include <streams/file_stream.h>cxx . . $ `<file>/libretro-common/include/streams/file_stream.h`/
67 #include <memmap.h>cxx . . $ `<file>/libretro-common/include/memmap.h`/
68
69 #if 1
70 #define HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`! 1
71 #endif
72
73 struct RFILEcxx . . $ RFILE#
74 {
75 unsigned hintscxx . . $ RFILE#hints.;
76 #if defined(PSP) || defined(VITA)
77 SceUID fd;
78 #elif defined(__CELLOS_LV2__)
79 int fd;
80 #else
81 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
82 FILEcxx . . $ FILE# *fpcxx . . $ RFILE#fp.;
83 #endif
84 #if defined(HAVE_MMAP)
85 uint8_t *mapped;
86 uint64_t mappos;
87 uint64_t mapsize;
88 #endif
89 int fdcxx . . $ RFILE#fd.;
90 #endif
91 };
92
93 int filestream_get_fdcxx . . $ filestream_get_fd(3edcd12cab33f13c).(RFILEcxx . . $ RFILE# *stream)
94 {
95 if (!stream)
96 return -1;
97 #if defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__)
98 return stream->fd;
99 #else
100 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
101 if ((stream->hintscxx . . $ RFILE#hints. & RFILE_HINT_UNBUFFEREDcxx . . $ RFILE_HINT_UNBUFFERED.) == 0)
102 return filenocxx . . $ fileno(89bc1efcdac0ca22).(stream->fpcxx . . $ RFILE#fp.);
103 #endif
104 return stream->fdcxx . . $ RFILE#fd.;
105 #endif
106 }
107
108 RFILEcxx . . $ RFILE# *filestream_opencxx . . $ filestream_open(5289339e9c722221).(const char *path, unsigned mode, ssize_tcxx . . $ ssize_t# len)
109 {
110 int flags = 0;
111 int mode_int = 0;
112 const char *mode_str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
113 RFILEcxx . . $ RFILE# *stream = (RFILEcxx . . $ RFILE#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(*stream));
114
115 if (!stream)
116 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
117
118 (void)mode_str;
119 (void)mode_int;
120 (void)flags;
121
122 stream->hintscxx . . $ RFILE#hints. = mode;
123
124 #ifdef HAVE_MMAP
125 if (stream->hints & RFILE_HINT_MMAP && (stream->hints & 0xff) == RFILE_MODE_READ)
126 stream->hints |= RFILE_HINT_UNBUFFERED;
127 else
128 #endif
129 stream->hintscxx . . $ RFILE#hints. &= ~RFILE_HINT_MMAPcxx . . $ RFILE_HINT_MMAP.;
130
131 switch (mode & 0xff)
132 {
133 case RFILE_MODE_READcxx . . $ RFILE_MODE_READ.:
134 #if defined(VITA) || defined(PSP)
135 mode_int = 0777;
136 flags = PSP_O_RDONLY;
137 #elif defined(__CELLOS_LV2__)
138 mode_int = 0777;
139 flags = CELL_FS_O_RDONLY;
140 #else
141 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
142 if ((stream->hintscxx . . $ RFILE#hints. & RFILE_HINT_UNBUFFEREDcxx . . $ RFILE_HINT_UNBUFFERED.) == 0)
143 mode_str = "rb";
144 #endif
145 /* No "else" here */
146 flags = O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!;
147 #endif
148 break;
149 case RFILE_MODE_WRITEcxx . . $ RFILE_MODE_WRITE.:
150 #if defined(VITA) || defined(PSP)
151 mode_int = 0777;
152 flags = PSP_O_CREAT | PSP_O_WRONLY | PSP_O_TRUNC;
153 #elif defined(__CELLOS_LV2__)
154 mode_int = 0777;
155 flags = CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_TRUNC;
156 #else
157 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
158 if ((stream->hintscxx . . $ RFILE#hints. & RFILE_HINT_UNBUFFEREDcxx . . $ RFILE_HINT_UNBUFFERED.) == 0)
159 mode_str = "wb";
160 #endif
161 else
162 {
163 flags = O_WRONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:44:9`! | O_CREATcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:47:10`! | O_TRUNCcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:56:10`!;
164 #ifndef _WIN32
165 flags |= S_IRUSRcxx . . $ `<external>/14710646456994434043/fcntl.h:105:10`! | S_IWUSRcxx . . $ `<external>/14710646456994434043/fcntl.h:106:10`!;
166 #endif
167 }
168 #endif
169 break;
170 case RFILE_MODE_READ_WRITEcxx . . $ RFILE_MODE_READ_WRITE.:
171 #if defined(VITA) || defined(PSP)
172 mode_int = 0777;
173 flags = PSP_O_RDWR;
174 #elif defined(__CELLOS_LV2__)
175 mode_int = 0777;
176 flags = CELL_FS_O_RDWR;
177 #else
178 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
179 if ((stream->hintscxx . . $ RFILE#hints. & RFILE_HINT_UNBUFFEREDcxx . . $ RFILE_HINT_UNBUFFERED.) == 0)
180 mode_str = "w+";
181 #endif
182 else
183 {
184 flags = O_RDWRcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:45:9`!;
185 #ifdef _WIN32
186 flags |= O_BINARY;
187 #endif
188 }
189 #endif
190 break;
191 }
192
193 #if defined(VITA) || defined(PSP)
194 stream->fd = sceIoOpen(path, flags, mode_int);
195 #elif defined(__CELLOS_LV2__)
196 cellFsOpen(path, flags, &stream->fd, NULL, 0);
197 #else
198 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
199 if ((stream->hintscxx . . $ RFILE#hints. & RFILE_HINT_UNBUFFEREDcxx . . $ RFILE_HINT_UNBUFFERED.) == 0)
200 {
201 stream->fpcxx . . $ RFILE#fp. = fopencxx . . $ fopen(82ec0787cd37e0a3).(path, mode_str);
202 if (!stream->fpcxx . . $ RFILE#fp.)
203 goto error;
204 }
205 else
206 #endif
207 {
208 stream->fdcxx . . $ RFILE#fd. = opencxx . . $ open(e156e3aa1e5c4ad1).(path, flags);
209 if (stream->fdcxx . . $ RFILE#fd. == -1)
210 goto error;
211 #ifdef HAVE_MMAP
212 if (stream->hints & RFILE_HINT_MMAP)
213 {
214 stream->mappos = 0;
215 stream->mapped = NULL;
216 stream->mapsize = filestream_seek(stream, 0, SEEK_END);
217
218 if (stream->mapsize == (uint64_t)-1)
219 goto error;
220
221 filestream_rewind(stream);
222
223 stream->mapped = (uint8_t*)mmap((void*)0, stream->mapsize, PROT_READ, MAP_SHARED, stream->fd, 0);
224
225 if (stream->mapped == MAP_FAILED)
226 stream->hints &= ~RFILE_HINT_MMAP;
227 }
228 #endif
229 }
230 #endif
231
232 #if defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__)
233 if (stream->fd == -1)
234 goto error;
235 #endif
236
237 return stream;
238
239 error:
240 filestream_closecxx . . $ filestream_close(3edcd12cab33f13c).(stream);
241 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
242 }
243
244 ssize_tcxx . . $ ssize_t# filestream_seekcxx . . $ filestream_seek(3ba5ec69a3eac100).(RFILEcxx . . $ RFILE# *stream, ssize_tcxx . . $ ssize_t# offset, int whence)
245 {
246 int ret = 0;
247 if (!stream)
248 return -1;
249
250 (void)ret;
251
252 #if defined(VITA) || defined(PSP)
253 ret = sceIoLseek(stream->fd, (SceOff)offset, whence);
254 if (ret == -1)
255 return -1;
256 return 0;
257 #elif defined(__CELLOS_LV2__)
258 uint64_t pos = 0;
259 if (cellFsLseek(stream->fd, offset, whence, &pos) != CELL_FS_SUCCEEDED)
260 return -1;
261 return 0;
262 #else
263 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
264 if ((stream->hintscxx . . $ RFILE#hints. & RFILE_HINT_UNBUFFEREDcxx . . $ RFILE_HINT_UNBUFFERED.) == 0)
265 return fseekcxx . . $ fseek(543fae30d249f6b1).(stream->fpcxx . . $ RFILE#fp., (long)offset, whence);
266 else
267 #endif
268 #ifdef HAVE_MMAP
269 /* Need to check stream->mapped because this function is
270 * called in filestream_open() */
271 if (stream->mapped && stream->hints & RFILE_HINT_MMAP)
272 {
273 /* fseek() returns error on under/overflow but allows cursor > EOF for
274 read-only file descriptors. */
275 switch (whence)
276 {
277 case SEEK_SET:
278 if (offset < 0)
279 return -1;
280
281 stream->mappos = offset;
282 break;
283
284 case SEEK_CUR:
285 if ((offset < 0 && stream->mappos + offset > stream->mappos) ||
286 (offset > 0 && stream->mappos + offset < stream->mappos))
287 return -1;
288
289 stream->mappos += offset;
290 break;
291
292 case SEEK_END:
293 if (stream->mapsize + offset < stream->mapsize)
294 return -1;
295
296 stream->mappos = stream->mapsize + offset;
297
298 break;
299 }
300
301 return stream->mappos;
302 }
303 else
304 #endif
305 {
306 ret = lseekcxx . . $ lseek(f1afe674ac17c82e).(stream->fdcxx . . $ RFILE#fd., offset, whence);
307 return ret < 0 ? -1 : ret;
308 }
309 #endif
310 }
311
312 ssize_tcxx . . $ ssize_t# filestream_tellcxx . . $ filestream_tell(fb7f681fccbdceb6).(RFILEcxx . . $ RFILE# *stream)
313 {
314 if (!stream)
315 return -1;
316 #if defined(VITA) || defined(PSP)
317 return sceIoLseek(stream->fd, 0, SEEK_CUR);
318 #elif defined(__CELLOS_LV2__)
319 uint64_t pos = 0;
320 if (cellFsLseek(stream->fd, 0, CELL_FS_SEEK_CUR, &pos) != CELL_FS_SUCCEEDED)
321 return -1;
322 return 0;
323 #else
324 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
325 if ((stream->hintscxx . . $ RFILE#hints. & RFILE_HINT_UNBUFFEREDcxx . . $ RFILE_HINT_UNBUFFERED.) == 0)
326 return ftellcxx . . $ ftell(1dcafcd8ef4c6e6c).(stream->fpcxx . . $ RFILE#fp.);
327 else
328 #endif
329 #ifdef HAVE_MMAP
330 /* Need to check stream->mapped because this function
331 * is called in filestream_open() */
332 if (stream->mapped && stream->hints & RFILE_HINT_MMAP)
333 return stream->mappos;
334 else
335 #endif
336 return lseekcxx . . $ lseek(f1afe674ac17c82e).(stream->fdcxx . . $ RFILE#fd., 0, SEEK_CURcxx . . $ `<external>/14710646456994434043/fcntl.h:138:10`!);
337 #endif
338 }
339
340 void filestream_rewindcxx . . $ filestream_rewind(3c4b55969f06ce5a).(RFILEcxx . . $ RFILE# *stream)
341 {
342 filestream_seekcxx . . $ filestream_seek(3ba5ec69a3eac100).(stream, 0L, SEEK_SETcxx . . $ `<external>/14710646456994434043/fcntl.h:137:10`!);
343 }
344
345 ssize_tcxx . . $ ssize_t# filestream_readcxx . . $ filestream_read(c96c610afba7cf57).(RFILEcxx . . $ RFILE# *stream, void *s, size_t len)
346 {
347 if (!stream || !s)
348 return -1;
349 #if defined(VITA) || defined(PSP)
350 return sceIoRead(stream->fd, s, len);
351 #elif defined(__CELLOS_LV2__)
352 uint64_t bytes_written;
353 if (cellFsRead(stream->fd, s, len, &bytes_written) != CELL_FS_SUCCEEDED)
354 return -1;
355 return bytes_written;
356 #else
357 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
358 if ((stream->hintscxx . . $ RFILE#hints. & RFILE_HINT_UNBUFFEREDcxx . . $ RFILE_HINT_UNBUFFERED.) == 0)
359 return freadcxx . . $ fread(738fc8ac1d711e58).(s, 1, len, stream->fpcxx . . $ RFILE#fp.);
360 else
361 #endif
362 #ifdef HAVE_MMAP
363 if (stream->hints & RFILE_HINT_MMAP)
364 {
365 if (stream->mappos > stream->mapsize)
366 return -1;
367
368 if (stream->mappos + len > stream->mapsize)
369 len = stream->mapsize - stream->mappos;
370
371 memcpy(s, &stream->mapped[stream->mappos], len);
372 stream->mappos += len;
373
374 return len;
375 }
376 else
377 #endif
378 return readcxx . . $ read(7e34d0a36f355389).(stream->fdcxx . . $ RFILE#fd., s, len);
379 #endif
380 }
381
382 ssize_tcxx . . $ ssize_t# filestream_writecxx . . $ filestream_write(219cf578744d1f0e).(RFILEcxx . . $ RFILE# *stream, const void *s, size_t len)
383 {
384 if (!stream)
385 return -1;
386 #if defined(VITA) || defined(PSP)
387 return sceIoWrite(stream->fd, s, len);
388 #elif defined(__CELLOS_LV2__)
389 uint64_t bytes_written;
390 if (cellFsWrite(stream->fd, s, len, &bytes_written) != CELL_FS_SUCCEEDED)
391 return -1;
392 return bytes_written;
393 #else
394 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
395 if ((stream->hintscxx . . $ RFILE#hints. & RFILE_HINT_UNBUFFEREDcxx . . $ RFILE_HINT_UNBUFFERED.) == 0)
396 return fwritecxx . . $ fwrite(ab0609fa07c47d6e).(s, 1, len, stream->fpcxx . . $ RFILE#fp.);
397 else
398 #endif
399 #ifdef HAVE_MMAP
400 if (stream->hints & RFILE_HINT_MMAP)
401 return -1;
402 else
403 #endif
404 return writecxx . . $ write(41184a59d38b4f65).(stream->fdcxx . . $ RFILE#fd., s, len);
405 #endif
406 }
407
408 int filestream_closecxx . . $ filestream_close(3edcd12cab33f13c).(RFILEcxx . . $ RFILE# *stream)
409 {
410 if (!stream)
411 return -1;
412
413 #if defined(VITA) || defined(PSP)
414 if (stream->fd > 0)
415 sceIoClose(stream->fd);
416 #elif defined(__CELLOS_LV2__)
417 if (stream->fd > 0)
418 cellFsClose(stream->fd);
419 #else
420 #if defined(HAVE_BUFFERED_IOcxx . . $ `libretro-common/streams/file_stream.c:70:9`!)
421 if ((stream->hintscxx . . $ RFILE#hints. & RFILE_HINT_UNBUFFEREDcxx . . $ RFILE_HINT_UNBUFFERED.) == 0)
422 {
423 if (stream->fpcxx . . $ RFILE#fp.)
424 fclosecxx . . $ fclose(89bc1efcdac0ca22).(stream->fpcxx . . $ RFILE#fp.);
425 }
426 else
427 #endif
428 #ifdef HAVE_MMAP
429 if (stream->hints & RFILE_HINT_MMAP)
430 munmap(stream->mapped, stream->mapsize);
431 #endif
432
433 if (stream->fdcxx . . $ RFILE#fd. > 0)
434 closecxx . . $ close(7864480464b09eea).(stream->fdcxx . . $ RFILE#fd.);
435 #endif
436 freecxx . . $ free(5d22bdacc48458e8).(stream);
437
438 return 0;
439 }
440
441 /**
442 * filestream_read_file:
443 * @path : path to file.
444 * @buf : buffer to allocate and read the contents of the
445 * file into. Needs to be freed manually.
446 *
447 * Read the contents of a file into @buf.
448 *
449 * Returns: number of items read, -1 on error.
450 */
451 int filestream_read_filecxx . . $ filestream_read_file(6440f34c71310b70).(const char *path, void **buf, ssize_tcxx . . $ ssize_t# *len)
452 {
453 ssize_tcxx . . $ ssize_t# ret = 0;
454 ssize_tcxx . . $ ssize_t# content_buf_size = 0;
455 void *content_buf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
456 RFILEcxx . . $ RFILE# *file = filestream_opencxx . . $ filestream_open(5289339e9c722221).(path, RFILE_MODE_READcxx . . $ RFILE_MODE_READ., -1);
457
458 if (!file)
459 {
460 #if __STDC_VERSION__cxx . . $ `<built-in>:404:9`! >= 199901L
461 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: Failed to open %s: %s\n", __FUNCTION__, path, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
462 #else
463 fprintf(stderr, "Failed to open %s: %s\n", path, strerror(errno));
464 #endif
465 goto error;
466 }
467
468 if (filestream_seekcxx . . $ filestream_seek(3ba5ec69a3eac100).(file, 0, SEEK_ENDcxx . . $ `<external>/14710646456994434043/fcntl.h:139:10`!) != 0)
469 goto error;
470
471 content_buf_size = filestream_tellcxx . . $ filestream_tell(fb7f681fccbdceb6).(file);
472 if (content_buf_size < 0)
473 goto error;
474
475 filestream_rewindcxx . . $ filestream_rewind(3c4b55969f06ce5a).(file);
476
477 content_buf = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(content_buf_size + 1);
478
479 if (!content_buf)
480 goto error;
481
482 ret = filestream_readcxx . . $ filestream_read(c96c610afba7cf57).(file, content_buf, content_buf_size);
483 if (ret < 0)
484 {
485 #if __STDC_VERSION__cxx . . $ `<built-in>:404:9`! >= 199901L
486 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: Failed to read %s: %s\n", __FUNCTION__, path, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
487 #else
488 fprintf(stderr, "Failed to read %s: %s\n", path, strerror(errno));
489 #endif
490 goto error;
491 }
492
493 filestream_closecxx . . $ filestream_close(3edcd12cab33f13c).(file);
494
495 *buf = content_buf;
496
497 /* Allow for easy reading of strings to be safe.
498 * Will only work with sane character formatting (Unix). */
499 ((char*)content_buf)[content_buf_size] = '\0';
500
501 if (len)
502 *len = ret;
503
504 return 1;
505
506 error:
507 if (file)
508 filestream_closecxx . . $ filestream_close(3edcd12cab33f13c).(file);
509 if (content_buf)
510 freecxx . . $ free(5d22bdacc48458e8).(content_buf);
511 if (len)
512 *len = -1;
513 *buf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
514 return 0;
515 }
516
517 /**
518 * filestream_write_file:
519 * @path : path to file.
520 * @data : contents to write to the file.
521 * @size : size of the contents.
522 *
523 * Writes data to a file.
524 *
525 * Returns: true (1) on success, false (0) otherwise.
526 */
527 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! filestream_write_filecxx . . $ filestream_write_file(687a2a5ef442d8f6).(const char *path, const void *data, ssize_tcxx . . $ ssize_t# size)
528 {
529 ssize_tcxx . . $ ssize_t# ret = 0;
530 RFILEcxx . . $ RFILE# *file = filestream_opencxx . . $ filestream_open(5289339e9c722221).(path, RFILE_MODE_WRITEcxx . . $ RFILE_MODE_WRITE., -1);
531 if (!file)
532 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
533
534 ret = filestream_writecxx . . $ filestream_write(219cf578744d1f0e).(file, data, size);
535 filestream_closecxx . . $ filestream_close(3edcd12cab33f13c).(file);
536
537 return (ret == size);
538 }