Files
test2/intern/uriconvert/uri_convert.cc
Germano Cavalcante 3ab65cff04 Windows: show popup after crash
Implements a crash dialog for Windows.

The crash popup provides the following actions:
- Restart: reopen Blender from the last saved or auto-saved time
- Report a Bug: forward to Blender bug tracker
- View Crash Log: open the .txt file with the crash log
- Close: Closes without any further action

Pull Request: https://projects.blender.org/blender/blender/pulls/129974
2025-04-04 18:38:53 +02:00

43 lines
813 B
C++

/* 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;
}