From: zooko Date: Mon, 15 Jun 2009 22:20:12 +0000 (+0530) Subject: narrow types of k and m from unsigned to unsigned short X-Git-Url: https://git.rkrishnan.org/pf/content/en/service/(%5B%5E?a=commitdiff_plain;h=fb5ee11a4d7d0715f6d6fe42b6f05d1a0ab7f7f5;p=tahoe-lafs%2Fzfec.git narrow types of k and m from unsigned to unsigned short Ignore-this: 4c26811e89232bb7917c961900670a87 darcs-hash:9bc59ddbad635e5bde000497cc81a50d75d0368c --- diff --git a/zfec/zfec/_fecmodule.c b/zfec/zfec/_fecmodule.c index 34a2941..e9449c9 100644 --- a/zfec/zfec/_fecmodule.c +++ b/zfec/zfec/_fecmodule.c @@ -30,8 +30,8 @@ typedef struct { PyObject_HEAD /* expose these */ - short kk; - short mm; + unsigned short kk; + unsigned short mm; /* internal */ fec_t* fec_matrix; @@ -78,8 +78,8 @@ Encoder_init(Encoder *self, PyObject *args, PyObject *kwdict) { PyErr_Format(py_fec_error, "Precondition violation: first argument is required to be less than or equal to the second argument, but they were %d and %d respectively", ink, inm); return -1; } - self->kk = (short)ink; - self->mm = (short)inm; + self->kk = (unsigned short)ink; + self->mm = (unsigned short)inm; self->fec_matrix = fec_new(self->kk, self->mm); return 0; @@ -289,8 +289,8 @@ typedef struct { PyObject_HEAD /* expose these */ - short kk; - short mm; + unsigned short kk; + unsigned short mm; /* internal */ fec_t* fec_matrix; @@ -338,8 +338,8 @@ Decoder_init(Encoder *self, PyObject *args, PyObject *kwdict) { PyErr_Format(py_fec_error, "Precondition violation: first argument is required to be less than or equal to the second argument, but they were %d and %d respectively", ink, inm); return -1; } - self->kk = (short)ink; - self->mm = (short)inm; + self->kk = (unsigned short)ink; + self->mm = (unsigned short)inm; self->fec_matrix = fec_new(self->kk, self->mm); return 0; diff --git a/zfec/zfec/fec.c b/zfec/zfec/fec.c index 6763bdb..637498d 100644 --- a/zfec/zfec/fec.c +++ b/zfec/zfec/fec.c @@ -412,7 +412,7 @@ fec_free (fec_t *p) { } fec_t * -fec_new(unsigned k, unsigned n) { +fec_new(unsigned short k, unsigned short n) { unsigned row, col; gf *p, *tmp_m; diff --git a/zfec/zfec/fec.h b/zfec/zfec/fec.h index e67778d..2ebab32 100644 --- a/zfec/zfec/fec.h +++ b/zfec/zfec/fec.h @@ -10,7 +10,7 @@ typedef unsigned char gf; typedef struct { unsigned long magic; - unsigned k, n; /* parameters of the code */ + unsigned short k, n; /* parameters of the code */ gf* enc_matrix; } fec_t; @@ -24,7 +24,7 @@ typedef struct { * param k the number of blocks required to reconstruct * param m the total number of blocks created */ -fec_t* fec_new(unsigned k, unsigned m); +fec_t* fec_new(unsigned short k, unsigned short m); void fec_free(fec_t* p); /**