Get the global comment string of the ZipFile, in the szComment buffer. uSizeBuf is the size of the szComment buffer. return the number of byte copied or an error code <0
| 3694 | // uSizeBuf is the size of the szComment buffer. |
| 3695 | // return the number of byte copied or an error code <0 |
| 3696 | int unzGetGlobalComment (unzFile file, char *szComment, uLong uSizeBuf) |
| 3697 | { //int err=UNZ_OK; |
| 3698 | unz_s* s; |
| 3699 | uLong uReadThis ; |
| 3700 | if (file==NULL) return UNZ_PARAMERROR; |
| 3701 | s=(unz_s*)file; |
| 3702 | uReadThis = uSizeBuf; |
| 3703 | if (uReadThis>s->gi.size_comment) uReadThis = s->gi.size_comment; |
| 3704 | if (lufseek(s->file,s->central_pos+22,SEEK_SET)!=0) return UNZ_ERRNO; |
| 3705 | if (uReadThis>0) |
| 3706 | { *szComment='\0'; |
| 3707 | if (lufread(szComment,(uInt)uReadThis,1,s->file)!=1) return UNZ_ERRNO; |
| 3708 | } |
| 3709 | if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) *(szComment+s->gi.size_comment)='\0'; |
| 3710 | return (int)uReadThis; |
| 3711 | } |
| 3712 | |
| 3713 | |
| 3714 |