Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2005/1119/5

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


64-bit fixes.
 [jmk] --rw-rw-r-- M 107020 glenda sys 23687 Nov 19 20:17 sys/src/cmd/webcookies.c
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:25,67 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:25,67
	  	char*	dom;		/* starts with . */
	  	char*	path;
	  	char*	version;
	- 	char*	comment;		/* optional, may be nil */
	+ 	char*	comment;	/* optional, may be nil */
	  
	- 	uint		expire;		/* time of expiration: ~0 means when webcookies dies */
	- 	int		secure;
	- 	int		explicitdom;	/* dom was explicitly set */
	- 	int		explicitpath;	/* path was explicitly set */
	- 	int		netscapestyle;
	+ 	uint	expire;		/* time of expiration: ~0 means when webcookies dies */
	+ 	int	secure;
	+ 	int	explicitdom;	/* dom was explicitly set */
	+ 	int	explicitpath;	/* path was explicitly set */
	+ 	int	netscapestyle;
	  
	  	/* internal info */
	- 	int		deleted;
	- 	int		mark;
	- 	int		ondisk;
	+ 	int	deleted;
	+ 	int	mark;
	+ 	int	ondisk;
	  };
	  
	  struct Jar
	  {
	  	Cookie	*c;
	- 	int		nc;
	- 	int		mc;
	+ 	int	nc;
	+ 	int	mc;
	  
	- 	Qid		qid;
	- 	int		dirty;
	- 	char		*file;
	- 	char		*lockfile;
	+ 	Qid	qid;
	+ 	int	dirty;
	+ 	char	*file;
	+ 	char	*lockfile;
	  };
	  
	  struct {
	- 	char *s;
	+ 	char	*s;
	  	int	offset;
	  	int	ishttp;
	  } stab[] = {
	  	"domain",		offsetof(Cookie, dom),		1,
	- 	"path",		offsetof(Cookie, path),		1,
	- 	"name",		offsetof(Cookie, name),		0,
	- 	"value",		offsetof(Cookie, value),		0,
	- 	"comment",	offsetof(Cookie, comment),	1,
	- 	"version",		offsetof(Cookie, version),		1,
	+ 	"path",			offsetof(Cookie, path),		1,
	+ 	"name",			offsetof(Cookie, name),		0,
	+ 	"value",		offsetof(Cookie, value),	0,
	+ 	"comment",		offsetof(Cookie, comment),	1,
	+ 	"version",		offsetof(Cookie, version),	1,
	  };
	  
	  struct {
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:68,75 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:68,75
	  	char *s;
	  	int	offset;
	  } itab[] = {
	- 	"expire",			offsetof(Cookie, expire),
	- 	"secure",			offsetof(Cookie, secure),
	+ 	"expire",		offsetof(Cookie, expire),
	+ 	"secure",		offsetof(Cookie, secure),
	  	"explicitdomain",	offsetof(Cookie, explicitdom),
	  	"explicitpath",		offsetof(Cookie, explicitpath),
	  	"netscapestyle",	offsetof(Cookie, netscapestyle),
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:110,116 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:110,116
	  
	  	first = 1;
	  	for(j=0; j<nelem(stab); j++){
	- 		t = *(char**)((ulong)c+stab[j].offset);
	+ 		t = *(char**)((char*)c+stab[j].offset);
	  		if(t == nil)
	  			continue;
	  		if(first)
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:120,126 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:120,126
	  		fmtprint(fmt, "%s=%q", stab[j].s, t);
	  	}
	  	for(j=0; j<nelem(itab); j++){
	- 		k = *(int*)((ulong)c+itab[j].offset);
	+ 		k = *(int*)((char*)c+itab[j].offset);
	  		if(k == 0)
	  			continue;
	  		if(first)
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:199,205 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:199,205
	  	int i;
	  
	  	for(i=0; i<nelem(stab); i++)
	- 		free(*(char**)((ulong)c+stab[i].offset));
	+ 		free(*(char**)((char*)c+stab[i].offset));
	  }
	  
	  void
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:209,215 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:209,215
	  	char **ps;
	  
	  	for(i=0; i<nelem(stab); i++){
	- 		ps = (char**)((ulong)c+stab[i].offset);
	+ 		ps = (char**)((char*)c+stab[i].offset);
	  		if(*ps)
	  			*ps = estrdup9p(*ps);
	  	}
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:297,303 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:297,303
	  		/* string attributes */
	  		for(j=0; j<nelem(stab); j++){
	  			if(strcmp(stab[j].s, attr) == 0){
	- 				pstr = (char**)((ulong)&c+stab[j].offset);
	+ 				pstr = (char**)((char*)&c+stab[j].offset);
	  				*pstr = val;
	  			}
	  		}
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:304,310 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:304,310
	  		/* integer attributes */
	  		for(j=0; j<nelem(itab); j++){
	  			if(strcmp(itab[j].s, attr) == 0){
	- 				pint = (int*)((ulong)&c+itab[j].offset);
	+ 				pint = (int*)((char*)&c+itab[j].offset);
	  				if(val[0]=='\0')
	  					*pint = 1;
	  				else
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:933,939 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:933,939
	  		}
	  		for(i=0; i<nelem(stab); i++)
	  			if(stab[i].ishttp && cistrcmp(stab[i].s, attr)==0)
	- 				*(char**)((ulong)c+stab[i].offset) = val;
	+ 				*(char**)((char*)c+stab[i].offset) = val;
	  		if(cistrcmp(attr, "expires") == 0){
	  			if(!isns)
	  				return "non-netscape cookie has Expires tag";
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:1003,1009 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:1003,1009
	  	int i, sz;
	  	Aux *a;
	  
	- 	switch((int)r->fid->file->aux){
	+ 	switch((uintptr)r->fid->file->aux){
	  	case Xhttp:
	  		syncjar(jar);
	  		a = emalloc9p(sizeof(Aux));
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:1039,1045 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:1039,1045
	  	Aux *a;
	  
	  	a = r->fid->aux;
	- 	switch((int)r->fid->file->aux){
	+ 	switch((uintptr)r->fid->file->aux){
	  	case Xhttp:
	  		if(a->state == NeedUrl){
	  			respond(r, "must write url before read");
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:1071,1077 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:1071,1077
	  	Jar *j;
	  
	  	a = r->fid->aux;
	- 	switch((int)r->fid->file->aux){
	+ 	switch((uintptr)r->fid->file->aux){
	  	case Xhttp:
	  		if(a->state == NeedUrl){
	  			if(r->ifcall.count >= sizeof buf){
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:1157,1163 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:1157,1163
	  	a = fid->aux;
	  	if(a == nil)
	  		return;
	- 	switch((int)fid->file->aux){
	+ 	switch((uintptr)fid->file->aux){
	  	case Xhttp:
	  		parsehttp(jar, a->inhttp, a->dom, a->path);
	  		break;


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.