mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
various: You cannot use the destination of snprintf as one of the srcs, undefined
This commit is contained in:
parent
b410e644c0
commit
caef8edac0
5 changed files with 59 additions and 24 deletions
|
@ -217,6 +217,7 @@ _rename_datfile(isfname, newname)
|
|||
{
|
||||
char namebuf[MAXPATHLEN];
|
||||
char newbuf[MAXPATHLEN];
|
||||
char newbuftemp[sizeof(newbuf)];
|
||||
|
||||
snprintf(namebuf, sizeof(namebuf), "%s", isfname);
|
||||
snprintf(newbuf, sizeof(newbuf), "%s", isfname);
|
||||
|
@ -225,9 +226,12 @@ _rename_datfile(isfname, newname)
|
|||
* Replace the last element of the old path with newname.
|
||||
*/
|
||||
_removelast(newbuf);
|
||||
if (strcmp(newbuf, "/") != 0)
|
||||
snprintf(newbuf, sizeof(newbuf), "%s/", newbuf);
|
||||
snprintf(newbuf, sizeof(newbuf), "%s%s", newbuf, newname);
|
||||
if (strcmp(newbuf, "/") != 0) {
|
||||
snprintf(newbuftemp, sizeof(newbuftemp), "%s/", newbuf);
|
||||
strcpy(newbuf, newbuftemp);
|
||||
}
|
||||
snprintf(newbuftemp, sizeof(newbuftemp), "%s%s", newbuf, newname);
|
||||
strcpy(newbuf, newbuftemp);
|
||||
|
||||
_makedat_isfname(namebuf);
|
||||
_makedat_isfname(newbuf);
|
||||
|
@ -242,6 +246,7 @@ _rename_indfile(isfname, newname)
|
|||
{
|
||||
char namebuf[MAXPATHLEN];
|
||||
char newbuf[MAXPATHLEN];
|
||||
char newbuftemp[MAXPATHLEN];
|
||||
|
||||
snprintf(namebuf, sizeof(namebuf), "%s", isfname);
|
||||
snprintf(newbuf, sizeof(newbuf), "%s", isfname);
|
||||
|
@ -250,9 +255,12 @@ _rename_indfile(isfname, newname)
|
|||
* Replace the last element of the old path with newname.
|
||||
*/
|
||||
_removelast(newbuf);
|
||||
if (strcmp(newbuf, "/") != 0)
|
||||
snprintf(newbuf, sizeof(newbuf), "%s/", newbuf);
|
||||
snprintf(newbuf, sizeof(newbuf), "%s%s", newbuf, newname);
|
||||
if (strcmp(newbuf, "/") != 0) {
|
||||
snprintf(newbuftemp, sizeof(newbuftemp), "%s/", newbuf);
|
||||
strcpy(newbuf, newbuftemp);
|
||||
}
|
||||
snprintf(newbuftemp, sizeof(newbuftemp), "%s%s", newbuf, newname);
|
||||
strcpy(newbuf, newbuftemp);
|
||||
|
||||
_makeind_isfname(namebuf);
|
||||
_makeind_isfname(newbuf);
|
||||
|
@ -267,6 +275,7 @@ _rename_varfile(isfname, newname)
|
|||
{
|
||||
char namebuf[MAXPATHLEN];
|
||||
char newbuf[MAXPATHLEN];
|
||||
char newbuftemp[MAXPATHLEN];
|
||||
|
||||
snprintf(namebuf, sizeof(namebuf), "%s", isfname);
|
||||
snprintf(newbuf, sizeof(newbuf), "%s", isfname);
|
||||
|
@ -275,9 +284,12 @@ _rename_varfile(isfname, newname)
|
|||
* Replace the last element of the old path with newname.
|
||||
*/
|
||||
_removelast(newbuf);
|
||||
if (strcmp(newbuf, "/") != 0)
|
||||
snprintf(newbuf, sizeof(newbuf), "%s/", newbuf);
|
||||
snprintf(newbuf, sizeof(newbuf), "%s%s", newbuf, newname);
|
||||
if (strcmp(newbuf, "/") != 0) {
|
||||
snprintf(newbuftemp, sizeof(newbuftemp), "%s/", newbuf);
|
||||
strcpy(newbuf, newbuftemp);
|
||||
}
|
||||
snprintf(newbuftemp, sizeof(newbuftemp), "%s%s", newbuf, newname);
|
||||
strcpy(newbuf, newbuftemp);
|
||||
|
||||
_makevar_isfname(namebuf);
|
||||
_makevar_isfname(newbuf);
|
||||
|
|
|
@ -389,6 +389,7 @@ CreateFamily (
|
|||
char *bitmap = NULL;
|
||||
char familyName [20]; /* FAMILY%d */
|
||||
char bitmapName [MAXPATHLEN + 2];
|
||||
char bitmapNameTemp [sizeof(bitmapName)];
|
||||
|
||||
XrmDatabase db;
|
||||
char *resType;
|
||||
|
@ -537,7 +538,8 @@ CreateFamily (
|
|||
{
|
||||
ptr++;
|
||||
*ptr = '\0';
|
||||
snprintf(bitmapName, sizeof(bitmapName), "%s%s", bitmapName, bitmap);
|
||||
snprintf(bitmapNameTemp, sizeof(bitmapNameTemp), "%s%s", bitmapName, bitmap);
|
||||
strcpy(bitmapName, bitmapNameTemp);
|
||||
bitmap = bitmapName;
|
||||
}
|
||||
else
|
||||
|
@ -948,11 +950,13 @@ main(
|
|||
int doGen = 0;
|
||||
|
||||
char tmpVolume [MAXPATHLEN + 2];
|
||||
char tmpVolumeTemp[sizeof(tmpVolume)];
|
||||
char tmpVolume2 [MAXPATHLEN + 2];
|
||||
char tmpTopic [MAXPATHLEN + 2];
|
||||
char tmpHeader [MAXPATHLEN + 2];
|
||||
char headerName [MAXPATHLEN + 2];
|
||||
char baseName [MAXPATHLEN + 2];
|
||||
char baseNameTemp[sizeof(baseName)];
|
||||
char tempName [MAXPATHLEN + 2];
|
||||
char **next;
|
||||
char *charSet;
|
||||
|
@ -1057,7 +1061,8 @@ main(
|
|||
myName, errno);
|
||||
exit (1);
|
||||
}
|
||||
snprintf(baseName, sizeof(baseName), "%s/%s", baseName, App_args.dir);
|
||||
snprintf(baseNameTemp, sizeof(baseNameTemp), "%s/%s", baseName, App_args.dir);
|
||||
strcpy(baseName, baseNameTemp);
|
||||
}
|
||||
else
|
||||
snprintf(baseName, sizeof(baseName), "%s", App_args.dir);
|
||||
|
@ -1076,8 +1081,10 @@ main(
|
|||
}
|
||||
|
||||
snprintf(tmpVolume, sizeof(tmpVolume), "%s", ptr);
|
||||
if (tmpVolume[strlen (tmpVolume) - 1] != '/')
|
||||
snprintf(tmpVolume, sizeof(tmpVolume), "%s", SlashString);
|
||||
if (tmpVolume[strlen (tmpVolume) - 1] != '/') {
|
||||
snprintf(tmpVolumeTemp, sizeof(tmpVolumeTemp), "%s%s", tmpVolume, SlashString);
|
||||
strcpy(tmpVolume, tmpVolumeTemp);
|
||||
}
|
||||
|
||||
free (ptr);
|
||||
|
||||
|
@ -1185,12 +1192,14 @@ main(
|
|||
/*
|
||||
* get temporary files for the volume and topic file.
|
||||
*/
|
||||
snprintf(tmpVolume, sizeof(tmpVolume), "%s%s", tmpVolume, App_args.file);
|
||||
snprintf(tmpVolumeTemp, sizeof(tmpVolumeTemp), "%s%s", tmpVolume, App_args.file);
|
||||
strcpy(tmpVolume, tmpVolumeTemp);
|
||||
|
||||
(void) strcpy (tmpHeader, tmpVolume);
|
||||
(void) strcpy (tmpTopic, tmpVolume);
|
||||
|
||||
snprintf(tmpVolume, sizeof(tmpVolume), "%s%s", tmpVolume, Ext_Hv);
|
||||
snprintf(tmpVolumeTemp, sizeof(tmpVolumeTemp), "%s%s", tmpVolume, Ext_Hv);
|
||||
strcpy(tmpVolume, tmpVolumeTemp);
|
||||
(void) strcat (tmpHeader, "00.ht");
|
||||
(void) strcat (tmpTopic , "01.ht");
|
||||
|
||||
|
|
|
@ -796,7 +796,9 @@ static float dphm = 300.*2540.;
|
|||
int (*stricmp)(const char *,const char *);
|
||||
char *name;
|
||||
char name_prefix[RSRCSPECLEN];
|
||||
char name_prefix_temp[sizeof(name_prefix)];
|
||||
char class_prefix[RSRCSPECLEN];
|
||||
char class_prefix_temp[sizeof(class_prefix)];
|
||||
char resource_name[RSRCSPECLEN];
|
||||
char resource_class[RSRCSPECLEN];
|
||||
char *str_type[20];
|
||||
|
@ -825,8 +827,10 @@ static float dphm = 300.*2540.;
|
|||
else name = EMPTY_STR;
|
||||
if (name[0] != EOS)
|
||||
{
|
||||
snprintf(name_prefix, sizeof(name_prefix), "%s%s%s", name_prefix, DOT_STR, name); /* e.g. dthelpprint.printer.<name> */
|
||||
snprintf(class_prefix, sizeof(class_prefix), "%s%s%s", class_prefix, DOT_STR, name); /* e.g. Dthelpprint.Printer.<name> */
|
||||
snprintf(name_prefix_temp, sizeof(name_prefix_temp), "%s%s%s", name_prefix, DOT_STR, name); /* e.g. dthelpprint.printer.<name> */
|
||||
strcpy(name_prefix, name_prefix_temp);
|
||||
snprintf(class_prefix_temp, sizeof(class_prefix_temp), "%s%s%s", class_prefix, DOT_STR, name); /* e.g. Dthelpprint.Printer.<name> */
|
||||
strcpy(class_prefix, class_prefix_temp);
|
||||
}
|
||||
|
||||
/**************************/
|
||||
|
|
|
@ -1501,6 +1501,7 @@ static const char *isoString = "ISO-8859-1";
|
|||
_DtXlateDb myDb = NULL;
|
||||
char myPlatform[_DtPLATFORM_MAX_LEN+1];
|
||||
char myLocale[256]; /* arbitrarily large */
|
||||
char myLocaleTemp[sizeof(myLocale)]; /* non-arbitrarily the same */
|
||||
char *locale;
|
||||
char *lang;
|
||||
char *charset;
|
||||
|
@ -1511,7 +1512,8 @@ int isStd;
|
|||
snprintf(myLocale, sizeof(myLocale), "%s", pLang);
|
||||
if (*pCharset)
|
||||
{
|
||||
snprintf(myLocale, sizeof(myLocale), "%s.%s", myLocale, pCharset);
|
||||
snprintf(myLocaleTemp, sizeof(myLocaleTemp), "%s.%s", myLocale, pCharset);
|
||||
strcpy(myLocale, myLocaleTemp);
|
||||
}
|
||||
|
||||
if ((_DtLcxOpenAllDbs(&myDb) != 0) ||
|
||||
|
|
|
@ -1140,6 +1140,7 @@ SetUserAuthorization (struct display *d, struct verify_info *verify)
|
|||
{
|
||||
FILE *old, *new;
|
||||
char home_name[1024], backup_name[1024], new_name[1024];
|
||||
char home_name_temp[sizeof(home_name)];
|
||||
char *name;
|
||||
char *home;
|
||||
char *envname = 0;
|
||||
|
@ -1159,9 +1160,12 @@ SetUserAuthorization (struct display *d, struct verify_info *verify)
|
|||
lockStatus = LOCK_ERROR;
|
||||
if (home) {
|
||||
snprintf(home_name, sizeof(home_name), "%s", home);
|
||||
if (home[strlen(home) - 1] != '/')
|
||||
snprintf(home_name, sizeof(home_name), "%s/", home_name);
|
||||
snprintf(home_name, sizeof(home_name), "%s.Xauthority", home_name);
|
||||
if (home[strlen(home) - 1] != '/') {
|
||||
snprintf(home_name_temp, sizeof(home_name_temp), "%s/", home_name);
|
||||
strcpy(home_name, home_name_temp);
|
||||
}
|
||||
snprintf(home_name_temp, sizeof(home_name_temp), "%s.Xauthority", home_name);
|
||||
strcpy(home_name, home_name_temp);
|
||||
Debug ("XauLockAuth %s\n", home_name);
|
||||
lockStatus = XauLockAuth (home_name, 1, 2, 10);
|
||||
Debug ("Lock is %d\n", lockStatus);
|
||||
|
@ -1319,6 +1323,7 @@ RemoveUserAuthorization (struct display *d, struct verify_info *verify)
|
|||
char *home;
|
||||
Xauth **auths, *entry;
|
||||
char name[1024], new_name[1024];
|
||||
char name_temp[sizeof(name)];
|
||||
int lockStatus;
|
||||
FILE *old, *new;
|
||||
struct stat statb;
|
||||
|
@ -1332,9 +1337,12 @@ RemoveUserAuthorization (struct display *d, struct verify_info *verify)
|
|||
return;
|
||||
Debug ("RemoveUserAuthorization\n");
|
||||
snprintf(name, sizeof(name), "%s", home);
|
||||
if (home[strlen(home) - 1] != '/')
|
||||
snprintf(name, sizeof(name), "%s/", name);
|
||||
snprintf(name, sizeof(name), "%s.Xauthority", name);
|
||||
if (home[strlen(home) - 1] != '/') {
|
||||
snprintf(name_temp, sizeof(name_temp), "%s/", name);
|
||||
strcpy(name, name_temp);
|
||||
}
|
||||
snprintf(name_temp, sizeof(name_temp), "%s.Xauthority", name);
|
||||
strcpy(name, name_temp);
|
||||
Debug ("XauLockAuth %s\n", name);
|
||||
lockStatus = XauLockAuth (name, 1, 2, 10);
|
||||
Debug ("Lock is %d\n", lockStatus);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue