Issue #7406: Fix some occurrences of potential signed overflow in int
[python.git] / PC / generrmap.c
blob2b25063e1e0b8f1650967f99ea2300ddd5c1105b
1 #include <stdio.h>
2 #include <errno.h>
4 /* Extract the mapping of Win32 error codes to errno */
6 int main()
8 int i;
9 printf("/* Generated file. Do not edit. */\n");
10 printf("int winerror_to_errno(int winerror)\n");
11 printf("{\n\tswitch(winerror) {\n");
12 for(i=1; i < 65000; i++) {
13 _dosmaperr(i);
14 if (errno == EINVAL)
15 continue;
16 printf("\t\tcase %d: return %d;\n", i, errno);
18 printf("\t\tdefault: return EINVAL;\n");
19 printf("\t}\n}\n");