Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  CapsuleDecoder.cpp

  Sprache: C
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#include "CapsuleDecoder.h"

#include "ErrorList.h"
#include "mozilla/net/NeqoHttp3Conn.h"

namespace mozilla::net {

CapsuleDecoder::CapsuleDecoder(const uint8_t* aData, size_t aLength) {
  NeqoDecoder::Init(aData, aLength, getter_AddRefs(mDecoder));
}

CapsuleDecoder::~CapsuleDecoder() = default;

template <>
Maybe<uint32_t> CapsuleDecoder::DecodeUint<uint32_t>() {
  uint32_t res = 0;
  if (mDecoder->DecodeUint32(&res)) {
    return Some(res);
  }
  return Nothing();
}

size_t CapsuleDecoder::BytesRemaining() { return mDecoder->Remaining(); }

size_t CapsuleDecoder::CurrentPos() { return mDecoder->Offset(); }

Maybe<uint64_t> CapsuleDecoder::DecodeVarint() {
  uint64_t v = 0;
  if (mDecoder->DecodeVarint(&v)) {
    return Some(v);
  }

  return Nothing();
}

// Decodes arbitrary data: returns a span over the next n bytes, if available.
Maybe<mozilla::Span<const uint8_t>> CapsuleDecoder::Decode(size_t n) {
  const uint8_t* buffer = nullptr;
  uint32_t length = 0;
  if (mDecoder->Decode(n, &buffer, &length)) {
    return Some(mozilla::Span<const uint8_t>(buffer, length));
  }

  return Nothing();
}

mozilla::Span<const uint8_t> CapsuleDecoder::GetRemaining() {
  const uint8_t* buffer = nullptr;
  uint32_t length = 0;
  mDecoder->DecodeRemainder(&buffer, &length);
  return mozilla::Span<const uint8_t>(buffer, length);
}

}  // namespace mozilla::net

Messung V0.5 in Prozent
C=93 H=95 G=93

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002