From 0b2f96443edcf3744941a278a49c7513c505d167 Mon Sep 17 00:00:00 2001 From: jonasbn Date: Sat, 25 Jan 2025 15:19:14 +0100 Subject: [PATCH 1/2] Addressed compiler warning: comparing a pointer to a null character constant; did you mean to compare to NULL? [-Wpointer-compare] --- src/main.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.m b/src/main.m index 020bddb..0f8af4d 100644 --- a/src/main.m +++ b/src/main.m @@ -52,7 +52,7 @@ int main(int argc, const char *argv[]) { // Get current HTTP handler NSString *current_handler_name = get_current_http_handler(); - if (target == '\0') { + if (target == nil) { // List all HTTP handlers, marking the current one with a star for (NSString *key in handlers) { char *mark = [key caseInsensitiveCompare:current_handler_name] == NSOrderedSame ? "* " : " "; From e33c6b07173711c0b0e004d5986dc73558390242 Mon Sep 17 00:00:00 2001 From: jonasbn Date: Thu, 30 Jan 2025 05:34:21 +0100 Subject: [PATCH 2/2] Updated PR, since I had been a tad too fast for my own good submitting the PR --- src/main.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.m b/src/main.m index 0f8af4d..d6e015b 100644 --- a/src/main.m +++ b/src/main.m @@ -43,7 +43,7 @@ void set_default_handler(NSString *url_scheme, NSString *handler) { } int main(int argc, const char *argv[]) { - const char *target = (argc == 1) ? '\0' : argv[1]; + NSString *target = (argc > 1) ? [NSString stringWithUTF8String:argv[1]] : nil; @autoreleasepool { // Get all HTTP handlers @@ -59,10 +59,10 @@ int main(int argc, const char *argv[]) { printf("%s%s\n", mark, [key UTF8String]); } } else { - NSString *target_handler_name = [NSString stringWithUTF8String:target]; + NSString *target_handler_name = target; if ([target_handler_name caseInsensitiveCompare:current_handler_name] == NSOrderedSame) { - printf("%s is already set as the default HTTP handler\n", target); + printf("%s is already set as the default HTTP handler\n", [target UTF8String]); } else { NSString *target_handler = handlers[target_handler_name]; @@ -71,7 +71,7 @@ int main(int argc, const char *argv[]) { set_default_handler(@"http", target_handler); set_default_handler(@"https", target_handler); } else { - printf("%s is not available as an HTTP handler\n", target); + printf("%s is not available as an HTTP handler\n", [target UTF8String]); return 1; }