Make argument of DohWrite() const.
Writing a buffer to a DOH object doesn't modify so it should be const. This allows the code using const pointers to pass them to DohWrite() without neither the casts nor gcc warnings. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12167 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
1f939323a4
commit
ac5ddb0315
5 changed files with 5 additions and 5 deletions
|
|
@ -645,7 +645,7 @@ int DohRead(DOH *obj, void *buffer, int length) {
|
|||
* DohWrite()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int DohWrite(DOH *obj, void *buffer, int length) {
|
||||
int DohWrite(DOH *obj, const void *buffer, int length) {
|
||||
DohBase *b = (DohBase *) obj;
|
||||
DohObjInfo *objinfo;
|
||||
if (DohCheck(obj)) {
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ extern int DohDelslice(DOH *obj, int sindex, int eindex);
|
|||
|
||||
/* File methods */
|
||||
|
||||
extern int DohWrite(DOHFile * obj, void *buffer, int length);
|
||||
extern int DohWrite(DOHFile * obj, const void *buffer, int length);
|
||||
extern int DohRead(DOHFile * obj, void *buffer, int length);
|
||||
extern int DohSeek(DOHFile * obj, long offset, int whence);
|
||||
extern long DohTell(DOHFile * obj);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ typedef struct {
|
|||
/* File methods */
|
||||
typedef struct {
|
||||
int (*doh_read) (DOH *obj, void *buffer, int nbytes); /* Read bytes */
|
||||
int (*doh_write) (DOH *obj, void *buffer, int nbytes); /* Write bytes */
|
||||
int (*doh_write) (DOH *obj, const void *buffer, int nbytes); /* Write bytes */
|
||||
int (*doh_putc) (DOH *obj, int ch); /* Put character */
|
||||
int (*doh_getc) (DOH *obj); /* Get character */
|
||||
int (*doh_ungetc) (DOH *obj, int ch); /* Unget character */
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static int File_read(DOH *fo, void *buffer, int len) {
|
|||
* File_write()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
static int File_write(DOH *fo, void *buffer, int len) {
|
||||
static int File_write(DOH *fo, const void *buffer, int len) {
|
||||
DohFile *f = (DohFile *) ObjData(fo);
|
||||
if (f->filep) {
|
||||
int ret = (int) fwrite(buffer, 1, len, f->filep);
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@ static int String_read(DOH *so, void *buffer, int len) {
|
|||
/* -----------------------------------------------------------------------------
|
||||
* int String_write() - Write data to a string
|
||||
* ----------------------------------------------------------------------------- */
|
||||
static int String_write(DOH *so, void *buffer, int len) {
|
||||
static int String_write(DOH *so, const void *buffer, int len) {
|
||||
int newlen;
|
||||
String *s = (String *) ObjData(so);
|
||||
s->hashkey = -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue