tkHTML

Check-in [9b7506b7f0]
Login

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

Overview
Comment:html gunzip data (html gzip data XXX) now works. (CVS 190)
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9b7506b7f00df5e3d506e855dc5015ec2ec5cf63
User & Date: hkoba 2003-03-19 17:06:29
Context
2005-03-11
14:03
Update to webpage. (CVS 191) check-in: 6d440b729f user: danielk1977 tags: trunk
2003-03-19
17:06
html gunzip data (html gzip data XXX) now works. (CVS 190) check-in: 9b7506b7f0 user: hkoba tags: trunk
17:05
``Automatic space compensation of sentence ending'' is now optional. You can turn it on by configure option: -sentencepadding yes (CVS 189) check-in: fd0ca022a1 user: hkoba tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/htmltcl.c.

1
2
3
4
5
6
7
8
static char const rcsid[] = "@(#) $Id: htmltcl.c,v 1.6 2002/12/17 18:24:16 drh Exp $";
/*
** The main routine for the HTML widget for Tcl/Tk
**
** This source code is released into the public domain by the author,
** D. Richard Hipp, on 2002 December 17.  Instead of a license, here
** is a blessing:
**
|







1
2
3
4
5
6
7
8
static char const rcsid[] = "@(#) $Id: htmltcl.c,v 1.7 2003/03/19 17:06:29 hkoba Exp $";
/*
** The main routine for the HTML widget for Tcl/Tk
**
** This source code is released into the public domain by the author,
** D. Richard Hipp, on 2002 December 17.  Instead of a license, here
** is a blessing:
**
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
  Tcl_SetObjResult(interp, result);
  return TCL_OK;
}

#include <zlib.h>

static int
check_header(char *s, int len) {
  int i, method, flags, n;
  if (len<12) return -1;
  if (s[0] != 0x1f || s[1] != 0x8b) return -1;
  method=s[2];
  if (method != 8) return -1;
  flags=s[3];
  i=10;







|







613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
  Tcl_SetObjResult(interp, result);
  return TCL_OK;
}

#include <zlib.h>

static int
check_header(unsigned char *s, int len) {
  int i, method, flags, n;
  if (len<12) return -1;
  if (s[0] != 0x1f || s[1] != 0x8b) return -1;
  method=s[2];
  if (method != 8) return -1;
  flags=s[3];
  i=10;
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
	}
      }
    } else if (!strcmp(from,"data")) {
      z_stream zf;
      int hlen;
      uncompr=(char*)malloc(ulen);
      from = Tcl_GetByteArrayFromObj (objv[3], &fnlen);
      hlen= check_header(from, fnlen);
      if (hlen<0 || hlen>fnlen) goto gunziperror;
      fnlen-=hlen; from+=hlen;
      zf.next_in=from;
      zf.avail_in=fnlen; zf.zalloc=Z_NULL; zf.zfree=Z_NULL; zf.opaque=Z_NULL;
      if (Z_OK != inflateInit2(&zf,-MAX_WBITS)) goto gunziperror;
      fn=uncompr;
      for (;;) {







|







669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
	}
      }
    } else if (!strcmp(from,"data")) {
      z_stream zf;
      int hlen;
      uncompr=(char*)malloc(ulen);
      from = Tcl_GetByteArrayFromObj (objv[3], &fnlen);
      hlen= check_header((unsigned char*)from, fnlen);
      if (hlen<0 || hlen>fnlen) goto gunziperror;
      fnlen-=hlen; from+=hlen;
      zf.next_in=from;
      zf.avail_in=fnlen; zf.zalloc=Z_NULL; zf.zfree=Z_NULL; zf.opaque=Z_NULL;
      if (Z_OK != inflateInit2(&zf,-MAX_WBITS)) goto gunziperror;
      fn=uncompr;
      for (;;) {

Added tests/html5.test.



























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/wish
if {[info commands html] == ""} {
    if {[file exists libTkhtml2.0.so]} {
	load ./libTkhtml2.0.so
    } else {
	package require Tkhtml
    }
}
package require tcltest

tcltest::test html-5.1 {gzip -> gunzip roundtrip} {
    html gunzip data [html gzip data abc]
} {abc}