read of mingw: unknown error

来源:互联网 发布:淘宝虎头鞋子 编辑:程序博客网 时间:2024/05/15 23:47

C:\MinGW-4.7.1\include\fcntl.h

#define _O_BINARY0x8000 /* Input and output is not translated. */

http://www.ixpub.net/thread-1450177-1-1.html

d:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\dalvik\libdex\ZipArchive.c

int dexZipOpenArchive(const char* fileName, ZipArchive* pArchive)
{
...
//    fd = open(fileName, O_RDONLY, 0);
    fd = open(fileName, O_RDONLY|_O_BINARY, 0);
make mingw open the file in BINARY

0  0x65741847  __android_log_print  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/system/core/liblog/logd_write.c  209

1  0x0056a4e5  dexSwapAndVerify  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/libdex/DexSwapVerify.c  2805
2  0x0052ebe2  rewriteDex  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/analysis/DexPrepare.c  736
3  0x0052e72f  dvmContinueOptimization  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/analysis/DexPrepare.c  574
4  0x0040205f  fromDex  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/dexopt/OptMain.c  538
5  0x00402188  dexoptmain  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/dexopt/OptMain.c  597
6  0x00401330  main  d:/linux/linuxkernel/WORKING_DIRECTORY/ango/dexopt/main.c  8
D:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\dalvik\libdex\DexFile.h
/* DEX file magic number */
#define DEX_MAGIC       "dex\n"
d:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\dalvik\libdex\DexSwapVerify.c
             pHeader->magic[0], pHeader->magic[1],
             pHeader->magic[2], pHeader->magic[3]);
=0x64 65 78 0d


2013-02-18  20:10           702,117 system@framework@bouncycastle.jar@classes.dex
2013-02-18  20:10         4,305,857 system@framework@core.jar@classes.dex
the size of system@framework@bouncycastle.jar@classes.dex should be 693920, because it's open in text mode by default, so the 0x0a is changed to 0d0a 


d:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\dalvik\vm\analysis\DexPrepare.c
//    fd = createIfMissing ? open(cacheFileName, O_CREAT|O_RDWR, 0644) : -1;
    fd = createIfMissing ? open(cacheFileName, O_CREAT|O_RDWR|_O_BINARY, 0644) : -1;


d:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\dalvik\dexopt\OptMain.c
//    fd = open(cachedName, O_CREAT|O_RDWR, 0644);
    fd = open(cachedName, O_CREAT|O_RDWR|_O_BINARY, 0644);