Re: [dev] [sbase] [patch] Adding tar v2

2013-07-14 Thread Nick
Quoth Galos, David:
> Thanks in large part to your information about how you invoke tar, I
> believe I have come up with a decent solution. I also was able to
> find the structified version of tar I had worked on in the past.

I'd be inclined to check for and filter out leading .. and / 
characters, to avoid tarballs doing unexpectedly evil things.



Re: [dev] [dwm] [patch] Fix warning about XKeycodeToKeysym

2013-07-14 Thread Anselm R Garbe
Hi Alexander,

On 12 July 2013 14:03, Alexander Rødseth  wrote:
> Attaching a patch for fixing a warning about XKeycodeToKeysym, by
> replacing it with a call to XGetKeyboardMapping.

Which warning are you referring to? Also in your suggested patch
keysyms_per_keycode_return is never evaluated, though keysym_count ==
1 in your suggested call.

Also according to
http://tronche.com/gui/x/xlib/input/XGetKeyboardMapping.html the
result must be XFree()'d to avoid mem leaks.

So if this is all about the stupid X deprecation warnings, I'm tempted
to ignore those Xlib hell until they really remove those old calls.

Best regards,
Anselm



Re: [dev] dwm bit fields conversion

2013-07-14 Thread Anselm R Garbe
On 7 July 2013 16:49, koneu  wrote:
> In Xdefs.h, Bool is typedef'd as int (= at least 2 bytes, sometimes more, 
> depending on the implementation), of which we set the last bit to 1 or 0.
> In the Monitor and Client structures dwm uses, we can instead use char bit 
> fields, storing up to 8 Bool values in 1 byte.
>
> diff --git a/dwm.c b/dwm.c
> index 314adf4..83af1f6 100644
> --- a/dwm.c
> +++ b/dwm.c
> @@ -91,7 +91,7 @@ struct Client {
> int basew, baseh, incw, inch, maxw, maxh, minw, minh;
> int bw, oldbw;
> unsigned int tags;
> -   Bool isfixed, isfloating, isurgent, neverfocus, oldstate, 
> isfullscreen;
> +   unsigned char isfixed :1, isfloating :1, isurgent :1, neverfocus :1, 
> oldstate :1, isfullscreen :1, :2;
> Client *next;
> Client *snext;
> Monitor *mon;
> @@ -121,8 +121,7 @@ struct Monitor {
> unsigned int seltags;
> unsigned int sellt;
> unsigned int tagset[2];
> -   Bool showbar;
> -   Bool topbar;
> +   unsigned char showbar :1, topbar :1, :6;
> Client *clients;
> Client *sel;
> Client *stack;

I find this less readable than the usage of Bool. If memory
consumption would be a major dwm concern, I'd agree with such a
suggestion. But there are more important problems to focus on in dwm
6.1 (fixed xinerama support).

Best regards,
Anselm



Re: [dev] [sbase] [patch] Adding tar v2

2013-07-14 Thread Chris Down
On 14 July 2013 20:42, Nick  wrote:
> Quoth Galos, David:
>> Thanks in large part to your information about how you invoke tar, I
>> believe I have come up with a decent solution. I also was able to
>> find the structified version of tar I had worked on in the past.
>
> I'd be inclined to check for and filter out leading .. and /
> characters, to avoid tarballs doing unexpectedly evil things.

I think all security onus for stuff like that should be on the user --
they can still do unexpectedly evil things either way (even stripping
.. and /). It should be the user's responsibility to verify what will
happen when a tarball is extracted using -t.



Re: [dev] dwm bit fields conversion

2013-07-14 Thread Markus Teich
Since this is just uncommon syntax (at least I haven't seen it before) 
and it is just used in the declaration I would be ok with it, if an 
additional comment explains it. It's not a strong opinion though, just 
an idea.


--Markus


Am 2013-07-14 21:32, schrieb Anselm R Garbe:

On 7 July 2013 16:49, koneu  wrote:
In Xdefs.h, Bool is typedef'd as int (= at least 2 bytes, sometimes 
more, depending on the implementation), of which we set the last bit 
to 1 or 0.
In the Monitor and Client structures dwm uses, we can instead use 
char bit fields, storing up to 8 Bool values in 1 byte.


diff --git a/dwm.c b/dwm.c
index 314adf4..83af1f6 100644
--- a/dwm.c
+++ b/dwm.c
@@ -91,7 +91,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw;
unsigned int tags;
-   Bool isfixed, isfloating, isurgent, neverfocus, oldstate, 
isfullscreen;
+   unsigned char isfixed :1, isfloating :1, isurgent :1, 
neverfocus :1, oldstate :1, isfullscreen :1, :2;

Client *next;
Client *snext;
Monitor *mon;
@@ -121,8 +121,7 @@ struct Monitor {
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
-   Bool showbar;
-   Bool topbar;
+   unsigned char showbar :1, topbar :1, :6;
Client *clients;
Client *sel;
Client *stack;


I find this less readable than the usage of Bool. If memory
consumption would be a major dwm concern, I'd agree with such a
suggestion. But there are more important problems to focus on in dwm
6.1 (fixed xinerama support).

Best regards,
Anselm




[dev] [sbase] Patch to make md5 and sha1 more similar

2013-07-14 Thread Jens Nyberg
Hi,

I've included a patch that makes minor changes to md5 and sha1. Both
hashing functions are pretty similar but the code differed in a few places
so I cleaned them both up a bit.

Also I made some minor changes like moving the rol function to below the
definitions and also instead of *= 8 I did a <<= 3 which is functionally
equivalent but should save a tiny bit of speed (unless the compiler is
smart enough to catch that and replaces it automatically).


0001-More-consistancy-between-md5-and-sha1.patch
Description: Binary data


Re: [dev] dwm bit fields conversion

2013-07-14 Thread pancake
I should check generated code, but usually a mov is faster than mov+and+mov for 
setting a bit.

On Jul 14, 2013, at 23:22, Markus Teich  wrote:

> Since this is just uncommon syntax (at least I haven't seen it before) and it 
> is just used in the declaration I would be ok with it, if an additional 
> comment explains it. It's not a strong opinion though, just an idea.
> 
> --Markus
> 
> 
> Am 2013-07-14 21:32, schrieb Anselm R Garbe:
>> On 7 July 2013 16:49, koneu  wrote:
>>> In Xdefs.h, Bool is typedef'd as int (= at least 2 bytes, sometimes more, 
>>> depending on the implementation), of which we set the last bit to 1 or 0.
>>> In the Monitor and Client structures dwm uses, we can instead use char bit 
>>> fields, storing up to 8 Bool values in 1 byte.
>>> diff --git a/dwm.c b/dwm.c
>>> index 314adf4..83af1f6 100644
>>> --- a/dwm.c
>>> +++ b/dwm.c
>>> @@ -91,7 +91,7 @@ struct Client {
>>>int basew, baseh, incw, inch, maxw, maxh, minw, minh;
>>>int bw, oldbw;
>>>unsigned int tags;
>>> -   Bool isfixed, isfloating, isurgent, neverfocus, oldstate, 
>>> isfullscreen;
>>> +   unsigned char isfixed :1, isfloating :1, isurgent :1, neverfocus 
>>> :1, oldstate :1, isfullscreen :1, :2;
>>>Client *next;
>>>Client *snext;
>>>Monitor *mon;
>>> @@ -121,8 +121,7 @@ struct Monitor {
>>>unsigned int seltags;
>>>unsigned int sellt;
>>>unsigned int tagset[2];
>>> -   Bool showbar;
>>> -   Bool topbar;
>>> +   unsigned char showbar :1, topbar :1, :6;
>>>Client *clients;
>>>Client *sel;
>>>Client *stack;
>> I find this less readable than the usage of Bool. If memory
>> consumption would be a major dwm concern, I'd agree with such a
>> suggestion. But there are more important problems to focus on in dwm
>> 6.1 (fixed xinerama support).
>> Best regards,
>> Anselm
>