Add ini.h, extra win32 functions, clean up formats

This commit is contained in:
Doyle Thai 2017-04-15 01:27:11 +10:00
parent e0cae3029d
commit f066d8bc4e
2 changed files with 1345 additions and 197 deletions

1490
dqn.h

File diff suppressed because it is too large Load Diff

View File

@ -729,9 +729,13 @@ void dqn_darray_test()
void dqn_file_test() void dqn_file_test()
{ {
// File i/o // File i/o
{
{ {
DqnFile file = {}; DqnFile file = {};
DQN_ASSERT(dqn_file_open(".clang-format", &file)); DQN_ASSERT(dqn_file_open(
".clang-format", &file,
(dqnfilepermissionflag_write | dqnfilepermissionflag_read),
dqnfileaction_open_only));
DQN_ASSERT(file.size == 1320); DQN_ASSERT(file.size == 1320);
u8 *buffer = (u8 *)calloc(1, (size_t)file.size * sizeof(u8)); u8 *buffer = (u8 *)calloc(1, (size_t)file.size * sizeof(u8));
@ -739,10 +743,22 @@ void dqn_file_test()
free(buffer); free(buffer);
dqn_file_close(&file); dqn_file_close(&file);
DQN_ASSERT(!file.handle && file.size == 0); DQN_ASSERT(!file.handle && file.size == 0 &&
file.permissionFlags == 0);
}
{
DqnFile file = {};
DQN_ASSERT(!dqn_file_open(
"asdljasdnel;kajdf", &file,
(dqnfilepermissionflag_write | dqnfilepermissionflag_read),
dqnfileaction_open_only));
DQN_ASSERT(file.size == 0);
DQN_ASSERT(file.permissionFlags == 0);
DQN_ASSERT(!file.handle);
printf("dqn_file_test(): file_io: Completed successfully\n"); printf("dqn_file_test(): file_io: Completed successfully\n");
} }
}
{ {
u32 numFiles; u32 numFiles;