Warmcat homepage andy@warmcat.com
libwebsockets
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1745907437, "reponame":"cgit", "desc":"CGI gitweb", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/cgit", "f":3, "items": [ {"schema":"libjg2-1", "cid":"d5546f5b8fb763c80288d3157a61c126", "commit": {"type":"commit", "time": 1530578599, "time_ofs": 480, "oid_tree": { "oid": "aecbdd5907a7bc09fcacd20cad6d5e15e797461f", "alias": []}, "oid":{ "oid": "ed060c9ba20124aafc0ead5f779a2b80a1cdac21", "alias": []}, "msg": "gcc8.1: fix strncat warning", "sig_commit": { "git_time": { "time": 1530578599, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1530578568, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "gcc8.1: fix strncat warning\n\n../ui-ssdiff.c: In function ‘replace_tabs’:\n../ui-ssdiff.c:142:4: warning: ‘strncat’ output truncated copying between 1 and 8 bytes from a string of length 8 [-Wstringop-truncation]\n strncat(result, spaces, 8 - (strlen(result) % 8));\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nActually the strncat that was there before intends that its\nstock of spaces gets truncated, and it's not a problem.\n\nHowever gcc8.1 is also right, normally truncation is undesirable.\n\nMake the code do the padding explicitly.\n\nSigned-off-by: Andy Green \u003candy@warmcat.com\u003e\n" , "diff": "diff --git a/ui-ssdiff.c b/ui-ssdiff.c\nindex 7f261ed..e520b95 100644\n--- a/ui-ssdiff.c\n+++ b/ui-ssdiff.c\n@@ -118,7 +118,6 @@ static char *replace_tabs(char *line)\n \tint n_tabs \u003d 0;\n \tint i;\n \tchar *result;\n-\tchar *spaces \u003d \u0022 \u0022;\n \n \tif (linelen \u003d\u003d 0) {\n \t\tresult \u003d xmalloc(1);\n@@ -138,8 +137,17 @@ static char *replace_tabs(char *line)\n \t\t\tstrcat(result, prev_buf);\n \t\t\tbreak;\n \t\t} else {\n+\t\t\tchar *p;\n+\t\t\tint n;\n+\n \t\t\tstrncat(result, prev_buf, cur_buf - prev_buf);\n-\t\t\tstrncat(result, spaces, 8 - (strlen(result) % 8));\n+\n+\t\t\tn \u003d strlen(result);\n+\t\t\tp \u003d result + n;\n+\t\t\tn \u003d 8 - (n % 8);\n+\t\t\twhile (n--)\n+\t\t\t\t*p++ \u003d ' ';\n+\t\t\t*p \u003d '\u005c0';\n \t\t}\n \t\tprev_buf \u003d cur_buf + 1;\n \t}\n","s":{"c":1745907437,"u": 841}} ],"g": 2276,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}