fix ncuriparse error,Correctly remove leading and trailing whitespace

This commit is contained in:
Shaway 2024-08-10 14:38:16 +08:00 committed by GitHub
parent f0b7cebb90
commit bfdef0eecb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -173,7 +173,10 @@ ncuriparse(const char* uri0, NCURI** durip)
2. convert all '\\' -> '\' (Temp hack to remove escape characters
inserted by Windows or MinGW)
*/
for(q=uri,p=uri;*p;p++) {if((*p == '\\' && p[1] == '\\') || *p < ' ') {continue;} else {*q++ = *p;}}
p = uri;
while(*p == ' ') p++;
for(q=uri;*p;p++) {if((*p == '\\' && p[1] == '\\')) {continue;} else {*q++ = *p;}}
while(*(q - 1) == ' ' && (q - 1) >= uri) q--;
*q = '\0';
p = uri;