Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(772)

Unified Diff: experimental/PdfViewer/pdfparser/native/SkPdfObject.h

Issue 19964003: pdfviewer: SkTDict, does accept to pass the length of the key also. We will use it, as this is a pr… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/pdfparser/native/SkPdfObject.h
===================================================================
--- experimental/PdfViewer/pdfparser/native/SkPdfObject.h (revision 10235)
+++ experimental/PdfViewer/pdfparser/native/SkPdfObject.h (working copy)
@@ -384,10 +384,14 @@
// 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 @@
return false;
}
- return fMap->set(key, value);
+ return fMap->set((const char*)key, len, value);
}
SkPdfObject* get(SkPdfObject* key) {
@@ -409,10 +413,14 @@
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 @@
return NULL;
}
SkPdfObject* ret = NULL;
- fMap->find(key, &ret);
+ fMap->find((const char*)key, len, &ret);
return ret;
}
@@ -435,11 +443,14 @@
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 char* key) const {
+ 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 @@
return NULL;
}
SkPdfObject* ret = NULL;
- fMap->find(key, &ret);
+ fMap->find((const char*)key, len, &ret);
return ret;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698