Descriptor array problem
| Mon, 2008-02-11 09:54 | |
|
Dear All, I am struggling with Symbian arrays. I am trying to use CDesC8Array-s. I allocated two of them on the heap, added some elements to it but I get a Kern-Exec 3 panic when I try to access their size. (BTW it seems also not to work if I keep things on the stack) Is there something obviously wrong with the following code? CDesC8Array * paramNames = new (ELeave) CDesC8ArrayFlat(4);Is there any good reference for arrays on line? Thanks, |
|






Forum posts: 1241
I never used MdcaCount(), I always used Count(), and it worked.
I did not understand from the SDK documentation what MdcaCount() should be good for, so I don't know whether that's really the problem or not.
René Brunner
Forum posts: 32
Thanks for your reply.
I tried changing MdcaCount() for Count() but it's the very same. I guess one probably calls the other.
Any other pointers or suggestions?
Thanks,
Enrico
Forum posts: 32
Hello again.
I changed the code to try and use RArray, but I still get weird behaviour from Count(), in this case the application does not crash but I get rubbish values:
RArray<TPtrC8> paramNamesInst(4);
CleanupClosePushL( paramNamesInst );
RArray<TPtrC8> paramValuesInst(4);
CleanupClosePushL( paramValuesInst );
paramNamesInst.AppendL( _L8("name1") );
paramValuesInst.AppendL( _L8("value1") );
paramNamesInst.AppendL( _L8("name2") );
paramValuesInst.AppendL( _L8("value1") );
paramNamesInst.AppendL( _L8("name3") );
paramValuesInst.AppendL( _L8("value3") );
paramNamesInst.AppendL( _L8("name4") );
paramValuesInst.AppendL( _L8("value4") );
// the following 2 return rubbish
TInt valuesCount = paramValuesInst.Count();
TInt namesCount = paramNamesInst.Count();
paramNamesInst.Close();
paramValuesInst.Close();
CleanupStack::Pop(2)
Any ideas what may be causing this?
Thanks,
Enrico
Forum posts: 72
If you get the panic: Kern-Exec 3, it seems that paramNames is NULL. Maybe you can debug it.
Forum posts: 25
The latest code that you have posted is giving perfect results. 'valuesCount' is being assigned 4 and 'namesCount' is also being assigned with 4. Are you still having the problem?
Forum posts: 32
Thanks aniait.
I realized that the problem was not in the array but in the method I use for logging its size
..which in turn had to do (I think) with the va_list macro having slightly changed behavior in the latest Symbian release.
Enrico
Forum posts: 1241
In such cases of mystery I use the debugger with the emulator whenever possible, and it's only impossible if the phone shows the mystery but not the emulator, which is quite rare. In your case I would have been able to directly look at the value of the 'valuesCount' variable in the debugger.
That's why I keep telling everybody who listens and everybody else anyway: Don't do Symbian programming without a debugger. You will get unhappy otherwise.
René Brunner
Forum posts: 1
I tried to use FleaC classes (FString, FStringList, etc.) for descriptors and arrays, and find it quite easy way to avoid traditional Symbian way. Not sure, if there is a device (urel) version available, but at least in the emulator it works fine! FleaC documentation is in my bookmarks: http://www.fleasome.com/index.php/the-project/documentation