goo/GooHash.cc | 7 ++++--- goo/GooHash.h | 7 ++++--- goo/GooString.cc | 7 ++++--- goo/GooString.h | 7 ++++--- 4 files changed, 16 insertions(+), 12 deletions(-)
New commits: commit 2a49511517678b7e05660bb9a35a614c83229b66 Author: Albert Astals Cid <[email protected]> Date: Thu Apr 5 11:50:23 2018 +0200 Add some const to GooHash and GooString diff --git a/goo/GooHash.cc b/goo/GooHash.cc index cd39a5ae..620803eb 100644 --- a/goo/GooHash.cc +++ b/goo/GooHash.cc @@ -14,6 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2017 Albert Astals Cid <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -154,7 +155,7 @@ void *GooHash::lookup(GooString *key) { return p->val.p; } -int GooHash::lookupInt(GooString *key) { +int GooHash::lookupInt(const GooString *key) { GooHashBucket *p; int h; @@ -351,7 +352,7 @@ void GooHash::expand() { gfree(oldTab); } -GooHashBucket *GooHash::find(GooString *key, int *h) { +GooHashBucket *GooHash::find(const GooString *key, int *h) { GooHashBucket *p; if (unlikely(!key)) @@ -378,7 +379,7 @@ GooHashBucket *GooHash::find(const char *key, int *h) { return nullptr; } -int GooHash::hash(GooString *key) { +int GooHash::hash(const GooString *key) { const char *p; unsigned int h; int i; diff --git a/goo/GooHash.h b/goo/GooHash.h index eda19e31..57f883c6 100644 --- a/goo/GooHash.h +++ b/goo/GooHash.h @@ -14,6 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2012 Albert Astals Cid <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -45,7 +46,7 @@ public: void replace(GooString *key, void *val); void replace(GooString *key, int val); void *lookup(GooString *key); - int lookupInt(GooString *key); + int lookupInt(const GooString *key); void *lookup(const char *key); int lookupInt(const char *key); void *remove(GooString *key); @@ -63,9 +64,9 @@ private: GooHash& operator=(const GooHash &other); void expand(); - GooHashBucket *find(GooString *key, int *h); + GooHashBucket *find(const GooString *key, int *h); GooHashBucket *find(const char *key, int *h); - int hash(GooString *key); + int hash(const GooString *key); int hash(const char *key); GBool deleteKeys; // set if key strings should be deleted diff --git a/goo/GooString.cc b/goo/GooString.cc index d67b8752..7956372d 100644 --- a/goo/GooString.cc +++ b/goo/GooString.cc @@ -26,6 +26,7 @@ // Copyright (C) 2013 Jason Crain <[email protected]> // Copyright (C) 2015 William Bader <[email protected]> // Copyright (C) 2016 Jakub Alba <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -206,7 +207,7 @@ GooString::GooString(const char *sA, int lengthA) { Set(sA, lengthA); } -GooString::GooString(GooString *str, int idx, int lengthA) { +GooString::GooString(const GooString *str, int idx, int lengthA) { s = nullptr; length = 0; assert(idx + lengthA <= str->length); @@ -268,7 +269,7 @@ GooString *GooString::append(char c) { return append((const char*)&c, 1); } -GooString *GooString::append(GooString *str) { +GooString *GooString::append(const GooString *str) { return append(str->getCString(), str->getLength()); } @@ -789,7 +790,7 @@ GooString *GooString::lowerCase() { return this; } -int GooString::cmp(GooString *str) const { +int GooString::cmp(const GooString *str) const { int n1, n2, i, x; char *p1, *p2; diff --git a/goo/GooString.h b/goo/GooString.h index 49f2888e..fb060db3 100644 --- a/goo/GooString.h +++ b/goo/GooString.h @@ -23,6 +23,7 @@ // Copyright (C) 2015 Adam Reichold <[email protected]> // Copyright (C) 2016 Jakub Alba <[email protected]> // Copyright (C) 2017 Adrian Johnson <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -64,7 +65,7 @@ public: GooString(const char *sA, int lengthA); // Create a string from <lengthA> chars at <idx> in <str>. - GooString(GooString *str, int idx, int lengthA); + GooString(const GooString *str, int idx, int lengthA); // Set content of a string to <newStr>. If <newLen> is CALC_STRING_LEN, then // length of the string will be calculated with strlen(). Otherwise we assume @@ -132,7 +133,7 @@ public: // Append a character or string. GooString *append(char c); - GooString *append(GooString *str); + GooString *append(const GooString *str); GooString *append(const char *str, int lengthA=CALC_STRING_LEN); // Append a formatted string. @@ -152,7 +153,7 @@ public: GooString *lowerCase(); // Compare two strings: -1:< 0:= +1:> - int cmp(GooString *str) const; + int cmp(const GooString *str) const; int cmpN(GooString *str, int n) const; int cmp(const char *sA) const; int cmpN(const char *sA, int n) const; _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
