Skip to contentSkip to conversation

ltp: fix databinchk() definition

PATCH New Alex Elder 1 participant 1 message Apr 4, 2011 Library code

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

PATCH 1/6 ltp: fix databinchk() definition

Fix a bogus (misspelled) declaration for databinchk() in "include/databin.h".

Then, change databinchk() so that its second argument is a signed rather than an unsigned character pointer. This is consistent with the way it is used throughout the code. Because of the way that argument is used, it won't change the behavior of that function; its value is immediately assigned to a local variable, which is still unsigned. Add a cast in that assignment to force the conversion.

---
 include/databin.h |    2 +-
 lib/databin.c     |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
include/databin.h +1 -1
index c168799..93c3863 100644
@@ -39,6 +39,6 @@
 
 void databingen( int mode, char *buffer, int bsize, int offset );
 
-void databinchedk( int mode, unsigned char *buffer, int bsize, int offset, char **errmsg);
+int databinchk( int mode, char *buffer, int bsize, int offset, char **errmsg);
 
 #endif
lib/databin.c +2 -2
index 6659ccf..c0f4307 100644
@@ -91,7 +91,7 @@ int ind;
 int
 databinchk(mode, buffer, bsize, offset, errmsg)
 int mode;	/* either a, c, r, z, o, or C */
-unsigned char *buffer;	/* buffer pointer */
+char *buffer;	/* buffer pointer */
 int bsize;	/* size of buffer */
 int offset;	/* offset into the file where buffer starts */
 char **errmsg;
@@ -102,7 +102,7 @@ char **errmsg;
     long expbits;
     long actbits;
 
-	chr=buffer;
+	chr = (unsigned char *) buffer;
 	total=bsize;
 
 	if (errmsg != NULL) {
Signature · 14 lines
1.7.4




------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list