Skip to content
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

Refactor and enhance Dialog handling in OSLib for improved safety and eficiency #61

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

dogo
Copy link
Owner

@dogo dogo commented Sep 8, 2024

Pull Request Description

This PR improves the dialog handling logic in OSLib by refactoring and optimizing various functions for better readability, maintainability, and safety. Key changes include:

  • Improved error handling: Ensured that all return values from sceUtility* functions are checked and handled appropriately. This avoids ignoring potential errors during dialog initialization and updates.
  • Buffer overflow prevention: Replaced strcpy with strncpy to safely copy message strings and prevent buffer overflows.
  • Enhanced oslDrawDialog: Improved logic for drawing dialogs, managing their states, and handling multiple dialog types (message, error, network, OSK, save/load, and browser dialogs).
  • Optimized state management: Simplified the code for managing dialog states (dialogType and status checks) and streamlined the process of detecting active dialogs.
  • Code readability and formatting: Cleaned up the code, improved indentation.

These improvements increase the overall robustness of the library and ensure that dialogs are handled safely and efficiently.

- Refactored ConfigureDialog function for better reuse across different dialog types.
- Added error handling for all sceUtility* function calls.
- Replaced strcpy with strncpy to prevent potential buffer overflows.
- Enhanced oslDrawDialog to handle multiple dialog types more efficiently.
- Simplified dialog state management.
- Consolidated code and improved formatting for readability and maintainability.
@dogo dogo merged commit 30827c1 into master Sep 8, 2024
6 checks passed
@dogo dogo deleted the refactor/dialog branch September 8, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant