Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
98bf1aaf
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
98bf1aaf
编写于
2月 19, 2018
作者:
D
Daniel Larimer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix warnings in many contracts
上级
e734fef2
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
47 addition
and
614 deletion
+47
-614
CMakeModules/wasm.cmake
CMakeModules/wasm.cmake
+1
-1
contracts/eosio.system/eosio.system.hpp
contracts/eosio.system/eosio.system.hpp
+10
-9
contracts/eosiolib/datastream.hpp
contracts/eosiolib/datastream.hpp
+1
-1
contracts/eosiolib/db.h
contracts/eosiolib/db.h
+0
-4
contracts/eosiolib/db.hpp
contracts/eosiolib/db.hpp
+0
-567
contracts/eosiolib/eosiolib.cpp
contracts/eosiolib/eosiolib.cpp
+7
-8
contracts/eosiolib/multi_index.hpp
contracts/eosiolib/multi_index.hpp
+4
-4
contracts/eosiolib/print.hpp
contracts/eosiolib/print.hpp
+1
-1
contracts/eosiolib/privileged.h
contracts/eosiolib/privileged.h
+1
-1
contracts/eosiolib/singleton.hpp
contracts/eosiolib/singleton.hpp
+1
-1
contracts/eosiolib/table.hpp
contracts/eosiolib/table.hpp
+3
-3
contracts/eosiolib/types.hpp
contracts/eosiolib/types.hpp
+1
-1
contracts/eosiolib/varint.hpp
contracts/eosiolib/varint.hpp
+1
-1
contracts/multi_index_test/multi_index_test.cpp
contracts/multi_index_test/multi_index_test.cpp
+4
-0
contracts/stltest/stltest.cpp
contracts/stltest/stltest.cpp
+3
-3
contracts/test.system/test.system.cpp
contracts/test.system/test.system.cpp
+9
-9
未找到文件。
CMakeModules/wasm.cmake
浏览文件 @
98bf1aaf
...
...
@@ -111,7 +111,7 @@ macro(compile_wast)
list
(
APPEND WASM_COMMAND -Wno-everything
)
else
()
list
(
APPEND WASM_COMMAND -Weverything -Wno-c++98-compat -Wno-old-style-cast -Wno-vla -Wno-vla-extension -Wno-c++98-compat-pedantic
-Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-packed
)
-Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-packed
-Wno-padded -Wno-c99-extensions
)
endif
()
foreach
(
folder
${
ARG_INCLUDE_FOLDERS
}
)
...
...
contracts/eosio.system/eosio.system.hpp
浏览文件 @
98bf1aaf
...
...
@@ -34,12 +34,13 @@ namespace eosiosystem {
struct
producer_votes
{
account_name
owner
;
uint64_t
padding
=
0
;
uint128_t
total_votes
;
uint64_t
primary_key
()
const
{
return
owner
;
}
uint128_t
by_votes
()
const
{
return
total_votes
;
}
EOSLIB_SERIALIZE
(
producer_votes
,
(
owner
)(
total_votes
)
)
;
EOSLIB_SERIALIZE
(
producer_votes
,
(
owner
)(
total_votes
)
)
};
typedef
eosio
::
multi_index
<
N
(
producervote
),
producer_votes
,
indexed_by
<
N
(
prototalvote
),
const_mem_fun
<
producer_votes
,
uint128_t
,
&
producer_votes
::
by_votes
>
>
...
...
@@ -54,7 +55,7 @@ namespace eosiosystem {
uint64_t
primary_key
()
const
{
return
owner
;
}
EOSLIB_SERIALIZE
(
account_votes
,
(
owner
)(
proxy
)(
last_update
)(
staked
)(
producers
)
)
;
EOSLIB_SERIALIZE
(
account_votes
,
(
owner
)(
proxy
)(
last_update
)(
staked
)(
producers
)
)
};
typedef
eosio
::
multi_index
<
N
(
accountvotes
),
account_votes
>
account_votes_index_type
;
...
...
@@ -64,7 +65,7 @@ namespace eosiosystem {
eosio
::
bytes
packed_key
;
/// a packed public key object
uint64_t
primary_key
()
const
{
return
owner
;
}
EOSLIB_SERIALIZE
(
producer_config
,
(
owner
)(
packed_key
)
)
;
EOSLIB_SERIALIZE
(
producer_config
,
(
owner
)(
packed_key
)
)
};
typedef
eosio
::
multi_index
<
N
(
producercfg
),
producer_config
>
producer_config_index_type
;
...
...
@@ -76,7 +77,7 @@ namespace eosiosystem {
uint64_t
primary_key
()
const
{
return
owner
;
}
EOSLIB_SERIALIZE
(
total_resources
,
(
owner
)(
total_net_weight
)(
total_cpu_weight
)(
total_ram
)
)
;
EOSLIB_SERIALIZE
(
total_resources
,
(
owner
)(
total_net_weight
)(
total_cpu_weight
)(
total_ram
)
)
};
...
...
@@ -102,7 +103,7 @@ namespace eosiosystem {
EOSLIB_SERIALIZE
(
delegated_bandwidth
,
(
from
)(
to
)(
net_weight
)(
cpu_weight
)
(
start_pending_net_withdraw
)(
pending_net_withdraw
)(
deferred_net_withdraw_handler
)
(
start_pending_cpu_withdraw
)(
pending_cpu_withdraw
)(
deferred_cpu_withdraw_handler
)
)
;
(
start_pending_cpu_withdraw
)(
pending_cpu_withdraw
)(
deferred_cpu_withdraw_handler
)
)
};
...
...
@@ -120,13 +121,13 @@ namespace eosiosystem {
account_name
producer
;
bytes
producer_key
;
EOSLIB_SERIALIZE
(
regproducer
,
(
producer
)(
producer_key
)
)
;
EOSLIB_SERIALIZE
(
regproducer
,
(
producer
)(
producer_key
)
)
};
ACTION
(
SystemAccount
,
regproxy
)
{
account_name
proxy_to_register
;
EOSLIB_SERIALIZE
(
regproxy
,
(
proxy_to_register
)
)
;
EOSLIB_SERIALIZE
(
regproxy
,
(
proxy_to_register
)
)
};
ACTION
(
SystemAccount
,
delegatebw
)
{
...
...
@@ -151,7 +152,7 @@ namespace eosiosystem {
ACTION
(
SystemAccount
,
nonce
)
{
eosio
::
string
value
;
EOSLIB_SERIALIZE
(
nonce
,
(
value
)
)
;
EOSLIB_SERIALIZE
(
nonce
,
(
value
)
)
};
/// new id options:
...
...
@@ -319,7 +320,7 @@ namespace eosiosystem {
});
currency
::
inline_transfer
(
sv
.
voter
,
SystemAccount
,
sv
.
amount
,
"stake for voting"
);
}
;
}
ACTION
(
SystemAccount
,
voteproducer
)
{
account_name
voter
;
...
...
contracts/eosiolib/datastream.hpp
浏览文件 @
98bf1aaf
...
...
@@ -99,7 +99,7 @@ class datastream {
* @brief Gets the position within the current stream
* @return p the position within the current stream
*/
inline
size_t
tellp
()
const
{
return
_pos
-
_start
;
}
inline
size_t
tellp
()
const
{
return
size_t
(
_pos
-
_start
)
;
}
/**
* Returns the number of remaining bytes that can be read/skipped
...
...
contracts/eosiolib/db.h
浏览文件 @
98bf1aaf
...
...
@@ -304,8 +304,6 @@ int32_t update_str( account_name scope, table_name table, account_name bta, char
* @param scope - the account scope that will be read, must exist in the transaction scopes list
* @param code - identifies the code that controls write-access to the data
* @param table - the ID/name of the table within the scope/code context to query
* @param key - location of the record key
* @param keylen - length of the record key
* @param value - location to copy the front record value
* @param valuelen - maximum length of the record value to read
* @return the number of bytes read or -1 if key was not found
...
...
@@ -316,8 +314,6 @@ int32_t update_str( account_name scope, table_name table, account_name bta, char
* @param scope - the account scope that will be read, must exist in the transaction scopes list
* @param code - identifies the code that controls write-access to the data
* @param table - the ID/name of the table within the scope/code context to query
* @param key - location of the record key
* @param keylen - length of the record key
* @param value - location to copy the back record value
* @param valuelen - maximum length of the record value to read
* @return the number of bytes read or -1 if key was not found
...
...
contracts/eosiolib/db.hpp
浏览文件 @
98bf1aaf
此差异已折叠。
点击以展开。
contracts/eosiolib/eosiolib.cpp
浏览文件 @
98bf1aaf
...
...
@@ -47,7 +47,7 @@ namespace eosio {
return
nullptr
;
}
const
uint32_t
new_heap_size
=
remaining
>
_new_heap_size
?
_new_heap_size
:
remaining
;
const
uint32_t
new_heap_size
=
uint32_t
(
remaining
)
>
_new_heap_size
?
_new_heap_size
:
uint32_t
(
remaining
)
;
char
*
new_memory_start
=
static_cast
<
char
*>
(
sbrk
(
new_heap_size
));
// if we can expand the current memory, keep working with it
if
(
current_memory
->
expand_memory
(
new_memory_start
,
new_heap_size
))
...
...
@@ -281,12 +281,11 @@ namespace eosio {
return
nullptr
;
}
const
int32_t
diff
=
size
-
*
orig_ptr_size
;
if
(
diff
<
0
)
if
(
*
orig_ptr_size
>
size
)
{
// use a buffer_ptr to allocate the memory to free
char
*
const
new_ptr
=
ptr
+
size
+
_size_marker
;
buffer_ptr
excess_to_free
(
new_ptr
,
-
diff
,
_heap
+
_heap_size
);
buffer_ptr
excess_to_free
(
new_ptr
,
*
orig_ptr_size
-
size
,
_heap
+
_heap_size
);
excess_to_free
.
mark_free
();
return
ptr
;
...
...
@@ -295,11 +294,11 @@ namespace eosio {
else
if
(
orig_buffer_end
==
&
_heap
[
_offset
])
{
orig_buffer
.
size
(
size
);
_offset
+=
diff
;
_offset
+=
size
-
*
orig_ptr_size
;
return
ptr
;
}
if
(
-
diff
==
0
)
if
(
size
==
*
orig_ptr_size
)
return
ptr
;
if
(
!
orig_buffer
.
merge_contiguous_if_available
(
size
))
...
...
@@ -416,7 +415,7 @@ namespace eosio {
bool
merge_contiguous
(
uint32_t
needed_size
,
bool
all_or_nothing
)
{
// do not bother if there isn't contiguious space to allocate
if
(
all_or_nothing
&&
_heap_end
-
_ptr
<
needed_size
)
if
(
all_or_nothing
&&
uint32_t
(
_heap_end
-
_ptr
)
<
needed_size
)
return
false
;
uint32_t
possible_size
=
_size
;
...
...
@@ -470,7 +469,7 @@ namespace eosio {
uint32_t
_heaps_actual_size
;
uint32_t
_active_heap
;
uint32_t
_active_free_heap
;
static
const
uint32_t
_alloc_memory_mask
=
1
<<
31
;
static
const
uint32_t
_alloc_memory_mask
=
uint32_t
(
1
)
<<
31
;
};
memory_manager
memory_heap
;
...
...
contracts/eosiolib/multi_index.hpp
浏览文件 @
98bf1aaf
...
...
@@ -168,7 +168,7 @@ class multi_index
const
multi_index
&
__idx
;
int
__primary_itr
;
int
__iters
[
sizeof
...(
Indicies
)];
int
__iters
[
sizeof
...(
Indicies
)
+
(
sizeof
...(
Indicies
)
==
0
)
];
};
uint64_t
_code
;
...
...
@@ -214,10 +214,11 @@ class multi_index
return
*
cacheitr
;
auto
size
=
db_get_i64
(
itr
,
nullptr
,
0
);
eosio_assert
(
size
>=
0
,
"error reading iterator"
);
char
tmp
[
size
];
db_get_i64
(
itr
,
tmp
,
size
);
db_get_i64
(
itr
,
tmp
,
uint32_t
(
size
)
);
datastream
<
const
char
*>
ds
(
tmp
,
size
);
datastream
<
const
char
*>
ds
(
tmp
,
uint32_t
(
size
)
);
auto
result
=
_items_index
.
emplace
(
*
this
,
[
&
](
auto
&
i
)
{
T
&
val
=
static_cast
<
T
&>
(
i
);
...
...
@@ -239,7 +240,6 @@ class multi_index
public:
multi_index
(
uint64_t
code
,
uint64_t
scope
)
:
_code
(
code
),
_scope
(
scope
){}
~
multi_index
()
{
}
uint64_t
get_code
()
const
{
return
_code
;
}
uint64_t
get_scope
()
const
{
return
_scope
;
}
...
...
contracts/eosiolib/print.hpp
浏览文件 @
98bf1aaf
...
...
@@ -44,7 +44,7 @@ namespace eosio {
* @param num to be printed
*/
inline
void
print
(
int
num
)
{
printi
(
num
);
printi
(
uint64_t
(
num
)
);
}
/**
...
...
contracts/eosiolib/privileged.h
浏览文件 @
98bf1aaf
...
...
@@ -16,7 +16,7 @@ extern "C" {
* @{
*/
void
set_resource_limits
(
account_name
account
,
int64_t
ram_bytes
,
int64_t
net_weight
,
int64_t
cpu_weight
,
int64_t
ignored
);
void
set_resource_limits
(
account_name
account
,
uint64_t
ram_bytes
,
uint64_t
net_weight
,
u
int64_t
cpu_weight
,
int64_t
ignored
);
void
set_active_producers
(
char
*
producer_data
,
size_t
producer_data_size
);
...
...
contracts/eosiolib/singleton.hpp
浏览文件 @
98bf1aaf
...
...
@@ -38,7 +38,7 @@ namespace eosio {
if
(
read
<
0
)
{
return
def
;
}
return
unpack
<
T
>
(
temp
+
sizeof
(
SingletonName
),
read
);
return
unpack
<
T
>
(
temp
+
sizeof
(
SingletonName
),
size_t
(
read
)
);
}
static
T
get_or_create
(
scope_name
scope
=
Code
,
const
T
&
def
=
T
()
)
{
...
...
contracts/eosiolib/table.hpp
浏览文件 @
98bf1aaf
...
...
@@ -23,7 +23,7 @@ namespace eosio {
auto
read
=
load_i64
(
DefaultScope
,
scope
,
TableName
,
temp
,
sizeof
(
temp
)
);
eosio_assert
(
read
>
0
,
"key does not exist"
);
datastream
<
const
char
*>
ds
(
temp
,
read
);
datastream
<
const
char
*>
ds
(
temp
,
uint32_t
(
read
)
);
T
result
;
ds
>>
result
;
return
result
;
...
...
@@ -39,7 +39,7 @@ namespace eosio {
return
def
;
}
datastream
<
const
char
*>
ds
(
temp
,
read
);
datastream
<
const
char
*>
ds
(
temp
,
uint32_t
(
read
)
);
T
result
;
ds
>>
result
;
return
result
;
...
...
@@ -54,7 +54,7 @@ namespace eosio {
return
def
;
}
datastream
<
const
char
*>
ds
(
temp
,
read
);
datastream
<
const
char
*>
ds
(
temp
,
uint32_t
(
read
)
);
T
result
;
ds
>>
result
;
return
result
;
...
...
contracts/eosiolib/types.hpp
浏览文件 @
98bf1aaf
...
...
@@ -39,7 +39,7 @@ namespace eosio {
for
(
uint32_t
i
=
0
;
i
<=
12
;
++
i
)
{
uint64_t
c
=
0
;
if
(
i
<
len
&&
i
<=
12
)
c
=
char_to_symbol
(
str
[
i
]
);
if
(
i
<
len
&&
i
<=
12
)
c
=
uint64_t
(
char_to_symbol
(
str
[
i
]
)
);
if
(
i
<
12
)
{
c
&=
0x1f
;
...
...
contracts/eosiolib/varint.hpp
浏览文件 @
98bf1aaf
...
...
@@ -102,7 +102,7 @@ struct signed_int {
template
<
typename
DataStream
>
friend
DataStream
&
operator
<<
(
DataStream
&
ds
,
const
signed_int
&
v
){
uint32_t
val
=
(
v
.
value
<<
1
)
^
(
v
.
value
>>
31
);
uint32_t
val
=
uint32_t
((
v
.
value
<<
1
)
^
(
v
.
value
>>
31
)
);
do
{
uint8_t
b
=
uint8_t
(
val
)
&
0x7f
;
val
>>=
7
;
...
...
contracts/multi_index_test/multi_index_test.cpp
浏览文件 @
98bf1aaf
...
...
@@ -5,6 +5,7 @@ using namespace eosio;
struct
limit_order
{
uint64_t
id
;
uint64_t
padding
=
0
;
uint128_t
price
;
uint64_t
expiration
;
account_name
owner
;
...
...
@@ -32,6 +33,7 @@ extern "C" {
});
orders
.
update
(
order
,
payer
,
[
&
](
auto
&
o
)
{
o
.
expiration
=
4
;
});
const
auto
*
o
=
orders
.
find
(
1
);
...
...
@@ -41,9 +43,11 @@ extern "C" {
auto
expidx
=
orders
.
get_index
<
N
(
byexp
)
>
();
for
(
const
auto
&
item
:
orders
)
{
(
void
)
item
.
id
;
}
for
(
const
auto
&
item
:
expidx
)
{
(
void
)
item
.
id
;
}
auto
lower
=
expidx
.
lower_bound
(
4
);
...
...
contracts/stltest/stltest.cpp
浏览文件 @
98bf1aaf
...
...
@@ -193,7 +193,7 @@ namespace stltest {
prints
(
"f() called
\n
"
);
}
static
void
on
(
const
message
&
msg
)
{
static
void
on
(
const
message
&
)
{
/* manual initialization of global variable
new(&std::__start_std_streams)std::ios_base::Init;
*/
...
...
@@ -244,7 +244,7 @@ namespace stltest {
std
::
map
<
int
,
long
>
m
;
m
.
emplace
(
0
,
1
);
auto
mit
=
m
.
lower_bound
(
2
);
m
.
lower_bound
(
2
);
std
::
set
<
long
>
st
;
st
.
insert
(
0
);
...
...
@@ -257,7 +257,7 @@ namespace stltest {
//hs.insert(0);
sort
(
dq
.
begin
(),
dq
.
end
());
auto
lit
=
find_if
(
l
.
begin
(),
l
.
end
(),
[](
uint32_t
f
)
{
return
f
<
10
;
});
find_if
(
l
.
begin
(),
l
.
end
(),
[](
uint32_t
f
)
{
return
f
<
10
;
});
prints
(
"STL test done.
\n
"
);
//std::cout << "STL test done." << std::endl;
}
...
...
contracts/test.system/test.system.cpp
浏览文件 @
98bf1aaf
...
...
@@ -18,33 +18,33 @@ namespace testsystem {
};
struct
set_account_limits
:
dispatchable
<
N
(
setalimits
)
>
{
account_name
account
;
int64_t
ram_bytes
;
int64_t
net_weight
;
int64_t
cpu_weight
;
account_name
account
;
uint64_t
ram_bytes
=
0
;
uint64_t
net_weight
=
0
;
uint64_t
cpu_weight
=
0
;
static
void
process
(
const
set_account_limits
&
act
)
{
set_resource_limits
(
act
.
account
,
act
.
ram_bytes
,
act
.
net_weight
,
act
.
cpu_weight
,
0
);
}
EOSLIB_SERIALIZE
(
set_account_limits
,
(
account
)(
ram_bytes
)(
net_weight
)(
cpu_weight
)
)
;
EOSLIB_SERIALIZE
(
set_account_limits
,
(
account
)(
ram_bytes
)(
net_weight
)(
cpu_weight
)
)
};
struct
set_global_limits
:
dispatchable
<
N
(
setglimits
)
>
{
int64_t
cpu_usec_per_period
;
static
void
process
(
const
set_global_limits
&
act
)
{
static
void
process
(
const
set_global_limits
&
)
{
// TODO: support this
}
EOSLIB_SERIALIZE
(
set_global_limits
,
(
cpu_usec_per_period
)
)
;
EOSLIB_SERIALIZE
(
set_global_limits
,
(
cpu_usec_per_period
)
)
};
struct
producer_key
{
account_name
account
;
std
::
string
public_key
;
EOSLIB_SERIALIZE
(
producer_key
,
(
account
)(
public_key
)
)
;
EOSLIB_SERIALIZE
(
producer_key
,
(
account
)(
public_key
)
)
};
struct
set_producers
:
dispatchable
<
N
(
setprods
)
>
{
...
...
@@ -57,7 +57,7 @@ namespace testsystem {
set_active_producers
(
buffer
,
sizeof
(
buffer
));
}
EOSLIB_SERIALIZE
(
set_producers
,
(
version
)(
producers
)
)
;
EOSLIB_SERIALIZE
(
set_producers
,
(
version
)(
producers
)
)
};
struct
require_auth
:
dispatchable
<
N
(
reqauth
)
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录