×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    KUidContactFieldFamilyName proper usage

    Hello, the code below produces garbage such as in the title:

    Code:
    .....
    else if (field.ContentType().ContainsFieldType(KUidContactFieldGivenName)) {                   //all fine
    				given.Fill('\0',1);				
    				given.Copy(field.TextStorage()->Text());
    				given.ZeroTerminate();
    			}else if (field.ContentType().ContainsFieldType(KUidContactFieldFamilyName)) {   //trouble
    				family.Fill('\0',1);				
    				family.Copy(field.TextStorage()->Text());
    				family.ZeroTerminate();
    			}
    .....
    Stuff like "0a06eb39efcf8537" gets returned as family name for contacts in a nokia S60 5th (5800 express device). However, fetching KUidContactFieldGivenName seems to return no junk. What is going on here ?

    Thanks

  2. #2
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    Re: KUidContactFieldFamilyName proper usage

    ___________ Bump

  3. #3
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: KUidContactFieldFamilyName proper usage

    Code:
    .....
    		else if (field.ContentType().ContainsFieldType(KUidContactFieldFamilyName)) { 
                                       if ( field.TextStorage()->Text().Length() > 0)
    			       {           				
    				family.Copy(field.TextStorage()->Text());
    			       }	
    			}
    .....
    There may be no field data that's why you got garbage value......Check length of data..It's valid than go to read.....
    Hope It'll help you.

  4. #4
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    Re: KUidContactFieldFamilyName proper usage

    Quote Originally Posted by kis_spn View Post

    There may be no field data that's why you got garbage value......Check length of data..It's valid than go to read.....
    Hope It'll help you.
    Well, if there is nothing to return, the code still gets me "0a06eb39efcf8537" or something similar. However if the family name is "Tomuta" then it would return 'Tomuta 0a06eb39efcf8537' (or similar).

    Thanks

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: KUidContactFieldFamilyName proper usage

    If there is nothing to return, your if is not expected to run, and you probably get some random garbage from the "original" content of the descriptor. Note that in this case the zero terminators will not be there, since they are also part of the if-s.
    Re-check what you are doing. If you do not empty your variables prior to this entire extraction loop, at the end you will not be able to decide if a variable contains garbage, or some content which was put there in the loop. Paired with some conversion to zero terminated string, it seems to be an easy way to get wrong results.

  6. #6
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    Re: KUidContactFieldFamilyName proper usage

    Quote Originally Posted by wizard_hu_ View Post
    If there is nothing to return, your if is not expected to run, and you probably get some random garbage from the "original" content of the descriptor.
    This explanation is pretty... straightforward. However, what you have failed to see is that all other 'else if' behave normally, and of course I am only talking about the case where the if (...KUidContactFieldFamilyName) { ... branch gets executed.

    Update: problem does not reproduce on a N95 phone, only seen it on 5800 express.

Similar Threads

  1. [moved] Proper usage of RFile class
    By vinp in forum Symbian
    Replies: 6
    Last Post: 2010-10-14, 08:59
  2. proper referenses
    By sepideh06 in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2008-06-21, 10:54
  3. Replies: 0
    Last Post: 2007-02-05, 16:07
  4. Proper use of RScheduler?
    By mapeters in forum Symbian
    Replies: 11
    Last Post: 2006-07-03, 07:42
  5. Is the usage of HBufC proper here?
    By asheeshv in forum Symbian
    Replies: 0
    Last Post: 2005-03-29, 15:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×