Changeset 18 in libcf++
- Timestamp:
- 08/12/15 23:51:04 (9 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/cf/network.h
r16 r18 75 75 * @throw cf::exception 76 76 */ 77 tcp(const cf::socket_t attachedSocket = UNUSED_SOCKET)77 tcp(const cf::socket_t attachedSocket = cf::nodesc) 78 78 throw (cf::exception); 79 79 -
trunk/include/cf/types.h
r17 r18 48 48 typedef int32_t socket_t; 49 49 #endif 50 51 const cf::int32_t nodesc = -1; 50 52 }; 51 53 -
trunk/src/bin.cpp
r15 r18 37 37 cf::size_t cf::bin::size() const 38 38 { 39 return mBin.size();39 return static_cast<cf::size_t>(mBin.size()); 40 40 } 41 41 -
trunk/src/codec.cpp
r15 r18 101 101 cf::uint8_t * buf = NULL; 102 102 cf::long_t outlen = 0; 103 cf::size_t memsize = in.size() / 4 * 3;103 cf::size_t memsize = static_cast<cf::size_t>(in.size()) / 4 * 3; 104 104 cf::memory mem(memsize); 105 105 … … 137 137 THROW_EXCEPTION("input string is not base64-encoded"); 138 138 139 remain = ptr - src;139 remain = static_cast<cf::long_t>(ptr - src); 140 140 binlen = ((remain + 2/* max padding length */) / 4) * 3; 141 141 … … 228 228 cf::uint8_t * buf = NULL; 229 229 cf::int32_t len = 0; 230 cf::size_t memsize = in.size() / 2;230 cf::size_t memsize = static_cast<cf::size_t>(in.size()) / 2; 231 231 cf::memory mem(memsize); 232 232 -
trunk/src/file.cpp
r4 r18 42 42 #endif 43 43 44 #define NO_FD -145 46 44 /*--------------------------------------------------------------*/ 47 45 … … 122 120 cf::file::file(const cf::char_t * path) 123 121 throw (cf::exception) 124 : mFD( NO_FD),122 : mFD(cf::nodesc), 125 123 mIsLocked(false) 126 124 { … … 179 177 { 180 178 ::close(mFD); 181 mFD = NO_FD;179 mFD = cf::nodesc; 182 180 } 183 181 … … 194 192 cf::bool_t cf::file::isOpened() 195 193 { 196 return mFD > NO_FD? true : false;194 return mFD > cf::nodesc ? true : false; 197 195 } 198 196 -
trunk/src/network.cpp
r15 r18 84 84 tv.tv_usec = 0; 85 85 86 result = select(s ock+ 1, &rfds, wfdsPtr, NULL, &tv);86 result = select(static_cast<int>(sock) + 1, &rfds, wfdsPtr, NULL, &tv); 87 87 if (result < 0) 88 88 THROW_EXCEPTION("select error"); … … 173 173 } 174 174 175 if (mSocket == UNUSED_SOCKET)175 if (mSocket == cf::nodesc) 176 176 mSocket = ::socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); 177 177 … … 192 192 cf::void_t cf::network::tcp::close() 193 193 { 194 if (mSocket == UNUSED_SOCKET)194 if (mSocket == cf::nodesc) 195 195 return; 196 196 197 197 closesocket(mSocket); 198 198 199 mSocket = UNUSED_SOCKET;199 mSocket = cf::nodesc; 200 200 } 201 201 … … 324 324 throw (exception) 325 325 { 326 if (sock == UNUSED_SOCKET)326 if (sock == cf::nodesc) 327 327 THROW_EXCEPTION("has invalid socket"); 328 328 … … 333 333 throw (exception) 334 334 { 335 if (mSocket == UNUSED_SOCKET)335 if (mSocket == cf::nodesc) 336 336 THROW_EXCEPTION("has invalid socket"); 337 337 338 338 cf::socket_t sock = mSocket; 339 339 340 mSocket = UNUSED_SOCKET;340 mSocket = cf::nodesc; 341 341 342 342 return sock;
Note:
See TracChangeset
for help on using the changeset viewer.