Skip to content

Commit 6c3003e

Browse files
committed
[WIP] u_char to char conversion
1 parent 1e563fd commit 6c3003e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+794
-794
lines changed

Diff for: src/nxt_app_log.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@
99

1010

1111
static nxt_time_string_t nxt_log_error_time_cache;
12-
static u_char *nxt_log_error_time(u_char *buf, nxt_realtime_t *now,
12+
static char *nxt_log_error_time(char *buf, nxt_realtime_t *now,
1313
struct tm *tm, size_t size, const char *format);
1414
static nxt_time_string_t nxt_log_debug_time_cache;
15-
static u_char *nxt_log_debug_time(u_char *buf, nxt_realtime_t *now,
15+
static char *nxt_log_debug_time(char *buf, nxt_realtime_t *now,
1616
struct tm *tm, size_t size, const char *format);
1717

1818

1919
void nxt_cdecl
2020
nxt_log_time_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...)
2121
{
22-
u_char *p, *end;
22+
char *p, *end;
2323
#if 0
24-
u_char *syslogmsg;
24+
char *syslogmsg;
2525
#endif
2626
va_list args;
2727
nxt_thread_t *thr;
2828
nxt_time_string_t *time_cache;
29-
u_char msg[NXT_MAX_ERROR_STR];
29+
char msg[NXT_MAX_ERROR_STR];
3030

3131
thr = nxt_thread();
3232

@@ -108,8 +108,8 @@ static nxt_time_string_t nxt_log_error_time_cache = {
108108
};
109109

110110

111-
static u_char *
112-
nxt_log_error_time(u_char *buf, nxt_realtime_t *now, struct tm *tm, size_t size,
111+
static char *
112+
nxt_log_error_time(char *buf, nxt_realtime_t *now, struct tm *tm, size_t size,
113113
const char *format)
114114
{
115115
return nxt_sprintf(buf, buf + size, format,
@@ -128,8 +128,8 @@ static nxt_time_string_t nxt_log_debug_time_cache = {
128128
};
129129

130130

131-
static u_char *
132-
nxt_log_debug_time(u_char *buf, nxt_realtime_t *now, struct tm *tm, size_t size,
131+
static char *
132+
nxt_log_debug_time(char *buf, nxt_realtime_t *now, struct tm *tm, size_t size,
133133
const char *format)
134134
{
135135
return nxt_sprintf(buf, buf + size, format,

Diff for: src/nxt_application.c

+14-14
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static void nxt_proto_quit_children(nxt_task_t *task);
6363
static nxt_process_t *nxt_proto_process_find(nxt_task_t *task, nxt_pid_t pid);
6464
static void nxt_proto_process_add(nxt_task_t *task, nxt_process_t *process);
6565
static nxt_process_t *nxt_proto_process_remove(nxt_task_t *task, nxt_pid_t pid);
66-
static u_char *nxt_cstr_dup(nxt_mp_t *mp, u_char *dst, u_char *src);
66+
static char *nxt_cstr_dup(nxt_mp_t *mp, char *dst, char *src);
6767
static void nxt_proto_signal_handler(nxt_task_t *task, void *obj, void *data);
6868
static void nxt_proto_sigterm_handler(nxt_task_t *task, void *obj, void *data);
6969
static void nxt_proto_sigchld_handler(nxt_task_t *task, void *obj, void *data);
@@ -207,7 +207,7 @@ static nxt_buf_t *
207207
nxt_discovery_modules(nxt_task_t *task, const char *path)
208208
{
209209
char *name;
210-
u_char *p, *end;
210+
char *p, *end;
211211
size_t size;
212212
glob_t glb;
213213
nxt_mp_t *mp;
@@ -310,7 +310,7 @@ nxt_discovery_modules(nxt_task_t *task, const char *path)
310310
"\"data\": \"%s\"},",
311311
mnt[j].src, mnt[j].dst, mnt[j].name, mnt[j].type,
312312
mnt[j].flags,
313-
mnt[j].data == NULL ? (u_char *) "" : mnt[j].data);
313+
mnt[j].data == NULL ? (char *) "" : mnt[j].data);
314314
}
315315

316316
*p++ = ']';
@@ -388,7 +388,7 @@ nxt_discovery_module(nxt_task_t *task, nxt_mp_t *mp, nxt_array_t *modules,
388388
module = modules->elts;
389389
n = modules->nelts;
390390

391-
version.start = (u_char *) app->version;
391+
version.start = (char *) app->version;
392392
version.length = nxt_strlen(app->version);
393393

394394
for (i = 0; i < n; i++) {
@@ -603,7 +603,7 @@ nxt_proto_start(nxt_task_t *task, nxt_process_data_t *data)
603603
static void
604604
nxt_proto_start_process_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
605605
{
606-
u_char *p;
606+
char *p;
607607
nxt_int_t ret;
608608
nxt_port_t *port;
609609
nxt_runtime_t *rt;
@@ -641,7 +641,7 @@ nxt_proto_start_process_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
641641

642642
init->name = (const char *) nxt_app_conf->name.start;
643643

644-
p = (u_char *) process->name;
644+
p = (char *) process->name;
645645
*p++ = '"';
646646
p = nxt_cpymem(p, nxt_app_conf->name.start, nxt_app_conf->name.length);
647647
p = nxt_cpymem(p, "\" application", 13);
@@ -968,7 +968,7 @@ nxt_app_set_logs(void)
968968
if (app_conf->stdout_log != NULL) {
969969
nxt_memzero(&file, sizeof(nxt_file_t));
970970
file.log_level = 1;
971-
file.name = (u_char *) app_conf->stdout_log;
971+
file.name = (char *) app_conf->stdout_log;
972972
ret = nxt_file_open(task, &file, O_WRONLY | O_APPEND, O_CREAT, 0666);
973973
if (ret == NXT_ERROR) {
974974
return NXT_ERROR;
@@ -981,7 +981,7 @@ nxt_app_set_logs(void)
981981
if (app_conf->stderr_log != NULL) {
982982
nxt_memzero(&file, sizeof(nxt_file_t));
983983
file.log_level = 1;
984-
file.name = (u_char *) app_conf->stderr_log;
984+
file.name = (char *) app_conf->stderr_log;
985985
ret = nxt_file_open(task, &file, O_WRONLY | O_APPEND, O_CREAT, 0666);
986986
if (ret == NXT_ERROR) {
987987
return NXT_ERROR;
@@ -995,10 +995,10 @@ nxt_app_set_logs(void)
995995
}
996996

997997

998-
static u_char *
999-
nxt_cstr_dup(nxt_mp_t *mp, u_char *dst, u_char *src)
998+
static char *
999+
nxt_cstr_dup(nxt_mp_t *mp, char *dst, char *src)
10001000
{
1001-
u_char *p;
1001+
char *p;
10021002
size_t len;
10031003

10041004
len = nxt_strlen(src);
@@ -1033,7 +1033,7 @@ nxt_app_setup(nxt_task_t *task, nxt_process_t *process)
10331033
nxt_app_lang_module_t *
10341034
nxt_app_lang_module(nxt_runtime_t *rt, nxt_str_t *name)
10351035
{
1036-
u_char *p, *end, *version;
1036+
char *p, *end, *version;
10371037
size_t version_length;
10381038
nxt_uint_t i, n;
10391039
nxt_app_type_t type;
@@ -1084,7 +1084,7 @@ nxt_app_lang_module(nxt_runtime_t *rt, nxt_str_t *name)
10841084

10851085

10861086
nxt_app_type_t
1087-
nxt_app_parse_type(u_char *p, size_t length)
1087+
nxt_app_parse_type(char *p, size_t length)
10881088
{
10891089
nxt_str_t str;
10901090

@@ -1205,7 +1205,7 @@ nxt_proto_process_lhq_pid(nxt_lvlhsh_query_t *lhq, nxt_pid_t *pid)
12051205
{
12061206
lhq->key_hash = nxt_murmur_hash2(pid, sizeof(nxt_pid_t));
12071207
lhq->key.length = sizeof(nxt_pid_t);
1208-
lhq->key.start = (u_char *) pid;
1208+
lhq->key.start = (char *) pid;
12091209
lhq->proto = &lvlhsh_processes_proto;
12101210
}
12111211

Diff for: src/nxt_application.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ typedef nxt_int_t (*nxt_application_setup_t)(nxt_task_t *task,
3636
typedef struct {
3737
nxt_app_type_t type;
3838
char *name;
39-
u_char *version;
39+
char *version;
4040
char *file;
4141
nxt_app_module_t *module;
4242
nxt_array_t *mounts; /* of nxt_fs_mount_t */
@@ -165,7 +165,7 @@ struct nxt_app_module_s {
165165

166166

167167
nxt_app_lang_module_t *nxt_app_lang_module(nxt_runtime_t *rt, nxt_str_t *name);
168-
nxt_app_type_t nxt_app_parse_type(u_char *p, size_t length);
168+
nxt_app_type_t nxt_app_parse_type(char *p, size_t length);
169169

170170
NXT_EXPORT extern nxt_str_t nxt_server;
171171
extern nxt_app_module_t nxt_external_module;

Diff for: src/nxt_buf.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
*/
5858

5959
typedef struct {
60-
u_char *pos;
61-
u_char *free;
62-
u_char *start;
63-
u_char *end;
60+
char *pos;
61+
char *free;
62+
char *start;
63+
char *end;
6464
} nxt_buf_mem_t;
6565

6666

Diff for: src/nxt_cert.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ nxt_cert_bio(nxt_task_t *task, BIO *bio)
104104
EVP_PKEY *key;
105105
nxt_uint_t nalloc;
106106
nxt_cert_t *cert, *new_cert;
107-
u_char *data;
108-
const u_char *data_copy;
107+
char *data;
108+
const char *data_copy;
109109
PKCS8_PRIV_KEY_INFO *p8inf;
110110
const EVP_PKEY_ASN1_METHOD *ameth;
111111

@@ -493,14 +493,14 @@ nxt_cert_details(nxt_mp_t *mp, nxt_cert_t *cert)
493493
{
494494
BIO *bio;
495495
X509 *x509;
496-
u_char *end;
496+
char *end;
497497
EVP_PKEY *key;
498498
ASN1_TIME *asn1_time;
499499
nxt_str_t str;
500500
nxt_int_t ret;
501501
nxt_uint_t i;
502502
nxt_conf_value_t *object, *chain, *element, *value;
503-
u_char buf[256];
503+
char buf[256];
504504

505505
static nxt_str_t key_str = nxt_string("key");
506506
static nxt_str_t chain_str = nxt_string("chain");
@@ -658,7 +658,7 @@ nxt_cert_name_details(nxt_mp_t *mp, X509 *x509, nxt_bool_t issuer)
658658
nxt_uint_t i, n, count;
659659
nxt_conf_value_t *object, *names;
660660
STACK_OF(GENERAL_NAME) *alt_names;
661-
u_char buf[256];
661+
char buf[256];
662662

663663
static nxt_cert_nid_t nids[] = {
664664
{ NID_commonName, nxt_string("common_name") },
@@ -772,7 +772,7 @@ nxt_cert_alt_names_details(nxt_mp_t *mp, STACK_OF(GENERAL_NAME) *alt_names)
772772

773773
str.length = ASN1_STRING_length(name->d.dNSName);
774774
#if OPENSSL_VERSION_NUMBER > 0x10100000L
775-
str.start = (u_char *) ASN1_STRING_get0_data(name->d.dNSName);
775+
str.start = (char *) ASN1_STRING_get0_data(name->d.dNSName);
776776
#else
777777
str.start = ASN1_STRING_data(name->d.dNSName);
778778
#endif
@@ -815,7 +815,7 @@ nxt_cert_store_load(nxt_task_t *task, nxt_mp_t *mp)
815815
{
816816
DIR *dir;
817817
size_t size, alloc;
818-
u_char *buf, *p;
818+
char *buf, *p;
819819
nxt_str_t name;
820820
nxt_int_t ret;
821821
nxt_file_t file;
@@ -855,7 +855,7 @@ nxt_cert_store_load(nxt_task_t *task, nxt_mp_t *mp)
855855
nxt_debug(task, "readdir(\"%s\"): \"%s\"", rt->certs.start, de->d_name);
856856

857857
name.length = nxt_strlen(de->d_name);
858-
name.start = (u_char *) de->d_name;
858+
name.start = (char *) de->d_name;
859859

860860
if (nxt_str_eq(&name, ".", 1) || nxt_str_eq(&name, "..", 2)) {
861861
continue;
@@ -1123,7 +1123,7 @@ nxt_cert_buf_completion(nxt_task_t *task, void *obj, void *data)
11231123
void
11241124
nxt_cert_store_get_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
11251125
{
1126-
u_char *p;
1126+
char *p;
11271127
nxt_int_t ret;
11281128
nxt_str_t name;
11291129
nxt_file_t file;
@@ -1213,7 +1213,7 @@ nxt_cert_store_delete(nxt_task_t *task, nxt_str_t *name, nxt_mp_t *mp)
12131213
void
12141214
nxt_cert_store_delete_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
12151215
{
1216-
u_char *p;
1216+
char *p;
12171217
nxt_str_t name;
12181218
nxt_port_t *ctl_port;
12191219
nxt_runtime_t *rt;

Diff for: src/nxt_cgroup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ nxt_cgroup_proc_add(nxt_task_t *task, nxt_process_t *process)
3434
return NXT_ERROR;
3535
}
3636

37-
ret = nxt_fs_mkdir_p((const u_char *) cgprocs, 0777);
37+
ret = nxt_fs_mkdir_p((const char *) cgprocs, 0777);
3838
if (nxt_slow_path(ret == NXT_ERROR)) {
3939
return NXT_ERROR;
4040
}

Diff for: src/nxt_clang.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,15 @@ nxt_popcount(unsigned int x)
199199

200200

201201
#define nxt_container_of(p, type, field) \
202-
(type *) ((u_char *) (p) - offsetof(type, field))
202+
(type *) ((char *) (p) - offsetof(type, field))
203203

204204

205205
#define nxt_pointer_to(p, offset) \
206206
((void *) ((char *) (p) + (offset)))
207207

208208

209209
#define nxt_value_at(type, p, offset) \
210-
*(type *) ((u_char *) p + offset)
210+
*(type *) ((char *) p + offset)
211211

212212

213213
#define nxt_nitems(x) \
@@ -244,11 +244,11 @@ nxt_popcount(unsigned int x)
244244

245245

246246
#define nxt_align_ptr(p, a) \
247-
(u_char *) (((uintptr_t) (p) + ((uintptr_t) (a) - 1)) \
247+
(char *) (((uintptr_t) (p) + ((uintptr_t) (a) - 1)) \
248248
& ~((uintptr_t) (a) - 1))
249249

250250
#define nxt_trunc_ptr(p, a) \
251-
(u_char *) ((uintptr_t) (p) & ~((uintptr_t) (a) - 1))
251+
(char *) ((uintptr_t) (p) & ~((uintptr_t) (a) - 1))
252252

253253

254254
#define nxt_length(s) \

Diff for: src/nxt_clone.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ nxt_int_t nxt_clone_credential_map_set(nxt_task_t *task, const char* mapfile,
1717
pid_t pid, nxt_int_t default_container, nxt_int_t default_host,
1818
nxt_clone_credential_map_t *map);
1919
nxt_int_t nxt_clone_credential_map_write(nxt_task_t *task, const char *mapfile,
20-
pid_t pid, u_char *mapinfo);
20+
pid_t pid, char *mapinfo);
2121

2222

2323
nxt_int_t
2424
nxt_clone_credential_setgroups(nxt_task_t *task, pid_t child_pid,
2525
const char *str)
2626
{
2727
int fd, n;
28-
u_char *p, *end;
29-
u_char path[PATH_MAX];
28+
char *p, *end;
29+
char path[PATH_MAX];
3030

3131
end = path + PATH_MAX;
3232
p = nxt_sprintf(path, end, "/proc/%d/setgroups", child_pid);
@@ -68,12 +68,12 @@ nxt_clone_credential_setgroups(nxt_task_t *task, pid_t child_pid,
6868

6969
nxt_int_t
7070
nxt_clone_credential_map_write(nxt_task_t *task, const char *mapfile,
71-
pid_t pid, u_char *mapinfo)
71+
pid_t pid, char *mapinfo)
7272
{
7373
int len, mapfd;
74-
u_char *p, *end;
74+
char *p, *end;
7575
ssize_t n;
76-
u_char buf[256];
76+
char buf[256];
7777

7878
end = buf + sizeof(buf);
7979

@@ -121,7 +121,7 @@ nxt_clone_credential_map_set(nxt_task_t *task, const char* mapfile, pid_t pid,
121121
nxt_int_t default_container, nxt_int_t default_host,
122122
nxt_clone_credential_map_t *map)
123123
{
124-
u_char *p, *end, *mapinfo;
124+
char *p, *end, *mapinfo;
125125
nxt_int_t ret, len;
126126
nxt_uint_t i;
127127

0 commit comments

Comments
 (0)