Team I typedef Foo - Irc log - Feb 21 - oop344 20111

From CDOT Wiki
Jump to: navigation, search

Session Start: Mon Feb 21 20:50:52 2011
Session Ident: #typedef_Foo
�03[20:50] * Now talking in #typedef_Foo
�03[20:50] * sendak.freenode.net sets mode: +ns
�03[20:50] * services. sets mode: -o wliang
�05[20:50] -sendak.freenode.net:#typedef_Foo- *** Notice -- TS for #typedef_Foo changed from 1298339452 to 1296428255
�03[20:50] * services. sets mode: +ct-s
�03[20:50] * ChanServ (ChanServ@services.) has joined #typedef_Foo
�03[20:50] * services. sets mode: +o ChanServ
�14[20:50] * @ChanServ (ChanServ@services.) has left #typedef_Foo
�03[21:30] * Yellow-Box_Mk2 (~chatzilla@142.204.87.77) has joined #typedef_Foo
[21:30] <Yellow-Box_Mk2> yo
[21:31] <Yellow-Box_Mk2> what warning do you think need to be removed\
[21:31] <Yellow-Box_Mk2> i coded my own strCpy
[21:31] <Yellow-Box_Mk2> but vc also gives a sprintf warning on one of our lines
�14[21:37] <wliang> hi
�14[21:37] <wliang> sprintf is from fardad right?
[21:38] <Yellow-Box_Mk2> all but one
[21:38] <Yellow-Box_Mk2> line 16
[21:38] <Yellow-Box_Mk2> biotest
[21:38] <Yellow-Box_Mk2> although
[21:38] <Yellow-Box_Mk2> I don't think it's used
[21:38] <Yellow-Box_Mk2> it's that Int2Str
�14[21:39] <wliang> not being used
�14[21:39] <wliang> comment it out
[21:39] <Yellow-Box_Mk2> k
�14[21:39] <wliang> i actually just finished the strcpy too, lol
[21:40] <Yellow-Box_Mk2> lol
�14[21:40] <wliang> czo i dunno if anyone is coming online
�14[21:40] <wliang> i tried it last nite, only warning bc have left is fardad's code
[21:41] <Yellow-Box_Mk2> no warnings on lnx
�14[21:41] <wliang> vs and gcc is strcpy
[21:42] <Yellow-Box_Mk2> so are we going to use your strCpy or mine?
�14[21:43] <wliang> u done urs?
[21:44] <Yellow-Box_Mk2> yes
�14[21:44] <wliang> tested i believe?
[21:45] <Yellow-Box_Mk2> i tested it...but I'll put the code in trunk amd wait for people to check it before putting it in tags
�14[21:46] <wliang> ur code has no more warning on all 3 platforms right?
[21:47] <Yellow-Box_Mk2> just warnings from fardads code
�14[21:47] <wliang> alrite we'll use ur code then
�14[21:49] <wliang> i'll be gone for now, be back around 11. later i'll put our irc log on team page
[21:51] <Yellow-Box_Mk2> k
[21:51] <Yellow-Box_Mk2> I'll upload code to tag at 11:30 unless anyone finds somthing wrong
�03[22:07] * Herman_Log (~User@CPE0026f39a4268-CM0026f39a4265.cpe.net.cable.rogers.com) has joined #typedef_Foo
[22:07] <Herman_Log> how goes the function
[22:09] <Yellow-Box_Mk2> working on it
�14[22:53] <wliang> hey i'm back
�14[22:55] <wliang> how's everything
[23:11] <Herman_Log> how close are we till done
�14[23:12] <wliang> we're basically done
�14[23:12] <wliang> all warnings r gone
�14[23:12] <wliang> except fardad's code
[23:13] <Herman_Log> cool
�14[23:14] <wliang> i think sean is doing some clean up
[23:14] <Herman_Log> ahh i c
�14[23:31] <wliang> sean u there?
[23:38] <Yellow-Box_Mk2> am now
�14[23:38] <wliang> hi
�14[23:38] <wliang> i see u updated the trunk
[23:38] <Yellow-Box_Mk2> yah
�14[23:40] <wliang> i suppose we're all set
[23:41] <Yellow-Box_Mk2> well I'm trying to make strCpy do mem check so no leak...
[23:42] <Yellow-Box_Mk2> but it's notworking out...not enough sleep to code
�14[23:42] <wliang> lol
�14[23:43] <wliang> where is the latest code?
[23:44] <Yellow-Box_Mk2> its in trunk...my strCpy is in sa seperate program so i can test it easier
[23:44] <Yellow-Box_Mk2> but there is strCpy in trunk
[23:44] <Yellow-Box_Mk2> just not themem safe version
�14[23:45] <wliang> i suggest fix that later on, tag this version first
[23:46] <Yellow-Box_Mk2> k
[23:49] <Yellow-Box_Mk2> release 0.2.1 Created
�14[23:49] <wliang> =)
�14[23:49] <wliang> u mind i help out ur strcpy?
[23:50] <Yellow-Box_Mk2> go ahead
�14[23:57] <wliang> inlight me why isn't this ctrcpy mem safe?
[23:57] <Yellow-Box_Mk2> k
[23:58] <Yellow-Box_Mk2> if strscr is str[15]
[23:58] <Yellow-Box_Mk2> and has "HelloWorld"
[23:58] <Yellow-Box_Mk2> and strdest is str[10]
[23:59] <Yellow-Box_Mk2> when you try to copy strscr over...oyu get mem leek
�14[23:59] <wliang> ooh! ic
[23:59] <Herman_Log> u can either stop the copying
[23:59] <Herman_Log> or expand so that str[10] becomes str[15]
Session Time: Tue Feb 22 00:00:00 2011
�14[00:00] <wliang> tru so far what i've worked on i've always been told to asume array has enough sapce
�14[00:01] <wliang> is that why vs warn strspy might be unsafe?
[00:01] <Yellow-Box_Mk2> never asume in programming...it leads to wierd situations
�14[00:02] <wliang> can pointer point to another pointer that points to a mem location?
[00:03] <Herman_Log> what line is ur strcpy function
[00:06] <Herman_Log> man that strCpy naming is confusing
[00:06] <Herman_Log> xD
[00:06] <Herman_Log> strori throws me off
[00:06] <Herman_Log> lol
[00:06] <Herman_Log> why not just strCpy(dest,source);
[00:06] <Herman_Log> ;P
[00:07] <Herman_Log> possbile memory leak @ CASE_ESCAPE
[00:07] <Herman_Log> just add cpyStr = (char*) malloc (slen+1); before the strCpy statement
[00:07] <Herman_Log> xD
[00:08] <Herman_Log> oh shit my bad
[00:09] <Herman_Log> was looking at ur branch
[00:09] <Herman_Log> not trunk
[00:09] <Herman_Log> trunk seems empy in isTextEditor
[00:09] <Herman_Log> bleh okay my bad
[00:09] <Herman_Log> my svn keeps doing a weird version instead of latest
�14[00:10] <wliang> lol
�14[00:10] <wliang> there r alot of ways to prevent mem leak for strCpy
�14[00:10] <wliang> but that doens't change the fact strcpy() isn't safe
�14[00:11] <wliang> ok i'm not making sense
[00:11] <Herman_Log> but yeah possible memoryleak
�14[00:11] <wliang> i mean, there's many ways to prevent mem leak for strcpy
[00:11] <Herman_Log> u cant prevent memoryleak inside strCpy
�14[00:12] <wliang> but that's becoz we know what we're doing
[00:12] <Herman_Log> u can prevent it on the scope its being called at
�14[00:12] <wliang> strcpy the function itself i don't think there is way to stop it
[00:12] <Herman_Log> aslong as u free the memory within the same scope that gets to calling strCpy u should be fine
[00:12] <Herman_Log> its just how u handle it via coding
�14[00:13] <wliang> all i can think of is to make sure strori does reach to the end otherwise free the mem and return error
[00:14] <Herman_Log> we talking inside the strCpy or outside of it
�14[00:14] <wliang> lol wait that's not possible
[00:14] <Herman_Log> yeah
[00:14] <Herman_Log> u can stop memory leak
[00:14] <Herman_Log> on the scope it calls strCpy
[00:14] <Herman_Log> not within strCpy
�14[00:15] <wliang> within strCpy return error(-1) if strori doesn't reach to \0
[00:15] <Herman_Log> but escape_key can cause mem leak
[00:15] <Herman_Log> or crashes the program
�14[00:15] <wliang> and then the next line free the mem if strCpy return  -1
[00:15] <Herman_Log> strori will always reaches 0
[00:15] <Herman_Log> \0 *
�14[00:17] <wliang> so this is what isTexteditor section 3.2 talking about
[00:18] <Herman_Log> 3.2?
[00:18] <Herman_Log> If memory allocation for aborting the edit (ESCAPE KEY) fails, quit the function returning -1.  ?
�14[00:19] <wliang> yea
�14[00:19] <wliang> if it fails to copy the original str back, quit and return -1
[00:19] <Herman_Log> check strlen of strdest i guess
[00:20] <Herman_Log> if less then strori
[00:20] <Herman_Log> gtfo?
[00:20] <Herman_Log> or are we takling about using calloc
�14[00:22] <wliang> ok, so we can call strCpy, afterward compare strlen for str and cpyStr, if not match then return -1 and terminate the function
[00:23] <Herman_Log> hmm maybew
�14[00:24] <wliang> that still doesn't change the fact that strCpy isn't safe, lol
[00:24] <Herman_Log> no strcpy function is safe
[00:24] <Herman_Log> u cantfree memory inside that function
[00:24] <Herman_Log> u have to do it outside
�14[00:24] <wliang> but then the way we use it should be ok
�14[00:26] <wliang> ok i suppose we're all set for the day
�14[00:27] <wliang> let's call it a night, i'm gonna put irclog on team page
�02[00:27] * Herman_Log (~User@CPE0026f39a4268-CM0026f39a4265.cpe.net.cable.rogers.com) Quit (Quit: Leaving�)