Skip to content

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

Merged
dogo merged 1 commit into
masterfrom
refactor/dialog
Sep 8, 2024
Merged

Refactor and enhance Dialog handling in OSLib for improved safety and eficiency#61
dogo merged 1 commit into
masterfrom
refactor/dialog

Conversation

@dogo

@dogo dogo commented Sep 8, 2024

Copy link
Copy Markdown
Owner

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
@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