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

Function makeFileResources

tools/aapt/Resource.cpp:267–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265// ==========================================================================
266
267static status_t makeFileResources(Bundle* bundle, const sp<AaptAssets>& assets,
268 ResourceTable* table,
269 const sp<ResourceTypeSet>& set,
270 const char* resType)
271{
272 String8 type8(resType);
273 String16 type16(resType);
274
275 bool hasErrors = false;
276
277 ResourceDirIterator it(set, String8(resType));
278 ssize_t res;
279 while ((res=it.next()) == NO_ERROR) {
280 if (bundle->getVerbose()) {
281 printf(" (new resource id %s from %s)\n",
282 it.getBaseName().string(), it.getFile()->getPrintableSource().string());
283 }
284 String16 baseName(it.getBaseName());
285 const char16_t* str = baseName.string();
286 const char16_t* const end = str + baseName.size();
287 while (str < end) {
288 if (!((*str >= 'a' && *str <= 'z')
289 || (*str >= '0' && *str <= '9')
290 || *str == '_' || *str == '.')) {
291 fprintf(stderr, "%s: Invalid file name: must contain only [a-z0-9_.]\n",
292 it.getPath().string());
293 hasErrors = true;
294 }
295 str++;
296 }
297 String8 resPath = it.getPath();
298 resPath.convertToResPath();
299 table->addEntry(SourcePos(it.getPath(), 0), String16(assets->getPackage()),
300 type16,
301 baseName,
302 String16(resPath),
303 NULL,
304 &it.getParams());
305 assets->addResource(it.getLeafName(), resPath, it.getFile(), type8);
306 }
307
308 return hasErrors ? UNKNOWN_ERROR : NO_ERROR;
309}
310
311class PreProcessImageWorkUnit : public WorkQueue::WorkUnit {
312public:

Callers 1

buildResourcesFunction · 0.85

Calls 13

SourcePosClass · 0.85
getVerboseMethod · 0.80
stringMethod · 0.80
getBaseNameMethod · 0.80
getPrintableSourceMethod · 0.80
addResourceMethod · 0.80
String16Class · 0.70
sizeMethod · 0.65
getPathMethod · 0.65
nextMethod · 0.45
addEntryMethod · 0.45
getPackageMethod · 0.45

Tested by

no test coverage detected