Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH v9] git on Mac OS and precomposed unicode

From: Robin Rosenberg <hidden>
Date: 2016-06-15 22:54:21

Just a couple of nitpicks.

Torsten Bögershausen skrev 2012-07-08 15.50:
quoted hunk ↗ jump to hunk
diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c
[...]
+static size_t has_utf8(const char *s, size_t maxlen, size_t *strlen_c)
+{
+	const uint8_t *utf8p = (const uint8_t*) s;
+	size_t strlen_chars = 0;
+	size_t ret = 0;
+
+	if ((!utf8p) || (!*utf8p)) {
Style: Drop the extra parentheses
+		return 0;
+	}
+
+	while((*utf8p) && maxlen) {
Style: Drop the extra parentheses
[...]
+void probe_utf8_pathname_composition(char *path, int len)
+{
+	const static char *auml_nfc = "\xc3\xa4";
+	const static char *auml_nfd = "\x61\xcc\x88";
+	int output_fd;
+	if (precomposed_unicode != -1)
+		return; /* We found it defined in the global config, respect it */
+	path[len] = 0;
Not needed, will be overwritten by strcpy
+	strcpy(path + len, auml_nfc);
+	output_fd = open(path, O_CREAT|O_EXCL|O_RDWR, 0600);
+	if (output_fd >=0) {
+		close(output_fd);
+		path[len] = 0;
Not needed, will be overwritten by strcpy
+		strcpy(path + len, auml_nfd);
+		/* Indicate to the user, that we can configure it to true */
+		if (0 == access(path, R_OK))
+			git_config_set("core.precomposeunicode", "false");
+			/* To be backward compatible, set precomposed_unicode to 0 */
+		precomposed_unicode = 0;
+		path[len] = 0;
Not needed, will be overwritten by strcpy
+		strcpy(path + len, auml_nfc);
+		unlink(path);
Err out if path cannot be deleted?

-- robin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help