mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-23 00:36:42 -10:00
intfstream_read_at reads at an offset and leaves the stream's position where it was: files and memory streams without touching the stream, so from several threads at once, CHD tracks by seeking there and back. The buffered stream reads from the file and keeps its window, and its own refills and wide reads go to the file at the offset. memstream_read_at backs memory streams. The CUE/ISO serial detectors read their probes this way. The zip reader takes its end records, directory, local headers and member chunks with one read at the offset each, where the file has them; the reads the stream lends from stay as they are. The Windows second handle is opened relative to the stream's own with an empty name through ntdll's NtCreateFile on every NT. From Vista on that is what ReOpenFile does; before it the handle is kept only when its volume and file index match the stream's, else the path reopen follows. Lanes: intfstream_read_at_test (file, buffered, memory; four threads), vfs_positional_ntverify_test (the check, on any version); archive_zip64 counts reads at offsets as reads through the stream.
64 lines
1.6 KiB
Makefile
64 lines
1.6 KiB
Makefile
include ../../sample_objdir.mk
|
|
|
|
TARGET := intfstream_read_at_test$(EXE)
|
|
.DEFAULT_GOAL := all
|
|
|
|
LIBRETRO_COMM_DIR := ../../..
|
|
|
|
SOURCES := \
|
|
intfstream_read_at_test.c \
|
|
$(LIBRETRO_COMM_DIR)/streams/file_stream.c \
|
|
$(LIBRETRO_COMM_DIR)/streams/interface_stream.c \
|
|
$(LIBRETRO_COMM_DIR)/streams/memory_stream.c \
|
|
$(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.c \
|
|
$(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c \
|
|
$(LIBRETRO_COMM_DIR)/file/file_path.c \
|
|
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
|
|
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
|
|
$(LIBRETRO_COMM_DIR)/string/rstrtod.c \
|
|
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \
|
|
$(LIBRETRO_COMM_DIR)/rthreads/rthreads.c \
|
|
$(LIBRETRO_COMM_DIR)/rthreads/retro_eventcount.c \
|
|
$(LIBRETRO_COMM_DIR)/features/features_cpu.c \
|
|
$(LIBRETRO_COMM_DIR)/time/rtime.c
|
|
|
|
OBJS := $(call sample_objs,$(SOURCES:.c=.o))
|
|
|
|
CFLAGS += -Wall -pedantic -std=gnu99 -g1 -O0 \
|
|
-I$(LIBRETRO_COMM_DIR)/include -DHAVE_THREADS
|
|
|
|
ifneq ($(SANITIZER),)
|
|
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer $(CFLAGS)
|
|
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
|
|
endif
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
LDLIBS += -lwinmm
|
|
else
|
|
LDLIBS += -lpthread
|
|
endif
|
|
|
|
all: $(TARGET)
|
|
|
|
%.o: %.c
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
$(SAMPLE_OBJDIR)/%.o: $$(call sample_src,$$*).c
|
|
@mkdir -p $(@D)
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
$(TARGET): $(OBJS)
|
|
$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
|
|
|
check: $(TARGET)
|
|
./$(TARGET)
|
|
|
|
clean:
|
|
rm -rf $(SAMPLE_OBJDIR)
|
|
rm -f $(TARGET) $(OBJS)
|
|
|
|
.PHONY: all check clean
|