Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux, Macのビルドを直す #5

Merged
merged 3 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ccpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: C/C++ CI

on:
push:
branches: [ '1.10' ]
branches: [ '1.10', '1.11']

This comment was marked as resolved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あ、これはupstream側のコード変更なんですね、こちらで不用意に触らない方がいいと思ったので、このsuggestionは取り下げます

pull_request:
branches: [ '1.10' ]
branches: [ '1.10', '1.11' ]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions src/bin/open_jtalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions src/text2mecab/text2mecab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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];
Expand All @@ -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++];
Expand All @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion src/text2mecab/text2mecab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down