aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2014-12-26 11:52:24 +0200
committerEli Zaretskii2014-12-26 11:52:24 +0200
commitd65526283d517e0b97b0c74af75bb2e869db4dae (patch)
tree824b887fd0e05a1666daee2eae0387f5a1c22749
parentf76956645ddf3bde4105b50e9bd1e3a1cc2da39c (diff)
downloademacs-d65526283d517e0b97b0c74af75bb2e869db4dae.tar.gz
emacs-d65526283d517e0b97b0c74af75bb2e869db4dae.zip
MS-Windows followup to stpcpy changes.
src/w32proc.c (sys_spawnve, get_lcid_callback): Use strcpy instead of strcat. src/w32menu.c (add_menu_item): Use stpcpy instead of strcat. src/w32.c (sys_readdir, stat_worker, symlink): Use strcpy instead of strcat. nt/gnulib.mk (stpcpy, string): Sync with the latest change in lib/gnulib.mk.
-rw-r--r--nt/ChangeLog5
-rw-r--r--nt/gnulib.mk111
-rw-r--r--src/ChangeLog10
-rw-r--r--src/w32.c13
-rw-r--r--src/w32menu.c6
-rw-r--r--src/w32proc.c15
6 files changed, 141 insertions, 19 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 1edfda0ffd2..2467e64bbef 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,8 @@
12014-12-26 Eli Zaretskii <eliz@gnu.org>
2
3 * gnulib.mk (stpcpy, string): Sync with the latest change in
4 lib/gnulib.mk.
5
12014-12-13 Eli Zaretskii <eliz@gnu.org> 62014-12-13 Eli Zaretskii <eliz@gnu.org>
2 7
3 * gnulib.mk (stddef.h): Sync with the latest change in lib/gnulib.mk. 8 * gnulib.mk (stddef.h): Sync with the latest change in lib/gnulib.mk.
diff --git a/nt/gnulib.mk b/nt/gnulib.mk
index 273f52293cc..a5dca96850f 100644
--- a/nt/gnulib.mk
+++ b/nt/gnulib.mk
@@ -43,7 +43,7 @@
43# the same distribution terms as the rest of that program. 43# the same distribution terms as the rest of that program.
44# 44#
45# Generated by gnulib-tool. 45# Generated by gnulib-tool.
46# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv update-copyright utimens vla warnings 46# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r timer-time timespec-add timespec-sub unsetenv update-copyright utimens vla warnings
47 47
48 48
49MOSTLYCLEANFILES += core *.stackdump 49MOSTLYCLEANFILES += core *.stackdump
@@ -771,6 +771,15 @@ EXTRA_DIST += stdint.in.h
771 771
772## end gnulib module stdint 772## end gnulib module stdint
773 773
774## begin gnulib module stpcpy
775
776
777EXTRA_DIST += stpcpy.c
778
779EXTRA_libgnu_a_SOURCES += stpcpy.c
780
781## end gnulib module stpcpy
782
774## begin gnulib module strftime 783## begin gnulib module strftime
775 784
776libgnu_a_SOURCES += strftime.c 785libgnu_a_SOURCES += strftime.c
@@ -779,6 +788,106 @@ EXTRA_DIST += strftime.h
779 788
780## end gnulib module strftime 789## end gnulib module strftime
781 790
791## begin gnulib module string
792
793BUILT_SOURCES += string.h
794
795# We need the following in order to create <string.h> when the system
796# doesn't have one that works with the given compiler.
797string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
798 $(AM_V_GEN)rm -f $@-t $@ && \
799 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
800 sed -e 's|@''GUARD_PREFIX''@|GL|g' \
801 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
802 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
803 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
804 -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
805 -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \
806 -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \
807 -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \
808 -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \
809 -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \
810 -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \
811 -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \
812 -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \
813 -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \
814 -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \
815 -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \
816 -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \
817 -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \
818 -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \
819 -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \
820 -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \
821 -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \
822 -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \
823 -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \
824 -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \
825 -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \
826 -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \
827 -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \
828 -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \
829 -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \
830 -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \
831 -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \
832 -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \
833 -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \
834 -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \
835 -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \
836 -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \
837 -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \
838 -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \
839 -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \
840 -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \
841 -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \
842 < $(srcdir)/string.in.h | \
843 sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
844 -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \
845 -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
846 -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
847 -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
848 -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
849 -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
850 -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \
851 -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
852 -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
853 -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
854 -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
855 -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
856 -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
857 -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
858 -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
859 -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
860 -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
861 -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
862 -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
863 -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
864 -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \
865 -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
866 -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
867 -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
868 -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \
869 -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
870 -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
871 -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
872 -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
873 -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
874 -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
875 -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
876 -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
877 -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
878 -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
879 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
880 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
881 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
882 < $(srcdir)/string.in.h; \
883 } > $@-t && \
884 mv $@-t $@
885MOSTLYCLEANFILES += string.h string.h-t
886
887EXTRA_DIST += string.in.h
888
889## end gnulib module string
890
782## begin gnulib module strtoimax 891## begin gnulib module strtoimax
783 892
784 893
diff --git a/src/ChangeLog b/src/ChangeLog
index f3bc9fd2c87..72601fe7c58 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12014-12-26 Eli Zaretskii <eliz@gnu.org>
2
3 * w32proc.c (sys_spawnve, get_lcid_callback): Use strcpy instead
4 of strcat.
5
6 * w32menu.c (add_menu_item): Use stpcpy instead of strcat.
7
8 * w32.c (sys_readdir, stat_worker, symlink): Use strcpy instead of
9 strcat.
10
12014-12-26 Paul Eggert <eggert@cs.ucla.edu> 112014-12-26 Paul Eggert <eggert@cs.ucla.edu>
2 12
3 Use bool for boolean in xsmfns.c 13 Use bool for boolean in xsmfns.c
diff --git a/src/w32.c b/src/w32.c
index 8d8f536ca40..6dea0c2a811 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -3405,10 +3405,10 @@ sys_readdir (DIR *dirp)
3405 int ln; 3405 int ln;
3406 3406
3407 strcpy (filename, dir_pathname); 3407 strcpy (filename, dir_pathname);
3408 ln = strlen (filename) - 1; 3408 ln = strlen (filename);
3409 if (!IS_DIRECTORY_SEP (filename[ln])) 3409 if (!IS_DIRECTORY_SEP (filename[ln - 1]))
3410 strcat (filename, "\\"); 3410 filename[ln++] = '\\';
3411 strcat (filename, "*"); 3411 strcpy (filename + ln, "*");
3412 3412
3413 /* Note: No need to resolve symlinks in FILENAME, because 3413 /* Note: No need to resolve symlinks in FILENAME, because
3414 FindFirst opens the directory that is the target of a 3414 FindFirst opens the directory that is the target of a
@@ -4969,7 +4969,7 @@ stat_worker (const char * path, struct stat * buf, int follow_symlinks)
4969 { 4969 {
4970 /* Make sure root directories end in a slash. */ 4970 /* Make sure root directories end in a slash. */
4971 if (!IS_DIRECTORY_SEP (name[len-1])) 4971 if (!IS_DIRECTORY_SEP (name[len-1]))
4972 strcat (name, "\\"); 4972 strcpy (name + len, "\\");
4973 if (GetDriveType (name) < 2) 4973 if (GetDriveType (name) < 2)
4974 { 4974 {
4975 errno = ENOENT; 4975 errno = ENOENT;
@@ -5438,8 +5438,7 @@ symlink (char const *filename, char const *linkname)
5438 p--; 5438 p--;
5439 if (p > linkfn) 5439 if (p > linkfn)
5440 strncpy (tem, linkfn, p - linkfn); 5440 strncpy (tem, linkfn, p - linkfn);
5441 tem[p - linkfn] = '\0'; 5441 strcpy (tem + (p - linkfn), filename);
5442 strcat (tem, filename);
5443 dir_access = faccessat (AT_FDCWD, tem, D_OK, AT_EACCESS); 5442 dir_access = faccessat (AT_FDCWD, tem, D_OK, AT_EACCESS);
5444 } 5443 }
5445 else 5444 else
diff --git a/src/w32menu.c b/src/w32menu.c
index 6633ffddbcf..287062c702c 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1256,9 +1256,9 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1256 if (wv->key != NULL) 1256 if (wv->key != NULL)
1257 { 1257 {
1258 out_string = SAFE_ALLOCA (strlen (wv->name) + strlen (wv->key) + 2); 1258 out_string = SAFE_ALLOCA (strlen (wv->name) + strlen (wv->key) + 2);
1259 strcpy (out_string, wv->name); 1259 p = stpcpy (out_string, wv->name);
1260 strcat (out_string, "\t"); 1260 p = stpcpy (p, "\t");
1261 strcat (out_string, wv->key); 1261 strcpy (p, wv->key);
1262 } 1262 }
1263 else 1263 else
1264 out_string = (char *)wv->name; 1264 out_string = (char *)wv->name;
diff --git a/src/w32proc.c b/src/w32proc.c
index 09e0c0530a4..c571726d70f 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1665,10 +1665,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
1665 if (egetenv ("CMDPROXY")) 1665 if (egetenv ("CMDPROXY"))
1666 strcpy (cmdname, egetenv ("CMDPROXY")); 1666 strcpy (cmdname, egetenv ("CMDPROXY"));
1667 else 1667 else
1668 { 1668 strcpy (lispstpcpy (cmdname, Vinvocation_directory), "cmdproxy.exe");
1669 lispstpcpy (cmdname, Vinvocation_directory);
1670 strcat (cmdname, "cmdproxy.exe");
1671 }
1672 1669
1673 /* Can't use unixtodos_filename here, since that needs its file 1670 /* Can't use unixtodos_filename here, since that needs its file
1674 name argument encoded in UTF-8. */ 1671 name argument encoded in UTF-8. */
@@ -3183,18 +3180,20 @@ get_lcid_callback (LPTSTR locale_num_str)
3183 if (GetLocaleInfo (try_lcid, LOCALE_SABBREVLANGNAME, 3180 if (GetLocaleInfo (try_lcid, LOCALE_SABBREVLANGNAME,
3184 locval, LOCALE_NAME_MAX_LENGTH)) 3181 locval, LOCALE_NAME_MAX_LENGTH))
3185 { 3182 {
3183 size_t locval_len;
3184
3186 /* This is for when they only specify the language, as in "ENU". */ 3185 /* This is for when they only specify the language, as in "ENU". */
3187 if (stricmp (locval, lname) == 0) 3186 if (stricmp (locval, lname) == 0)
3188 { 3187 {
3189 found_lcid = try_lcid; 3188 found_lcid = try_lcid;
3190 return FALSE; 3189 return FALSE;
3191 } 3190 }
3192 strcat (locval, "_"); 3191 locval_len = strlen (locval);
3192 strcpy (locval + locval_len, "_");
3193 if (GetLocaleInfo (try_lcid, LOCALE_SABBREVCTRYNAME, 3193 if (GetLocaleInfo (try_lcid, LOCALE_SABBREVCTRYNAME,
3194 locval + strlen (locval), LOCALE_NAME_MAX_LENGTH)) 3194 locval + locval_len + 1, LOCALE_NAME_MAX_LENGTH))
3195 { 3195 {
3196 size_t locval_len = strlen (locval); 3196 locval_len = strlen (locval);
3197
3198 if (strnicmp (locval, lname, locval_len) == 0 3197 if (strnicmp (locval, lname, locval_len) == 0
3199 && (lname[locval_len] == '.' 3198 && (lname[locval_len] == '.'
3200 || lname[locval_len] == '\0')) 3199 || lname[locval_len] == '\0'))