imgtools/romtools/rofsbuild/r_obey.cpp
changeset 654 7c11c3d8d025
parent 647 53d1ab72f5bc
child 675 02e65118a746
equal deleted inserted replaced
653:8ee61c1e0c5c 654:7c11c3d8d025
    89 	{_K("codepagingoverride"),	1, 1, EKeywordCodePagingOverride, "Overide the code paging attributes for every file in ROM, NOPAGING|DEFAULTUNPAGED|DEFAULTPAGED"},
    89 	{_K("codepagingoverride"),	1, 1, EKeywordCodePagingOverride, "Overide the code paging attributes for every file in ROM, NOPAGING|DEFAULTUNPAGED|DEFAULTPAGED"},
    90 	{_K("datapagingoverride"),	1, 1, EKeywordDataPagingOverride, "Overide the data paging attributes for every file in ROM, NOPAGING|DEFAULTUNPAGED|DEFAULTPAGED"},
    90 	{_K("datapagingoverride"),	1, 1, EKeywordDataPagingOverride, "Overide the data paging attributes for every file in ROM, NOPAGING|DEFAULTUNPAGED|DEFAULTPAGED"},
    91 	{_K("dataimagename"),1, 1,EKeywordDataImageName, "Data Drive image file name"},
    91 	{_K("dataimagename"),1, 1,EKeywordDataImageName, "Data Drive image file name"},
    92 	{_K("dataimagefilesystem"),1, 1,EKeywordDataImageFileSystem, "Drive image file system format"},
    92 	{_K("dataimagefilesystem"),1, 1,EKeywordDataImageFileSystem, "Drive image file system format"},
    93 	{_K("dataimagesize"),1, 1,EKeywordDataImageSize, "Maximum size of Data Drive image"},
    93 	{_K("dataimagesize"),1, 1,EKeywordDataImageSize, "Maximum size of Data Drive image"},
       
    94 	{_K("volumeid"),1, 1,EKeywordDataImageVolumeID, "Volume ID of Data Drive image"},
    94 	{_K("volume"),1, -1,EKeywordDataImageVolume, "Volume Label of Data Drive image"},
    95 	{_K("volume"),1, -1,EKeywordDataImageVolume, "Volume Label of Data Drive image"},
    95 	{_K("sectorsize"),1, 1,EKeywordDataImageSectorSize, "Sector size(in bytes) of Data Drive image"},
    96 	{_K("sectorsize"),1, 1,EKeywordDataImageSectorSize, "Sector size(in bytes) of Data Drive image"},
    96 	{_K("clustersize"),1, 1,EKeywordDataImageClusterSize, "Cluster size(in bytes) of Data Drive image"},
    97 	{_K("clustersize"),1, 1,EKeywordDataImageClusterSize, "Cluster size(in bytes) of Data Drive image"},
    97 	{_K("fattable"),1, 1,EKeywordDataImageNoOfFats, "Number of FATs in the Data Drive image"},
    98 	{_K("fattable"),1, 1,EKeywordDataImageNoOfFats, "Number of FATs in the Data Drive image"},
    98 	// things we don't normally report in the help information
    99 	// things we don't normally report in the help information
   817 			string volumeLabel = iReader.GetCurrentObeyStatement();
   818 			string volumeLabel = iReader.GetCurrentObeyStatement();
   818 			string volumeLabelKeyword = "volume";
   819 			string volumeLabelKeyword = "volume";
   819 
   820 
   820 			TUint position = volumeLabel.find(volumeLabelKeyword.c_str(),0,volumeLabelKeyword.size());
   821 			TUint position = volumeLabel.find(volumeLabelKeyword.c_str(),0,volumeLabelKeyword.size());
   821 			position += volumeLabelKeyword.size();
   822 			position += volumeLabelKeyword.size();
   822 			if (volumeLabel.find('=',position) != string::npos) {
   823 			while (iReader.IsGap(volumeLabel[position]))
   823 				position=volumeLabel.find('=',position);
   824 				position ++;
   824 				++position;
   825 			volumeLabel = volumeLabel.substr(position);
       
   826 				
       
   827 			if (volumeLabel.find('=',0) != string::npos) {
       
   828 				Print(EWarning,"Value for Volume Label includes illegel charactor. Default value is considered.\n");
       
   829 				break;
   825 			}								
   830 			}								
   826 
   831 
   827 			position = volumeLabel.find_first_not_of(' ',position);
   832 			// Remove the new line character from the end
       
   833 			position = volumeLabel.find_first_of("\n");
   828 			if (position != string::npos) {
   834 			if (position != string::npos) {
   829 				volumeLabel = volumeLabel.substr(position);
   835 				if (position != 0 && volumeLabel[position-1] == '\r')
   830 
   836 					position --;
   831 				// Remove the new line character from the end
   837 				volumeLabel = volumeLabel.substr(0,position);
   832 				position = volumeLabel.find_first_of("\r\n");
   838 			}
   833 				if (position != string::npos)
   839 			size_t length = volumeLabel.length();
   834 					volumeLabel = volumeLabel.substr(0,position);
   840 			if (length == 0) {
   835 				size_t length = volumeLabel.length() ;
       
   836 				if(length > 11) 
       
   837 						length = 11 ;
       
   838 				memcpy(iConfigurableFatAttributes.iDriveVolumeLabel,volumeLabel.c_str(),length) ;
       
   839 				while(length != 11)
       
   840 					iConfigurableFatAttributes.iDriveVolumeLabel[length++] = ' ';
       
   841 				iConfigurableFatAttributes.iDriveVolumeLabel[length] = 0;
       
   842 			}
       
   843 			else {
       
   844 				Print(EWarning,"Value for Volume Label is not provided. Default value is considered.\n");
   841 				Print(EWarning,"Value for Volume Label is not provided. Default value is considered.\n");
   845 			}
   842 				break;
       
   843 			}
       
   844 			if(length > 11) 
       
   845 					length = 11 ;
       
   846 			memcpy(iConfigurableFatAttributes.iDriveVolumeLabel,volumeLabel.c_str(),length) ;
       
   847 			while(length != 11)
       
   848 				iConfigurableFatAttributes.iDriveVolumeLabel[length++] = ' ';
       
   849 			iConfigurableFatAttributes.iDriveVolumeLabel[length] = 0;
   846 			break;
   850 			break;
   847 		}
   851 		}
   848 	case EKeywordDataImageSectorSize:
   852 	case EKeywordDataImageSectorSize:
   849 		{
   853 		{
   850 			const char* bigString = iReader.Word(1);
   854 			const char* bigString = iReader.Word(1);
   878 			Val(noOfFats,bigString); 
   882 			Val(noOfFats,bigString); 
   879 			if (noOfFats <=0)
   883 			if (noOfFats <=0)
   880 				Print(EWarning,"Invalid No of FATs specified. Default value is considered.\n");
   884 				Print(EWarning,"Invalid No of FATs specified. Default value is considered.\n");
   881 			else
   885 			else
   882 				iConfigurableFatAttributes.iDriveNoOfFATs = noOfFats;			
   886 				iConfigurableFatAttributes.iDriveNoOfFATs = noOfFats;			
       
   887 		}			
       
   888 		break;			
       
   889 	case EKeywordDataImageVolumeID:
       
   890 		{
       
   891 			static bool isSet = false;
       
   892 			if (isSet)
       
   893 				Print(EWarning,"Duplicate setting for volume ID will be ignored.\n");
       
   894 			const char* bigString = iReader.Word(1);
       
   895 			TUint32 volumeid = 0;
       
   896 			TInt res = Val(volumeid,bigString); 
       
   897 			if (res != KErrNone || volumeid == 0xFFFFFFFF)
       
   898 				Print(EWarning,"Invalid Volume ID specified. Default value is considered.\n");
       
   899 			else
       
   900 				iConfigurableFatAttributes.iVolumeId = volumeid;			
       
   901 			isSet = true;
   883 		}			
   902 		}			
   884 		break;			
   903 		break;			
   885 	default:
   904 	default:
   886 		// unexpected keyword iReader.Word(0), keep going.
   905 		// unexpected keyword iReader.Word(0), keep going.
   887 		break;
   906 		break;