Fix bug: add at the end of the ini-file of the empty line, otherwise new section is added wrong

git-svn-id: svn://kolibrios.org@4422 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
GerdtR 2014-01-01 12:32:09 +00:00
parent 88c24f6c96
commit a461856fa1

View File

@ -75,8 +75,7 @@ include 'libini_p.asm'
;;================================================================================================;; ;;================================================================================================;;
proc ini.enum_sections _f_name, _callback ;///////////////////////////////////////////////////////;; proc ini.enum_sections _f_name, _callback ;///////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;; ;;------------------------------------------------------------------------------------------------;;
;? Enumerate sections, calling callback function for each of them ;; ;? Enumerate sections, calling c2------------------------------------------------------------------;;
;;------------------------------------------------------------------------------------------------;;
;> _f_name = ini filename <asciiz> ;; ;> _f_name = ini filename <asciiz> ;;
;> _callback = callback function address: func(f_name, sec_name), where ;; ;> _callback = callback function address: func(f_name, sec_name), where ;;
;> f_name = ini filename (as passed to the function) <asciiz> ;; ;> f_name = ini filename (as passed to the function) <asciiz> ;;
@ -376,6 +375,20 @@ endl
lea ebx, [f] lea ebx, [f]
mov [f_addr], ebx mov [f_addr], ebx
;/GerdtR - bugfix: at end of file required empty line
invoke file.seek, [f.fh],2,SEEK_END
invoke file.read, [f.fh],[f.buf],2
mov edx,[f.buf]
cmp word[edx],0A0Dh
je @f
mov word[edx],0A0Dh
invoke file.seek, [f.fh],0,SEEK_END
invoke file.write, [f.fh],[f.buf],2
@@:
; lea ebx, [f]
;\GerdtR
stdcall libini._.find_section, ebx, [_sec_name] stdcall libini._.find_section, ebx, [_sec_name]
or eax, eax or eax, eax
jnz .create_section jnz .create_section
@ -433,6 +446,7 @@ endl
push edi push edi
mov esi, [_sec_name] mov esi, [_sec_name]
mov byte[edi], '[' mov byte[edi], '['
inc edi inc edi
call libini._.string_copy call libini._.string_copy
@ -698,10 +712,11 @@ locals
endDel rd 1 endDel rd 1
endl endl
push ebx ecx edi esi push ebx ecx edi esi
xor eax,eax
mov dword[funcFile],5 ;get file info mov dword[funcFile],5 ;get file info
mov dword[funcFile+4],0 mov dword[funcFile+4],eax
mov dword[funcFile+8],0 mov dword[funcFile+8],eax
mov dword[funcFile+12],0 mov dword[funcFile+12],eax
lea eax,[fileInfo] lea eax,[fileInfo]
mov dword[funcFile+16],eax mov dword[funcFile+16],eax
mov byte[funcFile+20],0 mov byte[funcFile+20],0
@ -799,8 +814,6 @@ endl
endp endp
;;================================================================================================;; ;;================================================================================================;;
proc ini.get_shortcut _f_name, _sec_name, _key_name, _def_val, _modifiers ;///////////////////////;; proc ini.get_shortcut _f_name, _sec_name, _key_name, _def_val, _modifiers ;///////////////////////;;
;;------------------------------------------------------------------------------------------------;; ;;------------------------------------------------------------------------------------------------;;