MCPcopy Create free account
hub / github.com/CyanogenMod/android_frameworks_base / validate

Method validate

tools/aapt/AaptAssets.cpp:1842–1904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1840}
1841
1842status_t AaptDir::validate() const
1843{
1844 const size_t NF = mFiles.size();
1845 const size_t ND = mDirs.size();
1846 size_t i;
1847 for (i = 0; i < NF; i++) {
1848 if (!validateFileName(mFiles.valueAt(i)->getLeaf().string())) {
1849 SourcePos(mFiles.valueAt(i)->getPrintableSource(), -1).error(
1850 "Invalid filename. Unable to add.");
1851 return UNKNOWN_ERROR;
1852 }
1853
1854 size_t j;
1855 for (j = i+1; j < NF; j++) {
1856 if (strcasecmp(mFiles.valueAt(i)->getLeaf().string(),
1857 mFiles.valueAt(j)->getLeaf().string()) == 0) {
1858 SourcePos(mFiles.valueAt(i)->getPrintableSource(), -1).error(
1859 "File is case-insensitive equivalent to: %s",
1860 mFiles.valueAt(j)->getPrintableSource().string());
1861 return UNKNOWN_ERROR;
1862 }
1863
1864 // TODO: if ".gz", check for non-.gz; if non-, check for ".gz"
1865 // (this is mostly caught by the "marked" stuff, below)
1866 }
1867
1868 for (j = 0; j < ND; j++) {
1869 if (strcasecmp(mFiles.valueAt(i)->getLeaf().string(),
1870 mDirs.valueAt(j)->getLeaf().string()) == 0) {
1871 SourcePos(mFiles.valueAt(i)->getPrintableSource(), -1).error(
1872 "File conflicts with dir from: %s",
1873 mDirs.valueAt(j)->getPrintableSource().string());
1874 return UNKNOWN_ERROR;
1875 }
1876 }
1877 }
1878
1879 for (i = 0; i < ND; i++) {
1880 if (!validateFileName(mDirs.valueAt(i)->getLeaf().string())) {
1881 SourcePos(mDirs.valueAt(i)->getPrintableSource(), -1).error(
1882 "Invalid directory name, unable to add.");
1883 return UNKNOWN_ERROR;
1884 }
1885
1886 size_t j;
1887 for (j = i+1; j < ND; j++) {
1888 if (strcasecmp(mDirs.valueAt(i)->getLeaf().string(),
1889 mDirs.valueAt(j)->getLeaf().string()) == 0) {
1890 SourcePos(mDirs.valueAt(i)->getPrintableSource(), -1).error(
1891 "Directory is case-insensitive equivalent to: %s",
1892 mDirs.valueAt(j)->getPrintableSource().string());
1893 return UNKNOWN_ERROR;
1894 }
1895 }
1896
1897 status_t err = mDirs.valueAt(i)->validate();
1898 if (err != NO_ERROR) {
1899 return err;

Callers

nothing calls this directly

Calls 7

validateFileNameFunction · 0.85
SourcePosClass · 0.85
stringMethod · 0.80
getPrintableSourceMethod · 0.80
sizeMethod · 0.65
errorMethod · 0.65
valueAtMethod · 0.45

Tested by

no test coverage detected