Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
233cd646
Commit
233cd646
authored
Nov 07, 2012
by
Davis King
Browse files
code cleanup
parent
62d28ae4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
51 deletions
+3
-51
dlib/server/server_kernel_abstract.h
dlib/server/server_kernel_abstract.h
+1
-1
dlib/server/server_kernel_c.h
dlib/server/server_kernel_c.h
+2
-50
No files found.
dlib/server/server_kernel_abstract.h
View file @
233cd646
...
@@ -225,7 +225,7 @@ namespace dlib
...
@@ -225,7 +225,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- i
p is of the form #.#.#.# (dotted quad notation)
or ip == ""
- i
s_ip_address(ip) == true
or ip == ""
- is_running() == false
- is_running() == false
ensures
ensures
- #get_listening_ip() == ip
- #get_listening_ip() == ip
...
...
dlib/server/server_kernel_c.h
View file @
233cd646
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "server_kernel_abstract.h"
#include "server_kernel_abstract.h"
#include "../algs.h"
#include "../algs.h"
#include "../assert.h"
#include "../assert.h"
#include "../sockets.h"
#include <string>
#include <string>
#include <sstream>
#include <sstream>
...
@@ -38,15 +39,6 @@ namespace dlib
...
@@ -38,15 +39,6 @@ namespace dlib
);
);
private:
private:
bool
is_dotted_quad
(
std
::
string
ip
)
const
;
/*!
ensures
returns true if ip is a valid dotted quad ip address else
returns false
!*/
};
};
...
@@ -133,7 +125,7 @@ namespace dlib
...
@@ -133,7 +125,7 @@ namespace dlib
{
{
// make sure requires clause is not broken
// make sure requires clause is not broken
DLIB_CASSERT
(
DLIB_CASSERT
(
(
(
is_
dotted_quad
(
ip
)
||
ip
==
""
)
&&
(
(
is_
ip_address
(
ip
)
||
ip
==
""
)
&&
this
->
is_running
()
==
false
),
this
->
is_running
()
==
false
),
"
\t
void server::set_listening_ip"
"
\t
void server::set_listening_ip"
<<
"
\n\t
ip == "
<<
ip
<<
"
\n\t
ip == "
<<
ip
...
@@ -145,46 +137,6 @@ namespace dlib
...
@@ -145,46 +137,6 @@ namespace dlib
server_base
::
set_listening_ip
(
ip
);
server_base
::
set_listening_ip
(
ip
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// private member function definitions
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
server_base
>
bool
server_kernel_c
<
server_base
>::
is_dotted_quad
(
std
::
string
ip
)
const
{
int
num
;
char
dot
;
std
::
istringstream
sin
(
ip
);
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
sin
>>
num
;
if
(
!
sin
)
return
false
;
if
(
num
<
0
||
num
>
255
)
return
false
;
sin
>>
dot
;
if
(
!
sin
)
return
false
;
if
(
dot
!=
'.'
)
return
false
;
}
sin
>>
num
;
if
(
!
sin
)
return
false
;
if
(
num
<
0
||
num
>
255
)
return
false
;
if
(
sin
.
get
()
!=
EOF
)
return
false
;
return
true
;
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment