comparison libpurple/dbus-analyze-functions.py @ 18146:5d1058768970

Remove the warning about signedness.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 17 Jun 2007 03:42:10 +0000
parents c6ee57944335
children 476e16ce29d0
comparison
equal deleted inserted replaced
18145:b2438a35c5f7 18146:5d1058768970
136 # pointers ... 136 # pointers ...
137 if (len(type) == 2) and (type[1] == pointer): 137 if (len(type) == 2) and (type[1] == pointer):
138 # strings 138 # strings
139 if type[0] in ["char", "gchar"]: 139 if type[0] in ["char", "gchar"]:
140 if const: 140 if const:
141 return self.inputstring(type, name) 141 return self.inputstring(type, name, unsigned)
142 else: 142 else:
143 raise myexception 143 raise myexception
144 144
145 elif type[0] == "GHashTable": 145 elif type[0] == "GHashTable":
146 return self.inputhash(type, name) 146 return self.inputhash(type, name)
242 if us: 242 if us:
243 self.inputparams.append(("G_TYPE_UINT", name)) 243 self.inputparams.append(("G_TYPE_UINT", name))
244 else: 244 else:
245 self.inputparams.append(("G_TYPE_INT", name)) 245 self.inputparams.append(("G_TYPE_INT", name))
246 246
247 def inputstring(self, type, name): 247 def inputstring(self, type, name, us):
248 self.paramshdr.append("const char *%s" % name) 248 if us:
249 self.paramshdr.append("const unsigned char *%s" % name)
250 else:
251 self.paramshdr.append("const char *%s" % name)
249 self.inputparams.append(("G_TYPE_STRING", name)) 252 self.inputparams.append(("G_TYPE_STRING", name))
250 253
251 def inputpurplestructure(self, type, name): 254 def inputpurplestructure(self, type, name):
252 self.paramshdr.append("const %s *%s" % (type[0], name)) 255 self.paramshdr.append("const %s *%s" % (type[0], name))
253 self.inputparams.append(("G_TYPE_INT", "GPOINTER_TO_INT(%s)" % name)) 256 self.inputparams.append(("G_TYPE_INT", "GPOINTER_TO_INT(%s)" % name))
364 else: 367 else:
365 self.cdecls.append("\tdbus_uint32_t %s;" % name) 368 self.cdecls.append("\tdbus_uint32_t %s;" % name)
366 self.cparams.append(("UINT32", name)) 369 self.cparams.append(("UINT32", name))
367 self.addintype("u", name) 370 self.addintype("u", name)
368 371
369 def inputstring(self, type, name): 372 def inputstring(self, type, name, us):
370 self.cdecls.append("\tconst char *%s;" % name) 373 if us:
374 self.cdecls.append("\tconst unsigned char *%s;" % name)
375 else:
376 self.cdecls.append("\tconst char *%s;" % name)
371 self.cparams.append(("STRING", name)) 377 self.cparams.append(("STRING", name))
372 self.ccode .append("\tNULLIFY(%s);" % name) 378 self.ccode.append("\t%s = (%s && %s[0]) ? %s : NULL;" % (name,name,name,name))
373 self.addintype("s", name) 379 self.addintype("s", name)
374 380
375 def inputhash(self, type, name): 381 def inputhash(self, type, name):
376 self.argfunc = "purple_dbus_message_get_args" 382 self.argfunc = "purple_dbus_message_get_args"
377 self.cdecls.append("\tDBusMessageIter %s_ITER;" % name) 383 self.cdecls.append("\tDBusMessageIter %s_ITER;" % name)