diff options
author | 2013-07-22 17:29:43 +0000 | |
---|---|---|
committer | 2013-07-22 17:29:43 +0000 | |
commit | d761e3295c10e467d5ae4a5f52ad80c85b656e23 (patch) | |
tree | c572a1b2d1b493090bad04723a9088c11b5446ed /experimental | |
parent | eb3fe8efadfa77519dd8fc3efa2f3140340101b7 (diff) |
pdfviewer: SkTDict, does accept to pass the length of the key also. We will use it, as this is a prerequirment for optimizing memory usage for pdf parser.
Review URL: https://codereview.chromium.org/19964003
git-svn-id: http://skia.googlecode.com/svn/trunk@10242 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/PdfViewer/pdfparser/native/SkPdfObject.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/experimental/PdfViewer/pdfparser/native/SkPdfObject.h b/experimental/PdfViewer/pdfparser/native/SkPdfObject.h index ff647987b0..d496670bc1 100644 --- a/experimental/PdfViewer/pdfparser/native/SkPdfObject.h +++ b/experimental/PdfViewer/pdfparser/native/SkPdfObject.h @@ -384,10 +384,14 @@ public: // we rewrite all delimiters and white spaces with '\0', so we expect the end of name to be '\0' SkASSERT(key->fStr.fBuffer[key->fStr.fBytes] == '\0'); - return set((char*)key->fStr.fBuffer, value); + return set(key->fStr.fBuffer, key->fStr.fBytes, value); } bool set(const char* key, SkPdfObject* value) { + return set((const unsigned char*)key, strlen(key), value); + } + + bool set(const unsigned char* key, size_t len, SkPdfObject* value) { SkASSERT(fObjectType == kDictionary_PdfObjectType); if (fObjectType != kDictionary_PdfObjectType) { @@ -395,7 +399,7 @@ public: return false; } - return fMap->set(key, value); + return fMap->set((const char*)key, len, value); } SkPdfObject* get(SkPdfObject* key) { @@ -409,10 +413,14 @@ public: SkASSERT(key->fStr.fBuffer[key->fStr.fBytes] == '\0'); - return get((char*)key->fStr.fBuffer); + return get(key->fStr.fBuffer, key->fStr.fBytes); } SkPdfObject* get(const char* key) { + return get((const unsigned char*)key, strlen(key)); + } + + SkPdfObject* get(const unsigned char* key, size_t len) { SkASSERT(fObjectType == kDictionary_PdfObjectType); SkASSERT(key); if (fObjectType != kDictionary_PdfObjectType) { @@ -420,7 +428,7 @@ public: return NULL; } SkPdfObject* ret = NULL; - fMap->find(key, &ret); + fMap->find((const char*)key, len, &ret); return ret; } @@ -435,11 +443,14 @@ public: SkASSERT(key->fStr.fBuffer[key->fStr.fBytes] == '\0'); - return get((char*)key->fStr.fBuffer); + return get(key->fStr.fBuffer, key->fStr.fBytes); } - const SkPdfObject* get(const char* key) const { + return get((const unsigned char*)key, strlen(key)); + } + + const SkPdfObject* get(const unsigned char* key, size_t len) const { SkASSERT(fObjectType == kDictionary_PdfObjectType); SkASSERT(key); if (fObjectType != kDictionary_PdfObjectType) { @@ -447,7 +458,7 @@ public: return NULL; } SkPdfObject* ret = NULL; - fMap->find(key, &ret); + fMap->find((const char*)key, len, &ret); return ret; } |