mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
Protect again memory overruns.
Get rid of warnings.
This commit is contained in:
+5
-1
@@ -73,7 +73,11 @@ class CMockConfig
|
||||
treat_as_map.merge!(@options[:treat_as])
|
||||
@options[:treat_as] = treat_as_map
|
||||
|
||||
@options.each_key { |key| eval("def #{key.to_s}() return @options[:#{key.to_s}] end") }
|
||||
@options.each_key do |key|
|
||||
unless methods.include?(key)
|
||||
eval("def #{key.to_s}() return @options[:#{key.to_s}] end")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def load_config_file_from_yaml yaml_filename
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size)
|
||||
size = size + CMOCK_MEM_INDEX_SIZE;
|
||||
if (size & CMOCK_MEM_ALIGN_MASK)
|
||||
size = (size + CMOCK_MEM_ALIGN_MASK) & ~CMOCK_MEM_ALIGN_MASK;
|
||||
if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) < size)
|
||||
if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) <= size)
|
||||
{
|
||||
#ifndef CMOCK_MEM_DYNAMIC
|
||||
return CMOCK_GUTS_NONE; // nothing we can do; our static buffer is out of memory
|
||||
|
||||
@@ -21,8 +21,17 @@ describe CMockPluginManager, "Verify CMockPluginManager Module" do
|
||||
:ignore => :args_and_calls
|
||||
)
|
||||
|
||||
eval "class << @config\ndef plugins\n@plugins||[]\nend\ndef plugins=(val)\n@plugins=val\nend\nend\n"
|
||||
def @config.plugins
|
||||
if instance_variable_defined?(:@plugins)
|
||||
@plugins || []
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def @config.plugins=(val)
|
||||
@plugins = val
|
||||
end
|
||||
end
|
||||
|
||||
after do
|
||||
|
||||
Reference in New Issue
Block a user