MCPcopy Create free account
hub / github.com/cppla/ServerStatus / io_open

Function io_open

server/src/system.c:270–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270IOHANDLE io_open(const char *filename, int flags)
271{
272 if(flags == IOFLAG_READ)
273 {
274 #if defined(CONF_FAMILY_WINDOWS)
275 // check for filename case sensitive
276 WIN32_FIND_DATA finddata;
277 HANDLE handle;
278 int length;
279
280 length = str_length(filename);
281 if(!filename || !length || filename[length-1] == '\\')
282 return 0x0;
283 handle = FindFirstFile(filename, &finddata);
284 if(handle == INVALID_HANDLE_VALUE)
285 return 0x0;
286 else if(str_comp(filename+length-str_length(finddata.cFileName), finddata.cFileName) != 0)
287 {
288 FindClose(handle);
289 return 0x0;
290 }
291 FindClose(handle);
292 #endif
293 return (IOHANDLE)fopen(filename, "rb");
294 }
295 if(flags == IOFLAG_WRITE)
296 return (IOHANDLE)fopen(filename, "wb");
297 return 0x0;
298}
299
300unsigned io_read(IOHANDLE io, void *buffer, unsigned size)
301{

Callers 4

dbg_logger_fileFunction · 0.85
mem_debug_dumpFunction · 0.85
JSONUpdateThreadMethod · 0.85
ReadConfigMethod · 0.85

Calls 2

str_lengthFunction · 0.85
str_compFunction · 0.85

Tested by

no test coverage detected