Re: [classlib][luni] launcher/shared/main.c compile errors on Win32
Heh, There are modern languages and platforms for goodness. Who cares about those ancient low-level sundry ;) 2006/9/21, Nathan Beyer [EMAIL PROTECTED]: Yeah, I thought modern compilers could handle that too, which is part of my hesitation on applying a fix. Is there some sort of flag that we're missing to kick this in for MSVC? As for char *dir[]; - I didn't try that in the declaration, so that might work. -Nathan -Original Message- From: Geir Magnusson Jr. [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 20, 2006 9:07 PM To: harmony-dev@incubator.apache.org Subject: Re: [classlib][luni] launcher/shared/main.c compile errors on Win32 Arrrgh. When I was making those changes I was thinking A long time ago, this would have been a problem, but thank goodness we're using modern compilers now... I guess not. Sorry about that. Teaches me to jump to conclusions... fixing now Did it reject char *dirs[];? geir On Sep 20, 2006, at 9:30 PM, Nathan Beyer wrote: I ran into some compile errors in luni's launcher/shared/main.c, which I believe were added here [1]. I made some local changes to get it to compile and run, but I wanted to pass the diff by the real C experts in the crowd, as I'm not much of C hacker. Based on the compile errors, the problem seemed to be that the local variables weren't declared at the beginning of the method. I moved up the declarations to the top of their respective methods. There was also an unused variable. Check out the below diff and let me know if it looks okay or not. Thanks. -Nathan [1] http://svn.apache.org/viewvc?view=rev http://svn.apache.org/viewvc?view=revrevision=448355 revision=448355 Index: main.c === --- main.c (revision 448406) +++ main.c (working copy) @@ -132,6 +132,7 @@ int genericLauncher = 0; char *str; char *knownGenericNames[] = { java, java.exe, javaw.exe, NULL }; + char *dirs[] = {NULL, NULL}; PORT_ACCESS_FROM_PORT (args-portLibrary); @@ -308,7 +309,7 @@ strcat (vmiPath, DIR_SEPERATOR_STRING); strcat (vmiPath, vmdll); -char *dirs[2]; dirs[0] = newPathToAdd; dirs[1] = exeName; @@ -1016,10 +1017,12 @@ char *oldPath = NULL; char *variableName = NULL; char *separator = NULL; - UDATA newPathLength; char *newPath; int rc = 0; char *exeName; + int found = 0; + int i = 0; + int strLen = 0; PORT_ACCESS_FROM_PORT (portLibrary); @@ -1041,9 +1044,6 @@ /* * see if we can find all paths in the current path */ - - int found = 0; - int i=0; for (i=0; i count; i++) { if (newPathToAdd[i] != NULL strstr(oldPath, newPathToAdd [i]) != 0) { @@ -1064,7 +1064,7 @@ * short) and then add the old path on the end */ - int strLen = strlen(variableName) + strlen(=) + strlen(oldPath); + strLen = strlen(variableName) + strlen(=) + strlen(oldPath); for (i=0; i count; i++) { if (newPathToAdd[i] != NULL strstr(oldPath, newPathToAdd [i]) == 0) { - Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [classlib][luni] launcher/shared/main.c compile errors on Win32
Arrrgh. When I was making those changes I was thinking A long time ago, this would have been a problem, but thank goodness we're using modern compilers now... I guess not. Sorry about that. Teaches me to jump to conclusions... fixing now Did it reject char *dirs[];? geir On Sep 20, 2006, at 9:30 PM, Nathan Beyer wrote: I ran into some compile errors in luni's launcher/shared/main.c, which I believe were added here [1]. I made some local changes to get it to compile and run, but I wanted to pass the diff by the real C experts in the crowd, as I'm not much of C hacker. Based on the compile errors, the problem seemed to be that the local variables weren't declared at the beginning of the method. I moved up the declarations to the top of their respective methods. There was also an unused variable. Check out the below diff and let me know if it looks okay or not. Thanks. -Nathan [1] http://svn.apache.org/viewvc?view=rev http://svn.apache.org/viewvc?view=revrevision=448355 revision=448355 Index: main.c === --- main.c (revision 448406) +++ main.c (working copy) @@ -132,6 +132,7 @@ int genericLauncher = 0; char *str; char *knownGenericNames[] = { java, java.exe, javaw.exe, NULL }; + char *dirs[] = {NULL, NULL}; PORT_ACCESS_FROM_PORT (args-portLibrary); @@ -308,7 +309,7 @@ strcat (vmiPath, DIR_SEPERATOR_STRING); strcat (vmiPath, vmdll); -char *dirs[2]; dirs[0] = newPathToAdd; dirs[1] = exeName; @@ -1016,10 +1017,12 @@ char *oldPath = NULL; char *variableName = NULL; char *separator = NULL; - UDATA newPathLength; char *newPath; int rc = 0; char *exeName; + int found = 0; + int i = 0; + int strLen = 0; PORT_ACCESS_FROM_PORT (portLibrary); @@ -1041,9 +1044,6 @@ /* * see if we can find all paths in the current path */ - - int found = 0; - int i=0; for (i=0; i count; i++) { if (newPathToAdd[i] != NULL strstr(oldPath, newPathToAdd [i]) != 0) { @@ -1064,7 +1064,7 @@ * short) and then add the old path on the end */ - int strLen = strlen(variableName) + strlen(=) + strlen(oldPath); + strLen = strlen(variableName) + strlen(=) + strlen(oldPath); for (i=0; i count; i++) { if (newPathToAdd[i] != NULL strstr(oldPath, newPathToAdd [i]) == 0) { - Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [classlib][luni] launcher/shared/main.c compile errors on Win32
Yeah, I thought modern compilers could handle that too, which is part of my hesitation on applying a fix. Is there some sort of flag that we're missing to kick this in for MSVC? As for char *dir[]; - I didn't try that in the declaration, so that might work. -Nathan -Original Message- From: Geir Magnusson Jr. [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 20, 2006 9:07 PM To: harmony-dev@incubator.apache.org Subject: Re: [classlib][luni] launcher/shared/main.c compile errors on Win32 Arrrgh. When I was making those changes I was thinking A long time ago, this would have been a problem, but thank goodness we're using modern compilers now... I guess not. Sorry about that. Teaches me to jump to conclusions... fixing now Did it reject char *dirs[];? geir On Sep 20, 2006, at 9:30 PM, Nathan Beyer wrote: I ran into some compile errors in luni's launcher/shared/main.c, which I believe were added here [1]. I made some local changes to get it to compile and run, but I wanted to pass the diff by the real C experts in the crowd, as I'm not much of C hacker. Based on the compile errors, the problem seemed to be that the local variables weren't declared at the beginning of the method. I moved up the declarations to the top of their respective methods. There was also an unused variable. Check out the below diff and let me know if it looks okay or not. Thanks. -Nathan [1] http://svn.apache.org/viewvc?view=rev http://svn.apache.org/viewvc?view=revrevision=448355 revision=448355 Index: main.c === --- main.c (revision 448406) +++ main.c (working copy) @@ -132,6 +132,7 @@ int genericLauncher = 0; char *str; char *knownGenericNames[] = { java, java.exe, javaw.exe, NULL }; + char *dirs[] = {NULL, NULL}; PORT_ACCESS_FROM_PORT (args-portLibrary); @@ -308,7 +309,7 @@ strcat (vmiPath, DIR_SEPERATOR_STRING); strcat (vmiPath, vmdll); -char *dirs[2]; dirs[0] = newPathToAdd; dirs[1] = exeName; @@ -1016,10 +1017,12 @@ char *oldPath = NULL; char *variableName = NULL; char *separator = NULL; - UDATA newPathLength; char *newPath; int rc = 0; char *exeName; + int found = 0; + int i = 0; + int strLen = 0; PORT_ACCESS_FROM_PORT (portLibrary); @@ -1041,9 +1044,6 @@ /* * see if we can find all paths in the current path */ - - int found = 0; - int i=0; for (i=0; i count; i++) { if (newPathToAdd[i] != NULL strstr(oldPath, newPathToAdd [i]) != 0) { @@ -1064,7 +1064,7 @@ * short) and then add the old path on the end */ - int strLen = strlen(variableName) + strlen(=) + strlen(oldPath); + strLen = strlen(variableName) + strlen(=) + strlen(oldPath); for (i=0; i count; i++) { if (newPathToAdd[i] != NULL strstr(oldPath, newPathToAdd [i]) == 0) { - Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]