Fossil SCM
Cherry-pick [http://www.sqlite.org/src/info/4043d87979|4043d87979], [http://www.sqlite.org/src/info/953cdd6ada|953cdd6ada] and [http://www.sqlite.org/src/info/23001a85cd|23001a85cd]: Ensure that _FILE_OFFSET_BITS and related macros are defined before any #include, for QNX. Meant for testing this change in SQLite in combination with the mingw4x fixes: [http://www.sqlite.org/src/timeline?r=mingw4x]
Commit
782c3bd265c38bdcc3aa6e0693af70cfc64f7315
Parent
007c32bdfd67711…
1 file changed
+55
-70
+55
-70
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -23,10 +23,64 @@ | ||
| 23 | 23 | # define SQLITE_PRIVATE static |
| 24 | 24 | #endif |
| 25 | 25 | #ifndef SQLITE_API |
| 26 | 26 | # define SQLITE_API |
| 27 | 27 | #endif |
| 28 | +/************** Begin file sqliteInt.h ***************************************/ | |
| 29 | +/* | |
| 30 | +** 2001 September 15 | |
| 31 | +** | |
| 32 | +** The author disclaims copyright to this source code. In place of | |
| 33 | +** a legal notice, here is a blessing: | |
| 34 | +** | |
| 35 | +** May you do good and not evil. | |
| 36 | +** May you find forgiveness for yourself and forgive others. | |
| 37 | +** May you share freely, never taking more than you give. | |
| 38 | +** | |
| 39 | +************************************************************************* | |
| 40 | +** Internal interface definitions for SQLite. | |
| 41 | +** | |
| 42 | +*/ | |
| 43 | +#ifndef _SQLITEINT_H_ | |
| 44 | +#define _SQLITEINT_H_ | |
| 45 | + | |
| 46 | +/* | |
| 47 | +** These #defines should enable >2GB file support on POSIX if the | |
| 48 | +** underlying operating system supports it. If the OS lacks | |
| 49 | +** large file support, or if the OS is windows, these should be no-ops. | |
| 50 | +** | |
| 51 | +** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any | |
| 52 | +** system #includes. Hence, this block of code must be the very first | |
| 53 | +** code in all source files. | |
| 54 | +** | |
| 55 | +** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch | |
| 56 | +** on the compiler command line. This is necessary if you are compiling | |
| 57 | +** on a recent machine (ex: Red Hat 7.2) but you want your code to work | |
| 58 | +** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2 | |
| 59 | +** without this option, LFS is enable. But LFS does not exist in the kernel | |
| 60 | +** in Red Hat 6.0, so the code won't work. Hence, for maximum binary | |
| 61 | +** portability you should omit LFS. | |
| 62 | +** | |
| 63 | +** The previous paragraph was written in 2005. (This paragraph is written | |
| 64 | +** on 2008-11-28.) These days, all Linux kernels support large files, so | |
| 65 | +** you should probably leave LFS enabled. But some embedded platforms might | |
| 66 | +** lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful. | |
| 67 | +** | |
| 68 | +** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later. | |
| 69 | +*/ | |
| 70 | +#ifndef SQLITE_DISABLE_LFS | |
| 71 | +# define _LARGE_FILE 1 | |
| 72 | +# ifndef _FILE_OFFSET_BITS | |
| 73 | +# define _FILE_OFFSET_BITS 64 | |
| 74 | +# endif | |
| 75 | +# define _LARGEFILE_SOURCE 1 | |
| 76 | +#endif | |
| 77 | + | |
| 78 | +/* The public SQLite interface. The _FILE_OFFSET_BITS macro must appear | |
| 79 | +** first in QNX. | |
| 80 | +*/ | |
| 81 | +/************** Include sqlite3.h in the middle of sqliteInt.h ***************/ | |
| 28 | 82 | /************** Begin file sqlite3.h *****************************************/ |
| 29 | 83 | /* |
| 30 | 84 | ** 2001 September 15 |
| 31 | 85 | ** |
| 32 | 86 | ** The author disclaims copyright to this source code. In place of |
| @@ -7411,54 +7465,11 @@ | ||
| 7411 | 7465 | |
| 7412 | 7466 | #endif /* ifndef _SQLITE3RTREE_H_ */ |
| 7413 | 7467 | |
| 7414 | 7468 | |
| 7415 | 7469 | /************** End of sqlite3.h *********************************************/ |
| 7416 | -/************** Begin file sqliteInt.h ***************************************/ | |
| 7417 | -/* | |
| 7418 | -** 2001 September 15 | |
| 7419 | -** | |
| 7420 | -** The author disclaims copyright to this source code. In place of | |
| 7421 | -** a legal notice, here is a blessing: | |
| 7422 | -** | |
| 7423 | -** May you do good and not evil. | |
| 7424 | -** May you find forgiveness for yourself and forgive others. | |
| 7425 | -** May you share freely, never taking more than you give. | |
| 7426 | -** | |
| 7427 | -************************************************************************* | |
| 7428 | -** Internal interface definitions for SQLite. | |
| 7429 | -** | |
| 7430 | -*/ | |
| 7431 | -#ifndef _SQLITEINT_H_ | |
| 7432 | -#define _SQLITEINT_H_ | |
| 7433 | - | |
| 7434 | -/* | |
| 7435 | -** These #defines should enable >2GB file support on POSIX if the | |
| 7436 | -** underlying operating system supports it. If the OS lacks | |
| 7437 | -** large file support, or if the OS is windows, these should be no-ops. | |
| 7438 | -** | |
| 7439 | -** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any | |
| 7440 | -** system #includes. Hence, this block of code must be the very first | |
| 7441 | -** code in all source files. | |
| 7442 | -** | |
| 7443 | -** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch | |
| 7444 | -** on the compiler command line. This is necessary if you are compiling | |
| 7445 | -** on a recent machine (ex: Red Hat 7.2) but you want your code to work | |
| 7446 | -** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2 | |
| 7447 | -** without this option, LFS is enable. But LFS does not exist in the kernel | |
| 7448 | -** in Red Hat 6.0, so the code won't work. Hence, for maximum binary | |
| 7449 | -** portability you should omit LFS. | |
| 7450 | -** | |
| 7451 | -** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later. | |
| 7452 | -*/ | |
| 7453 | -#ifndef SQLITE_DISABLE_LFS | |
| 7454 | -# define _LARGE_FILE 1 | |
| 7455 | -# ifndef _FILE_OFFSET_BITS | |
| 7456 | -# define _FILE_OFFSET_BITS 64 | |
| 7457 | -# endif | |
| 7458 | -# define _LARGEFILE_SOURCE 1 | |
| 7459 | -#endif | |
| 7470 | +/************** Continuing where we left off in sqliteInt.h ******************/ | |
| 7460 | 7471 | |
| 7461 | 7472 | /* |
| 7462 | 7473 | ** Include the configuration header output by 'configure' if we're using the |
| 7463 | 7474 | ** autoconf-based build |
| 7464 | 7475 | */ |
| @@ -23430,36 +23441,10 @@ | ||
| 23430 | 23441 | # else |
| 23431 | 23442 | # define OS_VXWORKS 0 |
| 23432 | 23443 | # endif |
| 23433 | 23444 | #endif |
| 23434 | 23445 | |
| 23435 | -/* | |
| 23436 | -** These #defines should enable >2GB file support on Posix if the | |
| 23437 | -** underlying operating system supports it. If the OS lacks | |
| 23438 | -** large file support, these should be no-ops. | |
| 23439 | -** | |
| 23440 | -** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch | |
| 23441 | -** on the compiler command line. This is necessary if you are compiling | |
| 23442 | -** on a recent machine (ex: RedHat 7.2) but you want your code to work | |
| 23443 | -** on an older machine (ex: RedHat 6.0). If you compile on RedHat 7.2 | |
| 23444 | -** without this option, LFS is enable. But LFS does not exist in the kernel | |
| 23445 | -** in RedHat 6.0, so the code won't work. Hence, for maximum binary | |
| 23446 | -** portability you should omit LFS. | |
| 23447 | -** | |
| 23448 | -** The previous paragraph was written in 2005. (This paragraph is written | |
| 23449 | -** on 2008-11-28.) These days, all Linux kernels support large files, so | |
| 23450 | -** you should probably leave LFS enabled. But some embedded platforms might | |
| 23451 | -** lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful. | |
| 23452 | -*/ | |
| 23453 | -#ifndef SQLITE_DISABLE_LFS | |
| 23454 | -# define _LARGE_FILE 1 | |
| 23455 | -# ifndef _FILE_OFFSET_BITS | |
| 23456 | -# define _FILE_OFFSET_BITS 64 | |
| 23457 | -# endif | |
| 23458 | -# define _LARGEFILE_SOURCE 1 | |
| 23459 | -#endif | |
| 23460 | - | |
| 23461 | 23446 | /* |
| 23462 | 23447 | ** standard include files. |
| 23463 | 23448 | */ |
| 23464 | 23449 | #include <sys/types.h> |
| 23465 | 23450 | #include <sys/stat.h> |
| 23466 | 23451 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -23,10 +23,64 @@ | |
| 23 | # define SQLITE_PRIVATE static |
| 24 | #endif |
| 25 | #ifndef SQLITE_API |
| 26 | # define SQLITE_API |
| 27 | #endif |
| 28 | /************** Begin file sqlite3.h *****************************************/ |
| 29 | /* |
| 30 | ** 2001 September 15 |
| 31 | ** |
| 32 | ** The author disclaims copyright to this source code. In place of |
| @@ -7411,54 +7465,11 @@ | |
| 7411 | |
| 7412 | #endif /* ifndef _SQLITE3RTREE_H_ */ |
| 7413 | |
| 7414 | |
| 7415 | /************** End of sqlite3.h *********************************************/ |
| 7416 | /************** Begin file sqliteInt.h ***************************************/ |
| 7417 | /* |
| 7418 | ** 2001 September 15 |
| 7419 | ** |
| 7420 | ** The author disclaims copyright to this source code. In place of |
| 7421 | ** a legal notice, here is a blessing: |
| 7422 | ** |
| 7423 | ** May you do good and not evil. |
| 7424 | ** May you find forgiveness for yourself and forgive others. |
| 7425 | ** May you share freely, never taking more than you give. |
| 7426 | ** |
| 7427 | ************************************************************************* |
| 7428 | ** Internal interface definitions for SQLite. |
| 7429 | ** |
| 7430 | */ |
| 7431 | #ifndef _SQLITEINT_H_ |
| 7432 | #define _SQLITEINT_H_ |
| 7433 | |
| 7434 | /* |
| 7435 | ** These #defines should enable >2GB file support on POSIX if the |
| 7436 | ** underlying operating system supports it. If the OS lacks |
| 7437 | ** large file support, or if the OS is windows, these should be no-ops. |
| 7438 | ** |
| 7439 | ** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any |
| 7440 | ** system #includes. Hence, this block of code must be the very first |
| 7441 | ** code in all source files. |
| 7442 | ** |
| 7443 | ** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch |
| 7444 | ** on the compiler command line. This is necessary if you are compiling |
| 7445 | ** on a recent machine (ex: Red Hat 7.2) but you want your code to work |
| 7446 | ** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2 |
| 7447 | ** without this option, LFS is enable. But LFS does not exist in the kernel |
| 7448 | ** in Red Hat 6.0, so the code won't work. Hence, for maximum binary |
| 7449 | ** portability you should omit LFS. |
| 7450 | ** |
| 7451 | ** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later. |
| 7452 | */ |
| 7453 | #ifndef SQLITE_DISABLE_LFS |
| 7454 | # define _LARGE_FILE 1 |
| 7455 | # ifndef _FILE_OFFSET_BITS |
| 7456 | # define _FILE_OFFSET_BITS 64 |
| 7457 | # endif |
| 7458 | # define _LARGEFILE_SOURCE 1 |
| 7459 | #endif |
| 7460 | |
| 7461 | /* |
| 7462 | ** Include the configuration header output by 'configure' if we're using the |
| 7463 | ** autoconf-based build |
| 7464 | */ |
| @@ -23430,36 +23441,10 @@ | |
| 23430 | # else |
| 23431 | # define OS_VXWORKS 0 |
| 23432 | # endif |
| 23433 | #endif |
| 23434 | |
| 23435 | /* |
| 23436 | ** These #defines should enable >2GB file support on Posix if the |
| 23437 | ** underlying operating system supports it. If the OS lacks |
| 23438 | ** large file support, these should be no-ops. |
| 23439 | ** |
| 23440 | ** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch |
| 23441 | ** on the compiler command line. This is necessary if you are compiling |
| 23442 | ** on a recent machine (ex: RedHat 7.2) but you want your code to work |
| 23443 | ** on an older machine (ex: RedHat 6.0). If you compile on RedHat 7.2 |
| 23444 | ** without this option, LFS is enable. But LFS does not exist in the kernel |
| 23445 | ** in RedHat 6.0, so the code won't work. Hence, for maximum binary |
| 23446 | ** portability you should omit LFS. |
| 23447 | ** |
| 23448 | ** The previous paragraph was written in 2005. (This paragraph is written |
| 23449 | ** on 2008-11-28.) These days, all Linux kernels support large files, so |
| 23450 | ** you should probably leave LFS enabled. But some embedded platforms might |
| 23451 | ** lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful. |
| 23452 | */ |
| 23453 | #ifndef SQLITE_DISABLE_LFS |
| 23454 | # define _LARGE_FILE 1 |
| 23455 | # ifndef _FILE_OFFSET_BITS |
| 23456 | # define _FILE_OFFSET_BITS 64 |
| 23457 | # endif |
| 23458 | # define _LARGEFILE_SOURCE 1 |
| 23459 | #endif |
| 23460 | |
| 23461 | /* |
| 23462 | ** standard include files. |
| 23463 | */ |
| 23464 | #include <sys/types.h> |
| 23465 | #include <sys/stat.h> |
| 23466 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -23,10 +23,64 @@ | |
| 23 | # define SQLITE_PRIVATE static |
| 24 | #endif |
| 25 | #ifndef SQLITE_API |
| 26 | # define SQLITE_API |
| 27 | #endif |
| 28 | /************** Begin file sqliteInt.h ***************************************/ |
| 29 | /* |
| 30 | ** 2001 September 15 |
| 31 | ** |
| 32 | ** The author disclaims copyright to this source code. In place of |
| 33 | ** a legal notice, here is a blessing: |
| 34 | ** |
| 35 | ** May you do good and not evil. |
| 36 | ** May you find forgiveness for yourself and forgive others. |
| 37 | ** May you share freely, never taking more than you give. |
| 38 | ** |
| 39 | ************************************************************************* |
| 40 | ** Internal interface definitions for SQLite. |
| 41 | ** |
| 42 | */ |
| 43 | #ifndef _SQLITEINT_H_ |
| 44 | #define _SQLITEINT_H_ |
| 45 | |
| 46 | /* |
| 47 | ** These #defines should enable >2GB file support on POSIX if the |
| 48 | ** underlying operating system supports it. If the OS lacks |
| 49 | ** large file support, or if the OS is windows, these should be no-ops. |
| 50 | ** |
| 51 | ** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any |
| 52 | ** system #includes. Hence, this block of code must be the very first |
| 53 | ** code in all source files. |
| 54 | ** |
| 55 | ** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch |
| 56 | ** on the compiler command line. This is necessary if you are compiling |
| 57 | ** on a recent machine (ex: Red Hat 7.2) but you want your code to work |
| 58 | ** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2 |
| 59 | ** without this option, LFS is enable. But LFS does not exist in the kernel |
| 60 | ** in Red Hat 6.0, so the code won't work. Hence, for maximum binary |
| 61 | ** portability you should omit LFS. |
| 62 | ** |
| 63 | ** The previous paragraph was written in 2005. (This paragraph is written |
| 64 | ** on 2008-11-28.) These days, all Linux kernels support large files, so |
| 65 | ** you should probably leave LFS enabled. But some embedded platforms might |
| 66 | ** lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful. |
| 67 | ** |
| 68 | ** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later. |
| 69 | */ |
| 70 | #ifndef SQLITE_DISABLE_LFS |
| 71 | # define _LARGE_FILE 1 |
| 72 | # ifndef _FILE_OFFSET_BITS |
| 73 | # define _FILE_OFFSET_BITS 64 |
| 74 | # endif |
| 75 | # define _LARGEFILE_SOURCE 1 |
| 76 | #endif |
| 77 | |
| 78 | /* The public SQLite interface. The _FILE_OFFSET_BITS macro must appear |
| 79 | ** first in QNX. |
| 80 | */ |
| 81 | /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ |
| 82 | /************** Begin file sqlite3.h *****************************************/ |
| 83 | /* |
| 84 | ** 2001 September 15 |
| 85 | ** |
| 86 | ** The author disclaims copyright to this source code. In place of |
| @@ -7411,54 +7465,11 @@ | |
| 7465 | |
| 7466 | #endif /* ifndef _SQLITE3RTREE_H_ */ |
| 7467 | |
| 7468 | |
| 7469 | /************** End of sqlite3.h *********************************************/ |
| 7470 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| 7471 | |
| 7472 | /* |
| 7473 | ** Include the configuration header output by 'configure' if we're using the |
| 7474 | ** autoconf-based build |
| 7475 | */ |
| @@ -23430,36 +23441,10 @@ | |
| 23441 | # else |
| 23442 | # define OS_VXWORKS 0 |
| 23443 | # endif |
| 23444 | #endif |
| 23445 | |
| 23446 | /* |
| 23447 | ** standard include files. |
| 23448 | */ |
| 23449 | #include <sys/types.h> |
| 23450 | #include <sys/stat.h> |
| 23451 |