diff -r 5576a85e174a -r 4204db81cdbc librazor/test-pfu.c --- a/librazor/test-pfu.c Fri Oct 17 10:13:48 2014 +0100 +++ b/librazor/test-pfu.c Thu Jul 07 15:17:29 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 J. Ali Harlow + * Copyright (C) 2014, 2016 J. Ali Harlow * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,17 +26,18 @@ #endif #include "razor.h" -int is_ascii_letter(char c) +#ifdef MSWIN_API +static int is_ascii_letter(char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } -int is_slash(char c) +static int is_slash(char c) { return c == '/' || c == '\\'; } -const char *mswin_path(const char *path) +static const char *mswin_path(const char *path) { if (path == NULL) return NULL; @@ -47,8 +48,9 @@ return path; } +#endif -int path_cmp(const char *p1, const char *p2) +static int path_cmp(const char *p1, const char *p2) { #ifdef MSWIN_API while(*p1 && *p2) { @@ -65,12 +67,13 @@ #endif } -int test_pfu(const char *url, const char *path) +static int test_pfu(const char *uri, const char *path) { char *s; int r; + struct razor_error *error = NULL; - s = razor_path_from_url(url); + s = razor_path_from_uri(uri, &error); #ifdef MSWIN_API path = mswin_path(path); @@ -82,18 +85,21 @@ r = (s != path); if (r) { - fprintf(stderr, "Fail: razor_path_from_url(\"%s\")", url); + fprintf(stderr, "Fail: razor_path_from_uri(\"%s\")", uri); if (s) fprintf(stderr, " returns \"%s\", expected", s); else - fprintf(stderr, " returns NULL, expected"); + fprintf(stderr, " fails (%s), expected", + razor_error_get_msg(error)); if (path) fprintf(stderr, " \"%s\"\n", path); else - fprintf(stderr, " NULL\n"); + fprintf(stderr, " failure\n"); } free(s); + if (error) + razor_error_free(error); return r; } @@ -101,7 +107,7 @@ #ifdef MSWIN_API UINT saved_cp; -void cleanup_on_exit(void) +static void cleanup_on_exit(void) { SetConsoleOutputCP(saved_cp); }