file_posix.c | file_posix.c | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
#include "util/logging.h" | #include "util/logging.h" | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
static void file_close_linux(AACS_FILE_H *file) | static void file_close_linux(AACS_FILE_H *file) | |||
{ | { | |||
if (file) { | if (file) { | |||
fclose((FILE *)file->internal); | fclose((FILE *)file->internal); | |||
DEBUG(DBG_FILE, "Closed LINUX file (%p)\n", file); | DEBUG(DBG_FILE, "Closed LINUX file (%p)\n", (void*)file); | |||
X_FREE(file); | X_FREE(file); | |||
} | } | |||
} | } | |||
static int64_t file_seek_linux(AACS_FILE_H *file, int64_t offset, int32_t o rigin) | static int64_t file_seek_linux(AACS_FILE_H *file, int64_t offset, int32_t o rigin) | |||
{ | { | |||
#if defined(__MINGW32__) | #if defined(__MINGW32__) | |||
return fseeko64((FILE *)file->internal, offset, origin); | return fseeko64((FILE *)file->internal, offset, origin); | |||
#else | #else | |||
skipping to change at line 85 | skipping to change at line 85 | |||
static int64_t file_write_linux(AACS_FILE_H *file, const uint8_t *buf, int6 4_t size) | static int64_t file_write_linux(AACS_FILE_H *file, const uint8_t *buf, int6 4_t size) | |||
{ | { | |||
return fwrite(buf, 1, size, (FILE *)file->internal); | return fwrite(buf, 1, size, (FILE *)file->internal); | |||
} | } | |||
static AACS_FILE_H *file_open_linux(const char* filename, const char *mode) | static AACS_FILE_H *file_open_linux(const char* filename, const char *mode) | |||
{ | { | |||
FILE *fp = NULL; | FILE *fp = NULL; | |||
AACS_FILE_H *file = malloc(sizeof(AACS_FILE_H)); | AACS_FILE_H *file = malloc(sizeof(AACS_FILE_H)); | |||
DEBUG(DBG_FILE, "Opening LINUX file %s... (%p)\n", filename, file); | DEBUG(DBG_FILE, "Opening LINUX file %s... (%p)\n", filename, (void*)fil e); | |||
file->close = file_close_linux; | file->close = file_close_linux; | |||
file->seek = file_seek_linux; | file->seek = file_seek_linux; | |||
file->read = file_read_linux; | file->read = file_read_linux; | |||
file->write = file_write_linux; | file->write = file_write_linux; | |||
file->tell = file_tell_linux; | file->tell = file_tell_linux; | |||
file->eof = file_eof_linux; | file->eof = file_eof_linux; | |||
if ((fp = fopen(filename, mode))) { | if ((fp = fopen(filename, mode))) { | |||
file->internal = fp; | file->internal = fp; | |||
return file; | return file; | |||
} | } | |||
DEBUG(DBG_FILE, "Error opening file %s ! (%p)\n", filename, file); | DEBUG(DBG_FILE, "Error opening file %s ! (%p)\n", filename, (void*)file ); | |||
X_FREE(file); | X_FREE(file); | |||
return NULL; | return NULL; | |||
} | } | |||
AACS_FILE_H* (*file_open)(const char* filename, const char *mode) = file_op en_linux; | AACS_FILE_H* (*file_open)(const char* filename, const char *mode) = file_op en_linux; | |||
AACS_FILE_OPEN aacs_register_file(AACS_FILE_OPEN p) | AACS_FILE_OPEN aacs_register_file(AACS_FILE_OPEN p) | |||
{ | { | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |