Code Monkey home page Code Monkey logo

Comments (1)

shampoofactory avatar shampoofactory commented on July 19, 2024

Is this also related to #44 ?

TLDR: It's related but does not solve the issue because there's an unhandled corner case.

I withdrew that commit as there is an unhandled corner case (*). Sorry.

I'm not sure I have any good answers for you but here are my two cents. Most of which I suspect you already know.

Within the context of lzfse_decode_buffer my understanding is that the return value, let's call it ret, can communicate three outcomes:

  1. Success. Here ret reflects the number of bytes written into the destination buffer.
  2. Destination buffer is too small. Here ret equals the size of the destination buffer.
  3. Decode error. Here ret equals 0. This is not explicitly documented but we can see the relevant code here.

The issue is that ret is overloaded. It's not always possible to assign an outcome based on ret alone.

For example, let's take a ret value of zero. This could mean:

  1. Success. Where we've decoded a zero-length input file.
  2. Destination buffer is too small. Where we've passed a zero-sized destination buffer.
  3. Decode error. Where we've passed invalid data.

Although we can exclude scenario 2 by not passing in zero-sized buffers, we still cannot differentiate between scenarios 1 and 3 (*). We need more information. At some level, we need to tweak the API. One such suggestion is here.

from lzfse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.