Re: [dev] [st][PATCH] unsigned function tdefcolor returns -1 on error
On Mon, 5 Aug 2013 08:18:38 +0200
"Roberto E. Vargas Caballero" <k0ga_AT_shike2.com> wrote:
> On Sun, Aug 04, 2013 at 08:54:35AM -0400, Eon S. Jeon wrote:
> > Hi
> >
> > I found that tdefcolor returns -1 on error, while its return type is
> > unsigned long. At the same time, line 1724 and 1731 are checking the
> > positivity of its unsigned return value.
> >
>
> Good point, but I think is better change the type of tdefcolor
> instead. Could you amend the patch and send it again?
>
Here it is.
diff --git a/st.c b/st.c
index 362de23..8aeb167 100644
--- a/st.c
+++ b/st.c
_AT_@ -361,7 +361,7 @@ static void tsetdirtattr(int);
static void tsetmode(bool, bool, int *, int);
static void tfulldirt(void);
static void techo(char *, int);
-static ulong tdefcolor(int *, int *, int);
+static long tdefcolor(int *, int *, int);
static inline bool match(uint, uint);
static void ttynew(void);
static void ttyread(void);
_AT_@ -1625,7 +1625,7 @@ tdeleteline(int n) {
tscrollup(term.c.y, n);
}
-ulong
+long
tdefcolor(int *attr, int *npar, int l) {
long idx = -1;
uint r, g, b;
_AT_@ -1676,7 +1676,7 @@ tdefcolor(int *attr, int *npar, int l) {
void
tsetattr(int *attr, int l) {
int i;
- ulong idx;
+ long idx;
for(i = 0; i < l; i++) {
switch(attr[i]) {
Received on Mon Aug 05 2013 - 22:37:59 CEST
This archive was generated by hypermail 2.3.0
: Mon Aug 05 2013 - 22:48:07 CEST