Diff for /np2/common/profile.c between versions 1.13 and 1.14

version 1.13, 2005/03/20 06:09:16 version 1.14, 2005/03/20 08:58:19
Line 265  static BRESULT seakey(PFILEH hdl, PFPOS  Line 265  static BRESULT seakey(PFILEH hdl, PFPOS 
 static BRESULT replace(PFILEH hdl, UINT pos, UINT size1, UINT size2) {  static BRESULT replace(PFILEH hdl, UINT pos, UINT size1, UINT size2) {
   
         UINT    cnt;          UINT    cnt;
           UINT    size;
         UINT    newsize;          UINT    newsize;
         OEMCHAR *p;          OEMCHAR *p;
         OEMCHAR *q;          OEMCHAR *q;
Line 276  static BRESULT replace(PFILEH hdl, UINT  Line 277  static BRESULT replace(PFILEH hdl, UINT 
         }          }
         cnt = hdl->size - size1;          cnt = hdl->size - size1;
         if (size1 < size2) {          if (size1 < size2) {
                 newsize = hdl->size + size2 - size1;                  size = hdl->size + size2 - size1;
                 if (newsize > hdl->buffers) {                  if (size > hdl->buffers) {
                         newsize = (newsize & (PFBUFSIZE - 1)) + PFBUFSIZE;                          newsize = (size & (~(PFBUFSIZE - 1))) + PFBUFSIZE;
                         p = (OEMCHAR *)_MALLOC(newsize * sizeof(OEMCHAR), "profile");                          p = (OEMCHAR *)_MALLOC(newsize * sizeof(OEMCHAR), "profile");
                         if (p == NULL) {                          if (p == NULL) {
                                 return(FAILURE);                                  return(FAILURE);
                         }                          }
                         CopyMemory(p, hdl->buffer, hdl->buffers * sizeof(OEMCHAR));  
                         if (hdl->buffer) {                          if (hdl->buffer) {
                                   CopyMemory(p, hdl->buffer, hdl->buffers * sizeof(OEMCHAR));
                                 _MFREE(hdl->buffer);                                  _MFREE(hdl->buffer);
                         }                          }
                         hdl->buffer = p;                          hdl->buffer = p;
                         hdl->buffers = newsize;                          hdl->buffers = newsize;
                 }                  }
                 hdl->size = newsize;                  hdl->size = size;
                 if (cnt) {                  if (cnt) {
                         p = hdl->buffer + size1;                          p = hdl->buffer + size1;
                         q = hdl->buffer + size2;                          q = hdl->buffer + size2;
Line 363  static PFILEH registfile(FILEH fh) { Line 364  static PFILEH registfile(FILEH fh) {
                 goto rf_err1;                  goto rf_err1;
         }          }
         size = (size - hdrsize) / srcwidth;          size = (size - hdrsize) / srcwidth;
         newsize = (size & (PFBUFSIZE - 1)) + PFBUFSIZE;          newsize = (size & (~(PFBUFSIZE - 1))) + PFBUFSIZE;
         buf = (OEMCHAR *)_MALLOC(newsize * srcwidth, "profile");          buf = (OEMCHAR *)_MALLOC(newsize * srcwidth, "profile");
         if (buf == NULL) {          if (buf == NULL) {
                 goto rf_err1;                  goto rf_err1;
Line 512  BRESULT profile_write(const OEMCHAR *app Line 513  BRESULT profile_write(const OEMCHAR *app
                 }                  }
                 buf = hdl->buffer + pfp.pos;                  buf = hdl->buffer + pfp.pos;
                 *buf++ = '[';                  *buf++ = '[';
                 CopyMemory(buf, app, pfp.applen);                  CopyMemory(buf, app, pfp.applen * sizeof(OEMCHAR));
                 buf += pfp.applen;                  buf += pfp.applen;
                 *buf++ = ']';                  *buf++ = ']';
 #if defined(OSLINEBREAK_CR) || defined(OSLINEBREAK_CRLF)  #if defined(OSLINEBREAK_CR) || defined(OSLINEBREAK_CRLF)
Line 535  BRESULT profile_write(const OEMCHAR *app Line 536  BRESULT profile_write(const OEMCHAR *app
                 return(FAILURE);                  return(FAILURE);
         }          }
         buf = hdl->buffer + pfp.pos;          buf = hdl->buffer + pfp.pos;
         CopyMemory(buf, key, pfp.keylen);          CopyMemory(buf, key, pfp.keylen * sizeof(OEMCHAR));
         buf += pfp.keylen;          buf += pfp.keylen;
         *buf++ = '=';          *buf++ = '=';
         CopyMemory(buf, data, datalen);          CopyMemory(buf, data, datalen * sizeof(OEMCHAR));
         buf += datalen;          buf += datalen;
 #if defined(OSLINEBREAK_CR) || defined(OSLINEBREAK_CRLF)  #if defined(OSLINEBREAK_CR) || defined(OSLINEBREAK_CRLF)
         *buf++ = '\r';          *buf++ = '\r';

Removed from v.1.13  
changed lines
  Added in v.1.14


RetroPC.NET-CVS <cvs@retropc.net>