956 const TUint8* currentPtr=opaqueData->GetPtr();//TUint8 pointer is used |
956 const TUint8* currentPtr=opaqueData->GetPtr();//TUint8 pointer is used |
957 |
957 |
958 //resource string length is limited to 255 characters max. |
958 //resource string length is limited to 255 characters max. |
959 const TInt unicodeLength=*currentPtr; |
959 const TInt unicodeLength=*currentPtr; |
960 |
960 |
961 ++currentPtr; |
|
962 if (unicodeLength!=0) |
961 if (unicodeLength!=0) |
963 { |
962 { |
964 if (REINTERPRET_CAST(TUint,currentPtr)&0x1) |
963 if (REINTERPRET_CAST(TUint,(currentPtr+1))&0x1) |
965 { |
964 { |
966 // The resource compiler puts out a padding byte (arbitrarily 0xab) |
965 // The resource compiler puts out a padding byte (arbitrarily 0xab) |
967 // to ensure the alignment of Unicode strings within each resource. |
966 // to ensure the alignment of Unicode strings within each resource. |
968 if(*currentPtr!=0xab) |
967 |
|
968 //Cardanility check. Values in the range 0-127 are stored in a single byte, |
|
969 //128-16383 in two bytes and other values in 4 bytes. |
|
970 if((*(currentPtr+1)!=0xab) && (*(currentPtr+3)!=0xab)) |
969 { |
971 { |
970 std::string errMsg= "Failed : Trying to access invalid registrationFile"; |
972 std::string errMsg= "Failed : Trying to access invalid registrationFile"; |
971 throw CResourceFileException(errMsg); |
973 throw CResourceFileException(errMsg); |
972 } |
974 } |
973 ++currentPtr; |
|
974 } |
975 } |
975 } |
976 } |
976 |
977 |
977 opaqueData->SetPtr(currentPtr); |
978 opaqueData->SetPtr(currentPtr); |
978 opaqueData->ForceLength(unicodeLength*2); |
979 opaqueData->SetLength(opaqueData->GetLength()); |
|
980 |
979 } |
981 } |
980 else |
982 else |
981 { |
983 { |
982 opaqueData = new Ptr8(1); |
984 opaqueData = new Ptr8(1); |
983 if(NULL==opaqueData || NULL==opaqueData->GetPtr()) |
985 if(NULL==opaqueData || NULL==opaqueData->GetPtr()) |
1006 const TUint8* currentPtr=opaqueData->GetPtr();//TUint8 pointer is used |
1008 const TUint8* currentPtr=opaqueData->GetPtr();//TUint8 pointer is used |
1007 |
1009 |
1008 //resource string length is limited to 255 characters max. |
1010 //resource string length is limited to 255 characters max. |
1009 const TInt unicodeLength=*currentPtr; |
1011 const TInt unicodeLength=*currentPtr; |
1010 |
1012 |
1011 ++currentPtr; |
|
1012 if (unicodeLength!=0) |
1013 if (unicodeLength!=0) |
1013 { |
1014 { |
1014 if (REINTERPRET_CAST(TUint,currentPtr)&0x1) |
1015 if (REINTERPRET_CAST(TUint,(currentPtr+1))&0x1) |
1015 { |
1016 { |
1016 // The resource compiler puts out a padding byte (arbitrarily 0xab) |
1017 // The resource compiler puts out a padding byte (arbitrarily 0xab) |
1017 // to ensure the alignment of Unicode strings within each resource. |
1018 // to ensure the alignment of Unicode strings within each resource. |
1018 if(*currentPtr!=0xab) |
1019 |
|
1020 //Cardanility check. Values in the range 0-127 are stored in a single byte, |
|
1021 //128-16383 in two bytes and other values in 4 bytes. |
|
1022 if((*(currentPtr+1)!=0xab) && (*(currentPtr+3)!=0xab)) |
1019 { |
1023 { |
1020 std::string errMsg= "Failed : Trying to access invalid registrationFile"; |
1024 std::string errMsg= "Failed : Trying to access invalid registrationFile"; |
1021 throw CResourceFileException(errMsg); |
1025 throw CResourceFileException(errMsg); |
1022 } |
1026 } |
1023 ++currentPtr; |
|
1024 } |
1027 } |
1025 } |
1028 } |
1026 |
1029 |
1027 opaqueData->SetPtr(currentPtr); |
1030 opaqueData->SetPtr(currentPtr); |
1028 opaqueData->SetLength(unicodeLength*2); |
1031 opaqueData->SetLength(opaqueData->GetLength()); |
1029 |
|
1030 CAppLocalOpaqueDataInfo* opaqueInfo = CAppLocalOpaqueDataInfo::NewL(iLocale, aServiceUid, opaqueData); |
1032 CAppLocalOpaqueDataInfo* opaqueInfo = CAppLocalOpaqueDataInfo::NewL(iLocale, aServiceUid, opaqueData); |
1031 iOpaqueDataArray.push_back(opaqueInfo); |
1033 iOpaqueDataArray.push_back(opaqueInfo); |
1032 } |
1034 } |
1033 } |
1035 } |
1034 } |
1036 } |