Friday, 2013-09-13

*** tpb has joined #timvideos00:00
*** tpb has joined #timvideos01:07
*** CarlFK has joined #timvideos01:10
*** mithro has joined #timvideos01:32
SewarCarlFK, iiie, mithro: https://dpaste.de/x1haR/01:42
tpbTitle: dpaste.de: Snippet #240028 (at dpaste.de)01:42
Sewarignore 51 for now01:42
iiieSewar, how can I help?01:43
Sewariiie: memset set all new extended bytes in string to NUL so they can be written by strcat01:43
Sewaroutput is updated in parse_edid but in main() it still the same 001:44
iiieit can be written by strcat01:44
iiieeven without being set to NULL01:44
iiiehm01:44
CarlFKMeeting Sep 12 EdX / Rackspace Autoscaling / What's Love Got to do with It? | LIVE: http://www.timvideos.us/chipy01:45
tpbTitle: Streaming for ChiPy - Chicago Python User Group (at www.timvideos.us)01:45
iiieah01:45
CarlFKwoo01:45
Sewarremoving memset breaks things, maybe another line affects it01:46
iiieline 50, you're reassigning output I think01:46
iiiewhat breaks skipping the memset?01:46
iiiestrcat?01:46
iiieeven though the memset only runs on the destination buffer?01:47
iiiehm01:47
iiiealright, we're going to try something odd01:47
Sewarline 50, yeah, extending its size01:47
iiieright, but after that the address of output is different01:48
Sewaryeah01:49
iiie*output = realloc....01:51
iiiethat probably won't work either....01:52
Sewaraccess violation, because output points to 001:52
iiiehm01:53
iiiewhat do we want output to be? we want it to be a pointer01:53
Sewaryeah01:54
iiieso I think we want to change the function signature01:54
Sewarlet me simplify the code without win stuff01:54
Sewariiie, https://dpaste.de/eLnwh/02:06
tpbTitle: dpaste.de: Snippet #240029 (at dpaste.de)02:06
SewarTo be clear, what I want to achieve, a char * variable in main(), which I can pass to parse_edid() multiple times so it gets extended, https://dpaste.de/x1haR/#L12902:25
tpbTitle: dpaste.de: Snippet #240028 (at dpaste.de)02:25
iiiehm02:26
* iiie is doing too many things at once02:27
iiieI think we want to pass the address of output to test / parser02:28
iiiewe want the address of the pointer not the pointer itself, because we assign a value to it with realloc02:29
Sewariiie: how to do that?02:34
iiie&variable is the address of the variable02:35
iiiewhat does that make the signature though, hm02:36
iiiejust a minute none windows so I should be able to run it...02:38
Sewarhttps://dpaste.de/eLnwh/ can be compiled and run in linux, I guess02:43
tpbTitle: dpaste.de: Snippet #240029 (at dpaste.de)02:43
CarlFKim off02:50
*** CarlFK has quit IRC02:50
iiieyeah, so c doesn't support passing by reference, so I think we have to be a little trickier02:56
iiiec++ on the other hand02:57
Sewarwell, the requirement is c right?03:02
iiiehttps://dpaste.de/dwI2F/#L the requirement is binary that works03:03
tpbTitle: dpaste.de: Snippet #240036 (at dpaste.de)03:03
iiiehttps://dpaste.de/zcmt1/#L03:04
tpbTitle: dpaste.de: Snippet #240038 (at dpaste.de)03:04
iiiethis was the result, see how the addresses don't match for outer and inner; that's why we need pass by reference, or to pass the value of the address and cast to what we want.03:05
Sewarmmm03:09
Sewarhttp://stackoverflow.com/a/2229510/195700203:09
tpbTitle: pointers - Passing by reference in C - Stack Overflow (at stackoverflow.com)03:09
iiiethat sounds like it should work then03:11
iiiehm03:11
SewarI think there's an incorrect mix of output, &output and *output in the code03:13
iiiecertainly03:13
Sewarhttp://ideone.com/GU36fH line 15 breaks03:24
tpbTitle: Ideone.com - GU36fH - Online C Compiler & Debugging Tool (at ideone.com)03:24
*** mithro has quit IRC03:25
iiieNow there's a cool tool03:31
Sewarthere's codepad.org too03:36
*** CarlFK has joined #timvideos03:41
*** iiie has quit IRC04:19
*** hyades has joined #timvideos05:17
hyadesSewar: you will need something like05:43
hyadesint test(char **output, int *output_len)05:43
hyadeshttp://ideone.com/MoRbnr05:45
tpbTitle: Ideone.com - MoRbnr - Online C Compiler & Debugging Tool (at ideone.com)05:45
Sewarwaw, thanks hyades06:41
hyadesSewar: btw, I dont think realloc and memset are good things06:46
hyadesthey sometimes dont work as expected06:46
Sewarwhat can I use instead then?06:47
hyadesfree + malloc06:59
hyadesand for loop :D06:59
hyadesonly malloc will do I guess07:01
*** CarlFK has quit IRC07:21
*** hyades has quit IRC11:53
*** CarlFK has joined #timvideos12:13
*** skay has quit IRC12:56
*** hyades has joined #timvideos13:05
*** hyades has quit IRC13:25
*** CarlFK has quit IRC13:27
*** hyades has joined #timvideos13:31
*** hyades has quit IRC13:38
*** hyades has joined #timvideos14:26
*** hyades_ has joined #timvideos14:44
*** hyades_ has quit IRC15:23
*** hyades has quit IRC15:23
*** hyades has joined #timvideos16:14
*** hyades has quit IRC17:31
*** hyades has joined #timvideos19:33
*** hyades_ has joined #timvideos20:03
*** hyades has quit IRC21:07
*** hyades_ has quit IRC21:08
*** hyades has joined #timvideos21:31
*** hyades has quit IRC22:35
*** hyades has joined #timvideos22:53

Generated by irclog2html.py 2.12.1 by Marius Gedminas - find it at mg.pov.lt!