1.1 --- a/librazor/test-pfu.c Fri Oct 17 10:13:48 2014 +0100
1.2 +++ b/librazor/test-pfu.c Mon Jul 04 10:48:18 2016 +0100
1.3 @@ -1,5 +1,5 @@
1.4 /*
1.5 - * Copyright (C) 2014 J. Ali Harlow <ali@juiblex.co.uk>
1.6 + * Copyright (C) 2014, 2016 J. Ali Harlow <ali@juiblex.co.uk>
1.7 *
1.8 * This program is free software; you can redistribute it and/or modify
1.9 * it under the terms of the GNU General Public License as published by
1.10 @@ -26,17 +26,18 @@
1.11 #endif
1.12 #include "razor.h"
1.13
1.14 -int is_ascii_letter(char c)
1.15 +#ifdef MSWIN_API
1.16 +static int is_ascii_letter(char c)
1.17 {
1.18 return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
1.19 }
1.20
1.21 -int is_slash(char c)
1.22 +static int is_slash(char c)
1.23 {
1.24 return c == '/' || c == '\\';
1.25 }
1.26
1.27 -const char *mswin_path(const char *path)
1.28 +static const char *mswin_path(const char *path)
1.29 {
1.30 if (path == NULL)
1.31 return NULL;
1.32 @@ -47,8 +48,9 @@
1.33
1.34 return path;
1.35 }
1.36 +#endif
1.37
1.38 -int path_cmp(const char *p1, const char *p2)
1.39 +static int path_cmp(const char *p1, const char *p2)
1.40 {
1.41 #ifdef MSWIN_API
1.42 while(*p1 && *p2) {
1.43 @@ -65,12 +67,13 @@
1.44 #endif
1.45 }
1.46
1.47 -int test_pfu(const char *url, const char *path)
1.48 +static int test_pfu(const char *uri, const char *path)
1.49 {
1.50 char *s;
1.51 int r;
1.52 + struct razor_error *error = NULL;
1.53
1.54 - s = razor_path_from_url(url);
1.55 + s = razor_path_from_uri(uri, &error);
1.56
1.57 #ifdef MSWIN_API
1.58 path = mswin_path(path);
1.59 @@ -82,18 +85,21 @@
1.60 r = (s != path);
1.61
1.62 if (r) {
1.63 - fprintf(stderr, "Fail: razor_path_from_url(\"%s\")", url);
1.64 + fprintf(stderr, "Fail: razor_path_from_uri(\"%s\")", uri);
1.65 if (s)
1.66 fprintf(stderr, " returns \"%s\", expected", s);
1.67 else
1.68 - fprintf(stderr, " returns NULL, expected");
1.69 + fprintf(stderr, " fails (%s), expected",
1.70 + razor_error_get_msg(error));
1.71 if (path)
1.72 fprintf(stderr, " \"%s\"\n", path);
1.73 else
1.74 - fprintf(stderr, " NULL\n");
1.75 + fprintf(stderr, " failure\n");
1.76 }
1.77
1.78 free(s);
1.79 + if (error)
1.80 + razor_error_free(error);
1.81
1.82 return r;
1.83 }
1.84 @@ -101,7 +107,7 @@
1.85 #ifdef MSWIN_API
1.86 UINT saved_cp;
1.87
1.88 -void cleanup_on_exit(void)
1.89 +static void cleanup_on_exit(void)
1.90 {
1.91 SetConsoleOutputCP(saved_cp);
1.92 }