DXGL r272 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r271
|
r272
|
r273
>
Date:
16:51, 20 October 2012
Author:
admin
Status:
new
Tags:
Comment:
minilibc: Add fclose and _fcloseall
Modified paths:
/minilibc/file.c
(modified) (
history
)
Diff
[
purge
]
Index: minilibc/file.c
—
—
@@ -293,3 +293,42 @@
294
294
}
295
295
return (FILE*)&minilibc_files[ptr];
296
296
}
297
+
298
+
299
+int fclose(FILE *stream)
300
+{
301
+ minilibc_FILE *file;
302
+ if(!stream)
303
+ {
304
+ errno = EINVAL;
305
+ return EOF;
306
+ }
307
+ file = (minilibc_FILE *)stream;
308
+ if(file->handle == INVALID_HANDLE_VALUE)
309
+ {
310
+ errno = EINVAL;
311
+ return EOF;
312
+ }
313
+ if(!CloseHandle(file->handle))
314
+ {
315
+ errno = EINVAL;
316
+ return EOF;
317
+ }
318
+ return 0;
319
+}
320
+
321
+int _fcloseall()
322
+{
323
+ int i;
324
+ int count;
325
+ if(!minilibc_files) return 0;
326
+ for(i = 0; i < filecount; i++)
327
+ {
328
+ if(!fclose((FILE*)&minilibc_files[i])) count++;
329
+ }
330
+ free(minilibc_files);
331
+ minilibc_files = NULL;
332
+ filecount = 0;
333
+ maxfiles = 0;
334
+ return count;
335
+}
\ No newline at end of file
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version