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

Make use of latin1 encoding explicit in gdextension_interface.cpp. #101352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ivorforce
Copy link
Contributor

@Ivorforce Ivorforce commented Jan 9, 2025

This is a small sanity PR with no change in behavior. latin1 constructors and parsing functions are exposed with this PR (as is parse_utf32 with similar reasoning).

Some functions in the gdextension interface advertise to parse latin1, but they currently parse "whatever the String constructor uses" - which is parse_latin1. This is correct, but imprecise.

To give more context, for most String constructor callers, the current parse_latin1 is incorrect, as most use it to parse utf-8 literals1. It would be sane to make the use of latin1 explicit, to avoid confusing it with the other cases.

I also took the opportunity to clean up the memnew calls of related functions a bit.

Footnotes

  1. https://github.com/godotengine/godot/issues/100641

@Ivorforce Ivorforce requested review from a team as code owners January 9, 2025 15:26
@Repiteo Repiteo added this to the 4.x milestone Jan 9, 2025
Copy link
Contributor

@Repiteo Repiteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How am I just now realizing we've never had a parsing equivalent for ascii of all things. Yeah, there's the CharString function, but the fact we've never had a parse_ascii or static String ascii feels like a wild oversight.

@Ivorforce
Copy link
Contributor Author

How am I just now realizing we've never had a parsing equivalent for ascii of all things. Yeah, there's the CharStringfunction, but the fact we've never had aparse_ascii or static String ascii feels like a wild oversight.

Hah, yeah that surprised me too. I have a PR open for it: #101304

@@ -31,6 +31,7 @@
#ifndef SORT_EFFECTS_RD_H
#define SORT_EFFECTS_RD_H

#include "servers/rendering/renderer_rd/shader_rd.h"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick fix due to build failing because of erroneous cache restores.

I have previously established that including a non-generated file explicitly solves such cache issues for good.

@Ivorforce Ivorforce force-pushed the string-latin1-explicit branch from b8c8ed1 to 5b834db Compare January 9, 2025 16:23
@Ivorforce Ivorforce force-pushed the string-latin1-explicit branch from 5b834db to 334e027 Compare January 13, 2025 12:16
Copy link
Contributor

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Overall, this is a great idea, however, I'm a little worried about introducing subtle behavior changes. There's two spots where I think behavior may be changing, and we should discuss if this is a change we want or not.

@Ivorforce Ivorforce force-pushed the string-latin1-explicit branch from 334e027 to 329774e Compare January 13, 2025 15:57
Copy link
Contributor

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in gdextension_interface.cpp look good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants