diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/cstubs | 14 | ||||
-rw-r--r-- | Modules/stropmodule.c | 43 |
2 files changed, 32 insertions, 25 deletions
diff --git a/Modules/cstubs b/Modules/cstubs index d8f2d90..7e99a82 100644 --- a/Modules/cstubs +++ b/Modules/cstubs @@ -529,21 +529,21 @@ gl_getmatrix(self, args) object *self; object *args; { - float arg1 [ 16 ] ; + Matrix arg1; object *v, *w; - int i; + int i, j; getmatrix( arg1 ); v = newlistobject(16); if (v == NULL) { return err_nomem(); } - for (i = 0; i < 16; i++) { - w = mknewfloatobject(arg1[i]); + for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) { + w = mknewfloatobject(arg1[i][j]); if (w == NULL) { DECREF(v); return NULL; } - setlistitem(v, i, w); + setlistitem(v, i*4+j, w); } return v; } @@ -559,7 +559,7 @@ gl_altgetmatrix(self, args) object *self; object *args; { - float arg1 [ 4 ] [ 4 ] ; + Matrix arg1; object *v, *w; int i, j; getmatrix( arg1 ); @@ -742,7 +742,7 @@ gl_packrect(self, args) if (packed == NULL) return NULL; parray = (unsigned long *) getstringvalue(unpacked); - p = getstringvalue(packed); + p = (unsigned char *) getstringvalue(packed); for (y = 0; y < height; y += packfactor, parray += packfactor*width) { for (x = 0; x < width; x += packfactor) { pixel = parray[x]; diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c index 6686abf..3a941a8 100644 --- a/Modules/stropmodule.c +++ b/Modules/stropmodule.c @@ -254,24 +254,26 @@ strop_lower(self, args) object *self; /* Not used */ object *args; { - char *s; + char *s, *s_new; int i, n; object *new; int changed; if (!getargs(args, "s#", &s, &n)) return NULL; - new = newsizedstringobject(s, n); + new = newsizedstringobject(NULL, n); if (new == NULL) return NULL; - s = getstringvalue(new); + s_new = getstringvalue(new); changed = 0; for (i = 0; i < n; i++) { - char c = s[i]; + char c = *s++; if (isupper(c)) { changed = 1; - s[i] = tolower(c); - } + *s_new = tolower(c); + } else + *s_new = c; + s_new++; } if (!changed) { DECREF(new); @@ -287,24 +289,26 @@ strop_upper(self, args) object *self; /* Not used */ object *args; { - char *s; + char *s, *s_new; int i, n; object *new; int changed; if (!getargs(args, "s#", &s, &n)) return NULL; - new = newsizedstringobject(s, n); + new = newsizedstringobject(NULL, n); if (new == NULL) return NULL; - s = getstringvalue(new); + s_new = getstringvalue(new); changed = 0; for (i = 0; i < n; i++) { - char c = s[i]; + char c = *s++; if (islower(c)) { changed = 1; - s[i] = toupper(c); - } + *s_new = toupper(c); + } else + *s_new = c; + s_new++; } if (!changed) { DECREF(new); @@ -320,28 +324,31 @@ strop_swapcase(self, args) object *self; /* Not used */ object *args; { - char *s; + char *s, *s_new; int i, n; object *new; int changed; if (!getargs(args, "s#", &s, &n)) return NULL; - new = newsizedstringobject(s, n); + new = newsizedstringobject(NULL, n); if (new == NULL) return NULL; - s = getstringvalue(new); + s_new = getstringvalue(new); changed = 0; for (i = 0; i < n; i++) { - char c = s[i]; + char c = *s++; if (islower(c)) { changed = 1; - s[i] = toupper(c); + *s_new = toupper(c); } else if (isupper(c)) { changed = 1; - s[i] = tolower(c); + *s_new = tolower(c); } + else + *s_new = c; + s_new++; } if (!changed) { DECREF(new); |