Skip to content

Commit b56a8ed

Browse files
Yosshi999r9y9
andauthored
Linux, Macのビルドを直す (r9y9#5)
* Update CI settings for 1.11 * use original enum instead of errno * fix typo Co-authored-by: Ryuichi Yamamoto <[email protected]>
1 parent d74d20a commit b56a8ed

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

.github/workflows/ccpp.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: C/C++ CI
22

33
on:
44
push:
5-
branches: [ '1.10' ]
5+
branches: [ '1.10', '1.11']
66
pull_request:
7-
branches: [ '1.10' ]
7+
branches: [ '1.10', '1.11' ]
88

99
jobs:
1010
build:

src/bin/open_jtalk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ static int Open_JTalk_synthesis(Open_JTalk * open_jtalk, const char *txt, FILE *
172172
int result = 0;
173173
char buff[MAXBUFLEN];
174174

175-
errno_t mecab_result = text2mecab(buff, MAXBUFLEN, txt);
176-
if (mecab_result != 0) {
175+
text2mecab_result_t mecab_result = text2mecab(buff, MAXBUFLEN, txt);
176+
if (mecab_result != TEXT2MECAB_SUCCESS) {
177177
return 0;
178178
}
179179
Mecab_analysis(&open_jtalk->mecab, buff);

src/text2mecab/text2mecab.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ static int strtopcmp(const char *str, const char *pattern)
9292
}
9393
}
9494

95-
errno_t text2mecab(char *output, size_t sizeOfOutput, const char *input)
95+
text2mecab_result_t text2mecab(char *output, size_t sizeOfOutput, const char *input)
9696
{
9797
if (input == NULL || output == NULL || sizeOfOutput == 0)
98-
return EINVAL;
98+
return TEXT2MECAB_RESULT_INVALID_ARGUMENT;
9999

100100
int i, j;
101101
const int length = strlen(input);
@@ -117,7 +117,7 @@ errno_t text2mecab(char *output, size_t sizeOfOutput, const char *input)
117117
str = text2mecab_conv_list[i + 1];
118118
if (index + strlen(str) >= sizeOfOutput) {
119119
output[0] = '\0';
120-
return ERANGE;
120+
return TEXT2MECAB_RESULT_RANGE_ERROR;
121121
}
122122
for (j = 0; str[j] != '\0'; j++)
123123
output[index++] = str[j];
@@ -136,7 +136,7 @@ errno_t text2mecab(char *output, size_t sizeOfOutput, const char *input)
136136
if (e > 0) {
137137
if (index + e >= sizeOfOutput) {
138138
output[0] = '\0';
139-
return ERANGE;
139+
return TEXT2MECAB_RESULT_RANGE_ERROR;
140140
}
141141
for (j = 0; j < e; j++)
142142
output[index++] = input[s++];
@@ -148,7 +148,7 @@ errno_t text2mecab(char *output, size_t sizeOfOutput, const char *input)
148148
}
149149
}
150150
output[index] = '\0';
151-
return 0;
151+
return TEXT2MECAB_RESULT_SUCCESS;
152152
}
153153

154154
TEXT2MECAB_C_END;

src/text2mecab/text2mecab.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@
5151

5252
TEXT2MECAB_H_START;
5353

54-
errno_t text2mecab(char *output, size_t sizeOfOutput, const char *input);
54+
typedef enum {
55+
TEXT2MECAB_RESULT_SUCCESS = 0,
56+
TEXT2MECAB_RESULT_INVALID_ARGUMENT = 1,
57+
TEXT2MECAB_RESULT_RANGE_ERROR = 2,
58+
} text2mecab_result_t;
59+
60+
text2mecab_result_t text2mecab(char *output, size_t sizeOfOutput, const char *input);
5561

5662
TEXT2MECAB_H_END;
5763

0 commit comments

Comments
 (0)