From: <ea...@us...> - 2003-06-13 18:34:16
|
Update of /cvsroot/mingw/msys/rt/src/winsup/cygwin In directory sc8-pr-cvs1:/tmp/cvs-serv21910 Modified Files: ChangeLog.MSYS environ.cc exceptions.cc msys_symlink.cc path.cc spawn.cc Log Message: * environ.cc: Remove DO_CPP_NEW filters througout. * exceptions.cc (exception): Output version and build date info to the stackdump file. * msys_symlink.cc (msys_symlink): Use msys_p2w() instead of cygwin_conv_to_win32_path(). * spawn.cc (spawn_guts): Ditto. * path.cc (msys_p2w): New function (copy previous cygwin_conv_to_win32_path and heavily modify). (cygwin_conv_to_win32_path): Remove contents and use msys_p2w. include/sys/cygwin.h (msys_p2w): Add declaration. Index: ChangeLog.MSYS =================================================================== RCS file: /cvsroot/mingw/msys/rt/src/winsup/cygwin/ChangeLog.MSYS,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** ChangeLog.MSYS 11 Jun 2003 14:20:27 -0000 1.50 --- ChangeLog.MSYS 13 Jun 2003 18:34:08 -0000 1.51 *************** *** 1,2 **** --- 1,15 ---- + 2003-06-13 Earnie Boyd <ea...@us...> + + * environ.cc: Remove DO_CPP_NEW filters througout. + * exceptions.cc (exception): Output version and build date info to the + stackdump file. + * msys_symlink.cc (msys_symlink): Use msys_p2w() instead of + cygwin_conv_to_win32_path(). + * spawn.cc (spawn_guts): Ditto. + * path.cc (msys_p2w): New function (copy previous + cygwin_conv_to_win32_path and heavily modify). + (cygwin_conv_to_win32_path): Remove contents and use msys_p2w. + include/sys/cygwin.h (msys_p2w): Add declaration. + 2003-06-11 Earnie Boyd <ea...@us...> Index: environ.cc =================================================================== RCS file: /cvsroot/mingw/msys/rt/src/winsup/cygwin/environ.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** environ.cc 17 Jul 2002 13:06:56 -0000 1.7 --- environ.cc 13 Jun 2003 18:34:08 -0000 1.8 *************** *** 815,823 **** else { - #if DO_CPP_NEW - tptr = new char [strlen (conv->native) + 1]; - #else tptr = (char *) alloca (strlen (conv->native) + 1); - #endif strcpy (tptr, conv->native); *dstp = tptr; --- 815,819 ---- *************** *** 826,834 **** if ((*dstp)[0] == '!' && isdrive ((*dstp) + 1) && (*dstp)[3] == '=') { - #if DO_CPP_NEW - tptr = new char [strlen (*dstp) + 1]; - #else tptr = (char *) alloca (strlen (*dstp) + 1); - #endif strcpy (tptr, *dstp); *tptr = '='; --- 822,826 ---- *************** *** 845,853 **** { srcplen = strlen (forced_winenv_vars[i]); - #if DO_CPP_NEW - tptr = new char [srcplen + MAX_PATH + 1]; - #else tptr = (char *) alloca (srcplen + MAX_PATH + 1); - #endif strcpy (tptr, forced_winenv_vars[i]); strcat (tptr, "="); --- 837,841 ---- *************** *** 871,880 **** /* Create an environment block suitable for passing to CreateProcess. */ char *ptr, *envblock; - #if DO_CPP_NEW - envblock = new char [envblocklen + 2 + (MAX_PATH * 256)]; - #else - //envblock = (char *) malloc (envblocklen + 2 + (MAX_PATH * 256)); envblock = (char *) malloc (envblocklen + 2); - #endif for (srcp = newenvp, ptr = envblock; *srcp; srcp++) { --- 859,863 ---- Index: exceptions.cc =================================================================== RCS file: /cvsroot/mingw/msys/rt/src/winsup/cygwin/exceptions.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** exceptions.cc 19 Apr 2003 01:03:46 -0000 1.3 --- exceptions.cc 13 Jun 2003 18:34:08 -0000 1.4 *************** *** 22,25 **** --- 22,26 ---- #include "perprocess.h" #include "security.h" + #include "cygwin_version.h" #define CALL_HANDLER_RETRY 20 *************** *** 199,203 **** #define HAVE_STATUS if (exception_name) ! small_printf ("Exception: %s at eip=%08x\r\n", exception_name, in->Eip); else small_printf ("Exception %d at eip=%08x\r\n", e->ExceptionCode, in->Eip); --- 200,210 ---- #define HAVE_STATUS if (exception_name) ! small_printf ("MSYS-%d.%d.%d Build:%s\nException: %s at eip=%08x\r\n", ! cygwin_version.dll_major / 1000, ! cygwin_version.dll_major % 1000, ! cygwin_version.dll_minor, ! cygwin_version.dll_build_date, ! exception_name, ! in->Eip); else small_printf ("Exception %d at eip=%08x\r\n", e->ExceptionCode, in->Eip); Index: msys_symlink.cc =================================================================== RCS file: /cvsroot/mingw/msys/rt/src/winsup/cygwin/msys_symlink.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** msys_symlink.cc 19 Jul 2002 16:13:25 -0000 1.3 --- msys_symlink.cc 13 Jun 2003 18:34:08 -0000 1.4 *************** *** 96,102 **** } ! cygwin_conv_to_win32_path (frompath, w_frompath); debug_printf("w_frompath: %s", w_frompath); ! cygwin_conv_to_win32_path (topath, w_topath); debug_printf("w_topath: %s", w_topath); --- 96,102 ---- } ! w_frompath = msys_p2w(frompath); debug_printf("w_frompath: %s", w_frompath); ! w_topath = msys_p2w(topath); debug_printf("w_topath: %s", w_topath); Index: path.cc =================================================================== RCS file: /cvsroot/mingw/msys/rt/src/winsup/cygwin/path.cc,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** path.cc 3 Jun 2003 12:24:30 -0000 1.36 --- path.cc 13 Jun 2003 18:34:08 -0000 1.37 *************** *** 3157,3162 **** extern "C" ! int ! cygwin_conv_to_win32_path (const char *path, char *win32_path) { TRACE_IN; --- 3157,3162 ---- extern "C" ! char * ! msys_p2w (const char *path) { TRACE_IN; *************** *** 3164,3169 **** if (!path || !*path) { ! *win32_path = '\0'; ! return 0; } --- 3164,3170 ---- if (!path || !*path) { ! char *retpath = (char *)malloc (1); ! *retpath = '\0'; ! return retpath; } *************** *** 3173,3186 **** char *sptr; char * sspath; - char *swin32_path = (char *)cmalloc(HEAP_STR, MAX_PATH); - memset (swin32_path, 0, MAX_PATH); - int swin32_pathlen; // retpath will be what sets win32_path before exiting. ! char *retpath = (char *)cmalloc(HEAP_STR, MAX_PATH); memset (retpath, 0, MAX_PATH); int retpath_len = 0; int retpath_buflen = MAX_PATH; - int sret; - int retval = 0; #define retpathcat(retstr) \ --- 3174,3182 ---- char *sptr; char * sspath; // retpath will be what sets win32_path before exiting. ! char *retpath = (char *)malloc(MAX_PATH); memset (retpath, 0, MAX_PATH); int retpath_len = 0; int retpath_buflen = MAX_PATH; #define retpathcat(retstr) \ *************** *** 3191,3195 **** retpath_buflen = ((retpath_buflen * 2 <= retpath_len) ? \ retpath_len + 1 : retpath_buflen * 2); \ ! retpath = (char *)crealloc (retpath, retpath_buflen); \ } \ strcat (retpath, retstr); --- 3187,3191 ---- retpath_buflen = ((retpath_buflen * 2 <= retpath_len) ? \ retpath_len + 1 : retpath_buflen * 2); \ ! retpath = (char *)realloc (retpath, retpath_buflen); \ } \ strcat (retpath, retstr); *************** *** 3206,3217 **** retpath_buflen = ((retpath_buflen * 2 <= retpath_len) ? \ retpath_len + 1 : retpath_buflen * 2); \ ! retpath = (char *)crealloc (retpath, retpath_buflen); \ } \ strcpy (retpath, retstr); - *win32_path = '\0'; - #if DEBUGGING ! debug_printf("cygwin_conv_to_win32_path (%s, ...)", path); #endif --- 3202,3211 ---- retpath_buflen = ((retpath_buflen * 2 <= retpath_len) ? \ retpath_len + 1 : retpath_buflen * 2); \ ! retpath = (char *)realloc (retpath, retpath_buflen); \ } \ strcpy (retpath, retstr); #if DEBUGGING ! debug_printf("msys_p2w (%s)", path); #endif *************** *** 3291,3299 **** { *sspath = '\0'; ! sret = cygwin_conv_to_win32_path (spath, swin32_path); // // Just ignore sret; swin32_path has the value we need. // retpathcat (swin32_path); spath = sspath + 1; sspath = strchr (spath, ':'); --- 3285,3294 ---- { *sspath = '\0'; ! char *swin32_path = msys_p2w (spath); // // Just ignore sret; swin32_path has the value we need. // retpathcat (swin32_path); + free (swin32_path); spath = sspath + 1; sspath = strchr (spath, ':'); *************** *** 3309,3314 **** { retpathcat (";"); ! sret = cygwin_conv_to_win32_path (spath, swin32_path); retpathcat (swin32_path); } } --- 3304,3310 ---- { retpathcat (";"); ! char *swin32_path = msys_p2w (spath); retpathcat (swin32_path); + free (swin32_path); } } *************** *** 3326,3334 **** { *(sspath - 1) = '\0'; ! sret = cygwin_conv_to_win32_path (spath, swin32_path); ! if (sret) { ! retpathcpy (path); ! retval = -1; break; } --- 3322,3329 ---- { *(sspath - 1) = '\0'; ! char *swin32_path = msys_p2w (spath); ! if (swin32_path == spath) { ! return ((char *)path); break; } *************** *** 3336,3339 **** --- 3331,3335 ---- retpathcat ("/"); retpathcat (sspath); + free (swin32_path); break; } *************** *** 3342,3347 **** { set_errno(p.error); ! retpathcpy (path); ! retval = -1; break; } --- 3338,3342 ---- { set_errno(p.error); ! return ((char *)path); break; } *************** *** 3360,3368 **** // *sspath = '\0'; ! sret = cygwin_conv_to_win32_path (++sspath, swin32_path); ! if (sret) { ! retpathcpy (path); ! retval = -1; break; } --- 3355,3362 ---- // *sspath = '\0'; ! char *swin32_path = msys_p2w(++sspath); ! if (swin32_path == sspath) { ! return ((char *)path); break; } *************** *** 3370,3373 **** --- 3364,3368 ---- retpathcat ("="); retpathcat (swin32_path); + free (swin32_path); break; } *************** *** 3382,3390 **** debug_printf("spath = %s", spath); #endif ! sret = cygwin_conv_to_win32_path (sspath, swin32_path); ! if (sret) { ! retpathcpy (path); ! retval = -1; break; } --- 3377,3384 ---- debug_printf("spath = %s", spath); #endif ! char *swin32_path = msys_p2w (sspath); ! if (swin32_path == sspath) { ! return ((char *)path); break; } *************** *** 3396,3399 **** --- 3390,3394 ---- *sspath = '/'; retpathcat (swin32_path); + free (swin32_path); break; } *************** *** 3412,3423 **** { retpathcpy ("\""); ! sret = cygwin_conv_to_win32_path (&spath[1], swin32_path); ! if (sret) { ! retpathcpy (path); ! retval = -1; break; } retpathcat (swin32_path); break; } --- 3407,3418 ---- { retpathcpy ("\""); ! char *swin32_path = msys_p2w (&spath[1]); ! if (swin32_path == &spath[1]) { ! return ((char *)path); break; } retpathcat (swin32_path); + free (swin32_path); break; } *************** *** 3431,3442 **** { retpathcpy ("'"); ! sret = cygwin_conv_to_win32_path (&spath[1], swin32_path); ! if (sret) { ! retpathcpy (path); ! retval = -1; break; } retpathcat (swin32_path); break; } --- 3426,3437 ---- { retpathcpy ("'"); ! char *swin32_path = msys_p2w (&spath[1]); ! if (swin32_path == &spath[1]) { ! return ((char *)path); break; } retpathcat (swin32_path); + free (swin32_path); break; } *************** *** 3452,3463 **** retpathcpy (spath); sspath[1] = '/'; ! sret = cygwin_conv_to_win32_path (&sspath[1], swin32_path); ! if (sret) { ! retpathcpy (path); ! retval = -1; break; } retpathcat (swin32_path); break; } --- 3447,3458 ---- retpathcpy (spath); sspath[1] = '/'; ! char *swin32_path = msys_p2w (&sspath[1]); ! if (swin32_path == &sspath[1]) { ! return ((char *)path); break; } retpathcat (swin32_path); + free (swin32_path); break; } *************** *** 3488,3495 **** } } - // - // Copy the return value. - // - strcpy (win32_path, retpath); // --- 3483,3486 ---- *************** *** 3501,3505 **** if (path_changed) { ! spath = win32_path; while ((sspath = strchr(spath, '/'))) { --- 3492,3496 ---- if (path_changed) { ! spath = retpath; while ((sspath = strchr(spath, '/'))) { *************** *** 3513,3517 **** if (path_changed) { ! spath = win32_path; while ((sspath = strchr(spath, '\\'))) { --- 3504,3508 ---- if (path_changed) { ! spath = retpath; while ((sspath = strchr(spath, '\\'))) { *************** *** 3522,3530 **** } ! if (swin32_path) ! cfree(swin32_path); ! if (retpath) ! cfree(retpath); ! return retval; } --- 3513,3526 ---- } ! return retpath; ! } ! ! extern "C" ! int ! cygwin_conv_to_win32_path (const char *path, char *win32_path) ! { ! TRACE_IN; ! win32_path = msys_p2w(path); ! return ((win32_path == path) ? -1 : 0); } Index: spawn.cc =================================================================== RCS file: /cvsroot/mingw/msys/rt/src/winsup/cygwin/spawn.cc,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** spawn.cc 11 Jun 2003 14:20:31 -0000 1.17 --- spawn.cc 13 Jun 2003 18:34:09 -0000 1.18 *************** *** 509,517 **** { //convert argv to win32 - char tmpbuf[MAX_PATH] = "\0"; - if (strlen(newargv[i]) < MAX_PATH) { ! cygwin_conv_to_win32_path(newargv[i], tmpbuf); //debug_printf("%d of %d, %s, %s", i, ac, newargv[i], tmpbuf); debug_printf("newargv[%d] = %s", i, newargv[i]); --- 509,515 ---- { //convert argv to win32 if (strlen(newargv[i]) < MAX_PATH) { ! char *tmpbuf = msys_p2w(newargv[i]); //debug_printf("%d of %d, %s, %s", i, ac, newargv[i], tmpbuf); debug_printf("newargv[%d] = %s", i, newargv[i]); *************** *** 658,662 **** #endif char **envblockarg = (char **)malloc(sizeof (char *) * (envblockcnt + 1)); ! char *tptr, *wpath; int envblocknlen = 0, envblockarglen = 0; envblockn = envblock; --- 656,660 ---- #endif char **envblockarg = (char **)malloc(sizeof (char *) * (envblockcnt + 1)); ! char *tptr; int envblocknlen = 0, envblockarglen = 0; envblockn = envblock; *************** *** 664,671 **** { envblocknlen = strlen(envblockn); ! envblockarg[loop] = (char *) malloc(envblocknlen + MAX_PATH); ! memset (envblockarg[loop], 0, envblocknlen + MAX_PATH); ! wpath = (char *)malloc (envblocknlen + MAX_PATH); ! memset (wpath, 0, envblocknlen + MAX_PATH); if ((tptr = strchr(envblockn, '='))) --- 662,667 ---- { envblocknlen = strlen(envblockn); ! envblockarg[loop] = (char *) malloc(envblocknlen + MAX_PATH + 1); ! memset (envblockarg[loop], 0, envblocknlen + MAX_PATH + 1); if ((tptr = strchr(envblockn, '='))) *************** *** 673,678 **** tptr++; strncpy (envblockarg[loop], envblockn, tptr - envblockn); ! cygwin_conv_to_win32_path (tptr, wpath); strcat(envblockarg[loop], wpath); } --- 669,676 ---- tptr++; strncpy (envblockarg[loop], envblockn, tptr - envblockn); ! char *wpath = msys_p2w(tptr); ! debug_printf("wpath=%s", wpath); strcat(envblockarg[loop], wpath); + free (wpath); } *************** *** 680,686 **** envblockarglen += strlen(envblockarg[loop]) + 1; envblockn = envblockn + envblocknlen + 1; - if (wpath) - free (wpath); } // END FOR (int loop=0;loop < envblockcnt;loop++) if (envblock) --- 678,683 ---- envblockarglen += strlen(envblockarg[loop]) + 1; envblockn = envblockn + envblocknlen + 1; } // END FOR (int loop=0;loop < envblockcnt;loop++) + envblockarg[envblockcnt] = '\0'; if (envblock) |