mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
[Protocol] Replace some usage of remaining_length with the more appropiate is_remaining_empty
This commit is contained in:
parent
8fe521749a
commit
dd80d6309f
4 changed files with 6 additions and 6 deletions
|
|
@ -174,7 +174,7 @@ pub(crate) fn data_to_map(packet: &[u8]) -> GDResult<(HashMap<String, String>, V
|
|||
let mut vars = HashMap::new();
|
||||
|
||||
let mut buf = Bufferer::new_with_data(Endianess::Big, packet);
|
||||
while buf.remaining_length() > 0 {
|
||||
while !buf.is_remaining_empty() {
|
||||
let key = buf.get_string_utf8()?;
|
||||
if key.is_empty() {
|
||||
break;
|
||||
|
|
@ -214,7 +214,7 @@ fn parse_players_and_teams(packets: Vec<Vec<u8>>) -> GDResult<(Vec<Player>, Vec<
|
|||
for packet in packets {
|
||||
let mut buf = Bufferer::new_with_data(Endianess::Little, &packet);
|
||||
|
||||
while buf.remaining_length() > 0 {
|
||||
while !buf.is_remaining_empty() {
|
||||
if buf.get_u8()? < 3 {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -255,7 +255,7 @@ fn parse_players_and_teams(packets: Vec<Vec<u8>>) -> GDResult<(Vec<Player>, Vec<
|
|||
false => &mut teams_data,
|
||||
};
|
||||
|
||||
while buf.remaining_length() > 0 {
|
||||
while !buf.is_remaining_empty() {
|
||||
let item = buf.get_string_utf8()?;
|
||||
if item.is_empty() {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ fn get_server_vars(bufferer: &mut Bufferer) -> GDResult<HashMap<String, String>>
|
|||
let mut values = HashMap::new();
|
||||
|
||||
let mut done_processing_vars = false;
|
||||
while !done_processing_vars && bufferer.remaining_length() > 0 {
|
||||
while !done_processing_vars && !bufferer.is_remaining_empty() {
|
||||
let key = bufferer.get_string_utf8()?;
|
||||
let value = bufferer.get_string_utf8_optional()?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue