A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/stlink-org/stlink/pull/909 below:

[refactoring] Clean code with unified variable type · Issue #909 · stlink-org/stlink · GitHub

As far as I can see, many functions use fixed-length variables. It is indeed useful for functions that need to deal with fixed data format. However the abuse of fixed-length variables are causing potential build failures and inessential casts.

For example in src/usb.c:

send_recv accept txsize and rxsize as size_t but in the actual context, those arguments have to be casted to int or unsigned int, without a fixed length, and whoever calls it provides arguments of a different type(uint32_t or magic numbers in this case). unintentional cast from 32 bit to 64 bit is applied at the calling process. Also, to prevent a build failure, many explicit casts are required.

I suggest replacing fixed length variables according to their actual usages.
Staying fuzzy to be more portable.

I would like to give it a try if others find it meaningful.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4