summaryrefslogtreecommitdiff
path: root/src/Initialize.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2019-03-17 17:19:45 -0400
committerAlan Coopersmith <alan.coopersmith@oracle.com>2019-04-06 10:31:25 -0700
commitcf9e8c73c4ffa671d580938c9a84d6ef0bd2710d (patch)
tree21cd4cab8b92df9f9050ea8df40d9cc35bed451d /src/Initialize.c
parentfb7e899e94dd402c868e8eb59ccf32284732f6ac (diff)
This cleans up the "easy" warning fixes which can be made using my
Regress script, comparing object-files before/after the edits: https://invisible-island.net/ansification/index.html https://invisible-island.net/scripts/readme.html The changes are casts, which quiet the gcc warnings about implicit conversion that my "gcc-normal" script would show. I avoided reformatting the code. The change reduces the number of gcc warnings from 769 to 163. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src/Initialize.c')
-rw-r--r--src/Initialize.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/Initialize.c b/src/Initialize.c
index a9b8844..0218849 100644
--- a/src/Initialize.c
+++ b/src/Initialize.c
@@ -180,7 +180,7 @@ static void GetHostname (
return;
buf[0] = '\0';
- (void) gethostname (buf, maxlen);
+ (void) gethostname (buf, (size_t) maxlen);
buf [maxlen - 1] = '\0';
#endif
}
@@ -320,11 +320,11 @@ String _XtGetUserName(
char* ptr;
if ((ptr = getenv("USER"))) {
- (void) strncpy (dest, ptr, len-1);
+ (void) strncpy (dest, ptr, (size_t) (len-1));
dest[len-1] = '\0';
} else {
if ((pw = _XGetpwuid(getuid(),pwparams)) != NULL) {
- (void) strncpy (dest, pw->pw_name, len-1);
+ (void) strncpy (dest, pw->pw_name, (size_t)(len-1));
dest[len-1] = '\0';
} else
*dest = '\0';
@@ -367,7 +367,7 @@ static String GetRootDirName(
return NULL;
if ((ptr = getenv("HOME"))) {
- (void) strncpy (dest, ptr, len-1);
+ (void) strncpy (dest, ptr, (size_t)(len-1));
dest[len-1] = '\0';
} else {
if ((ptr = getenv("USER")))
@@ -375,7 +375,7 @@ static String GetRootDirName(
else
pw = _XGetpwuid(getuid(),pwparams);
if (pw != NULL) {
- (void) strncpy (dest, pw->pw_dir, len-1);
+ (void) strncpy (dest, pw->pw_dir, (size_t)(len-1));
dest[len-1] = '\0';
} else
*dest = '\0';
@@ -437,7 +437,7 @@ static void CombineUserDefaults(
} else {
char filename[PATH_MAX];
(void) GetRootDirName(filename,
- PATH_MAX - strlen (slashDotXdefaults) - 1);
+ PATH_MAX - (int)strlen (slashDotXdefaults) - 1);
(void) strcat(filename, slashDotXdefaults);
(void)XrmCombineFileDatabase(filename, pdb, False);
}
@@ -574,9 +574,9 @@ XrmDatabase XtScreenDatabase(
#endif
(void) GetRootDirName(filename = filenamebuf,
- PATH_MAX - strlen (slashDotXdefaultsDash) - 1);
+ PATH_MAX - (int)strlen (slashDotXdefaultsDash) - 1);
(void) strcat(filename, slashDotXdefaultsDash);
- len = strlen(filename);
+ len = (int)strlen(filename);
GetHostname (filename+len, PATH_MAX-len);
}
(void)XrmCombineFileDatabase(filename, &db, False);
@@ -657,14 +657,14 @@ static void _MergeOptionTables(
enum {Check, NotSorted, IsSorted} sort_order = Check;
*dst = table = (XrmOptionDescRec*)
- __XtMalloc( sizeof(XrmOptionDescRec) * (num_src1 + num_src2) );
+ __XtMalloc( (Cardinal)(sizeof(XrmOptionDescRec) * (num_src1 + num_src2) ));
(void) memmove(table, src1, sizeof(XrmOptionDescRec) * num_src1 );
if (num_src2 == 0) {
*num_dst = num_src1;
return;
}
- endP = &table[dst_len = num_src1];
+ endP = &table[dst_len = (int)num_src1];
for (opt2 = src2, i2= 0; i2 < num_src2; opt2++, i2++) {
found = False;
whereP = endP-1; /* assume new option goes at the end */
@@ -709,7 +709,7 @@ static void _MergeOptionTables(
dst_len++;
}
}
- *num_dst = dst_len;
+ *num_dst = (Cardinal)dst_len;
}
@@ -770,13 +770,13 @@ XrmDatabase _XtPreparseCommandLine(
String *targv;
int targc = argc;
- targv = (String *) __XtMalloc(sizeof(char *) * argc);
- (void) memmove(targv, argv, sizeof(char *) * argc);
+ targv = (String *) __XtMalloc((Cardinal)(sizeof(char *) * (size_t)argc));
+ (void) memmove(targv, argv, sizeof(char *) * (size_t) argc);
_MergeOptionTables(opTable, XtNumber(opTable), urlist, num_urs,
&options, &num_options);
name_list[0] = class_list[0] = XrmPermStringToQuark(".");
name_list[2] = class_list[2] = NULLQUARK;
- XrmParseCommand(&db, options, num_options, ".", &targc, targv);
+ XrmParseCommand(&db, options, (int) num_options, ".", &targc, targv);
if (applName) {
name_list[1] = XrmPermStringToQuark("name");
if (XrmQGetResource(db, name_list, name_list, &type, &val) &&
@@ -893,7 +893,7 @@ void _XtDisplayInitialize(
/* Parse the command line and remove Xt arguments from argv */
_MergeOptionTables( opTable, XtNumber(opTable), urlist, num_urs,
&options, &num_options );
- XrmParseCommand(&pd->cmd_db, options, num_options, name, argc, argv);
+ XrmParseCommand(&pd->cmd_db, options, (int) num_options, name, argc, argv);
db = XtScreenDatabase(DefaultScreenOfDisplay(dpy));
@@ -908,7 +908,7 @@ void _XtDisplayInitialize(
while (!XrmQGetSearchList(db, name_list, class_list,
search_list, search_list_size)) {
XrmHashTable* old = search_list;
- Cardinal size = (search_list_size*=2)*sizeof(XrmHashTable);
+ Cardinal size = (Cardinal) ((size_t)(search_list_size *= 2)*sizeof(XrmHashTable));
if (!(search_list = (XrmHashTable*)ALLOCATE_LOCAL(size)))
_XtAllocError(NULL);
(void) memmove((char*)search_list, (char*)old, (size>>1) );