# HG changeset patch
# User Patrik Svestka <patrik.svestka@gmail.com>
# Date 1548944923 -3600
# Thu Jan 31 15:28:43 2019 +0100
# Branch jv
# Node ID 14192e6eeae81dbd1edf2aae5504c7a953d4ad7c
# Parent ecd8104acb9a1a1355128660fc8ee8d5d6677c3f
Issue #252: User input checks - raise an error when the method parameter does not fit the requirements
- valueTypeAndSize: checking if nameString is a string if not, raise an error
- deleteValueNamed: checking if nameString is a string if not, raise an error
- deleteSubKeyNamed:flags: checking if nameString is a string if not, raise an error
- subKeyNamed:flags:createIfAbsent: checking if subKeyString is a string if not, raise an error
- valueNamed:put:unexpandedReferences: checking if nameString is a string if not, raise an error
diff -r ecd8104acb9a -r 14192e6eeae8 Win32OperatingSystem.st
a
|
b
|
|
15960 | 15960 | |
15961 | 15961 | windowsRegistryTable := Dictionary new. |
15962 | 15962 | |
| 15963 | "/ checking user input |
| 15964 | nameString isString ifFalse:[ |
| 15965 | self error: 'nameString is not a string!!' |
| 15966 | ]. |
15963 | 15967 | "/ adding terminating null into empty string |
15964 | 15968 | nameString notNil ifTrue:[ |
15965 | 15969 | nameUtf16Z := nameString isEmpty ifTrue:[(nameString, (Character codePoint: 0)) asUnicode16String] "/ needed for defaultValue |
… |
… |
|
16123 | 16127 | |
16124 | 16128 | |subKeyStringUtf16Z errorNumber| |
16125 | 16129 | |
| 16130 | "/ checking user input |
| 16131 | subKeyString isString ifFalse:[ |
| 16132 | self error: 'subKeyString is not a string!!' |
| 16133 | ]. |
16126 | 16134 | subKeyStringUtf16Z := subKeyString asUnicode16StringZ. |
16127 | 16135 | |
16128 | 16136 | %{ |
… |
… |
|
16554 | 16562 | |
16555 | 16563 | |subKeyStringUtf16Z newEntry subHandle errorNumber disposition| |
16556 | 16564 | |
| 16565 | "/ checking user input |
| 16566 | subKeyString isString ifFalse:[ |
| 16567 | self error: 'subKeyString is not a string!!' |
| 16568 | ]. |
16557 | 16569 | subKeyStringUtf16Z := subKeyString asUnicode16StringZ. |
16558 | 16570 | |
16559 | 16571 | %{ |
… |
… |
|
16684 | 16696 | |
16685 | 16697 | |nameUtf16Z errorNumber| |
16686 | 16698 | |
| 16699 | "/ checking user input |
| 16700 | nameString isString ifFalse:[ |
| 16701 | self error: 'nameString is not a string!!' |
| 16702 | ]. |
16687 | 16703 | "/ adding terminating null into empty string |
16688 | 16704 | nameString notNil ifTrue:[ |
16689 | 16705 | nameUtf16Z := nameString isEmpty ifTrue:[(nameString, (Character codePoint: 0)) asUnicode16String] "/ needed for defaultValue |
… |
… |
|
16814 | 16830 | nameString isString ifFalse:[ |
16815 | 16831 | self error: 'nameString is not a string!!' |
16816 | 16832 | ]. |
16817 | | |
16818 | 16833 | "/ adding terminating null into empty string |
16819 | 16834 | nameString notNil ifTrue:[ |
16820 | 16835 | nameString isEmpty ifTrue:[nameUtf16Z := (nameString, (Character codePoint: 0)) asUnicode16String] "/ needed for defaultValue |
… |
… |
|
17096 | 17111 | Null-terminated string that contains unexpanded references to environment variables (for example, ""%PATH%""). It will be a Unicode or ANSI string, |
17097 | 17112 | depending on whether you use the Unicode or ANSI functions. |
17098 | 17113 | " |
17099 | | |
17100 | 17114 | |nameUtf16Z dataUtf16Z stringArray errorNumber| |
17101 | | |
| 17115 | |
| 17116 | "/ checking user input |
| 17117 | nameString isString ifFalse:[ |
| 17118 | self error: 'nameString is not a string!!' |
| 17119 | ]. |
17102 | 17120 | "/ nameString asUnicodeString and null terminated |
17103 | 17121 | nameString notNil ifTrue:[ |
17104 | 17122 | nameUtf16Z := nameString isEmpty ifTrue:[(nameString, (Character codePoint: 0)) asUnicode16String] "/ needed for defaultValue: |