Skip to content

Commit

Permalink
- 1.9: quelled warnings
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//src/png/dev/": change = 8199]
  • Loading branch information
zenspider committed Feb 8, 2013
1 parent 5ce5033 commit 048dfba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
22 changes: 11 additions & 11 deletions lib/png.rb
Expand Up @@ -16,6 +16,10 @@ class String # :nodoc: # ZenTest SKIP
unsigned long png_crc() {
static unsigned long crc[256];
static char crc_table_computed = 0;
unsigned long c = 0xffffffff;
size_t len = RSTRING_LEN(self);
char * s = StringValuePtr(self);
unsigned i;
if (! crc_table_computed) {
unsigned long c;
Expand All @@ -31,11 +35,6 @@ class String # :nodoc: # ZenTest SKIP
crc_table_computed = 1;
}
unsigned long c = 0xffffffff;
unsigned len = RSTRING_LEN(self);
char * s = StringValuePtr(self);
unsigned i;
for (i = 0; i < len; i++) {
c = crc[(c ^ s[i]) & 0xff] ^ (c >> 8);
}
Expand Down Expand Up @@ -127,12 +126,13 @@ class PNG

builder.c <<-EOM
VALUE png_join() {
int i, j;
VALUE data = rb_iv_get(self, "@data");
unsigned int data_len = RARRAY_LEN(data);
unsigned int row_len = RARRAY_LEN(RARRAY_PTR(data)[0]);
unsigned long size = data_len * (1 + (row_len * 4));
char * result = malloc(size);
size_t i, j;
VALUE data = rb_iv_get(self, "@data");
size_t data_len = RARRAY_LEN(data);
size_t row_len = RARRAY_LEN(RARRAY_PTR(data)[0]);
size_t size = data_len * (1 + (row_len * 4));
char * result = malloc(size);
unsigned long idx = 0;
for (i = 0; i < data_len; i++) {
VALUE row = RARRAY_PTR(data)[i];
Expand Down
1 change: 0 additions & 1 deletion lib/png/pie.rb
Expand Up @@ -24,7 +24,6 @@ def self.pie_chart(diameter, pct_green,
diameter += 1 if diameter % 2 == 0
radius = (diameter / 2.0).to_i
pct_in_deg = FULL * pct_green
rad_to_deg = HALF / Math::PI

canvas = PNG::Canvas.new(diameter, diameter)

Expand Down
4 changes: 2 additions & 2 deletions test/test_png_reader.rb
Expand Up @@ -61,13 +61,13 @@ def test_class_read_IDAT
end

def test_class_read_IHDR
bit_depth, color_type, width, height = PNG.read_IHDR @IHDR_data
_, _, width, height = PNG.read_IHDR @IHDR_data
assert_equal 10, width
assert_equal 10, height
end

def test_class_load_metadata
png, canvas = util_png
png, _ = util_png

width, height, bit_depth = PNG.load(png.to_blob, :metadata)

Expand Down

0 comments on commit 048dfba

Please sign in to comment.