9front - general discussion about 9front
 help / color / mirror / Atom feed
* 64 bit botches in games/music
@ 2017-02-15  5:58 Nick Owens
  2017-02-15  7:44 ` [9front] " cinap_lenrek
  2017-02-15  7:53 ` cinap_lenrek
  0 siblings, 2 replies; 3+ messages in thread
From: Nick Owens @ 2017-02-15  5:58 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 128 bytes --]

attached is a proposed patch to fix pointer reallocs in jukefs, and to
fix chan size in playlistfs.

if it's ok i'll commit it.

[-- Attachment #2: music.diff --]
[-- Type: text/plain, Size: 2175 bytes --]

diff -r 12e494045696 sys/src/games/music/jukefs/parse.c
--- a/sys/src/games/music/jukefs/parse.c	Mon Feb 13 22:28:35 2017 +0100
+++ b/sys/src/games/music/jukefs/parse.c	Wed Feb 15 05:53:36 2017 -0800
@@ -275,7 +275,7 @@
 				catsetinit(&ot->categories, catnr++);
 				/* And make an entry in the catobjects table */
 				if(ncat <= ntoken){
-					catobjects = realloc(catobjects, (ntoken+1)*sizeof(Object*));
+					catobjects = realloc(catobjects, (ntoken+1)*sizeof(Object**));
 					while(ncat <= ntoken) catobjects[ncat++] = nil;
 				}
 				if(catobjects[ntoken] != nil)
@@ -436,7 +436,7 @@
 		 */
 		for(i = 0; i < parent->nchildren; i++)
 				if(parent->children[i] == child) return;
-		parent->children = realloc(parent->children, (i+1)*4);
+		parent->children = realloc(parent->children, (i+1)*sizeof(Object**));
 		parent->children[i] = child;
 		parent->nchildren++;
 		if(parent->type == Category && child->type == Category)
@@ -457,7 +457,7 @@
 		i = child->ncatparents;
 		if(0) fprint(2, "addcatparent %s parent %d type %d child %d type %d\n",where,
 			parent->tabno, parent->type, child->tabno, child->type);
-		child->catparents = realloc(child->catparents, (i+1)*4);
+		child->catparents = realloc(child->catparents, (i+1)*sizeof(Object**));
 		child->catparents[i] = parent;
 		child->ncatparents++;
 }
@@ -476,7 +476,7 @@
 //				if(child->catparents[i] == parent) return;
 		i = child->ncatparents;
 		fprint(2, "addcatparent parent %d child %d\n", parent->tabno, child->tabno);
-		child->catparents = realloc(child->catparents, (i+1)*4);
+		child->catparents = realloc(child->catparents, (i+1)*sizeof(Object**));
 		child->catparents[i] = parent;
 		child->ncatparents++;
 }
diff -r 12e494045696 sys/src/games/music/playlistfs/player.c
--- a/sys/src/games/music/playlistfs/player.c	Mon Feb 13 22:28:35 2017 +0100
+++ b/sys/src/games/music/playlistfs/player.c	Wed Feb 15 05:53:36 2017 -0800
@@ -356,7 +356,7 @@
 	for(i = 0; i < NSparebuf; i++)
 		sendp(spare, malloc(sizeof(Pacbuf)));
 
-	playc = chancreate(sizeof(Pmsg), 1);
+	playc = chancreate(sizeof(ulong), 1);
 	procrfork(decproc, nil, 32*1024, RFFDG);
 	procrfork(pcmproc, nil, 32*1024, RFFDG);
 }


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] 64 bit botches in games/music
  2017-02-15  5:58 64 bit botches in games/music Nick Owens
@ 2017-02-15  7:44 ` cinap_lenrek
  2017-02-15  7:53 ` cinap_lenrek
  1 sibling, 0 replies; 3+ messages in thread
From: cinap_lenrek @ 2017-02-15  7:44 UTC (permalink / raw)
  To: 9front

this is wrong:

-					catobjects = realloc(catobjects, (ntoken+1)*sizeof(Object*));
+					catobjects = realloc(catobjects, (ntoken+1)*sizeof(Object**));

extern	Object	**catobjects;

^- this reads as "ARRAY OF POINTERS", so you want to use n * sizeof(Object*).

--
cinap


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] 64 bit botches in games/music
  2017-02-15  5:58 64 bit botches in games/music Nick Owens
  2017-02-15  7:44 ` [9front] " cinap_lenrek
@ 2017-02-15  7:53 ` cinap_lenrek
  1 sibling, 0 replies; 3+ messages in thread
From: cinap_lenrek @ 2017-02-15  7:53 UTC (permalink / raw)
  To: 9front

pushed.

--
cinap


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-15  7:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15  5:58 64 bit botches in games/music Nick Owens
2017-02-15  7:44 ` [9front] " cinap_lenrek
2017-02-15  7:53 ` cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).