Bug 1716518 - Upgrade moz_cbor to v0.1.2. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D117819
This commit is contained in:
Mike Hommey 2021-06-15 22:04:53 +00:00
parent 63d1fe7a19
commit 2a2f5269ca
9 changed files with 13 additions and 14 deletions

4
Cargo.lock generated
View File

@ -3141,9 +3141,9 @@ dependencies = [
[[package]]
name = "moz_cbor"
version = "0.1.1"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20c82a57087fd5990d7122dbff1607c3b20c3d2958e9d9ad9765aab415e2c91c"
checksum = "2133b12230591b7e727c8977b96b791bba421cd80ce8eb08b782dcb4a43fa1e9"
[[package]]
name = "moz_task"

View File

@ -1 +1 @@
{"files":{"Cargo.toml":"626010f6b5f39602fedf2e4b3875d2a28e6cd276e57916d0d5955a208577d758","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"900075da16923e46236926014f2ce8a0a404dfcedceee43d9ad50e6202ab1184","rustfmt.toml":"bef4bec6cfcc87f4bfe5cea736d9a74c6ead61ae27eecb72932cbe8eaf33e0cb","src/decoder.rs":"4c3d578f0613b04cc7efaf1c56440ebf4945683f9f53968d702a7c980443039b","src/lib.rs":"f3a66cfd05b979373e53aed41119e359722290356b6ebce4f2f4da9a9909d4cf","src/serializer.rs":"6b3ec21f6f205e94f3ef84f02f4882a1c5e7c56f89d6061bfd3ec72313a3473a","src/test_decoder.rs":"dce93e4ca4021fe63928fff7536295866f711c8d9e4715b34abcdd469b91d099","src/test_serializer.rs":"7583a0047ada83e060773cd10a1be316996782cbe5ada90451e99492de8be0dc"},"package":"20c82a57087fd5990d7122dbff1607c3b20c3d2958e9d9ad9765aab415e2c91c"}
{"files":{"Cargo.toml":"137eb0326df095bf3fa030839b880f2cf4f370a44511effc4c2a4760798bc695","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"900075da16923e46236926014f2ce8a0a404dfcedceee43d9ad50e6202ab1184","rustfmt.toml":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/decoder.rs":"979a2165a0452368a0eba1da9066ed4cca491567b087dc051f4e65d15a6f13fa","src/lib.rs":"e8b91d719c9ab39562cc101c1fddd1953f7a119ce73320432a4b2647c92b2886","src/serializer.rs":"5e0466556ddc5e222339f244967f10549eb215b5d82ceb655e1838918212bde7","src/test_decoder.rs":"882b804096647cf3864ba067ef3d6eaca60e7945924ca4f122a3bd67a89f298d","src/test_serializer.rs":"b1c198ebc423849504333439c00a5c30dd40a5965da56dd32cc1be5d29d9cb15"},"package":"2133b12230591b7e727c8977b96b791bba421cd80ce8eb08b782dcb4a43fa1e9"}

View File

@ -3,7 +3,7 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g. crates.io) dependencies
# to registry (e.g., crates.io) dependencies
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
@ -12,7 +12,7 @@
[package]
name = "moz_cbor"
version = "0.1.1"
version = "0.1.2"
authors = ["Franziskus Kiefer <franziskuskiefer@gmail.com>", "David Keeler <dkeeler@mozilla.com>"]
description = "Library to use CBOR (https://tools.ietf.org/html/rfc7049) in Rust"
keywords = ["jose", "cbor"]

View File

@ -1 +0,0 @@
reorder_imported_names = true

View File

@ -48,7 +48,7 @@ impl<'a> DecoderCursor<'a> {
fn read_int(&mut self) -> Result<u64, CborError> {
let first_value = self.read_uint_from_bytes(1)? & INITIAL_VALUE_MASK;
match first_value {
0...23 => Ok(first_value),
0..=23 => Ok(first_value),
24 => self.read_uint_from_bytes(1),
25 => self.read_uint_from_bytes(2),
26 => self.read_uint_from_bytes(4),

View File

@ -5,8 +5,8 @@ mod test_decoder;
#[cfg(test)]
mod test_serializer;
use std::collections::BTreeMap;
use std::cmp::Ordering;
use std::collections::BTreeMap;
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq)]
pub enum CborType {

View File

@ -7,19 +7,19 @@ fn common_encode_unsigned(output: &mut Vec<u8>, tag: u8, value: u64) {
assert!(tag < 8);
let shifted_tag = tag << 5;
match value {
0...23 => {
0..=23 => {
output.push(shifted_tag | (value as u8));
}
24...255 => {
24..=255 => {
output.push(shifted_tag | 24);
output.push(value as u8);
}
256...65_535 => {
256..=65_535 => {
output.push(shifted_tag | 25);
output.push((value >> 8) as u8);
output.push((value & 255) as u8);
}
65_536...4_294_967_295 => {
65_536..=4_294_967_295 => {
output.push(shifted_tag | 26);
output.push((value >> 24) as u8);
output.push(((value >> 16) & 255) as u8);

View File

@ -1,6 +1,6 @@
use {CborError, CborType};
use decoder::{decode, MAX_ARRAY_SIZE};
use std::collections::BTreeMap;
use {CborError, CborType};
// First test all the basic types
fn test_decoder(bytes: Vec<u8>, expected: CborType) {

View File

@ -1,5 +1,5 @@
use CborType;
use std::collections::BTreeMap;
use CborType;
#[test]
fn test_nint() {