Skip Menu |

This queue is for tickets about the Archive-Chm CPAN distribution.

Report information
The Basics
Id: 17777
Status: open
Priority: 0/
Queue: Archive-Chm

People
Owner: Nobody in particular
Requestors: tasuka [...] mac.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.06
Fixed in: 0.06



Subject: complie parse error on _set_errmsg function
Chm.xs:90: warning: passing argument 1 of '_set_errmsg' from incompatible pointer type Chm.xs:90: error: too few arguments to function '_set_errmsg' add on Chm.pm line 185 to _set_errmsg(obj,"No error whatsoever"); will resolved problem
Subject: Chm.pm.patch
--- Chm.pm.old 2006-02-21 09:36:52.000000000 +0800 +++ Chm.pm 2006-02-21 09:28:15.000000000 +0800 @@ -182,7 +182,7 @@ SV* new(char* class, char* filename) chmfile->is_open = 1; chmfile->error = 0; - _set_errmsg("No error whatsoever"); + _set_errmsg(obj,"No error whatsoever"); /* Tasuka */ chmfile->filename = strdup(filename); sv_setiv(obj, (IV)chmfile); @@ -1091,4 +1091,4 @@ Copyright (C) 2005 Alexandru Palade, Net All rights reserved. -=cut +=cut \ No newline at end of file
On Lun. 20 Feb. 2006 20:39:07, guest wrote: Show quoted text
> Chm.xs:90: warning: passing argument 1 of '_set_errmsg' from > incompatible pointer type > Chm.xs:90: error: too few arguments to function '_set_errmsg' > > add on Chm.pm line 185 to _set_errmsg(obj,"No error whatsoever"); > > will resolved problem
It's not this simple. First of all, _set_errmsg() expects to receive a reference, and obj is not - we have to pass obj_ref. Moreover, the chmfile->errmsg field MUST be initialised to 0, or the free() inside _set_errmsg() will cause damage. Otherwise, it will compile but won't pass the tests. Here's the proposed patch (also annexed): --- Chm.pm 2006-07-16 02:02:13.378620656 +0200 +++ correct/Chm.pm 2006-07-16 02:01:55.134394200 +0200 @@ -179,14 +179,16 @@ chmfile->target = chm_open(filename); if (!(chmfile->target)) return NULL; - - chmfile->is_open = 1; - chmfile->error = 0; - _set_errmsg("No error whatsoever"); - chmfile->filename = strdup(filename); + chmfile->is_open = 1; + chmfile->error = 0; + chmfile->filename = strdup(filename); + chmfile->errmsg = 0; /* MUST initialise for _set_errmsg */ + sv_setiv(obj, (IV)chmfile); SvREADONLY_on(obj); + + _set_errmsg(obj_ref, "No error whatsoever"); /* MUST pass obj_ref */ return obj_ref; }
--- Chm.pm 2006-07-16 02:02:13.378620656 +0200 +++ correct/Chm.pm 2006-07-16 02:01:55.134394200 +0200 @@ -179,14 +179,16 @@ chmfile->target = chm_open(filename); if (!(chmfile->target)) return NULL; - - chmfile->is_open = 1; - chmfile->error = 0; - _set_errmsg("No error whatsoever"); - chmfile->filename = strdup(filename); + chmfile->is_open = 1; + chmfile->error = 0; + chmfile->filename = strdup(filename); + chmfile->errmsg = 0; /* MUST initialise for _set_errmsg */ + sv_setiv(obj, (IV)chmfile); SvREADONLY_on(obj); + + _set_errmsg(obj_ref, "No error whatsoever"); /* MUST pass obj_ref */ return obj_ref; }