Index: tool/lemon.c ================================================================== --- tool/lemon.c +++ tool/lemon.c @@ -18,11 +18,17 @@ # define __WIN32__ # endif #endif #ifdef __WIN32__ -extern int access(); +#ifdef __cplusplus +extern "C" { +#endif +extern int access(const char *path, int mode); +#ifdef __cplusplus +} +#endif #else #include #endif /* #define PRIVATE static */ @@ -43,11 +49,10 @@ int i; for (i = 0; i < made_files_count; i++) { if (!successful_exit) { remove(made_files[i]); } - free((void *) made_files[i]); } free(made_files); made_files_count = 0; made_files = NULL; } @@ -397,11 +402,11 @@ } if( rc==0 && ap1->type==REDUCE ){ rc = ap1->x.rp->index - ap2->x.rp->index; } if( rc==0 ){ - rc = ap2 - ap1; + rc = (int) (ap2 - ap1); } return rc; } /* Sort parser actions */ @@ -2757,14 +2762,13 @@ ** was an error you need to track down. */ if(( *mode=='w' ) && (strcmp(suffix, ".out") != 0)){ const char **ptr = (const char **) realloc(made_files, sizeof (const char **) * (made_files_count + 1)); - char *fname = strdup(lemp->outname); + const char *fname = Strsafe(lemp->outname); if ((ptr == NULL) || (fname == NULL)) { free(ptr); - free(fname); memory_error(); } made_files = ptr; made_files[made_files_count++] = fname; } @@ -3243,11 +3247,11 @@ used += n; assert( used>=0 ); } n = lemonStrlen(zText); } - if( n+sizeof(zInt)*2+used >= alloced ){ + if( (int) (n+sizeof(zInt)*2+used) >= alloced ){ alloced = n + sizeof(zInt)*2 + used + 200; z = (char *) realloc(z, alloced); } if( z==0 ) return empty; while( n-- > 0 ){