Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » [FIXED] ToUpper, ToLower,and ToAscii (char*, int) causes AssertFailed
Re: [BUG] ToUpper, ToLower,and ToAscii (char*, int) causes AssertFailed [message #46591 is a reply to message #46583] Sun, 05 June 2016 18:15 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
There are two reasons why this crashes:

a) default encoding is UTF8 and with UTF8 conversion in general does not guarantee that the ouput number of bytes is the same as input one. Now in this case, it is, but I do not think it is even healthy to support this conversion. You can make it work by adding some 8-bit charset, like

ToUpper(s, 4, CHARSET_WIN1252);

b) you are overwriting string literal, which is undefined behaviour. So

#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	char s[] = "abcd";
	ToUpper(s, 4, CHARSET_WIN1250);
}


Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to handle a lack of memory
Next Topic: [FEATURE] Accessing to Alternate Win Registry View (patch included)
Goto Forum:
  


Current Time: Sat May 18 03:49:03 CEST 2024

Total time taken to generate the page: 0.02053 seconds