Skip to content

Commit

Permalink
Purge unmaintained progressive loading code.
Browse files Browse the repository at this point in the history
The progressive loading and trylater mechanism adds a substantial
amount of complexity and special error handling to allow the
device interface to proceed in the face of exceptions.

The progressive loading only has a purpose for linearized files,
and has issues where it can get stuck in a state and never
progress. Since none of these issues have been reported by
users or customers, we can assume that nobody uses this
feature.

This code is notoriously fragile and difficult to get right,
and is a constant source of oss-fuzz bugs and assert errors.

Let's reduce the technical debt by removing this feature.
This commit removes the progressive loading and trylater
exceptions. Following commits will clean up and remove
the error handling that is no longer necessary.
  • Loading branch information
ccxvii committed Mar 22, 2019
1 parent b52af7a commit 2fbf8bc
Show file tree
Hide file tree
Showing 38 changed files with 36 additions and 3,763 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
[submodule "thirdparty/zlib"]
path = thirdparty/zlib
url = ../thirdparty-zlib.git
[submodule "thirdparty/curl"]
path = thirdparty/curl
url = ../thirdparty-curl.git
[submodule "thirdparty/freeglut"]
path = thirdparty/freeglut
url = ../thirdparty-freeglut.git
18 changes: 0 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ $(OUT)/generated/%.o : generated/%.c
$(OUT)/platform/x11/%.o : platform/x11/%.c
$(CC_CMD) -Wall $(X11_CFLAGS)

$(OUT)/platform/x11/curl/%.o : platform/x11/%.c
$(CC_CMD) -Wall $(X11_CFLAGS) $(CURL_CFLAGS) -DHAVE_CURL

$(OUT)/platform/gl/%.o : platform/gl/%.c
$(CC_CMD) -Wall $(THIRD_CFLAGS) $(GLUT_CFLAGS)

Expand Down Expand Up @@ -252,35 +249,20 @@ ifeq ($(HAVE_WIN32),yes)
VIEW_APPS += $(MUVIEW_WIN32_EXE)
endif

ifeq ($(HAVE_X11),yes)
ifeq ($(HAVE_CURL),yes)
MUVIEW_X11_CURL_EXE := $(OUT)/mupdf-x11-curl
MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/pdfapp.o
MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/x11_main.o
MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/x11_image.o
MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/curl_stream.o
$(MUVIEW_X11_CURL_EXE) : $(MUVIEW_X11_CURL_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB) $(CURL_LIB)
$(LINK_CMD) $(THIRD_LIBS) $(X11_LIBS) $(CURL_LIBS) $(LIBCRYPTO_LIBS)
VIEW_APPS += $(MUVIEW_X11_CURL_EXE)
endif
endif

# --- Generated dependencies ---

-include $(MUPDF_OBJ:%.o=%.d)
-include $(PKCS7_OBJ:%.o=%.d)
-include $(THREAD_OBJ:%.o=%.d)
-include $(THIRD_OBJ:%.o=%.d)
-include $(GLUT_OBJ:%.o=%.d)
-include $(CURL_OBJ:%.o=%.d)

-include $(MUTOOL_OBJ:%.o=%.d)
-include $(MUVIEW_GLUT_OBJ:%.o=%.d)
-include $(MUVIEW_X11_OBJ:%.o=%.d)
-include $(MUVIEW_WIN32_OBJ:%.o=%.d)

-include $(MURASTER_OBJ:%.o=%.d)
-include $(MUVIEW_X11_CURL_OBJ:%.o=%.d)

# --- Examples ---

Expand Down
6 changes: 0 additions & 6 deletions Makerules
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ else ifeq ($(OS),Linux)
SYS_ZLIB_LIBS := $(shell pkg-config --libs zlib)
endif

HAVE_CURL := $(shell pkg-config --exists libcurl && echo yes)
ifeq ($(HAVE_CURL),yes)
SYS_CURL_CFLAGS := $(shell pkg-config --cflags libcurl)
SYS_CURL_LIBS := $(shell pkg-config --libs libcurl)
endif

HAVE_GLUT := yes
ifeq ($(HAVE_GLUT),yes)
SYS_GLUT_CFLAGS :=
Expand Down
33 changes: 0 additions & 33 deletions Makethird
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ ifeq ($(USE_SYSTEM_LIBS),yes)
USE_SYSTEM_OPENJPEG := yes
USE_SYSTEM_ZLIB := yes
USE_SYSTEM_GLUT := yes
USE_SYSTEM_CURL := yes
endif

ifeq ($(OS),MACOS)
Expand Down Expand Up @@ -376,35 +375,3 @@ GLUT_CFLAGS := -Ithirdparty/freeglut/include
GLUT_LIBS := -lGL -lX11 -lXrandr

endif

# --- cURL ---

ifeq ($(USE_SYSTEM_CURL),yes)
CURL_CFLAGS := $(SYS_CURL_CFLAGS)
CURL_LIBS := $(SYS_CURL_LIBS)
else

CURL_SRC += $(sort $(wildcard thirdparty/curl/lib/*.c))
CURL_SRC += $(sort $(wildcard thirdparty/curl/lib/vauth/*.c))
CURL_SRC += $(sort $(wildcard thirdparty/curl/lib/vtls/*.c))

CURL_OBJ := $(CURL_SRC:%.c=$(OUT)/%.o)

LOCAL_CURL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CURL_CFLAGS += -DBUILDING_LIBCURL
LOCAL_CURL_CFLAGS += -DCURL_STATICLIB
LOCAL_CURL_CFLAGS += -DCURL_DISABLE_LDAP
LOCAL_CURL_CFLAGS += -Ithirdparty/curl/include
LOCAL_CURL_CFLAGS += -Ithirdparty/curl/lib

CURL_LIB := $(OUT)/libcurl.a

$(CURL_LIB): $(CURL_OBJ)

$(OUT)/thirdparty/curl/%.o: thirdparty/curl/%.c
$(CC_CMD) $(LOCAL_CURL_CFLAGS)

CURL_CFLAGS := -Ithirdparty/curl/include
CURL_LIBS := -lpthread

endif
Loading

0 comments on commit 2fbf8bc

Please sign in to comment.