Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5802 → Rev 5803

/programs/cmm/lib/file_system.h
281,10 → 281,10
:dword ConvertSize(dword bytes)
{
byte size_nm[4];
if (bytes>=1073741824) strncpy(#size_nm, "Gb",2);
else if (bytes>=1048576) strncpy(#size_nm, "Mb",2);
else if (bytes>=1024) strncpy(#size_nm, "Kb",2);
else strncpy(#size_nm, "b ",2);
if (bytes>=1073741824) strlcpy(#size_nm, "Gb",2);
else if (bytes>=1048576) strlcpy(#size_nm, "Mb",2);
else if (bytes>=1024) strlcpy(#size_nm, "Kb",2);
else strlcpy(#size_nm, "b ",2);
while (bytes>1023) bytes/=1024;
sprintf(#ConvertSize_size_prefix,"%d %s",bytes,#size_nm);
return #ConvertSize_size_prefix;
/programs/cmm/lib/strings.h
13,7 → 13,7
// strlen( EDI)
// utf8_strlen( ESI)
// strcpy( EDI, ESI) --- 0 if ==
// strncpy(dword text1,text2,signed length)
// strlcpy(dword text1,text2,signed length)
// strcat( EDI, ESI)
// strncat(dword text1,text2,signed length) --- pasting the text of a certain length
// strchr( ESI,BL) --- find first BL
216,34 → 216,6
$jnz L2
}
 
inline dword strncpy(dword text1, text2, signed len)
signed o1,o2;
{
if(!text1)||(!len) return text1;
if(len<4)
{
o2 = len;
goto RUN_BYTE;
}
o1 = len/4;
o2 = len-4*o1;
while(o1){
DSDWORD[text1] = DSDWORD[text2];
text1 += 4;
text2 += 4;
$dec o1
}
RUN_BYTE:
while(o2){
DSBYTE[text1] = DSBYTE[text2];
$inc text1
$inc text2
$dec o2
}
DSBYTE[text1] = 0;
return text1;
}
 
inline fastcall int strlcpy(dword ESI, EDI, EBX)
{
if (EBX<0) return -1;
759,7 → 731,7
dword l = strlen(text);
dword ret = malloc(l+1);
if(!ret) return NULL;
strncpy(ret,text,l);
strlcpy(ret,text,l);
return ret;
}
 
771,7 → 743,7
copy = malloc(len + 1);
if (copy != NULL)
{
strncpy(copy, str, len);
strlcpy(copy, str, len);
DSBYTE[len+copy] = '\0';
}
return copy;