Mercurial > hg > audiodb
comparison insert.cpp @ 594:c850f3433454
Deal with signed/unsigned comparison, again.
Mingw's off_t appears to be 32-bit always.
author | mas01cr |
---|---|
date | Tue, 11 Aug 2009 21:42:39 +0000 |
parents | 633614461994 |
children | 6ad0a6e67d4c |
comparison
equal
deleted
inserted
replaced
593:70acfcb5010a | 594:c850f3433454 |
---|---|
344 * because of the particular relationships between all of these | 344 * because of the particular relationships between all of these |
345 * numbers, so we just cast the left hand side to off_t, which | 345 * numbers, so we just cast the left hand side to off_t, which |
346 * will do the right thing for us on all platforms. | 346 * will do the right thing for us on all platforms. |
347 * | 347 * |
348 * I hate C. | 348 * I hate C. |
349 * | |
350 * Addendum: the above reasoning is skewered on Win32, where off_t | |
351 * is apparently signed 32-bit always (i.e. no large-file | |
352 * support). So now, we cast datum->dim to size_t, so that our | |
353 * types are the same on both sides. I hate C even more. | |
349 */ | 354 */ |
350 if(((off_t) (st.st_size - sizeof(uint32_t))) != (size / datum->dim)) { | 355 if((st.st_size - sizeof(uint32_t)) != (size / (size_t) datum->dim)) { |
351 goto error; | 356 goto error; |
352 } | 357 } |
353 read_or_goto_error(fd, &dim, sizeof(uint32_t)); | 358 read_or_goto_error(fd, &dim, sizeof(uint32_t)); |
354 if(dim != 1) { | 359 if(dim != 1) { |
355 goto error; | 360 goto error; |