Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* //this version of getString doesn't work right
- DataView.prototype.getString=function(bi,L){
- var c,ps="",i=0,e=L%4,x="\\x",z="0"; L-=e;
- while(i!=L){
- c=this.getUint32(bi+i).toString(16);
- ps+=x+c[0]+(c[1]||z)+x+(c[2]||z)+(c[3]||z)+x+(c[4]||z)+(c[5]||z)+x+(c[6]||z)+(c[7]||z);
- i+=4;
- }
- while(e--){ ps+=x+this.getUint8(bi+i).toString(16);
- i++;
- }
- return eval('"'+ps+'"');
- };
- */
- //good version:
- DataView.prototype.getString=function(bi,L){
- var i=0,s="";
- while(i!=L){
- s+=String.fromCharCode(this.getUint8(bi+i));
- i++;
- }
- return s;
- };
- DataView.prototype.setString=function(bi,s){
- var i=0,L=s.length;
- while(i!=L){
- this.setUint8(bi+i,s.charCodeAt(i));
- i++;
- }
- };
- self.strNui8=function strNui8(s,ui8,u8i){
- var L=s.length,i=L; u8i=u8i||0;
- while(i--) ui8[u8i+i]=s.charCodeAt(i);
- };
- self.ui8Gstr=function Ui8Gstr(ui8,i,L){
- var s="";
- while(i!=L){ s+=String.fromCharCode(ui8[i]); i++; }
- return s;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement