From 8aa6e39cc0ad8973a6f2c078b91551bbfafee3cc Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sat, 14 Nov 2020 14:10:33 +0100 Subject: [PATCH 1/3] Fix several missing initializers in glib/tests/uri.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/uri.c:40:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 40 | { "/etc", NULL, "file:///etc"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:41:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 41 | { "/etc", "", "file:///etc"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:42:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 42 | { "/etc", "otherhost", "file://otherhost/etc"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:51:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 51 | { "/etc", "localhost", "file://localhost/etc"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:58:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 58 | { "/etc/\xE5\xE4\xF6", NULL, "file:///etc/%E5%E4%F6" }, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:59:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 59 | { "/etc/\xC3\xB6\xC3\xA4\xC3\xA5", NULL, "file:///etc/%C3%B6%C3%A4%C3%A5"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:63:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 63 | { "/etc/file with #%", NULL, "file:///etc/file%20with%20%23%25"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:68:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 68 | { "/0123456789", NULL, "file:///0123456789"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:69:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 69 | { "/ABCDEFGHIJKLMNOPQRSTUVWXYZ", NULL, "file:///ABCDEFGHIJKLMNOPQRSTUVWXYZ"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:70:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 70 | { "/abcdefghijklmnopqrstuvwxyz", NULL, "file:///abcdefghijklmnopqrstuvwxyz"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:71:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 71 | { "/-_.!~*'()", NULL, "file:///-_.!~*'()"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:77:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 77 | { "/\"#%<>[\\]^`{|}\x7F", NULL, "file:///%22%23%25%3C%3E%5B%5C%5D%5E%60%7B%7C%7D%7F"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:79:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 79 | { "/;@+$,", NULL, "file:///%3B@+$,"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:83:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 83 | { "/:", NULL, "file:///:"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:84:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 84 | { "/?&=", NULL, "file:///%3F&="}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:86:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 86 | { "/", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "file://ABCDEFGHIJKLMNOPQRSTUVWXYZ/"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:87:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’ 87 | { "/", "abcdefghijklmnopqrstuvwxyz", "file://abcdefghijklmnopqrstuvwxyz/"}, | ^ glib/tests/uri.c:35:17: note: ‘expected_error’ declared here 35 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:108:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’ 108 | { "file:///etc", "/etc"}, | ^ glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here 102 | char *expected_hostname; | ^~~~~~~~~~~~~~~~~ glib/tests/uri.c:109:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’ 109 | { "file:/etc", "/etc"}, | ^ glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here 102 | char *expected_hostname; | ^~~~~~~~~~~~~~~~~ glib/tests/uri.c:119:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’ 119 | { "file://localhost/etc", "/etc", "localhost"}, | ^ glib/tests/uri.c:103:17: note: ‘expected_error’ declared here 103 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:120:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’ 120 | { "file://localhost/etc/%23%25%20file", "/etc/#% file", "localhost"}, | ^ glib/tests/uri.c:103:17: note: ‘expected_error’ declared here 103 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:121:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’ 121 | { "file://localhost/\xE5\xE4\xF6", "/\xe5\xe4\xf6", "localhost"}, | ^ glib/tests/uri.c:103:17: note: ‘expected_error’ declared here 103 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:122:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’ 122 | { "file://localhost/%E5%E4%F6", "/\xe5\xe4\xf6", "localhost"}, | ^ glib/tests/uri.c:103:17: note: ‘expected_error’ declared here 103 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:124:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’ 124 | { "file://otherhost/etc", "/etc", "otherhost"}, | ^ glib/tests/uri.c:103:17: note: ‘expected_error’ declared here 103 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:125:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’ 125 | { "file://otherhost/etc/%23%25%20file", "/etc/#% file", "otherhost"}, | ^ glib/tests/uri.c:103:17: note: ‘expected_error’ declared here 103 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:127:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’ 127 | { "file:////etc/%C3%B6%C3%C3%C3%A5", "//etc/\xc3\xb6\xc3\xc3\xc3\xa5", NULL}, | ^ glib/tests/uri.c:103:17: note: ‘expected_error’ declared here 103 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:135:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’ 135 | { "file:////etc", "//etc"}, | ^ glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here 102 | char *expected_hostname; | ^~~~~~~~~~~~~~~~~ glib/tests/uri.c:136:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’ 136 | { "file://///etc", "///etc"}, | ^ glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here 102 | char *expected_hostname; | ^~~~~~~~~~~~~~~~~ glib/tests/uri.c:147:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’ 147 | { "file:///c:\\foo", "/c:\\foo"}, | ^ glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here 102 | char *expected_hostname; | ^~~~~~~~~~~~~~~~~ glib/tests/uri.c:148:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’ 148 | { "file:///c:/foo", "/c:/foo"}, | ^ glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here 102 | char *expected_hostname; | ^~~~~~~~~~~~~~~~~ glib/tests/uri.c:149:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’ 149 | { "file:////c:/foo", "//c:/foo"}, | ^ glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here 102 | char *expected_hostname; | ^~~~~~~~~~~~~~~~~ glib/tests/uri.c:152:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’ 152 | { "file://ABCDEFGHIJKLMNOPQRSTUVWXYZ/", "/", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"}, | ^ glib/tests/uri.c:103:17: note: ‘expected_error’ declared here 103 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ glib/tests/uri.c:153:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’ 153 | { "file://abcdefghijklmnopqrstuvwxyz/", "/", "abcdefghijklmnopqrstuvwxyz"}, | ^ glib/tests/uri.c:103:17: note: ‘expected_error’ declared here 103 | GConvertError expected_error; /* If failed */ | ^~~~~~~~~~~~~~ --- glib/tests/uri.c | 100 +++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/glib/tests/uri.c b/glib/tests/uri.c index 77aa95604..b7c187dc4 100644 --- a/glib/tests/uri.c +++ b/glib/tests/uri.c @@ -37,54 +37,54 @@ typedef struct FileToUriTest file_to_uri_tests[] = { - { "/etc", NULL, "file:///etc"}, - { "/etc", "", "file:///etc"}, - { "/etc", "otherhost", "file://otherhost/etc"}, + { "/etc", NULL, "file:///etc", 0 }, + { "/etc", "", "file:///etc", 0 }, + { "/etc", "otherhost", "file://otherhost/etc", 0 }, #ifdef G_OS_WIN32 - { "/etc", "localhost", "file:///etc"}, - { "c:\\windows", NULL, "file:///c:/windows"}, - { "c:\\windows", "localhost", "file:///c:/windows"}, - { "c:\\windows", "otherhost", "file://otherhost/c:/windows"}, - { "\\\\server\\share\\dir", NULL, "file:////server/share/dir"}, - { "\\\\server\\share\\dir", "localhost", "file:////server/share/dir"}, + { "/etc", "localhost", "file:///etc", 0 }, + { "c:\\windows", NULL, "file:///c:/windows", 0 }, + { "c:\\windows", "localhost", "file:///c:/windows", 0 }, + { "c:\\windows", "otherhost", "file://otherhost/c:/windows", 0 }, + { "\\\\server\\share\\dir", NULL, "file:////server/share/dir", 0 }, + { "\\\\server\\share\\dir", "localhost", "file:////server/share/dir", 0 }, #else - { "/etc", "localhost", "file://localhost/etc"}, + { "/etc", "localhost", "file://localhost/etc", 0 }, { "c:\\windows", NULL, NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH}, /* it's important to get this error on Unix */ { "c:\\windows", "localhost", NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH}, { "c:\\windows", "otherhost", NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH}, #endif { "etc", "localhost", NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH}, #ifndef G_PLATFORM_WIN32 - { "/etc/\xE5\xE4\xF6", NULL, "file:///etc/%E5%E4%F6" }, - { "/etc/\xC3\xB6\xC3\xA4\xC3\xA5", NULL, "file:///etc/%C3%B6%C3%A4%C3%A5"}, + { "/etc/\xE5\xE4\xF6", NULL, "file:///etc/%E5%E4%F6", 0 }, + { "/etc/\xC3\xB6\xC3\xA4\xC3\xA5", NULL, "file:///etc/%C3%B6%C3%A4%C3%A5", 0 }, #endif { "/etc", "\xC3\xB6\xC3\xA4\xC3\xA5", NULL, G_CONVERT_ERROR_ILLEGAL_SEQUENCE}, { "/etc", "\xE5\xE4\xF6", NULL, G_CONVERT_ERROR_ILLEGAL_SEQUENCE}, - { "/etc/file with #%", NULL, "file:///etc/file%20with%20%23%25"}, + { "/etc/file with #%", NULL, "file:///etc/file%20with%20%23%25", 0 }, { "", NULL, NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH}, { "", "", NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH}, { "", "localhost", NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH}, { "", "otherhost", NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH}, - { "/0123456789", NULL, "file:///0123456789"}, - { "/ABCDEFGHIJKLMNOPQRSTUVWXYZ", NULL, "file:///ABCDEFGHIJKLMNOPQRSTUVWXYZ"}, - { "/abcdefghijklmnopqrstuvwxyz", NULL, "file:///abcdefghijklmnopqrstuvwxyz"}, - { "/-_.!~*'()", NULL, "file:///-_.!~*'()"}, + { "/0123456789", NULL, "file:///0123456789", 0 }, + { "/ABCDEFGHIJKLMNOPQRSTUVWXYZ", NULL, "file:///ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0 }, + { "/abcdefghijklmnopqrstuvwxyz", NULL, "file:///abcdefghijklmnopqrstuvwxyz", 0 }, + { "/-_.!~*'()", NULL, "file:///-_.!~*'()", 0 }, #ifdef G_OS_WIN32 /* As '\\' is a path separator on Win32, it gets turned into '/' in the URI */ - { "/\"#%<>[\\]^`{|}\x7F", NULL, "file:///%22%23%25%3C%3E%5B/%5D%5E%60%7B%7C%7D%7F"}, + { "/\"#%<>[\\]^`{|}\x7F", NULL, "file:///%22%23%25%3C%3E%5B/%5D%5E%60%7B%7C%7D%7F", 0 }, #else /* On Unix, '\\' is a normal character in the file name */ - { "/\"#%<>[\\]^`{|}\x7F", NULL, "file:///%22%23%25%3C%3E%5B%5C%5D%5E%60%7B%7C%7D%7F"}, + { "/\"#%<>[\\]^`{|}\x7F", NULL, "file:///%22%23%25%3C%3E%5B%5C%5D%5E%60%7B%7C%7D%7F", 0 }, #endif - { "/;@+$,", NULL, "file:///%3B@+$,"}, + { "/;@+$,", NULL, "file:///%3B@+$,", 0 }, /* This and some of the following are of course as such illegal file names on Windows, * and would not occur in real life. */ - { "/:", NULL, "file:///:"}, - { "/?&=", NULL, "file:///%3F&="}, + { "/:", NULL, "file:///:", 0 }, + { "/?&=", NULL, "file:///%3F&=", 0 }, { "/", "0123456789-", NULL, G_CONVERT_ERROR_ILLEGAL_SEQUENCE}, - { "/", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "file://ABCDEFGHIJKLMNOPQRSTUVWXYZ/"}, - { "/", "abcdefghijklmnopqrstuvwxyz", "file://abcdefghijklmnopqrstuvwxyz/"}, + { "/", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "file://ABCDEFGHIJKLMNOPQRSTUVWXYZ/", 0 }, + { "/", "abcdefghijklmnopqrstuvwxyz", "file://abcdefghijklmnopqrstuvwxyz/", 0 }, { "/", "_.!~*'()", NULL, G_CONVERT_ERROR_ILLEGAL_SEQUENCE}, { "/", "\"#%<>[\\]^`{|}\x7F", NULL, G_CONVERT_ERROR_ILLEGAL_SEQUENCE}, { "/", ";?&=+$,", NULL, G_CONVERT_ERROR_ILLEGAL_SEQUENCE}, @@ -105,26 +105,26 @@ typedef struct FileFromUriTest file_from_uri_tests[] = { - { "file:///etc", "/etc"}, - { "file:/etc", "/etc"}, + { "file:///etc", "/etc", NULL, 0 }, + { "file:/etc", "/etc", NULL, 0 }, #ifdef G_OS_WIN32 /* On Win32 we don't return "localhost" hostames, just in case * it isn't recognized anyway. */ - { "file://localhost/etc", "/etc", NULL}, - { "file://localhost/etc/%23%25%20file", "/etc/#% file", NULL}, - { "file://localhost/\xE5\xE4\xF6", "/\xe5\xe4\xf6", NULL}, - { "file://localhost/%E5%E4%F6", "/\xe5\xe4\xf6", NULL}, + { "file://localhost/etc", "/etc", NULL, 0 }, + { "file://localhost/etc/%23%25%20file", "/etc/#% file", NULL, 0 }, + { "file://localhost/\xE5\xE4\xF6", "/\xe5\xe4\xf6", NULL, 0 }, + { "file://localhost/%E5%E4%F6", "/\xe5\xe4\xf6", NULL, 0 }, #else - { "file://localhost/etc", "/etc", "localhost"}, - { "file://localhost/etc/%23%25%20file", "/etc/#% file", "localhost"}, - { "file://localhost/\xE5\xE4\xF6", "/\xe5\xe4\xf6", "localhost"}, - { "file://localhost/%E5%E4%F6", "/\xe5\xe4\xf6", "localhost"}, + { "file://localhost/etc", "/etc", "localhost", 0 }, + { "file://localhost/etc/%23%25%20file", "/etc/#% file", "localhost", 0 }, + { "file://localhost/\xE5\xE4\xF6", "/\xe5\xe4\xf6", "localhost", 0 }, + { "file://localhost/%E5%E4%F6", "/\xe5\xe4\xf6", "localhost", 0 }, #endif - { "file://otherhost/etc", "/etc", "otherhost"}, - { "file://otherhost/etc/%23%25%20file", "/etc/#% file", "otherhost"}, + { "file://otherhost/etc", "/etc", "otherhost", 0 }, + { "file://otherhost/etc/%23%25%20file", "/etc/#% file", "otherhost", 0 }, { "file://%C3%B6%C3%A4%C3%A5/etc", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, - { "file:////etc/%C3%B6%C3%C3%C3%A5", "//etc/\xc3\xb6\xc3\xc3\xc3\xa5", NULL}, + { "file:////etc/%C3%B6%C3%C3%C3%A5", "//etc/\xc3\xb6\xc3\xc3\xc3\xa5", NULL, 0 }, { "file://\xE5\xE4\xF6/etc", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, { "file://%E5%E4%F6/etc", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, { "file:///some/file#bad", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, @@ -132,25 +132,25 @@ file_from_uri_tests[] = { { "", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, { "file:test", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, { "http://www.yahoo.com/", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, - { "file:////etc", "//etc"}, - { "file://///etc", "///etc"}, + { "file:////etc", "//etc", NULL, 0 }, + { "file://///etc", "///etc", NULL, 0 }, #ifdef G_OS_WIN32 /* URIs with backslashes come from some nonstandard application, but accept them anyhow */ - { "file:///c:\\foo", "c:\\foo"}, - { "file:///c:/foo\\bar", "c:\\foo\\bar"}, + { "file:///c:\\foo", "c:\\foo", NULL, 0 }, + { "file:///c:/foo\\bar", "c:\\foo\\bar", NULL, 0 }, /* Accept also the old Netscape drive-letter-and-vertical bar convention */ - { "file:///c|/foo", "c:\\foo"}, - { "file:////server/share/dir", "\\\\server\\share\\dir"}, - { "file://localhost//server/share/foo", "\\\\server\\share\\foo"}, - { "file://otherhost//server/share/foo", "\\\\server\\share\\foo", "otherhost"}, + { "file:///c|/foo", "c:\\foo", NULL, 0 }, + { "file:////server/share/dir", "\\\\server\\share\\dir", NULL, 0 }, + { "file://localhost//server/share/foo", "\\\\server\\share\\foo", NULL, 0 }, + { "file://otherhost//server/share/foo", "\\\\server\\share\\foo", "otherhost", 0 }, #else - { "file:///c:\\foo", "/c:\\foo"}, - { "file:///c:/foo", "/c:/foo"}, - { "file:////c:/foo", "//c:/foo"}, + { "file:///c:\\foo", "/c:\\foo", NULL, 0 }, + { "file:///c:/foo", "/c:/foo", NULL, 0 }, + { "file:////c:/foo", "//c:/foo", NULL, 0 }, #endif { "file://0123456789/", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, - { "file://ABCDEFGHIJKLMNOPQRSTUVWXYZ/", "/", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"}, - { "file://abcdefghijklmnopqrstuvwxyz/", "/", "abcdefghijklmnopqrstuvwxyz"}, + { "file://ABCDEFGHIJKLMNOPQRSTUVWXYZ/", "/", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0 }, + { "file://abcdefghijklmnopqrstuvwxyz/", "/", "abcdefghijklmnopqrstuvwxyz", 0 }, { "file://-_.!~*'()/", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, { "file://\"<>[\\]^`{|}\x7F/", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, { "file://;?&=+$,/", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, From e457df8b8b08ecfb4194f11886558539c3328b7f Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sat, 14 Nov 2020 14:26:47 +0100 Subject: [PATCH 2/3] Fix several signedness warnings in glib/tests/uri.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/uri.c: In function ‘run_file_to_uri_tests’: glib/tests/uri.c:172:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 172 | for (i = 0; i < G_N_ELEMENTS (file_to_uri_tests); i++) | ^ glib/tests/uri.c: In function ‘run_file_from_uri_tests’: glib/tests/uri.c:197:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 197 | for (i = 0; i < G_N_ELEMENTS (file_from_uri_tests); i++) | ^ glib/tests/uri.c: In function ‘run_file_roundtrip_tests’: glib/tests/uri.c:276:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 276 | for (i = 0; i < G_N_ELEMENTS (file_to_uri_tests); i++) | ^ glib/tests/uri.c: In function ‘test_uri_parse_params’: glib/tests/uri.c:1594:25: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘const long int’} 1594 | for (j = 0; j < params_tests[i].expected_n_params; j += 2) | ^ --- glib/tests/uri.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glib/tests/uri.c b/glib/tests/uri.c index b7c187dc4..d2ac498c3 100644 --- a/glib/tests/uri.c +++ b/glib/tests/uri.c @@ -165,7 +165,7 @@ file_from_uri_tests[] = { static void run_file_to_uri_tests (void) { - int i; + gsize i; gchar *res; GError *error; @@ -189,7 +189,7 @@ run_file_to_uri_tests (void) static void run_file_from_uri_tests (void) { - int i; + gsize i; gchar *res; gchar *hostname; GError *error; @@ -269,7 +269,7 @@ safe_strcmp_hostname (const gchar *a, const gchar *b) static void run_file_roundtrip_tests (void) { - int i; + gsize i; gchar *uri, *hostname, *res; GError *error; @@ -1591,7 +1591,7 @@ test_uri_parse_params (gconstpointer test_data) g_assert_no_error (err); g_assert_cmpint (g_hash_table_size (params), ==, params_tests[i].expected_n_params); - for (j = 0; j < params_tests[i].expected_n_params; j += 2) + for (j = 0; j < (gsize) params_tests[i].expected_n_params; j += 2) g_assert_cmpstr (g_hash_table_lookup (params, params_tests[i].expected_param_key_values[j]), ==, params_tests[i].expected_param_key_values[j + 1]); } From 40e70f5d947c90cada88957daa0370c420cf94b1 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sat, 14 Nov 2020 14:43:39 +0100 Subject: [PATCH 3/3] Fix several signedness warnings in glib/tests/uri.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from glib/glib.h:86, from glib/tests/uri.c:25: glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘GConvertError’ 134 | if (!err || (err)->domain != dom || (err)->code != c) \ | ^~ glib/tests/uri.c:182:9: note: in expansion of macro ‘g_assert_error’ 182 | g_assert_error (error, G_CONVERT_ERROR, file_to_uri_tests[i].expected_error); | ^~~~~~~~~~~~~~ glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘GConvertError’ 134 | if (!err || (err)->domain != dom || (err)->code != c) \ | ^~ glib/tests/uri.c:220:9: note: in expansion of macro ‘g_assert_error’ 220 | g_assert_error (error, G_CONVERT_ERROR, file_from_uri_tests[i].expected_error); | ^~~~~~~~~~~~~~ glib/tests/uri.c: In function ‘test_uri_parsing_absolute’: glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘GUriError’ 134 | if (!err || (err)->domain != dom || (err)->code != c) \ | ^~ glib/tests/uri.c:790:11: note: in expansion of macro ‘g_assert_error’ 790 | g_assert_error (error, G_URI_ERROR, test->expected_error_code); | ^~~~~~~~~~~~~~ In file included from glib/glibconfig.h:9, from glib/gtypes.h:32, from glib/galloca.h:32, from glib/glib.h:30, from glib/tests/uri.c:25: glib/tests/uri.c: In function ‘test_uri_iter_params’: glib/tests/uri.c:1495:51: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘const long int’} and ‘long unsigned int’ 1495 | params_tests[i].expected_n_params <= G_N_ELEMENTS (params_tests[i].expected_param_key_values) / 2); | ^~ glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’ 941 | #define G_LIKELY(expr) (expr) | ^~~~ glib/tests/uri.c:1494:7: note: in expansion of macro ‘g_assert’ 1494 | g_assert (params_tests[i].expected_n_params < 0 || | ^~~~~~~~ glib/tests/uri.c: In function ‘test_uri_parse_params’: glib/tests/uri.c:1562:51: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘const long int’} and ‘long unsigned int’ 1562 | params_tests[i].expected_n_params <= G_N_ELEMENTS (params_tests[i].expected_param_key_values) / 2); | ^~ glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’ 941 | #define G_LIKELY(expr) (expr) | ^~~~ glib/tests/uri.c:1561:7: note: in expansion of macro ‘g_assert’ 1561 | g_assert (params_tests[i].expected_n_params < 0 || | ^~~~~~~~ --- glib/tests/uri.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/glib/tests/uri.c b/glib/tests/uri.c index d2ac498c3..c666fc5af 100644 --- a/glib/tests/uri.c +++ b/glib/tests/uri.c @@ -32,7 +32,7 @@ typedef struct char *filename; char *hostname; char *expected_result; - GConvertError expected_error; /* If failed */ + gint expected_error; /* If failed */ } FileToUriTest; FileToUriTest @@ -100,7 +100,7 @@ typedef struct char *uri; char *expected_filename; char *expected_hostname; - GConvertError expected_error; /* If failed */ + gint expected_error; /* If failed */ } FileFromUriTest; FileFromUriTest @@ -549,7 +549,7 @@ typedef struct { GUriFlags flags; /* Outputs */ gboolean expected_success; - GUriError expected_error_code; /* unused if @expected_success is true */ + gint expected_error_code; /* unused if @expected_success is true */ const UriParts expected_parts; /* unused if @expected_success is false */ } UriAbsoluteTest; @@ -1492,7 +1492,7 @@ test_uri_iter_params (gconstpointer test_data) g_test_message ("URI %" G_GSIZE_FORMAT ": %s", i, params_tests[i].uri); g_assert (params_tests[i].expected_n_params < 0 || - params_tests[i].expected_n_params <= G_N_ELEMENTS (params_tests[i].expected_param_key_values) / 2); + params_tests[i].expected_n_params <= (gssize) G_N_ELEMENTS (params_tests[i].expected_param_key_values) / 2); /* The tests get run twice: once with the length unspecified, using a * nul-terminated string; and once with the length specified and a copy of @@ -1559,7 +1559,7 @@ test_uri_parse_params (gconstpointer test_data) g_test_message ("URI %" G_GSIZE_FORMAT ": %s", i, params_tests[i].uri); g_assert (params_tests[i].expected_n_params < 0 || - params_tests[i].expected_n_params <= G_N_ELEMENTS (params_tests[i].expected_param_key_values) / 2); + params_tests[i].expected_n_params <= (gssize) G_N_ELEMENTS (params_tests[i].expected_param_key_values) / 2); /* The tests get run twice: once with the length unspecified, using a * nul-terminated string; and once with the length specified and a copy of