Git Product home page Git Product logo

Comments (6)

farindk avatar farindk commented on August 30, 2024

Changed (and a bit more).
Thanks

2013/9/5 Markus Elfring [email protected]

I have looked at a few source files for your current software. I have
noticed that some checks for return codes are missing.

Would you like to add more error handling for return values from functions
like the following?

  • fopenhttp://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html=>
    mainhttps://github.com/strukturag/libde265/blob/aad31624ed7bdd3eb665511e569a8fb4e700525d/dec265/dec265.cc#L57
  • callochttp://pubs.opengroup.org/onlinepubs/9699919799/functions/calloc.html=>
    de265_new_decoderhttps://github.com/strukturag/libde265/blob/aad31624ed7bdd3eb665511e569a8fb4e700525d/libde265/de265.c#L65

Reply to this email directly or view it on GitHubhttps://github.com//issues/3
.

from libde265.

elfring avatar elfring commented on August 30, 2024

Thanks for your improvement.

I find it still incomplete.

Are you interested in aspect-oriented software development?

from libde265.

farindk avatar farindk commented on August 30, 2024

Fixed.

from libde265.

elfring avatar elfring commented on August 30, 2024

The added value check is wrong. How do you think about an approach like the following?

   if (fread(buf, 1, BUFFER_SIZE, fh) != BUFFER_SIZE)
     {
      if ferror(fh)
         goto handle_read_error;
      else
        {
         ...
        }
     }

Do you prefer a different reaction than a crash because of a null pointer that might be returned from the function "de265_new_decoder"?

I guess that it would be nice if the function "de265_init" will acknowledge by a return value if the initialisation of your software library was really successful.

Would you like to care for return values also from functions like "fwrite" and "fclose"?

Would you like to add an annotation like "warn_unused_result" to any function of your API?

from libde265.

farindk avatar farindk commented on August 30, 2024

No, on contrary, your approach is wrong. Because at the end of a file, fread will return a value smaller than BUFFER_SIZE when it reads the final bytes.

I do not want to care about errors in fclose(). First, because that code is not used (only debugging), second, because I have never seen this fail, third, because I have far more important things to add.

from libde265.

elfring avatar elfring commented on August 30, 2024

You could add the check for "feof(fh)" in the else branch. ;-)

I hope that return value ignorance can be changed.

from libde265.

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.