aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m16
-rw-r--r--Source/SPFieldEditorController.m4
-rw-r--r--Source/SPTableContent.m6
-rw-r--r--Source/SPTableStructureDelegate.m2
4 files changed, 21 insertions, 7 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m
index ec4aa44b..bdb271fe 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m
@@ -430,12 +430,22 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf);
void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf)
{
+ // NSUInteger i = 0;
+ // nbytes--;
+ // while (++i <= len)
+ // buf[len - i] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0';
+ //
+ // buf[len] = '\0';
+ // ↑ why does this code not working anymore?
+
NSUInteger i = 0;
nbytes--;
- while (++i <= len)
- buf[len - i] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0';
+ len--;
+ while (i <= len)
+ buf[len - i++] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0';
+
+ buf[len+1] = '\0';
- buf[len] = '\0';
}
/**
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index bf48ec80..7bdd2eb9 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -225,10 +225,10 @@
// Init according bit check boxes
NSUInteger i = 0;
NSUInteger maxBit = (NSUInteger)((maxTextLength > 64) ? 64 : maxTextLength);
- if([bitSheetNULLButton state] == NSOffState)
+ if([bitSheetNULLButton state] == NSOffState && maxBit <= [(NSString*)sheetEditData length])
for( i = 0; i<maxBit; i++ )
[[self valueForKeyPath:[NSString stringWithFormat:@"bitSheetBitButton%ld", i]]
- setState:([sheetEditData characterAtIndex:(maxBit-i-1)] == '1') ? NSOnState : NSOffState];
+ setState:([(NSString*)sheetEditData characterAtIndex:(maxBit-i-1)] == '1') ? NSOnState : NSOffState];
for( i = maxBit; i<64; i++ )
[[self valueForKeyPath:[NSString stringWithFormat:@"bitSheetBitButton%ld", i]] setEnabled:NO];
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index e4fe9dc2..dcc56525 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -1669,9 +1669,13 @@
} else if ([[column objectForKey:@"default"] isEqualToString:@""]
&& ![[column objectForKey:@"null"] boolValue]
&& ([[column objectForKey:@"typegrouping"] isEqualToString:@"float"]
- || [[column objectForKey:@"typegrouping"] isEqualToString:@"integer"]))
+ || [[column objectForKey:@"typegrouping"] isEqualToString:@"integer"]
+ || [[column objectForKey:@"typegrouping"] isEqualToString:@"bit"]))
{
[newRow addObject:@"0"];
+ } else if ([[column objectForKey:@"typegrouping"] isEqualToString:@"bit"] && [[column objectForKey:@"default"] hasPrefix:@"b'"] && [(NSString*)[column objectForKey:@"default"] length] > 3) {
+ // remove leading b' and final '
+ [newRow addObject:[[[column objectForKey:@"default"] substringFromIndex:2] substringToIndex:[(NSString*)[column objectForKey:@"default"] length]-3]];
} else {
[newRow addObject:[column objectForKey:@"default"]];
}
diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m
index ad061b62..4e04ca05 100644
--- a/Source/SPTableStructureDelegate.m
+++ b/Source/SPTableStructureDelegate.m
@@ -516,7 +516,7 @@
}
// Check if UNSIGNED and ZEROFILL is allowed
else if([[aTableColumn identifier] isEqualToString:@"zerofill"] || [[aTableColumn identifier] isEqualToString:@"unsigned"]) {
- [aCell setEnabled:([fieldValidation isFieldTypeNumeric:theRowType])];
+ [aCell setEnabled:([fieldValidation isFieldTypeNumeric:theRowType] && ![theRowType isEqualToString:@"BIT"])];
}
// Check if BINARY is allowed
else if([[aTableColumn identifier] isEqualToString:@"binary"]) {