diff --git a/.github/workflows/ccpp.yaml b/.github/workflows/ccpp.yaml index 62d8f3b..c166713 100644 --- a/.github/workflows/ccpp.yaml +++ b/.github/workflows/ccpp.yaml @@ -2,9 +2,9 @@ name: C/C++ CI on: push: - branches: [ '1.10' ] + branches: [ '1.10', '1.11'] pull_request: - branches: [ '1.10' ] + branches: [ '1.10', '1.11' ] jobs: build: diff --git a/src/bin/open_jtalk.c b/src/bin/open_jtalk.c index e84c280..202d26b 100644 --- a/src/bin/open_jtalk.c +++ b/src/bin/open_jtalk.c @@ -172,8 +172,8 @@ static int Open_JTalk_synthesis(Open_JTalk * open_jtalk, const char *txt, FILE * int result = 0; char buff[MAXBUFLEN]; - errno_t mecab_result = text2mecab(buff, MAXBUFLEN, txt); - if (mecab_result != 0) { + text2mecab_result_t mecab_result = text2mecab(buff, MAXBUFLEN, txt); + if (mecab_result != TEXT2MECAB_SUCCESS) { return 0; } Mecab_analysis(&open_jtalk->mecab, buff); diff --git a/src/text2mecab/text2mecab.c b/src/text2mecab/text2mecab.c index 198e214..a34ae85 100644 --- a/src/text2mecab/text2mecab.c +++ b/src/text2mecab/text2mecab.c @@ -92,10 +92,10 @@ static int strtopcmp(const char *str, const char *pattern) } } -errno_t text2mecab(char *output, size_t sizeOfOutput, const char *input) +text2mecab_result_t text2mecab(char *output, size_t sizeOfOutput, const char *input) { if (input == NULL || output == NULL || sizeOfOutput == 0) - return EINVAL; + return TEXT2MECAB_RESULT_INVALID_ARGUMENT; int i, j; const int length = strlen(input); @@ -117,7 +117,7 @@ errno_t text2mecab(char *output, size_t sizeOfOutput, const char *input) str = text2mecab_conv_list[i + 1]; if (index + strlen(str) >= sizeOfOutput) { output[0] = '\0'; - return ERANGE; + return TEXT2MECAB_RESULT_RANGE_ERROR; } for (j = 0; str[j] != '\0'; j++) output[index++] = str[j]; @@ -136,7 +136,7 @@ errno_t text2mecab(char *output, size_t sizeOfOutput, const char *input) if (e > 0) { if (index + e >= sizeOfOutput) { output[0] = '\0'; - return ERANGE; + return TEXT2MECAB_RESULT_RANGE_ERROR; } for (j = 0; j < e; j++) output[index++] = input[s++]; @@ -148,7 +148,7 @@ errno_t text2mecab(char *output, size_t sizeOfOutput, const char *input) } } output[index] = '\0'; - return 0; + return TEXT2MECAB_RESULT_SUCCESS; } TEXT2MECAB_C_END; diff --git a/src/text2mecab/text2mecab.h b/src/text2mecab/text2mecab.h index bb1eba1..2878a30 100644 --- a/src/text2mecab/text2mecab.h +++ b/src/text2mecab/text2mecab.h @@ -51,7 +51,13 @@ TEXT2MECAB_H_START; -errno_t text2mecab(char *output, size_t sizeOfOutput, const char *input); +typedef enum { + TEXT2MECAB_RESULT_SUCCESS = 0, + TEXT2MECAB_RESULT_INVALID_ARGUMENT = 1, + TEXT2MECAB_RESULT_RANGE_ERROR = 2, +} text2mecab_result_t; + +text2mecab_result_t text2mecab(char *output, size_t sizeOfOutput, const char *input); TEXT2MECAB_H_END;