Tweaks for forward compatibility

Change-Id: I136fcbbc14072ee5f5281d09445f28d083ed3ce1
Merge "Tweaks for forward compatibility"
Tweak for forward compatibility

Change-Id: Ide7ecd29d6931999357fc9ca48fd64e5510a6a2b
Merge "Tweak for forward compatibility"
skia: Don't use -D_FORTIFY_SOURCE=2

SkString uses a dynamic growing mechanism for storing strings.
This dynamic mechanism confuses GCC, which thinks it's operating
with a single character. This causes crashes when we use
Android's -D_FORTIFY_SOURCE=2 extensions.

Consider the following code:

  SkLanguage SkLanguage::getParent() const {
      SkASSERT(fInfo != NULL);
      const char* tag = fInfo->fTag.c_str();
      SkASSERT(tag != NULL);

      // strip off the rightmost "-.*"
      char* parentTagEnd = strrchr(tag, '-');
  [DELETED]
  }

fInfo->fTag is a SkString, which is declared as:

  class SkString {
  public:
  [DELETED]
      size_t      size() const { return (size_t) fRec->fLength; }
      const char* c_str() const { return fRec->data(); }
      char operator[](size_t n) const { return this->c_str()[n]; }
  [DELETED]
  private:
      struct Rec {
      public:
          size_t      fLength;
          int32_t     fRefCnt;
          char        fBeginningOfData;

          char* data() { return &fBeginningOfData; }
          const char* data() const { return &fBeginningOfData; }
      };
      Rec* fRec;
  [DELETED]
  };

When "fInfo->fTag.c_str();" is executed in "SkLanguage::getParent()", it
returns a pointer to fBeginningOfData, which is a single char. The compiler
believes that "tag" always points to an element of size 1. When Android's
strrchr() fortify extensions are called, we trigger an abort, because
strrchr() detects an attempt to read beyond the one character
fBeginningOfData.

Change-Id: Ibe957544b5114c14018630a8f42213bf3dd806e3
Merge "skia: Don't use -D_FORTIFY_SOURCE=2"
Merge branch 'master' of https://android.googlesource.com/platform/external/skia into jb-mv