ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Spectre2/Share.cpp
(Generate patch)

Comparing Spectre2/Share.cpp (file contents):
Revision 431 by douglas, 2005-03-26T22:35:26-08:00 vs.
Revision 439 by douglas, 2005-04-07T15:56:53-07:00

# Line 94 | Line 94 | extern "C"
94          void authenticate(const char* host, const char* name, char* work, int workSize, char* owner, int ownerSize, char* password, int passwordSize)
95          {
96                  const Share& share(*Daemon::shares.Find(Share(host, name)));
97 +                const ext::Buffer& owner_(share.getOwner().GetData());
98  
99 <                if (!share.getOwner().IsEmpty())
100 <                        ::snprintf(owner, ownerSize, "%s", share.getOwner().NullTerminate());
99 >                if (!owner_.IsEmpty())
100 >                {
101 >                        _foreach (const ext::Buffer, atom, owner_)
102 >                                owner[_index] = *atom;
103 >
104 >                        owner[owner_.GetSize() < size_t(ownerSize) ? owner_.GetSize() : ownerSize - 1] = '\0';
105 >                }
106                  
107 <                ::snprintf(password, passwordSize, "%s", share.getPassword().NullTerminate());
107 >                ext::Buffer password_(share.getPassword().GetData());
108 >
109 >                _foreach (ext::Buffer, atom, password_)
110 >                        password[_index] = *atom;
111 >
112 >                password[password_.GetSize() < size_t(passwordSize) ? password_.GetSize() : passwordSize - 1] = '\0';
113          }
114   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines