diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-01-10 21:04:17 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-10 21:04:17 +0000 |
commit | 2ba3f84ab559da02a11aa000b3cecb3b3668af61 (patch) | |
tree | 266f450b512f607ec54d54af4fa8c13fdbe7ef91 /src/utfstring.cpp | |
parent | ea18007633b31901f2ae275cc0576c3f7ce99fc9 (diff) | |
parent | 3611f253f6fdfa4954d374ab85ddaa7f799c130c (diff) | |
download | libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.gz libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.bz2 libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.xz libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.zip |
Merged in the core branch. This is a major update that fixes many things, and
changes many others, including source files that were deleted and renamed.
Before doing this update, I reccomend a full clean, or even a fresh checkout.
Things to note, most outstanding about this update:
- Bu::Socket was changed to Bu::TcpSocket and the default mode is blocking.
- All templatized container classes are SharedCore now, which is good, but
SharedCore is inherently non-reentrant safe. However, all SharedCore classes
have a "clone" function that return a non-shared copy of the object, safe for
passing into a reentrant safe function accessing shared memory.
Diffstat (limited to '')
-rw-r--r-- | src/utfstring.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/utfstring.cpp b/src/utfstring.cpp new file mode 100644 index 0000000..ae5efaf --- /dev/null +++ b/src/utfstring.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | #include "bu/utfstring.h" | ||
2 | |||
3 | template class Bu::FBasicString<short>; | ||
4 | |||
5 | template<> uint32_t Bu::__calcHashCode<Bu::UtfString>( const Bu::UtfString &k ) | ||
6 | { | ||
7 | long j, sz = k.getSize()*2; | ||
8 | const char *s = (const char *)k.getStr(); | ||
9 | |||
10 | long nPos = 0; | ||
11 | for( j = 0; j < sz; j++, s++ ) | ||
12 | { | ||
13 | nPos = *s + (nPos << 6) + (nPos << 16) - nPos; | ||
14 | } | ||
15 | |||
16 | return nPos; | ||
17 | } | ||
18 | |||
19 | template<> bool Bu::__cmpHashKeys<Bu::UtfString>( | ||
20 | const Bu::UtfString &a, const Bu::UtfString &b ) | ||
21 | { | ||
22 | return a == b; | ||
23 | } | ||
24 | |||
25 | template<> void Bu::__tracer_format<Bu::UtfString>( const Bu::UtfString &v ) | ||
26 | { | ||
27 | printf("(%ld)\"%s\"", v.getSize(), (const char *)v.getStr() ); | ||
28 | } | ||
29 | |||