svnno****@sourc*****
svnno****@sourc*****
2011年 3月 22日 (火) 17:27:09 JST
Revision: 445 http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=445 Author: yoya Date: 2011-03-22 17:27:09 +0900 (Tue, 22 Mar 2011) Log Message: ----------- author: yoya - 負の offset 指定で get が呼ばれた場合のガード - set の方のガードで返す値を -1 から 1 に変更 Modified Paths: -------------- trunk/src/trans_table.c -------------- next part -------------- Modified: trunk/src/trans_table.c =================================================================== --- trunk/src/trans_table.c 2011-03-22 08:13:11 UTC (rev 444) +++ trunk/src/trans_table.c 2011-03-22 08:27:09 UTC (rev 445) @@ -42,6 +42,9 @@ } int trans_table_get(trans_table_t *trans_table, int offset) { + if (offset < 0) { + return 0; + } if (trans_table->table_num <= offset) { return 0; } @@ -49,9 +52,9 @@ } int trans_table_set(trans_table_t *trans_table, int offset, int cid) { - if (offset < 0) { - return -1; - } + if (offset < 0) { + return 1; // failed + } if (trans_table->table_num <= offset) { if (trans_table_realloc(trans_table, offset)) { return 1; // failed