Monday, May 09, 2005


Tip 2: Check that there is sufficient space before writing to a descriptor

An attempt to access an area outside the area allocated for descriptor data will cause a panic in both debug and release builds, because the descriptor functions use __ASSERT_ALWAYS to check for out-of-bounds access. A panic causes your code will stop executing immediately, whether running in an application, server or test framework. So be absolutely certain that there is space in your target descriptor, if necessary, by doing a check first by using the Length() or MaxLength() methods.

_LIT8(KImageGif, “image/gif”); // 9 characters
TBuf8<8> mimeType8; // Space for only 8 characters

mimeType8.Copy(KImageGif); // Panic!

Or, if no error checking is needed:

_LIT8(KImageGif, “image/gif”); // 9 characters
TBuf8<8> mimeType8; // Space for only 8 characters
mimeType9 ? 9 or 8 ?
I think that's a typo. Should be mimeType8.

Thanks, both of you (?) for your comments. I do value your feedback. In future, I'd prefer not to receive anonymous comments; if possible, please can you leave a name.
helpful tips and Very useful and important for all bloggers.I managed to create health related site you must like it
Investment Plans to make money online, Online Jobs can make money online from home, Just Visit
"Free Social Media Marketing where Every thing will be Free, Facebook Likes, Twitter Followers, Twitter Tweets, Twitter Re-Tweets, Twitter Favorites, Google Plus Followers, StumbleUpon Followers, Youtube Views, Youtube Likes, Youtube Subsribes, Pinterest Followers, Pinterest Likes, Pinterest PinIt, Free Website Visitors."
Just Join now and Free Increase your Social Media Networks.

Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?

WWW Top Tips for Descriptors