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

Fixed multiple warnings. #582

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Conversation

vitimiti
Copy link

Added explicit casts and added some NULL pointer checks to remove warnings that happen during compilation and prevent undefined behaviour.

Added the .vscode folder to be ignored.
Initialized the utf_chars array to an empty array.
Removed trailing whitespace after if clause.
Added a missing FILED_TYPE_JSON filed to the enum_field_types
enumeration.

Changed the magic numbers in the switch case 246 and 245 for
FILED_TYPE_NEWDECIMAL and
FILED_TYPE_JSON respectively.
Added a return logic to the HL_NAME function based on SDL.

Added missing casts to the HL_NAME implementation using hl_copy_bytes.
Added explicit cast for the function sqlite3_prepare16_v2 which expects
a const void** as 5th argument instead of the const char** that tl
represents.
Added missing parenthesis to suppress different types size warnings.

Added an if clause in hl_free to avoid running through null pointers.
Now addr type within hl_debug_read_register is vbyte* to prevent
warnings in hl_debug_read in line 351.
Moved the "free(store);" line to after the "hl_remove_root(store);" line
to prevent the use of a NULL pointer in hl_remove_root.
Added two ustrdup logic to prevent accidentally modifying the
const uchar *str parameter.

Copied this str to a local variable to modify said pointer locally
and not modify str, as promised by the const identifier.
Now the send function is explicitly casted to int.
Now the integer is first cast into a long integer to make the cast to
vbyte* be of equivalent size.
libs/mysql/mysql.c Outdated Show resolved Hide resolved
src/std/ucs2.c Outdated Show resolved Hide resolved
Now the variable does not have the same name as the C function.

Removed unnecessary comments.
src/std/ucs2.c Outdated Show resolved Hide resolved
Fixed second instance of using a C function name as a variable name.

Improved the naming of the copied str.
src/gc.c Outdated Show resolved Hide resolved
Reverted if statement to prevent breaking changes.
Explicitly added a 0 in the array initialization to prevent MSVC errors.
@vitimiti
Copy link
Author

It looks like my C++ training got in the way of how to properly initialize arrays to all zeros. I have added the proper C way and I will see if the tests now pass in MSVC.

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.

2 participants