Changeset 3802 for trunk/src


Ignore:
Timestamp:
Jul 6, 2000, 11:17:02 PM (25 years ago)
Author:
sandervl
Message:

VP fixed strncpy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/odincrt/string.cpp

    r2039 r3802  
    1 /* $Id: string.cpp,v 1.1 1999-12-09 10:58:15 sandervl Exp $ */
     1/* $Id: string.cpp,v 1.2 2000-07-06 21:17:02 sandervl Exp $ */
    22/*
    33 * Project Odin Software License can be found in LICENSE.TXT
     
    1515  register char *p2 = (char *)src;
    1616
    17   length--; // pre-decrement to avoid exceeding buffer length
    18             // results in better code than (dest > 1)
    19 
    2017  for (;*p2 && length; length--)
    2118    *p1++ = *p2++;
    2219
    23   *p1 = 0; //CB: copy arg-1, set end 0
     20  if ( length > 0 ) // above loop ended due to nul in src
     21    *p1 = 0;
    2422
    2523  return dest;
Note: See TracChangeset for help on using the changeset viewer.