SMCWrapper icon indicating copy to clipboard operation
SMCWrapper copied to clipboard

Cleaned code, removed smc.h, fixed typos

Open perfaram opened this issue 10 years ago • 4 comments

List :

  • Cleaned code (by removing smc.h and transferring missing typedefs into SMCWrapper.h, by wiping useless macros, by reordering typedefs, by having all includes in the same place - the header, by normalising carriage returns and indentation)
  • Corrected some silly mistakes (SMCWrapper.m includes its header, fixed a segfaulting typo that took me an hour to find)
  • stringRepresentationForBytes:...:toNSString now actually returns a value
  • Added methods to request raw hex values (e.g. 68 65 6c 6c 6f) from SMCVals
  • Added FAILURE_REPRESENTING_STRUCT in SMCState enum, to be used when the SMCVal couldn't be represented (through stringRepresentation... methods). (NOT YET IN USE)

perfaram avatar Mar 30 '15 15:03 perfaram

Bump ?

perfaram avatar Apr 02 '15 15:04 perfaram

Take a look at the 'SMCWrapper' branch in http://github.com/perfaram/xline, this is where most improvements I made here come from.

perfaram avatar Apr 02 '15 15:04 perfaram

Just asking, why are we passing NSStrings by reference anyways ? Couldn't we just return the NSString (which is usually easier for the programmer who uses SMCWrapper) and have the error passed by ref ? Or have a @property for errors, making the whole thing very much easier, especially knowing that we are going to have more detailed errors ?

Cleaner list of options, in which Error stands either for NSError** or SMCState_t * :

  1. -(BOOL) readKey:(NSString *)key intoString:(NSString **)str; (current)
  2. -(NSString*) readKey:(NSString *)key withError:(Error **)err; (passing byref)
  3. -(NSString*) readKey:(NSString *)key; (setting @property in method)

I vote for the last one.

perfaram avatar Apr 02 '15 17:04 perfaram

After working a bit on other projects, I changed my mind. The current version seems good. BUT, to have more precision, we could also have a @property [...] error, so that it doesn't break with current version, but we can have additional data for debugging.

perfaram avatar May 03 '15 06:05 perfaram