From 89a4bea94219832381c7eb23fa6f817112d8bbe4 Mon Sep 17 00:00:00 2001 From: MIYAGI Hikaru Date: Mon, 18 Mar 2019 19:37:38 +0900 Subject: [PATCH] =?UTF-8?q?-e=20=E3=82=92=E4=BD=BF=E7=94=A8=E3=81=97?= =?UTF-8?q?=E3=82=BF=E3=82=B0=E3=83=AC=E3=82=B3=E3=83=BC=E3=83=89=E3=81=8C?= =?UTF-8?q?4096=E3=83=90=E3=82=A4=E3=83=88=E3=82=92=E8=B6=85=E3=81=88?= =?UTF-8?q?=E3=82=8B=E6=99=82=E3=81=AB=E3=81=9D=E3=82=8C=E4=BB=A5=E9=99=8D?= =?UTF-8?q?=E3=81=8C=E5=8F=8D=E6=98=A0=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit あとコード整理とか。FLAC対応をやめたので入力時のMBPを特別扱いする必要がなくなったのでそこらへんの削除。 そしてパッチバージョン上げ --- src/main.c | 1 - src/parse-tags.c | 92 +++++++-------------------------------------- src/put-tags.c | 1 - src/read.c | 1 - src/retrieve-tags.c | 5 +-- src/version.h | 4 +- 6 files changed, 17 insertions(+), 87 deletions(-) diff --git a/src/main.c b/src/main.c index 667e864..6af03b8 100644 --- a/src/main.c +++ b/src/main.c @@ -336,7 +336,6 @@ int main(int argc, char **argv) { fileerror(O.in); } - uint8_t *fbp; ogg_sync_state oy; ogg_sync_init(&oy); diff --git a/src/parse-tags.c b/src/parse-tags.c index 957dd62..26fe115 100644 --- a/src/parse-tags.c +++ b/src/parse-tags.c @@ -47,9 +47,6 @@ static void err_bin(void) { static void err_esc(void) { tagerror(catgets(catd, 5, 5, "invalid escape sequence")); } -static void err_utf8(void) { - tagerror(catgets(catd, 5, 6, "invalid UTF-8 sequence")); -} static void err_noterm(void) { mainerror(err_main_no_term); } @@ -121,16 +118,14 @@ static void finalize_record(void) { first_call = true; } -static size_t wsplen, fieldlen; +static size_t wsplen; static bool on_field, keep_blank; -static uint8_t field_pending[22]; static bool test_blank(uint8_t *line, size_t n, bool lf) { if (first_call) { // = で始まってたらすぐエラー(575) - if (*line == 0x3d) err_nosep(); + if (*line == 0x3d) err_empty(); first_call = false; on_field = true; - fieldlen = 0; keep_blank = true; wsplen = 0; recordlen = 0; @@ -172,19 +167,14 @@ static bool test_blank(uint8_t *line, size_t n, bool lf) { if (editlen > TAG_LENGTH_LIMIT__OUTPUT) { exceed_output_limit(); } - fieldlen = recordlen = wsplen; - if (wsplen <= 22) { - memset(field_pending, 0x20, wsplen); - } - else { - // 空白と見做していた分を書き込み - uint8_t buf[STACK_BUF_LEN]; - memset(buf, 0x20, STACK_BUF_LEN); - while (wsplen) { - size_t wlen = wsplen > STACK_BUF_LEN ? STACK_BUF_LEN : wsplen; - fwrite(buf, 1, wlen, strstore); - wsplen -= wlen; - } + recordlen = wsplen; + // 空白と見做していた分を書き込み + uint8_t buf[STACK_BUF_LEN]; + memset(buf, 0x20, STACK_BUF_LEN); + while (wsplen) { + size_t wlen = wsplen > STACK_BUF_LEN ? STACK_BUF_LEN : wsplen; + fwrite(buf, 1, wlen, strstore); + wsplen -= wlen; } } return false; @@ -199,60 +189,6 @@ static void append_buffer(uint8_t *line, size_t n) { fwrite(line, 1, n, strstore); } -static bool count_field_len(uint8_t *line, size_t n) { - uint8_t *p = field_pending + fieldlen; - size_t add; - bool filled; - if (on_field) { - add = n - fieldlen; - } - else { - add = (uint8_t*)memchr(line, 0x3d, n) - line; - } - if (fieldlen + add <= 22) { - memcpy(&field_pending[fieldlen], line, add); - filled = !on_field; - } - else { - memcpy(&field_pending[fieldlen], line, 22 - fieldlen); - filled = true; - } - fieldlen += add; - return filled; -} - -static void test_mbp(uint8_t **line, size_t *n) { - if (fieldlen > 22) { - append_buffer(*line, *n); - } - else { - bool filled; - size_t before = fieldlen; - filled = count_field_len(*line, *n); - size_t add = fieldlen - before; - if (filled) { - size_t w; - // M_B_Pを比較する分のバッファが埋まったか項目名が決まった場合 - if (fieldlen > 22) { - if (add + before > 22) { - add = 22 - before; - } - w = 22; - } - else if (fieldlen == 22 && !on_field) { - w = 22; - } - else { - w = fieldlen; - } - append_buffer(field_pending, w); - *line += add; - *n -= add; - append_buffer(*line, *n); - } - } -} - static void line_oc(uint8_t *line, size_t n, bool lf) { static bool afterlf = false; @@ -289,11 +225,8 @@ static void line_oc(uint8_t *line, size_t n, bool lf) { if (on_field) { if(!test_tag_field(line, n, true, &on_field, NULL)) err_name(); if (on_field && lf) err_name(); - test_mbp(&line, &n); - } - else { - append_buffer(line, n); } + append_buffer(line, n); afterlf = lf; } @@ -365,8 +298,8 @@ static void line_vc(uint8_t *line, size_t n, bool lf) { if (on_field) { if(!test_tag_field(line, n, true, &on_field, NULL)) err_name(); if (on_field && lf) err_nosep(); - test_mbp(&line, &n); } + append_buffer(line, n); if (lf) { finalize_record(); } @@ -400,6 +333,7 @@ void *split(void *fp_) { } fclose(fp); line(NULL, 0, false); + return NULL; } void *parse_tags(void* nouse_) { diff --git a/src/put-tags.c b/src/put-tags.c index 6a7b018..7ff7ea6 100644 --- a/src/put-tags.c +++ b/src/put-tags.c @@ -90,7 +90,6 @@ void *put_tags(void *fp_) { putdest = O.tag_deferred ? tmpfile() : stdout; iconv_t cd; - char charsetname[128]; if (!O.tag_raw) { cd = iconv_new(nl_langinfo(CODESET), "UTF-8"); diff --git a/src/read.c b/src/read.c index 7056d48..13f751e 100644 --- a/src/read.c +++ b/src/read.c @@ -307,7 +307,6 @@ static bool copy_tag_packet(ogg_page *og, bool *packet_break_in_page) { int lace_num = og->header[26]; if (!lace_num) return false; - uint8_t const *lace = &og->header[27]; uint8_t const *bin = og->body; uint_fast8_t i; diff --git a/src/retrieve-tags.c b/src/retrieve-tags.c index 3bc651f..07a6034 100644 --- a/src/retrieve-tags.c +++ b/src/retrieve-tags.c @@ -131,7 +131,6 @@ static bool rtcopy_delete(FILE *packet_input, void *fptag_) { // 削除リストのループ rewind(dellist_str); rewind(dellist_len); - bool copy = true; bool matched = false; while (fread(buf, 1, 5, dellist_len)) { uint32_t cmplen = *(uint32_t*)buf; @@ -244,10 +243,10 @@ void *retrieve_tags(void *packet_input_) { } fwrite(buf, 1, codec->commagic_len, fptag); if (!rtn->part_of_comment) { - // コメントパケットが無かった時用 + // VP8でコメントパケットが無かった時用 if (O.edit == EDIT_LIST) exit(0); uint8_t buf2[8] = ""; - fwrite(buf, 1, 8, fptag); + fwrite(buf2, 1, 8, fptag); rtn->tagbegin = codec->commagic_len + 4; goto NOTCOMMENT; } diff --git a/src/version.h b/src/version.h index f79b6ef..dd42596 100644 --- a/src/version.h +++ b/src/version.h @@ -1,5 +1,5 @@ -#define OPUSCOMMENT_VERSION "1.4.9" +#define OPUSCOMMENT_VERSION "1.4.10" #define OPUSCOMMENT_REVISION_YEAR (2019 - 1900) #define OPUSCOMMENT_REVISION_MONTH (3 - 1) -#define OPUSCOMMENT_REVISION_DAY 16 +#define OPUSCOMMENT_REVISION_DAY 18