protocol: atomics replace unsafe for version/debug. Closes #261
This commit is contained in:
parent
f15ece0377
commit
e834ee2f53
|
@ -39,7 +39,7 @@ impl Default for Stack {
|
||||||
|
|
||||||
impl Serializable for Option<Stack> {
|
impl Serializable for Option<Stack> {
|
||||||
fn read_from<R: io::Read>(buf: &mut R) -> Result<Option<Stack>, protocol::Error> {
|
fn read_from<R: io::Read>(buf: &mut R) -> Result<Option<Stack>, protocol::Error> {
|
||||||
let protocol_version = unsafe { protocol::CURRENT_PROTOCOL_VERSION };
|
let protocol_version = protocol::current_protocol_version();
|
||||||
|
|
||||||
if protocol_version >= 404 {
|
if protocol_version >= 404 {
|
||||||
let present = buf.read_u8()? != 0;
|
let present = buf.read_u8()? != 0;
|
||||||
|
|
|
@ -433,7 +433,7 @@ impl Metadata {
|
||||||
|
|
||||||
impl Serializable for Metadata {
|
impl Serializable for Metadata {
|
||||||
fn read_from<R: io::Read>(buf: &mut R) -> Result<Self, protocol::Error> {
|
fn read_from<R: io::Read>(buf: &mut R) -> Result<Self, protocol::Error> {
|
||||||
let protocol_version = unsafe { protocol::CURRENT_PROTOCOL_VERSION };
|
let protocol_version = protocol::current_protocol_version();
|
||||||
|
|
||||||
if protocol_version >= 404 {
|
if protocol_version >= 404 {
|
||||||
Metadata::read_from113(buf)
|
Metadata::read_from113(buf)
|
||||||
|
@ -445,7 +445,7 @@ impl Serializable for Metadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_to<W: io::Write>(&self, buf: &mut W) -> Result<(), protocol::Error> {
|
fn write_to<W: io::Write>(&self, buf: &mut W) -> Result<(), protocol::Error> {
|
||||||
let protocol_version = unsafe { protocol::CURRENT_PROTOCOL_VERSION };
|
let protocol_version = protocol::current_protocol_version();
|
||||||
|
|
||||||
if protocol_version >= 404 {
|
if protocol_version >= 404 {
|
||||||
self.write_to113(buf)
|
self.write_to113(buf)
|
||||||
|
|
Loading…
Reference in New Issue