Thread (20 messages) flat view 20 messages, 3 authors, 2011-02-24

Re: [PATCH v2 3/7] Create helper functions to deal with handles on interactive gatttool

From: Johan Hedberg <hidden>
Date: 2011-02-23 03:09:03

Hi Sheldon,

On Tue, Feb 22, 2011, Sheldon Demario wrote:
+	*dst = strtoll(src, &e, 16);
+	if (errno != 0 || *e != '\0') {
+		return -1;
 	}
Firstly, you've got a coding style issue here: no {} for one-line
scopes. Secondly, are you sure that this is the right way to check for
strtoll failure? If there was some earlier libc function that failed
errno might be set to != 0 even if strtoll succeeds, right? Or are all
errno using libc functions guaranteed to set errno to 0 on success?
Reading the man-page of strtoll it seems you should be checking for
LLONG_MIN and LLONG_MAX return values.

I've pushed the first two patches since they were fine, but I'll stop
here until we get some clarification on this matter.

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help