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

Function okayToCompress

tools/aapt/Package.cpp:629–656  ·  view source on GitHub ↗

* Determine whether or not we want to try to compress this file based * on the file extension. */

Source from the content-addressed store, hash-verified

627 * on the file extension.
628 */
629bool okayToCompress(Bundle* bundle, const String8& pathName)
630{
631 String8 ext = pathName.getPathExtension();
632 int i;
633
634 if (ext.length() == 0)
635 return true;
636
637 for (i = 0; i < NELEM(kNoCompressExt); i++) {
638 if (strcasecmp(ext.string(), kNoCompressExt[i]) == 0)
639 return false;
640 }
641
642 const android::Vector<const char*>& others(bundle->getNoCompressExtensions());
643 for (i = 0; i < (int)others.size(); i++) {
644 const char* str = others[i];
645 int pos = pathName.length() - strlen(str);
646 if (pos < 0) {
647 continue;
648 }
649 const char* path = pathName.string();
650 if (strcasecmp(path + pos, str) == 0) {
651 return false;
652 }
653 }
654
655 return true;
656}
657
658bool endsWith(const char* haystack, const char* needle)
659{

Callers 1

processFileFunction · 0.85

Calls 3

stringMethod · 0.80
sizeMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected