Skip to content

Commit

Permalink
fix bug in shuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
hfxunlp committed Nov 22, 2017
1 parent fe124ef commit ef7a57e
Show file tree
Hide file tree
Showing 38 changed files with 10 additions and 57 deletions.
4 changes: 2 additions & 2 deletions devc/x64/shuffle/shuffle.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ int shuffle_by_chunks() {
if (verbose > 0) fprintf(stderr, "array size: %lld\n", array_size);
sprintf(filename, "%s_%04d.bin", file_head, fidcounter);
fid = fopen(filename, "w");
_setmode(_fileno(fid), _O_BINARY);
if (fid == NULL) {
fprintf(stderr, "Unable to open file %s.\n", filename);
return 1;
}
_setmode(_fileno(fid), _O_BINARY);
if (verbose > 1) fprintf(stderr, "Shuffling by chunks: processed 0 lines.");

while (1) { //Continue until EOF
Expand All @@ -165,6 +165,7 @@ int shuffle_by_chunks() {
fprintf(stderr, "Unable to open file %s.\n", filename);
return 1;
}
_setmode(_fileno(fid), _O_BINARY);
i = 0;
}
fread(&array[i], sizeof(CREC), 1, fin);
Expand Down Expand Up @@ -225,4 +226,3 @@ int main(int argc, char **argv) {
if ((i = find_arg((char *)"-array-size", argc, argv)) > 0) array_size = atoll(argv[i + 1]);
return shuffle_by_chunks();
}

3 changes: 2 additions & 1 deletion devc/x86/shuffle/shuffle.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ int shuffle_by_chunks() {
if (verbose > 0) fprintf(stderr, "array size: %lld\n", array_size);
sprintf(filename, "%s_%04d.bin", file_head, fidcounter);
fid = fopen(filename, "w");
_setmode(_fileno(fid), _O_BINARY);
if (fid == NULL) {
fprintf(stderr, "Unable to open file %s.\n", filename);
return 1;
}
_setmode(_fileno(fid), _O_BINARY);
if (verbose > 1) fprintf(stderr, "Shuffling by chunks: processed 0 lines.");

while (1) { //Continue until EOF
Expand All @@ -165,6 +165,7 @@ int shuffle_by_chunks() {
fprintf(stderr, "Unable to open file %s.\n", filename);
return 1;
}
_setmode(_fileno(fid), _O_BINARY);
i = 0;
}
fread(&array[i], sizeof(CREC), 1, fin);
Expand Down
Binary file modified release/devc/glove-win_devc_x64.zip
Binary file not shown.
Binary file modified release/devc/glove-win_devc_x86.zip
Binary file not shown.
Binary file modified release/vs/glove-win_vs_x64.zip
Binary file not shown.
Binary file modified release/vs/glove-win_vs_x86.zip
Binary file not shown.
Binary file modified vs/x64/shuffle/.vs/shuffle/v15/.suo
Binary file not shown.
Binary file modified vs/x64/shuffle/.vs/shuffle/v15/Browse.VC.db
Binary file not shown.
3 changes: 2 additions & 1 deletion vs/x64/shuffle/shuffle/shuffle.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ int shuffle_by_chunks() {
if (verbose > 0) fprintf(stderr, "array size: %lld\n", array_size);
sprintf(filename, "%s_%04d.bin", file_head, fidcounter);
fid = fopen(filename, "w");
_setmode(_fileno(fid), _O_BINARY);
if (fid == NULL) {
fprintf(stderr, "Unable to open file %s.\n", filename);
return 1;
}
_setmode(_fileno(fid), _O_BINARY);
if (verbose > 1) fprintf(stderr, "Shuffling by chunks: processed 0 lines.");

while (1) { //Continue until EOF
Expand All @@ -165,6 +165,7 @@ int shuffle_by_chunks() {
fprintf(stderr, "Unable to open file %s.\n", filename);
return 1;
}
_setmode(_fileno(fid), _O_BINARY);
i = 0;
}
fread(&array[i], sizeof(CREC), 1, fin);
Expand Down
23 changes: 1 addition & 22 deletions vs/x64/shuffle/shuffle/x64/Release/shuffle.log
Original file line number Diff line number Diff line change
@@ -1,22 +1 @@
 shuffle.c
shuffle.c(95): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(1772): note: 参见“sprintf”的声明
shuffle.c(96): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(207): note: 参见“fopen”的声明
shuffle.c(125): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(1772): note: 参见“sprintf”的声明
shuffle.c(145): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(1772): note: 参见“sprintf”的声明
shuffle.c(146): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(207): note: 参见“fopen”的声明
shuffle.c(162): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(1772): note: 参见“sprintf”的声明
shuffle.c(163): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(207): note: 参见“fopen”的声明
shuffle.c(221): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
shuffle.c(222): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
正在生成代码
All 15 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
已完成代码的生成
shuffle.vcxproj -> E:\ano\Workspace\glove-win\vs\x64\shuffle\x64\Release\shuffle.exe
shuffle.vcxproj -> E:\ano\Workspace\glove-win\vs\x64\shuffle\x64\Release\shuffle.pdb (Full PDB)

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file removed vs/x64/shuffle/shuffle/x64/Release/vc141.pdb
Binary file not shown.
Binary file removed vs/x64/shuffle/x64/Release/shuffle.iobj
Binary file not shown.
Binary file removed vs/x64/shuffle/x64/Release/shuffle.ipdb
Binary file not shown.
Binary file removed vs/x64/shuffle/x64/Release/shuffle.pdb
Binary file not shown.
Binary file modified vs/x86/shuffle/.vs/shuffle/v15/.suo
Binary file not shown.
Binary file modified vs/x86/shuffle/.vs/shuffle/v15/Browse.VC.db
Binary file not shown.
Binary file removed vs/x86/shuffle/Release/shuffle.iobj
Binary file not shown.
Binary file removed vs/x86/shuffle/Release/shuffle.ipdb
Binary file not shown.
Binary file removed vs/x86/shuffle/Release/shuffle.pdb
Binary file not shown.
27 changes: 1 addition & 26 deletions vs/x86/shuffle/shuffle/Release/shuffle.log
Original file line number Diff line number Diff line change
@@ -1,26 +1 @@
 shuffle.c
shuffle.c(92): warning C4244: “函数”: 从“__int64”转换到“::size_t”,可能丢失数据
shuffle.c(95): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(1772): note: 参见“sprintf”的声明
shuffle.c(96): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(207): note: 参见“fopen”的声明
shuffle.c(125): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(1772): note: 参见“sprintf”的声明
shuffle.c(141): warning C4244: “函数”: 从“__int64”转换到“::size_t”,可能丢失数据
shuffle.c(145): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(1772): note: 参见“sprintf”的声明
shuffle.c(146): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(207): note: 参见“fopen”的声明
shuffle.c(162): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(1772): note: 参见“sprintf”的声明
shuffle.c(163): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\stdio.h(207): note: 参见“fopen”的声明
shuffle.c(221): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
shuffle.c(222): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
正在生成代码
15 of 15 functions (100.0%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation
0 functions had inline decision re-evaluated but remain unchanged
已完成代码的生成
shuffle.vcxproj -> E:\ano\Workspace\glove-win\vs\x86\shuffle\Release\shuffle.exe
shuffle.vcxproj -> E:\ano\Workspace\glove-win\vs\x86\shuffle\Release\shuffle.pdb (Full PDB)

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file removed vs/x86/shuffle/shuffle/Release/vc141.pdb
Binary file not shown.
3 changes: 2 additions & 1 deletion vs/x86/shuffle/shuffle/shuffle.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ int shuffle_by_chunks() {
if (verbose > 0) fprintf(stderr, "array size: %lld\n", array_size);
sprintf(filename, "%s_%04d.bin", file_head, fidcounter);
fid = fopen(filename, "w");
_setmode(_fileno(fid), _O_BINARY);
if (fid == NULL) {
fprintf(stderr, "Unable to open file %s.\n", filename);
return 1;
}
_setmode(_fileno(fid), _O_BINARY);
if (verbose > 1) fprintf(stderr, "Shuffling by chunks: processed 0 lines.");

while (1) { //Continue until EOF
Expand All @@ -165,6 +165,7 @@ int shuffle_by_chunks() {
fprintf(stderr, "Unable to open file %s.\n", filename);
return 1;
}
_setmode(_fileno(fid), _O_BINARY);
i = 0;
}
fread(&array[i], sizeof(CREC), 1, fin);
Expand Down

0 comments on commit ef7a57e

Please sign in to comment.