@@ -111,11 +111,11 @@ var structData = map[string]ChunkData{
111
111
112
112
"PREF" : {nil , "Preferences" },
113
113
"PREF.PRHD" : {handlePrefPrhd , "Preferences Header" },
114
- "PREF.ASL " : {nil , "ASL Preferences" },
115
- "PREF.FONT" : {nil , "Font Preferences" },
116
- "PREF.ICTL" : {nil , "IControl Preferences" },
117
- "PREF.INPT" : {nil , "Input Preferences" },
118
- "PREF.KMSW" : {nil , "Keyboard/Mouse Preferences" },
114
+ "PREF.ASL " : {handlePrefAsl , "ASL Preferences" },
115
+ "PREF.FONT" : {handlePrefFont , "Font Preferences" },
116
+ "PREF.ICTL" : {handlePrefIctl , "IControl Preferences" },
117
+ "PREF.INPT" : {handlePrefInpt , "Input Preferences" },
118
+ "PREF.KMSW" : {handlePrefKmsw , "Keyboard/Mouse Preferences" },
119
119
"PREF.LCLE" : {nil , "Locale Preferences" },
120
120
"PREF.PALT" : {nil , "Palette Preferences" },
121
121
"PREF.CMAP" : {handleIlbmCmap , "Color Map" },
@@ -258,3 +258,20 @@ func getByte(data []byte, offset *uint32) (int8, error) {
258
258
* offset ++
259
259
return result , nil
260
260
}
261
+
262
+ // getStringBuffer reads a string from the data at the given offset.
263
+ // The numer of bytes to read is given by bufLen. The offset is incremented
264
+ // by the bufLen.
265
+ // In case of an error, it returns "" and the error. The offset is unchanged.
266
+ func getStringBuffer (data []byte , offset * uint32 , bufLen uint32 ) (string , error ) {
267
+ var result string
268
+
269
+ if len (data ) < int (* offset + bufLen ) {
270
+ return "" , fmt .Errorf ("data too short for String" )
271
+ }
272
+ high := int (* offset + bufLen )
273
+ result = string (data [* offset :high ])
274
+
275
+ * offset += bufLen
276
+ return result , nil
277
+ }
0 commit comments