comparison seobeo/s_web.c @ 147:6de849867459 hg-web

[HgWeb] Updated logic to use Seobeo Client.
author June Park <parkjune1995@gmail.com>
date Fri, 09 Jan 2026 18:39:34 -0800
parents 1c4d8873e846
children 827c6ac504cd
comparison
equal deleted inserted replaced
146:8e56f800b7e4 147:6de849867459
754 } 754 }
755 Dowa_Array_Free(g_routes); 755 Dowa_Array_Free(g_routes);
756 g_routes = NULL; 756 g_routes = NULL;
757 } 757 }
758 758
759 // Logging functions moved to s_logging.c 759 // Written by AI. I don't know what it does.
760 760 void Seobeo_Url_Decode(char *dst, const char *src)
761 {
762 char a, b;
763 while (*src) {
764 /* Check if we have a % followed by two valid hex characters */
765 if (*src == '%' && src[1] && src[2]) {
766 a = src[1];
767 b = src[2];
768
769 /* Manual isxdigit check and conversion for 'a' */
770 int a_val = -1;
771 if (a >= '0' && a <= '9') a_val = a - '0';
772 else if (a >= 'a' && a <= 'f') a_val = a - 'a' + 10;
773 else if (a >= 'A' && a <= 'F') a_val = a - 'A' + 10;
774
775 /* Manual isxdigit check and conversion for 'b' */
776 int b_val = -1;
777 if (b >= '0' && b <= '9') b_val = b - '0';
778 else if (b >= 'a' && b <= 'f') b_val = b - 'a' + 10;
779 else if (b >= 'A' && b <= 'F') b_val = b - 'A' + 10;
780
781 /* If both were valid hex, combine them */
782 if (a_val != -1 && b_val != -1) {
783 *dst++ = (char)((a_val << 4) | b_val);
784 src += 3;
785 continue;
786 }
787 }
788
789 /* Handle '+' as space, otherwise copy character literally */
790 if (*src == '+') {
791 *dst++ = ' ';
792 } else {
793 *dst++ = *src;
794 }
795 src++;
796 }
797 *dst = '\0';
798 }