Skip to content

Commit 269bbec

Browse files
committed
fix: cast warnings.
1 parent 4ff45f8 commit 269bbec

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

casbin/model/Assertion.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ enum policy_op{
77
policy_add,
88
policy_remove
99
};
10+
typedef enum policy_op policy_op;
1011

1112
// Assertion represents an expression in a section of the model.
1213
// For example: r = sub, obj, act
@@ -17,7 +18,7 @@ class Assertion {
1718
string value;
1819
vector<string> tokens;
1920
vector<vector<string>> policy;
20-
RoleManager *rm;
21+
RoleManager* rm;
2122

2223
void BuildIncrementalRoleLinks(RoleManager* rm, policy_op op, vector<vector<string>> rules);
2324

casbin/util/built_in_functions.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ ReturnType KeyMatch2(Scope scope) {
5353
break;
5454
}
5555
if(key1_arr[i] != key2_arr[i]){
56-
int index1 = key2_arr[i].find("*");
57-
int index2 = key2_arr[i].find(":");
56+
int index1 = int(key2_arr[i].find("*"));
57+
int index2 = int(key2_arr[i].find(":"));
5858
if(index1 != string::npos){
5959
if(index1==0){
6060
res = true;
@@ -103,9 +103,9 @@ ReturnType KeyMatch3(Scope scope) {
103103
break;
104104
}
105105
if(key1_arr[i] != key2_arr[i]){
106-
int index1 = key2_arr[i].find("*");
107-
int index2 = key2_arr[i].find("{");
108-
int index3 = key2_arr[i].find("}");
106+
int index1 = int(key2_arr[i].find("*"));
107+
int index2 = int(key2_arr[i].find("{"));
108+
int index3 = int(key2_arr[i].find("}"));
109109
if(index1 != string::npos){
110110
if(index1==0){
111111
res = true;

0 commit comments

Comments
 (0)