Skip to content

Commit d6e539e

Browse files
committed
restyle
1 parent 6521001 commit d6e539e

File tree

1 file changed

+50
-64
lines changed

1 file changed

+50
-64
lines changed

tests/host/common/strl.cpp

Lines changed: 50 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,89 +4,75 @@
44
#include <cstdlib>
55
#include <cstring>
66

7-
extern "C" {
8-
9-
#ifndef HAVE_STRLCAT
10-
/*
11-
'_cups_strlcat()' - Safely concatenate two strings.
12-
*/
13-
14-
size_t /* O - Length of string */
15-
strlcat(char* dst, /* O - Destination string */
16-
const char* src, /* I - Source string */
17-
size_t size) /* I - Size of destination string buffer */
7+
extern "C"
188
{
19-
size_t srclen; /* Length of source string */
20-
size_t dstlen; /* Length of destination string */
9+
#ifndef HAVE_STRLCAT
10+
// '_cups_strlcat()' - Safely concatenate two strings.
2111

22-
/*
23-
Figure out how much room is left...
24-
*/
12+
size_t /* O - Length of string */
13+
strlcat(char* dst, /* O - Destination string */
14+
const char* src, /* I - Source string */
15+
size_t size) /* I - Size of destination string buffer */
16+
{
17+
size_t srclen; /* Length of source string */
18+
size_t dstlen; /* Length of destination string */
2519

26-
dstlen = strlen(dst);
27-
size -= dstlen + 1;
20+
// Figure out how much room is left...
2821

29-
if (!size)
30-
{
31-
return (dstlen); /* No room, return immediately... */
32-
}
22+
dstlen = strlen(dst);
23+
size -= dstlen + 1;
3324

34-
/*
35-
Figure out how much room is needed...
36-
*/
25+
if (!size)
26+
{
27+
return (dstlen); /* No room, return immediately... */
28+
}
3729

38-
srclen = strlen(src);
30+
// Figure out how much room is needed...
3931

40-
/*
41-
Copy the appropriate amount...
42-
*/
32+
srclen = strlen(src);
4333

44-
if (srclen > size)
45-
{
46-
srclen = size;
47-
}
34+
// Copy the appropriate amount...
4835

49-
memcpy(dst + dstlen, src, srclen);
50-
dst[dstlen + srclen] = '\0';
36+
if (srclen > size)
37+
{
38+
srclen = size;
39+
}
5140

52-
return (dstlen + srclen);
53-
}
41+
memcpy(dst + dstlen, src, srclen);
42+
dst[dstlen + srclen] = '\0';
43+
44+
return (dstlen + srclen);
45+
}
5446
#endif /* !HAVE_STRLCAT */
5547

5648
#ifndef HAVE_STRLCPY
57-
/*
58-
'_cups_strlcpy()' - Safely copy two strings.
59-
*/
60-
61-
size_t /* O - Length of string */
62-
strlcpy(char* dst, /* O - Destination string */
63-
const char* src, /* I - Source string */
64-
size_t size) /* I - Size of destination string buffer */
65-
{
66-
size_t srclen; /* Length of source string */
49+
// '_cups_strlcpy()' - Safely copy two strings.
50+
51+
size_t /* O - Length of string */
52+
strlcpy(char* dst, /* O - Destination string */
53+
const char* src, /* I - Source string */
54+
size_t size) /* I - Size of destination string buffer */
55+
{
56+
size_t srclen; /* Length of source string */
6757

68-
/*
69-
Figure out how much room is needed...
70-
*/
58+
// Figure out how much room is needed...
7159

72-
size--;
60+
size--;
7361

74-
srclen = strlen(src);
62+
srclen = strlen(src);
7563

76-
/*
77-
Copy the appropriate amount...
78-
*/
64+
// Copy the appropriate amount...
7965

80-
if (srclen > size)
81-
{
82-
srclen = size;
83-
}
66+
if (srclen > size)
67+
{
68+
srclen = size;
69+
}
8470

85-
memcpy(dst, src, srclen);
86-
dst[srclen] = '\0';
71+
memcpy(dst, src, srclen);
72+
dst[srclen] = '\0';
8773

88-
return (srclen);
89-
}
74+
return (srclen);
75+
}
9076
#endif /* !HAVE_STRLCPY */
9177

92-
} // extern "C"
78+
} // extern "C"

0 commit comments

Comments
 (0)