Add Chromium-only Blender WebEngine parity work

This commit is contained in:
mes123456
2026-08-12 04:47:48 -04:00
commit 9fd26010f6
18225 changed files with 11622124 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2024 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(INC
.
)
set(INC_SYS
)
set(SRC
uri_convert.cc
uri_convert.hh
)
set(LIB
)
blender_add_lib(bf_intern_uriconvert "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -0,0 +1,42 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include <cctype>
#include <cstdio>
#include "uri_convert.hh" /* Own include. */
bool url_encode(const char *str, char *dst, size_t dst_size)
{
size_t i = 0;
while (*str && i < dst_size - 1) {
char c = char(*str);
if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') {
dst[i++] = *str;
}
else if (c == ' ') {
dst[i++] = '+';
}
else {
if (i + 3 >= dst_size) {
/* There is not enough space for %XX. */
dst[i] = '\0';
return false;
}
sprintf(&dst[i], "%%%02X", c);
i += 3;
}
++str;
}
dst[i] = '\0';
if (*str != '\0') {
/* Output buffer was too small. */
return false;
}
return true;
}

View File

@@ -0,0 +1,25 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup intern_uri
*/
/**
* \brief Encodes a string into URL format by converting special characters into percent-encoded
* sequences.
*
* This function iterates over the provided C-string and replaces non-alphanumeric characters
* (except for '-', '_', '.', '~') with their hexadecimal representations prefixed with '%'.
* Spaces are converted into '+', following the conventions of URL encoding for forms
* (application/x-www-form-urlencoded).
*
* \param str: The input C-string to be URL-encoded.
* \param dst: The output buffer where the URL-encoded string will be stored.
* \param dst_size: The size of the output buffer `dst`.
* \return: `true` if encoding was successful, or `false` if the output buffer was insufficient.
*/
bool url_encode(const char *str, char *dst, size_t dst_size);