saitoha / libsixel

A SIXEL encoder/decoder implementation derived from kmiya's sixel (https://github.com/saitoha/sixel).
MIT License
2.49k stars 83 forks source link

Completion of error handling #5

Closed elfring closed 9 years ago

elfring commented 10 years ago

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?

saitoha commented 10 years ago

fwrite ⇒ sixel_to_png malloc ⇒ sixel_create_image

Thanks!! I corrected above items you pointed out by 2b8d931.

ftell ⇒ stbi_info_from_file

I keep it as is. So it seems to be dead code :)

elfring commented 10 years ago

I suggest to avoid ignorance of return values a bit more.

Are you interested to apply aspect-oriented software development? How do you think about to encapsulate error detection and corresponding exception handling as a reusable aspect in your software?

elfring commented 10 years ago

How do you think about to improve static source code analysis also for your software?

Do you find information sources like the following useful?

elfring commented 10 years ago

Would you like to reopen this bug report?

saitoha commented 10 years ago

I’d like to try such analysis tools to detect "ignorance of return values". Which is your recommendation among this list? https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#C.2FC.2B.2B

elfring commented 10 years ago

I suggest to reuse the following tools for finding more update candidates depending on your preferences for factors like freedom, licence costs and programming language support.

  1. AspectC++
  2. Secure Programming Lint
  3. Coccinelle
  4. Coverity Scan
saitoha commented 9 years ago

I think it's done in develop branch. Semantic error handling is available by introducing new API set that returns error code SIXELSTATUS. Thanks!

elfring commented 9 years ago

Did you try any static source code analysis out with your updated application programming interface?

How do you think about to annotate any functions with "__attribute__((warn_unused_result))"?