Fossil

Check-in [f2fc37c063]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix "Corrupt line endings in cat/finfo on Windows with CR+LF files", reported on ML.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f2fc37c063af9fae4fac87d754ba7448ddc7ef8c
User & Date: jan.nijtmans 2014-11-26 10:13:24.085
References
2016-11-05
04:30
Fix extra empty lines in diff output from non-interactive process on Windows; similar to [f2fc37c0]. check-in: 476fe9e932 user: ashepilko tags: trunk
Context
2014-11-26
14:53
Fix related to previous one: prevent to convert from UTF-8 to Unicode before writing to the (non-redirected) windows console. Strange effects could happen. check-in: 156ef9ec06 user: jan.nijtmans tags: trunk
10:13
Fix "Corrupt line endings in cat/finfo on Windows with CR+LF files", reported on ML. check-in: f2fc37c063 user: jan.nijtmans tags: trunk
2014-11-19
13:19
Update the built-in SQLite to the latest 3.8.8 alpha. check-in: fd1a292199 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/blob.c.
22
23
24
25
26
27
28




29
30
31
32
33
34
35
#if defined(FOSSIL_ENABLE_MINIZ)
#  define MINIZ_HEADER_FILE_ONLY
#  include "miniz.c"
#else
#  include <zlib.h>
#endif
#include "blob.h"





#if INTERFACE
/*
** A Blob can hold a string or a binary object of arbitrary size.  The
** size changes as necessary.
*/
struct Blob {







>
>
>
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#if defined(FOSSIL_ENABLE_MINIZ)
#  define MINIZ_HEADER_FILE_ONLY
#  include "miniz.c"
#else
#  include <zlib.h>
#endif
#include "blob.h"
#if defined(_WIN32)
#include <fcntl.h>
#include <io.h>
#endif

#if INTERFACE
/*
** A Blob can hold a string or a binary object of arbitrary size.  The
** size changes as necessary.
*/
struct Blob {
821
822
823
824
825
826
827


828
829




830
831
832
833
834
835
836

  if( zFilename[0]==0 || (zFilename[0]=='-' && zFilename[1]==0) ){
    nWrote = blob_size(pBlob);
#if defined(_WIN32)
    if( fossil_utf8_to_console(blob_buffer(pBlob), nWrote, 0) >= 0 ){
      return nWrote;
    }


#endif
    fwrite(blob_buffer(pBlob), 1, nWrote, stdout);




  }else{
    file_mkfolder(zFilename, 1);
    out = fossil_fopen(zFilename, "wb");
    if( out==0 ){
      fossil_fatal_recursive("unable to open file \"%s\" for writing",
                             zFilename);
      return 0;







>
>


>
>
>
>







825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846

  if( zFilename[0]==0 || (zFilename[0]=='-' && zFilename[1]==0) ){
    nWrote = blob_size(pBlob);
#if defined(_WIN32)
    if( fossil_utf8_to_console(blob_buffer(pBlob), nWrote, 0) >= 0 ){
      return nWrote;
    }
    fflush(stdout);
    _setmode(_fileno(stdout), _O_BINARY);
#endif
    fwrite(blob_buffer(pBlob), 1, nWrote, stdout);
#if defined(_WIN32)
    fflush(stdout);
    _setmode(_fileno(stdout), _O_TEXT);
#endif
  }else{
    file_mkfolder(zFilename, 1);
    out = fossil_fopen(zFilename, "wb");
    if( out==0 ){
      fossil_fatal_recursive("unable to open file \"%s\" for writing",
                             zFilename);
      return 0;