Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / apps / JAWS2 / JAWS / Cache_Manager.cpp
blobfd17e3dd77cc9b9ca844cb7455c405ca969448d1
1 #include "ace/ACE.h"
2 #include "ace/OS_NS_string.h"
4 #include "JAWS/Cache_Manager.h"
5 #include "JAWS/Cache_List_T.h"
7 JAWS_String_Hash_Functor::JAWS_String_Hash_Functor (const char *s)
8 : i_ (0)
10 this->i_ = ACE::hash_pjw (s);
13 JAWS_String_Hash_Functor::operator unsigned long () const
15 return this->i_;
18 JAWS_String_Equal_Functor::JAWS_String_Equal_Functor (const char *s1,
19 const char *s2)
20 : i_ (0)
22 this->i_ = ACE_OS::strcmp (s1, s2);
25 JAWS_String_Equal_Functor::operator int () const
27 return this->i_ == 0;
30 JAWS_Strdup_String::JAWS_Strdup_String ()
31 : c_ (0),
32 s_ (0)
36 JAWS_Strdup_String::JAWS_Strdup_String (const char *s)
37 : c_ (0),
38 s_ (0)
40 this->c_ = new int (1);
41 this->s_ = ACE_OS::strdup (s);
44 JAWS_Strdup_String::JAWS_Strdup_String (const JAWS_Strdup_String &s)
45 : c_ (s.c_),
46 s_ (s.s_)
48 ++*(this->c_);
51 JAWS_Strdup_String::~JAWS_Strdup_String ()
53 if (this->c_ && --*(this->c_) == 0)
55 if (this->s_)
56 ACE_OS::free (this->s_);
57 delete this->c_;
59 this->s_ = 0;
60 this->c_ = 0;
63 JAWS_Strdup_String::operator const char * () const
65 return this->s_;
68 void
69 JAWS_Strdup_String::operator = (const char *s)
71 if (this->c_ && --*(this->c_) == 0)
73 if (this->s_)
74 ACE_OS::free (this->s_);
75 delete this->c_;
77 this->c_ = new int (1);
78 this->s_ = ACE_OS::strdup (s);
81 void
82 JAWS_Strdup_String::operator = (const JAWS_Strdup_String &s)
84 if (this == &s)
85 return;
87 if (this->c_ && --*(this->c_) == 0)
89 if (this->s_)
90 ACE_OS::free (this->s_);
91 delete this->c_;
93 this->c_ = s.c_;
94 this->s_ = s.s_;
95 ++*(this->c_);