diff options
-rw-r--r-- | platform/gl/gl-main.c | 5 | ||||
-rw-r--r-- | source/fitz/directory.c | 2 | ||||
-rw-r--r-- | source/fitz/tempfile.c | 54 | ||||
-rw-r--r-- | source/fitz/time.c | 4 | ||||
-rw-r--r-- | source/pdf/pdf-appearance.c | 2 |
5 files changed, 15 insertions, 52 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c index 338ed0dc..060b8e13 100644 --- a/platform/gl/gl-main.c +++ b/platform/gl/gl-main.c @@ -678,6 +678,7 @@ static void do_search_hits(int xofs, int yofs) static void do_forms(float xofs, float yofs) { + static int do_forms_tag = 0; pdf_ui_event event; fz_point p; int i; @@ -700,13 +701,13 @@ static void do_forms(float xofs, float yofs) if (pdf_pass_event(ctx, pdf, (pdf_page*)page, &event)) { if (pdf->focus) - ui.active = do_forms; + ui.active = &do_forms_tag; pdf_update_page(ctx, (pdf_page*)page); render_page(); ui_needs_update = 1; } } - else if (ui.active == do_forms && !ui.down) + else if (ui.active == &do_forms_tag && !ui.down) { ui.active = NULL; event.etype = PDF_EVENT_TYPE_POINTER; diff --git a/source/fitz/directory.c b/source/fitz/directory.c index 6e216c94..df42f83c 100644 --- a/source/fitz/directory.c +++ b/source/fitz/directory.c @@ -61,7 +61,7 @@ fz_is_directory(fz_context *ctx, const char *path) if (stat(path, &info) < 0) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot stat: %s", strerror(errno)); - return info.st_mode & S_IFDIR; + return S_ISDIR(info.st_mode); } fz_archive * diff --git a/source/fitz/tempfile.c b/source/fitz/tempfile.c index 7c2bb1ff..8465d61e 100644 --- a/source/fitz/tempfile.c +++ b/source/fitz/tempfile.c @@ -7,54 +7,12 @@ * if required. */ -#include <string.h> -#include <stdlib.h> -#include <stdio.h> /* for tempnam */ +#include <stdio.h> -/* For now, put temporary files with the hint. */ -#define USE_HINT_FOR_DIR - -#if defined(_WIN32) || defined(_WIN64) -#define DIRSEP '\\' -#else -#define DIRSEP '/' -#endif - -char *fz_tempfilename(fz_context *ctx, const char *base, const char *hint) +char *fz_tempfilename(fz_context *ctx, const char *base, const char *dir) { - char *tmp; - char *ret; - -#ifdef USE_HINT_FOR_DIR - char *hintpath; - size_t hintlen; - - hintlen = strlen(hint); - hintpath = fz_malloc(ctx, 1 + hintlen); - if (hint == NULL) - fz_throw(ctx, FZ_ERROR_GENERIC, "Failed to construct temporary file name"); - - while (hintlen > 0 && hint[hintlen-1] != DIRSEP) - hintlen--; - - if (hintlen > 0) - memcpy(hintpath, hint, hintlen); - hintpath[hintlen] = 0; - tmp = tempnam(hintlen > 0 ? hintpath : ".", base); - fz_free(ctx, hintpath); -#else - tmp = tempnam(".", base); -#endif - - if (tmp == NULL) - fz_throw(ctx, FZ_ERROR_GENERIC, "Failed to construct temporary file name"); - ret = fz_strdup(ctx, tmp); - - /* The value returned from tempnam is allocated using malloc. - * We must therefore free it using free. Real, honest to God - * free, not Memento_free, or other wrapped versions. - */ -#undef free - (free)(tmp); - return ret; + char *p = tmpnam(NULL); + if (!p) + fz_throw(ctx, FZ_ERROR_GENERIC, "cannot generate temporary file name"); + return fz_strdup(ctx, p); } diff --git a/source/fitz/time.c b/source/fitz/time.c index 82805556..99c0952c 100644 --- a/source/fitz/time.c +++ b/source/fitz/time.c @@ -159,4 +159,8 @@ fz_free_argv(int argc, char **argv) free(argv); } +#else + +int fz_time_dummy; + #endif /* _WIN32 */ diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c index e421b8dc..a6445d0d 100644 --- a/source/pdf/pdf-appearance.c +++ b/source/pdf/pdf-appearance.c @@ -2276,7 +2276,7 @@ static void draw_logo(fz_context *ctx, fz_path *path) fz_lineto(ctx, path, 95.25f, 117.749f); fz_curveto(ctx, path, 105.75f, 108.749f, 114.0f, 105.749f, 125.25f, 105.749f); fz_closepath(ctx, path); -}; +} static void insert_signature_appearance_layers(fz_context *ctx, pdf_document *doc, pdf_annot *annot) { |