From 9220a9a31375a5c36ab65a309a81b5a464cf20a4 Mon Sep 17 00:00:00 2001 From: maxcodehack Date: Thu, 17 Dec 2020 13:43:15 +0000 Subject: [PATCH] uPDF: - Can open files with space in name - Move getrusage stub to libopenjpeg git-svn-id: svn://kolibrios.org@8438 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/media/updf/apps/Makefile | 4 ++-- contrib/media/updf/apps/kolibri.h | 1 + contrib/media/updf/apps/kos_main.c | 22 ++++++++++++++-------- contrib/media/updf/apps/pdfapp.c | 2 +- contrib/media/updf/apps/pdfapp.h | 2 +- contrib/media/updf/apps/resource.h | 23 ----------------------- contrib/media/updf/libopenjpeg/j2k_lib.c | 3 ++- 7 files changed, 21 insertions(+), 36 deletions(-) delete mode 100755 contrib/media/updf/apps/resource.h diff --git a/contrib/media/updf/apps/Makefile b/contrib/media/updf/apps/Makefile index 3cd4810061..59309afb2d 100755 --- a/contrib/media/updf/apps/Makefile +++ b/contrib/media/updf/apps/Makefile @@ -12,9 +12,9 @@ LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib -L ../lib APPS_SRC := $(notdir $(wildcard *.c)) default: $(patsubst %.c,%.o,$(APPS_SRC)) - $(LD) $(LDFLAGS) $(LIBPATH) -o updf kolibri.o pdfapp.o kos_main.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lc.dll -lopenjpeg -lz -lc -lsyscall --subsystem native + $(LD) $(LDFLAGS) $(LIBPATH) -o updf kolibri.o pdfapp.o kos_main.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lopenjpeg -lz -lc.dll -lsyscall --subsystem native # yet not work -# $(LD) $(LDFLAGS) $(LIBPATH) -o pdfdraw kolibri.o pdfapp.o pdfdraw.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lc.dll -lopenjpeg -lz -lc -lsyscall --subsystem native +# $(LD) $(LDFLAGS) $(LIBPATH) -o pdfdraw kolibri.o pdfapp.o pdfdraw.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lopenjpeg -lz -lc.dll -lsyscall --subsystem native objcopy updf -O binary diff --git a/contrib/media/updf/apps/kolibri.h b/contrib/media/updf/apps/kolibri.h index 93c7acd14d..4e718397b8 100644 --- a/contrib/media/updf/apps/kolibri.h +++ b/contrib/media/updf/apps/kolibri.h @@ -148,3 +148,4 @@ int kol_clip_set(int n, char buffer[]); void kos_blit(int dstx, int dsty, int w, int h, int srcx, int srcy,int srcw, int srch, int stride, char *d); int kos_random(int num); +int kos_get_mouse_wheels(void); diff --git a/contrib/media/updf/apps/kos_main.c b/contrib/media/updf/apps/kos_main.c index 075fac6fb6..d008c373d2 100644 --- a/contrib/media/updf/apps/kos_main.c +++ b/contrib/media/updf/apps/kos_main.c @@ -1,6 +1,3 @@ -// getrusage -#include "resource.h" - #include #include "fitz.h" #include "mupdf.h" @@ -94,9 +91,8 @@ char *winpassword(pdfapp_t *app, char *filename) } -void wintitle(pdfapp_t *app, char *s) +void wintitle(pdfapp_t *app, char *s, char param[]) { - char* param = *(char**)0x1C; sprintf(Title,"%s - uPDF", strrchr(param, '/') + 1 ); } @@ -368,13 +364,20 @@ int main (int argc, char* argv[]) { char ii, mouse_wheels_state; + // argv without spaces + char full_argv[1024]; + for (int i = 1; i 2) continue; //fix rolled up + + // ?? Form.client_width++; //fix for Menuet kernel bug Form.client_height++; //fix for Menuet kernel bug + DrawWindow(); break; diff --git a/contrib/media/updf/apps/pdfapp.c b/contrib/media/updf/apps/pdfapp.c index acea0b4dd2..b4488c41bb 100644 --- a/contrib/media/updf/apps/pdfapp.c +++ b/contrib/media/updf/apps/pdfapp.c @@ -347,7 +347,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai { sprintf(buf, "%s - %d/%d (%d dpi)", app->doctitle, app->pageno, app->pagecount, app->resolution); - wintitle(app, buf); + /// wintitle(app, buf); ctm = pdfapp_viewctm(app); bbox = fz_round_rect(fz_transform_rect(ctm, app->page_bbox)); diff --git a/contrib/media/updf/apps/pdfapp.h b/contrib/media/updf/apps/pdfapp.h index 8efb4d3872..0aec8d0eea 100644 --- a/contrib/media/updf/apps/pdfapp.h +++ b/contrib/media/updf/apps/pdfapp.h @@ -13,7 +13,7 @@ enum { ARROW, HAND, WAIT }; extern void winwarn(pdfapp_t*, char *s); extern void winerror(pdfapp_t*, fz_error error); -extern void wintitle(pdfapp_t*, char *title); +extern void wintitle(pdfapp_t*, char *title, char param[]); extern void winresize(pdfapp_t*, int w, int h); extern void winrepaint(pdfapp_t*); extern void winrepaintsearch(pdfapp_t*); diff --git a/contrib/media/updf/apps/resource.h b/contrib/media/updf/apps/resource.h deleted file mode 100755 index 392295123b..0000000000 --- a/contrib/media/updf/apps/resource.h +++ /dev/null @@ -1,23 +0,0 @@ -#include - -struct rusage { - struct timeval ru_utime; /* user time used */ - struct timeval ru_stime; /* system time used */ - long ru_maxrss; /* integral max resident set size */ - long ru_ixrss; /* integral shared text memory size */ - long ru_idrss; /* integral unshared data size */ - long ru_isrss; /* integral unshared stack size */ - long ru_minflt; /* page reclaims */ - long ru_majflt; /* page faults */ - long ru_nswap; /* swaps */ - long ru_inblock; /* block input operations */ - long ru_oublock; /* block output operations */ - long ru_msgsnd; /* messages sent */ - long ru_msgrcv; /* messages received */ - long ru_nsignals; /* signals received */ - long ru_nvcsw; /* voluntary context switches */ - long ru_nivcsw; /* involuntary context switches */ -}; - -/// STUB /// -int getrusage(int _who, struct rusage *_rusage) {}; diff --git a/contrib/media/updf/libopenjpeg/j2k_lib.c b/contrib/media/updf/libopenjpeg/j2k_lib.c index d815f166dd..c6b1eb2151 100755 --- a/contrib/media/updf/libopenjpeg/j2k_lib.c +++ b/contrib/media/updf/libopenjpeg/j2k_lib.c @@ -48,7 +48,8 @@ double opj_clock(void) { struct rusage t; double procTime; /* (1) Get the rusage data structure at this moment (man getrusage) */ - getrusage(0,&t); + /// STUB /// + /// getrusage(0,&t); /* (2) What is the elapsed time ? - CPU time = User time + System time */ /* (2a) Get the seconds */ procTime = t.ru_utime.tv_sec + t.ru_stime.tv_sec;