-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Osc in mixxx arm64 2.6 with TrackInfo (Title&Artist) -- Special OSCleton version #14181
base: main
Are you sure you want to change the base?
Conversation
This is not a review, I just suggest you to do a small source reorganization. I see that in /src/osc/ip and /src/osc/osc , there is code from the library. This code should probably be relocated into /lib/osc you can do that with git (i don't know if you use the commandline or some graphical application) and it will keep the history. |
}; | ||
|
||
// function to convert and carry special characters in TrackArtist & TrackTitle to ASCII | ||
QString escapeStringToJsonUnicode(const QString& input) { |
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.
I think it helps to return here directly ASCII as QByteArray.
QString escapeStringToJsonUnicode(const QString& input) { | ||
QString escaped; | ||
for (QChar c : input) { | ||
if (c.isPrint() && c.unicode() < 128) { |
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.
This is not fast because it checks all character in the 16 bit range. How about:
if (c.isPrint() && c.unicode() < 128) { | |
if (c.unicode() >= ' ' && c.unicode() <='~' && c != '\\' && c != '\"' ) { |
escaped += c; | ||
} else { | ||
// Escape non-ASCII and special characters | ||
escaped += QString("\\u%1").arg(c.unicode(), 4, 16, QChar('0')).toUpper(); |
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.
Here memory extra alocation is involved. To be honest, I have no better idea. It would be great to know the final string size forehead and print everything into it in one go. However this requires some not too easy code. Probably not worse the effort.
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.
Osc in mixxx arm64 2.6 with TrackInfo (Title&Artist) -- Special OSCleton version
Extra in this version : GetT# function to request TrackArtist & TrackTitle