-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rcheevos #84
Rcheevos #84
Conversation
char _hash[HASH_SIZE] = {}; | ||
|
||
int res = rc_hash_generate_from_file(_hash, consoleID, filePath.c_str()); | ||
hash = _hash; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hash
should only by set if res
== RC_OK
. However, on the note of checking return value, here's a snippet of (maybe outdated) documentation I found:
Return value
If the function succeeds, the return value is RC_OK. Otherwise, the error code can be converted to a string using rc_error_str.
- RC_INVALID_STATE - one or more required parameters was not provided.
- RC_OUT_OF_MEMORY - enough memory could not be allocated to complete the operation.
To be fully correct, we should handle all pre-conditions and post-conditions when calling into an external library. To satisfy post-conditions, this means checking the result and logging errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments above the function state:
/* generates a hash from a file.
* returns non-zero on success, or zero on failure.
*/
That's why I didn't use the RC_OK
you suggested in the previous comment, it was a bit confusing to check if the result is different from the OK value my thoughts when reading that were that if CCheevos::GenerateHashFromFile
returns true it means it failed
I scrutinized the code and found a couple suggestions. |
fcffb19
to
0a3df37
Compare
I tried compiling on Windows and found the following warnings:
|
Just pointing out, the last two commits should be squashed so that the build succeeds on every commit to aid in bisecting. But no need to update for this PR. |
2fd03e8
to
262c7b3
Compare
Rcheevos expose hash and url functions RCheevos expose post rc_url_ping function fix crash when cheevos is deleted Added comment to the base file of RetroArch Reset rc_runtime Fix compiler error and refactor Peek() Guard against uninitialized variable
Replace libretro.h with libretro-common/libretro.h
This PR adds support for rcheevos to RetroPlayer. This PR is used by xbmc/xbmc#20913 and depends on it to be build