100+ results for 'php sizeof'

Not the results you expected?

vec.c (https://github.com/llucax/dmd.git) C · 656 lines

39 void vec_init()

40 {

41 assert(sizeof(vec_base_t)==2 && VECSHIFT==4 ||

42 sizeof(vec_base_t)==4 && VECSHIFT==5 ||

43 sizeof(vec_base_t)==8 && VECSHIFT==6);

44 if (vec_initcount++ == 0)

45 vec_count = 0;

105 case 1: v[0] = 0;

106 break;

107 default: memset(v,0,dim * sizeof(vec_base_t));

108 break;

109 }

112 else

113 {

114 v = (vec_t) mem_calloc((dim + 2) * sizeof(vec_base_t));

115 }

116 if (v)

ObstacleModule.cpp (https://github.com/emamanto/nbites.git) C++ · 466 lines

37 ObstacleModule::ObstacleModule() : obstacleOut(base())

38 {

39 memset(obstacleBuffer, 0, sizeof(obstacleBuffer));

40 memset(obstacleDistances, 0, sizeof(obstacleDistances));

HAPBLECharacteristic+Broadcast.c (https://github.com/apple/HomeKitADK.git) C · 395 lines

161 uint8_t bytes[2 + 3 * 42 + 1]; // 128 + 1, allows for 42 concurrent broadcasts on a single KVS key.

162 bool found;

163 err = GetBroadcastConfiguration(aid, &found, bytes, sizeof bytes, &numBytes, &key, keyValueStore);

164 if (err) {

165 HAPAssert(err == kHAPError_Unknown);

240 uint8_t bytes[2 + 3 * 42 + 1]; // 128 + 1, allows for 42 concurrent broadcasts on a single KVS key.

241 bool found;

242 err = GetBroadcastConfiguration(aid, &found, bytes, sizeof bytes, &numBytes, &key, keyValueStore);

243 if (err) {

244 HAPAssert(err == kHAPError_Unknown);

292

293 // Add configuration.

294 if (numBytes >= sizeof bytes - 1 - 3) {

295 HAPLogCharacteristic(

296 &logObject,

hist.c (https://github.com/andygross/omap_dmm_tiler.git) C · 527 lines

279

280 if (fabs(diff) >= 0.01)

281 scnprintf(buf, sizeof(buf), "%+4.2F%%", diff);

282

283 return scnprintf(hpp->buf, hpp->size, fmt, buf);

308

309 if (ratio > 0.0)

310 scnprintf(buf, sizeof(buf), "%+14.6F", ratio);

311

312 return scnprintf(hpp->buf, hpp->size, fmt, buf);

337

338 if (wdiff != 0)

339 scnprintf(buf, sizeof(buf), "%14ld", wdiff);

340

341 return scnprintf(hpp->buf, hpp->size, fmt, buf);

vec.c (https://bitbucket.org/olioengr/dmd.git) C · 655 lines

40 void vec_init()

41 {

42 assert(sizeof(vec_base_t)==2&&VECSHIFT==4||sizeof(vec_base_t)==4&&VECSHIFT== 5);

43 if (vec_initcount++ == 0)

44 vec_count = 0;

104 case 1: v[0] = 0;

105 break;

106 default: memset(v,0,dim * sizeof(vec_base_t));

107 break;

108 }

111 else

112 {

113 v = (vec_t) mem_calloc((dim + 2) * sizeof(vec_base_t));

114 }

115 if (v)

mavlink_msg_point_of_interest.h (https://github.com/flixr/mavlink-ivy-interface.git) C Header · 292 lines

74 packet.color = color;

75 packet.coordinate_system = coordinate_system;

76 memcpy(packet.name, name, sizeof(char)*26);

77 memcpy(_MAV_PAYLOAD(msg), &packet, 43);

78 #endif

122 packet.color = color;

123 packet.coordinate_system = coordinate_system;

124 memcpy(packet.name, name, sizeof(char)*26);

125 memcpy(_MAV_PAYLOAD(msg), &packet, 43);

126 #endif

180 packet.color = color;

181 packet.coordinate_system = coordinate_system;

182 memcpy(packet.name, name, sizeof(char)*26);

183 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POINT_OF_INTEREST, (const char *)&packet, 43, 95);

184 #endif

rmd128.c (https://gitlab.com/kush/linux) C · 327 lines

227 rctx->state[3] = RMD_H3;

228

229 memset(rctx->buffer, 0, sizeof(rctx->buffer));

230

231 return 0;

236 {

237 struct rmd128_ctx *rctx = shash_desc_ctx(desc);

238 const u32 avail = sizeof(rctx->buffer) - (rctx->byte_count & 0x3f);

239

240 rctx->byte_count += len;

242 /* Enough space in buffer? If so copy and we're done */

243 if (avail > len) {

244 memcpy((char *)rctx->buffer + (sizeof(rctx->buffer) - avail),

245 data, len);

246 goto out;

utilities.c (https://gitlab.com/kajan-rezg/postgres) C · 473 lines

7 extern symbol * create_s(void) {

8 symbol * p;

9 void * mem = malloc(HEAD + (CREATE_SIZE + 1) * sizeof(symbol));

10 if (mem == NULL) return NULL;

11 p = (symbol *) (HEAD + (char *) mem);

188

189 extern int eq_s(struct SN_env * z, int s_size, const symbol * s) {

190 if (z->l - z->c < s_size || memcmp(z->p + z->c, s, s_size * sizeof(symbol)) != 0) return 0;

191 z->c += s_size; return 1;

192 }

193

194 extern int eq_s_b(struct SN_env * z, int s_size, const symbol * s) {

195 if (z->c - z->lb < s_size || memcmp(z->p + z->c - s_size, s, s_size * sizeof(symbol)) != 0) return 0;

196 z->c -= s_size; return 1;

197 }

Voxel_Reader.cxx (https://github.com/hmeyer/oce.git) C++ · 529 lines

197 {

198 ((Standard_Byte**)((Voxel_DS*)myBoolVoxels)->myData)[i1] =

199 (Standard_Byte*) calloc(8/*number of bytes in slice*/, sizeof(Standard_Byte));

200 }

201 (((Standard_Byte**)((Voxel_DS*)myBoolVoxels)->myData)[i1])[i2] = (Standard_Byte)value;

274 {

275 ((Standard_Byte**)((Voxel_DS*)myColorVoxels)->myData)[i1] =

276 (Standard_Byte*) calloc(32/*number of bytes in slice*/, sizeof(Standard_Byte));

277 }

278 (((Standard_Byte**)((Voxel_DS*)myColorVoxels)->myData)[i1])[i2] = (Standard_Byte)value;

353 {

354 ((Standard_ShortReal**)((Voxel_DS*)myFloatVoxels)->myData)[i1] =

355 (Standard_ShortReal*) calloc(32/*number of floats in slice*/, sizeof(Standard_ShortReal));

356 }

357 (((Standard_ShortReal**)((Voxel_DS*)myFloatVoxels)->myData)[i1])[i2] = value;

filespec.c (https://bitbucket.org/olioengr/dmd.git) C · 424 lines

118 #if MSDOS || __OS2__ || __NT__ || _WIN32

119 char cwd_d[132];

120 if (getcwd(cwd_d, sizeof(cwd_d)))

121 cwd_t = cwd_d;

122 else

posts.php (https://gitlab.com/Ltaimao/wecenter) PHP · 514 lines

1 <?php

2 /*

3 +--------------------------------------------------------------------------

112 $this->update('posts_index', $data, 'id = ' . intval($post_index['id']));

113

114 if (sizeof($posts_index) > 1)

115 {

116 $this->delete('posts_index', "post_id = " . intval($post_id) . " AND post_type = '" . $this->quote($post_type) . "' AND id != " . intval($post_index['id']));

LineMarker.cxx (https://github.com/quiachonj/notepad-plus.git) C++ · 309 lines

107 Point(centreX + dimOn2 - dimOn4, centreY),

108 };

109 surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),

110 fore.allocated, back.allocated);

111

116 Point(centreX, centreY + dimOn2 - dimOn4),

117 };

118 surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),

119 fore.allocated, back.allocated);

120

134 Point(centreX - armSize, centreY + 1),

135 };

136 surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),

137 fore.allocated, back.allocated);

138

DB.php (https://github.com/durand54/sitellite.git) PHP · 425 lines

1 <?php

2 // +----------------------------------------------------------------------+

3 // | PEAR :: Cache |

4 // +----------------------------------------------------------------------+

5 // | Copyright (c) 1997-2003 The PHP Group |

6 // +----------------------------------------------------------------------+

7 // | This source file is subject to version 2.0 of the PHP license, |

8 // | that is bundled with this package in the file LICENSE, and is |

9 // | available at through the world-wide-web at |

10 // | http://www.php.net/license/2_02.txt. |

11 // | If you did not receive a copy of the PHP license and are unable to |

12 // | obtain it through the world-wide-web, please send a note to |

13 // | license@php.net so we can mail you a copy immediately. |

14 // +----------------------------------------------------------------------+

15 // | Authors: Sebastian Bergmann <sb@sebastian-bergmann.de> |

bytebuffer.cpp (https://github.com/brookerk/mmoserver.git) C++ · 388 lines

218 T bytebuffer::read()

219 {

220 unsigned int Tsize = sizeof(T);

221 if(_ReadPos + Tsize > _WritePos)

222 {

236 void bytebuffer::append(T value)

237 {

238 unsigned int Tsize = sizeof(T);

239 while(_WritePos + Tsize > _capacity)

240 resize(_capacity * 3);

247 T bytebuffer::peek()

248 {

249 unsigned int Tsize = sizeof(T);

250 if(_ReadPos + Tsize > _WritePos)

251 {

bmi.c (https://github.com/ThomasHabets/linux.git) C · 524 lines

266 {

267 struct bmi_cmd cmd;

268 u32 hdrlen = sizeof(cmd.id) + sizeof(cmd.write_mem);

269 u32 txlen;

270 int ret;

312 struct bmi_cmd cmd;

313 union bmi_resp resp;

314 u32 cmdlen = sizeof(cmd.id) + sizeof(cmd.execute);

315 u32 resplen = sizeof(resp.execute);

435 {

436 struct bmi_cmd cmd;

437 u32 cmdlen = sizeof(cmd.id) + sizeof(cmd.lz_start);

438 int ret;

439

504 {

505 struct bmi_cmd cmd;

506 u32 cmdlen = sizeof(cmd.id) + sizeof(cmd.set_app_start);

507 int ret;

508

heap.c (https://github.com/zick/kashiwa.git) C · 422 lines

177 return FORWARDING_ADDRESS(env);

178 }

179 size = sizeof(env_t) + sizeof(lobject) * (env->num - 1);

180 #ifdef GC_VERBOSE

181 fprintf(stderr, "copy %p -> %p (env)\n", env, heap_free);

202 break;

203 case TAG_CONS:

204 *size = sizeof(cons_t);

205 ((cons_t*)p)->car = copy_lobject(((cons_t*)p)->car);

206 ((cons_t*)p)->cdr = copy_lobject(((cons_t*)p)->cdr);

207 break;

208 case TAG_ENV:

209 *size = sizeof(env_t) + sizeof(lobject) * (((env_t*)p)->num - 1);

210 ((env_t*)p)->link = copy_env(((env_t*)p)->link);

211 for (i = 0; i < ((env_t*)p)->num; ++i) {

yaltools_glob.c (https://github.com/libyal/libyal.git) C · 577 lines

130 *glob,

131 0,

132 sizeof( ${tools_name}_glob_t ) ) == NULL )

133 {

134 libcerror_error_set(

235 return( -1 );

236 }

237 previous_size = sizeof( system_character_t * ) * glob->number_of_results;

238 new_size = sizeof( system_character_t * ) * new_number_of_results;

shake.c (https://github.com/arendst/Sonoff-Tasmota.git) C · 590 lines

472 sc->rate = 200 - (size_t)(security_level >> 2);

473 sc->dptr = 0;

474 memset(sc->A, 0, sizeof sc->A);

475 sc->A[ 1] = ~(uint64_t)0;

476 sc->A[ 2] = ~(uint64_t)0;

ngx_http_lua_headers.c (https://github.com/tgbyte/nginx-passenger-debian.git) C · 496 lines

477 "if new_key ~= key then return tb[new_key] else return nil end";

478

479 rc = luaL_loadbuffer(L, buf, sizeof(buf) - 1,

480 "ngx.req.get_headers __index");

481 }

sn76489.c (https://github.com/nicoya/OpenEmu.git) C · 307 lines

57 psg->output_channels = 0xFF; /* All Channels, both sides */

58

59 memset(psg->channel_masks[0], 0xFFFFFFFF, 4 * sizeof(uint32));

60 memset(psg->channel_masks[1], 0xFFFFFFFF, 4 * sizeof(uint32));

279 psg->output_channels = data;

280

281 memset(psg->channel_masks[0], 0, 4 * sizeof(uint32));

282 memset(psg->channel_masks[1], 0, 4 * sizeof(uint32));

array.idl.php (https://github.com/diegoIta/hiphop-php.git) PHP · 376 lines

1 <?php

2

3 include_once 'base.php';

187 'recursive' => array(Boolean, 'false')), FunctionIsFoldable);

188

189 f('sizeof', Int32,

190 array('var' => Variant,

191 'recursive' => array(Boolean, 'false')), FunctionIsFoldable);

parse-events.y (https://github.com/rjwysocki/linux-pm.git) Happy · 532 lines

24 #define ALLOC_LIST(list) \

25 do { \

26 list = malloc(sizeof(*list)); \

27 ABORT_ON(!list); \

28 INIT_LIST_HEAD(list); \

440 event_term

441 {

442 struct list_head *head = malloc(sizeof(*head));

443 struct parse_events_term *term = $1;

444

binvolume.c (https://bitbucket.org/ecosynth/ecosynther.git) C · 351 lines

89 /* Create and return an empty binary volume */

90 bvol_t *new_bin_volume(int w, int h, int d, bvol_type_t type) {

91 bvol_t *b = malloc(sizeof(bvol_t));

92 b->w = w; b->h = h; b->d = d;

93 b->type = type;

198

199 bmp_t *bvm2bmp(bvol_t *b) {

200 bmp_t *bmp = malloc(sizeof(bmp_t));

201

202 bmp_file_header_t file_header;

216

217 /* Fill the file header */

218 file_header.filesize = 14 + sizeof(bmp_info_header_t) + data_bytes;

219 file_header.offset = 14 + sizeof(bmp_info_header_t);

220

221 /* Fill the info header */

222 info_header.header_size = sizeof(bmp_info_header_t);

223 info_header.width = b->w;

224 info_header.height = b->h;

tce_shm_bitmap.h (https://github.com/Tencent/MSEC.git) C Header · 655 lines

50 return true;

51

52 m_nShmSize = (nBitmapSize+7)/8 + sizeof(SHead);

53 m_nMaxIndex = nBitmapSize;

54

55 if ( !m_oShm.Init( iShmKey, m_nShmSize ) )

56 {

57 xsnprintf(m_szErrMsg,sizeof(m_szErrMsg),"Array Init Failed:%s", m_oShm.GetErrMsg());

58 return false;

59 }

62 if ( !m_oShm.Attach(bReadOnly) )

63 {

64 xsnprintf(m_szErrMsg,sizeof(m_szErrMsg),"Array Init Failed:%s", m_oShm.GetErrMsg());

65 return false;

66 }

symbol_table.c (https://gitlab.com/brian0218/rk3188_r-box_android4.2.2_sdk) C · 488 lines

187 _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table)

188 {

189 struct scope_level *const scope = calloc(1, sizeof(*scope));

190

191 scope->next = table->current_scope;

206 int name_space, const char *name)

207 {

208 struct _mesa_symbol_table_iterator *iter = calloc(1, sizeof(*iter));

209 struct symbol_header *const hdr = find_symbol(table, name);

210

337

338 if (hdr == NULL) {

339 hdr = calloc(1, sizeof(*hdr));

340 hdr->name = strdup(name);

341

advanced_ftpserver.inc.php (https://github.com/BenBE/ispCP.git) PHP · 257 lines

1 <?php

2

3 // -------------------------------------------------------------------------------

85

86 // Include

87 echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&amp;image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";

88

89 } // end net2ftp_printCssInclude

226 setStatus(7, 10, __("Getting the list of directories and files"));

227 $ftp_rawlist_result = ftp_rawlist($conn_id, "-a");

228 if (sizeof($ftp_rawlist_result) <= 1) {

229 $ftp_rawlist_result = ftp_rawlist($conn_id, "");

230 }

232 // Parse the list

233 setStatus(8, 10, __("Parsing the list of directories and files"));

234 for($i=0; $i<sizeof($ftp_rawlist_result); $i++) {

235 $parsedlist[$i] = ftp_scanline($troubleshoot_directory, $ftp_rawlist_result[$i]);

236 } // end for

writer.h (https://github.com/primitiv/primitiv.git) C Header · 491 lines

174

175 Writer &operator<<(float x) {

176 static_assert(sizeof(float) == sizeof(std::uint32_t), "");

177 std::uint32_t y;

178 std::memcpy(&y, &x, sizeof(float));

326 return *this;

327 #else

328 static_assert(sizeof(std::size_t) == sizeof(std::uint32_t), "");

329 const std::int8_t type = x.type();

330 const std::size_t size = x.size();

439 Writer &operator<<(const std::unordered_map<T, U> &x) {

440 #ifdef PRIMITIV_WORDSIZE_64

441 static_assert(sizeof(std::size_t) > sizeof(std::uint32_t), "");

442 const std::size_t size = x.size();

443 if (size < (1ull << 4)) {

SystemPartition.c (https://github.com/Astaelan/SEMOS.git) C · 311 lines

176 while (entrySize != 0)

177 {

178 SystemPartitionCache * cache = (SystemPartitionCache *)malloc(sizeof(SystemPartitionCache));

179 cache->EntrySize = entrySize;

180 cache->LBA = *(UINT32 *)(sectorBuf + 2);

mavlink_msg_object_detection_event.h (https://github.com/arktools/ardupilotone.git) C Header · 270 lines

69 packet.type = type;

70 packet.quality = quality;

71 mav_array_memcpy(packet.name, name, sizeof(char)*20);

72 memcpy(_MAV_PAYLOAD(msg), &packet, 36);

73 #endif

114 packet.type = type;

115 packet.quality = quality;

116 mav_array_memcpy(packet.name, name, sizeof(char)*20);

117 memcpy(_MAV_PAYLOAD(msg), &packet, 36);

118 #endif

169 packet.type = type;

170 packet.quality = quality;

171 mav_array_memcpy(packet.name, name, sizeof(char)*20);

172 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBJECT_DETECTION_EVENT, (const char *)&packet, 36, 179);

173 #endif

PointerUtils.cs (https://github.com/soywiz/cspspemu.git) C# · 368 lines

237 public static byte[] ArrayToByteArray<TType>(TType[] inputArray)

238 {

239 var outputArray = new byte[inputArray.Length * Marshal.SizeOf(typeof(TType))];

240 GetArrayPointer(inputArray,

241 (inputPointer) =>

259 public static TType[] ByteArrayToArray<TType>(byte[] inputArray)

260 {

261 var outputArray = new TType[inputArray.Length / Marshal.SizeOf(typeof(TType))];

262 GetArrayPointer(inputArray,

263 (inputPointer) =>

297 public static string FixedByteGet(int size, byte* ptr) => PtrToStringUtf8(ptr);

298 public static void FixedByteSet(int size, byte* ptr, string value) => StoreStringOnPtr(value, Encoding.UTF8, ptr, size);

299 public static int Sizeof<T>() => Marshal.SizeOf(typeof(T));

300

301 public static int Memcmp(byte* left, byte* right, int count)

derrec.c (https://github.com/zye/cmvs_dep.git) C · 359 lines

344 s_wsfe(&io___19);

345 do_fio(&c__1, path, (ftnlen)3);

346 do_fio(&c__1, (char *)&nt, (ftnlen)sizeof(integer));

347 e_wsfe();

348 } else {

startup_ewarm.c (https://github.com/hrshygoodness/Luminary-Micro-Library.git) C · 235 lines

88 __root const uVectorEntry __vector_table[] @ ".intvec" =

89 {

90 { .ulPtr = (unsigned long)pulStack + sizeof(pulStack) },

91 // The initial stack pointer

92 ResetISR, // The reset handler

main.c (git://github.com/breckinloggins/ZombieSQL.git) C · 426 lines ✨ Summary

This C code tests a database system’s query and update functionality. It initializes the type system, creates a test database, runs various queries with different conditions (EQ, NE, LT, GT, LTE, GTE), and updates rows in the database to verify the results. The tests cover basic queries and row updates, ensuring the database system functions correctly under different scenarios.

37 TEST_ASSERT("ZdbEngineCreateDB", !ZdbEngineCreateDB("Company", &db));

38

39 ZdbColumn** columns = malloc(5*sizeof(ZdbColumn*));

40 TEST_ASSERT("Create ID Column", !ZdbEngineCreateColumn("ID", ZdbStandardTypes->intType, 1, &(columns[0])));

41 TEST_ASSERT("Create Name Column", !ZdbEngineCreateColumn("Name", ZdbStandardTypes->varcharType, 0, &(columns[1])));

152 // Test sizeof

153 size_t size;

154 TEST_ASSERT("sizeof", !ZdbTypeSizeof(ZdbStandardTypes->intType, NULL, &size));

155 TEST_ASSERT("sizeof check", size == sizeof(int));

156 TEST_ASSERT("sizeof unsupported", ZdbTypeSizeof(ZdbStandardTypes->intType, &a, &size) == ZDB_RESULT_UNSUPPORTED);

157

158 // Test From String

310

311 /* Collect the values for this row as a string */

312 void** values = calloc(db->tables[table]->columnCount, sizeof(void*));

313

314 int i;

ttap3_util.c (https://gitlab.com/farmos_public/libtp3) C · 958 lines

234 TP3_SC_NOT_PROPER_DEVTYPE);

235

236 memset ((void *)pnode, 0x00, sizeof (tp3_nodedata_t));

237

238 pnode->numofdev = numofdev;

240

241 if (numofdev > 0) {

242 pnode->gids = (int *)MALLOC(sizeof(int) * numofdev);

243 pnode->stats = (tp3_devstat_t *)MALLOC(sizeof(tp3_devstat_t) * numofdev);

244 pnode->envs = (int *)MALLOC(sizeof(int) * numofdev);

245 if (devtype == TP3_DEV_SENSOR) {

246 pnode->attrs = (void *)MALLOC(sizeof(tp3_senattr_t) * numofdev);

247 } else {

248 pnode->attrs = (void *)MALLOC(sizeof(tp3_actattr_t) * numofdev);

249 }

250

rpc_gateway.h (https://github.com/adamgreen/gcc4mbed.git) C Header · 272 lines

46 */

47 #define UVISOR_BOX_RPC_GATEWAY_SYNC(box_name, gw_name, fn_name, fn_ret, ...) \

48 UVISOR_STATIC_ASSERT(sizeof(fn_ret) <= sizeof(uint32_t), gw_name ## _return_type_too_big); \

49 _UVISOR_BOX_RPC_GATEWAY_ARG_CHECK(gw_name, __VA_ARGS__) \

50 _UVISOR_BOX_RPC_GATEWAY_SYNC_CALLER_DECL(fn_name, gw_name ## _rpc_gateway, __VA_ARGS__) \

93 */

94 #define UVISOR_BOX_RPC_GATEWAY_ASYNC(box_name, gw_name, fn_name, fn_ret, ...) \

95 UVISOR_STATIC_ASSERT(sizeof(fn_ret) <= sizeof(uint32_t), gw_name ## _return_type_too_big); \

96 _UVISOR_BOX_RPC_GATEWAY_ARG_CHECK(gw_name, __VA_ARGS__) \

97 _UVISOR_BOX_RPC_GATEWAY_ASYNC_CALLER_DECL(fn_name, gw_name ## _rpc_gateway, __VA_ARGS__) \

127

128 #define _UVISOR_BOX_RPC_GATEWAY_ARG_CHECK_1(gw_name, p0_type) \

129 UVISOR_STATIC_ASSERT(sizeof(p0_type) <= sizeof(uint32_t), gw_name ## _param_0_too_big);

130

131 #define _UVISOR_BOX_RPC_GATEWAY_ARG_CHECK_2(gw_name, p0_type, p1_type) \

test_bytearray.hpp (https://github.com/leocassarani/rubinius.git) C++ Header · 202 lines

26

27 void test_create() {

28 size_t mag = sizeof(Object*);

29 ByteArray* b;

30

55 void test_size() {

56 ByteArray* b = ByteArray::create(state, 1);

57 TS_ASSERT_EQUALS(b->size(state), Fixnum::from(sizeof(Object*)));

58 }

59

object.c (https://github.com/eagafonov/jabberd2.git) C · 326 lines

40

41 p = pool_new();

42 os = (os_t) pmalloco(p, sizeof(struct os_st));

43

44 os->p = p;

85 log_debug(ZONE, "creating new object");

86

87 o = (os_object_t) pmalloco(os->p, sizeof(struct os_object_st));

88 o->os = os;

89

136 log_debug(ZONE, "adding field %s (val %x type %d) to object", key, val, type);

137

138 osf = pmalloco(o->os->p, sizeof(struct os_field_st));

139 osf->key = pstrdup(o->os->p, key);

140

SkNx.h (https://gitlab.com/Atomic-ROM/external_skia) C Header · 294 lines

88 template <int N, typename T>

89 class SkNf {

90 typedef SkNb<N, sizeof(T)> Nb;

91

92 static int32_t MyNi(float);

201 template <typename T>

202 class SkNf<1,T> {

203 typedef SkNb<1, sizeof(T)> Nb;

204

205 static int32_t MyNi(float);

JITInlineMethods.h (https://bitbucket.org/ultra_iter/qt-vtl.git) C Header · 867 lines

38 ALWAYS_INLINE void JIT::emitPutJITStubArg(RegisterID src, unsigned argumentNumber)

39 {

40 unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + JITSTACKFRAME_ARGS_INDEX;

41 poke(src, argumentStackOffset);

42 }

46 ALWAYS_INLINE void JIT::emitPutJITStubArgConstant(unsigned value, unsigned argumentNumber)

47 {

48 unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + JITSTACKFRAME_ARGS_INDEX;

49 poke(Imm32(value), argumentStackOffset);

50 }

54 ALWAYS_INLINE void JIT::emitPutJITStubArgConstant(void* value, unsigned argumentNumber)

55 {

56 unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + JITSTACKFRAME_ARGS_INDEX;

57 poke(ImmPtr(value), argumentStackOffset);

58 }

dt_cg.c (https://bitbucket.org/freebsd/freebsd-head/) C · 2007 lines ✨ Summary

This C code is part of a compiler’s intermediate representation (IR) generation process for a dynamic typing system. It generates machine-specific code for a given IR node, which represents an expression in the source code. The code creates and manages registers, handles different types of nodes (e.g., identifiers, integers), and appends instructions to a list of generated code.

47 dt_cg_node_alloc(uint_t label, dif_instr_t instr)

48 {

49 dt_irnode_t *dip = malloc(sizeof (dt_irnode_t));

50

51 if (dip == NULL)

72 dtrace_typeinfo_t dtt;

73

74 if (ctf_type_name(fp, type, n, sizeof (n)) == NULL ||

75 dt_type_lookup(n, &dtt) == -1 || (

76 dtt.dtt_ctfp == fp && dtt.dtt_type == type))

483

484 if (dstsize < srcsize)

485 n = sizeof (uint64_t) * NBBY - dstsize * NBBY;

486 else

487 n = sizeof (uint64_t) * NBBY - srcsize * NBBY;

userOnlineMapper.php (https://github.com/greevex/mzz-framework-blank-application.git) PHP · 175 lines

1 <?php

2 /**

3 * $URL: svn://svn.mzz.ru/mzz/trunk/system/modules/user/mappers/userOnlineMapper.php $

10 *

11 * @link http://www.mzz.ru

12 * @version $Id: userOnlineMapper.php 4039 2009-12-17 10:30:13Z striker $

13 */

14

131 $users = $this->searchAllByCriteria($criteria);

132

133 if (sizeof($users)) {

134 $userMapper = $toolkit->getMapper('user', 'user', 'user');

135 }

PickupLocationMapper.php (https://github.com/seosamba/ecommerce.git) PHP · 149 lines

1 <?php

2 /**

3 * PickupLocation.php

85 $data = $this->getDbTable()->fetchAll($select)->toArray();

86 return array(

87 'totalRecords' => sizeof($data),

88 'data' => array_slice($data, $offset, $limit),

89 'offset' => $offset,

descriptor.c (https://github.com/robins/postgres.git) C · 355 lines

21 push_assignment(char *var, enum ECPGdtype value)

22 {

23 struct assignment *new = (struct assignment *) mm_alloc(sizeof(struct assignment));

24

25 new->next = assignments;

81 return;

82

83 new = (struct descriptor *) mm_alloc(sizeof(struct descriptor));

84

85 new->next = descriptors;

333 };

334

335 strlcpy(descriptor_names[input], name, sizeof(descriptor_names[input]));

336 return &varspace[input];

337 }

MathLoader.php (https://github.com/drobbins/s3db.git) PHP · 133 lines

6 * - signing and sign validation

7 *

8 * PHP versions 4 and 5

9 *

10 * LICENSE: This source file is subject to version 3.0 of the PHP license

11 * that is available through the world-wide-web at the following URI:

12 * http://www.php.net/license/3_0.txt. If you did not receive a copy of

13 * the PHP License and are unable to obtain it through the web, please

18 * @author Alexander Valyalkin <valyala@gmail.com>

19 * @copyright 2005, 2006 Alexander Valyalkin

20 * @license http://www.php.net/license/3_0.txt PHP License 3.0

21 * @version 1.2.0b

22 * @link http://pear.php.net/package/Crypt_RSA

49 * @author Alexander Valyalkin <valyala@gmail.com>

50 * @copyright 2005, 2006 Alexander Valyalkin

51 * @license http://www.php.net/license/3_0.txt PHP License 3.0

52 * @link http://pear.php.net/package/Crypt_RSA

lr0.c (https://bitbucket.org/iorivur/freebsd-bhyve-with-suspend-resume.git) C · 599 lines

228 continue;

229

230 p = (core *)MALLOC(sizeof(core) + i * sizeof(short));

231 NO_SPACE(p);

232

299 n = (unsigned)(iend - isp1);

300

301 p = (core *)allocate((sizeof(core) + (n - 1) * sizeof(short)));

302 p->accessing_symbol = (Value_t) symbol;

303 p->number = (Value_t) nstates;

403 short *send;

404

405 p = (shifts *)allocate((sizeof(shifts) +

406 (unsigned)(nshifts - 1) * sizeof(short)));

451 if (count)

452 {

453 p = (reductions *)allocate((sizeof(reductions) +

454 (unsigned)(count - 1) *

455 sizeof(short)));

tait8741.c (https://github.com/joolswills/mameox.git) C · 360 lines

245 intf = taito8741intf;

246

247 //taito8741 = (I8741 *)osd_malloc(intf->num*sizeof(I8741));

248 //if( taito8741 == 0 ) return 1;

249

nested_struct1.c (https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk) C · 169 lines

85

86 #ifdef USING_MMAP

87 pcl = allocate_mmap (sizeof(ffi_closure));

88 #else

89 pcl = &cl;

hstore_gin.c (https://gitlab.com/kajan-rezg/postgres) C · 212 lines

54 *nentries = 2 * count;

55 if (count)

56 entries = (Datum *) palloc(sizeof(Datum) * 2 * count);

57

58 for (i = 0; i < count; ++i)

104

105 *nentries = 1;

106 entries = (Datum *) palloc(sizeof(Datum));

107 item = makeitem(VARDATA_ANY(query), VARSIZE_ANY_EXHDR(query), KEYFLAG);

108 entries[0] = PointerGetDatum(item);

123 &key_datums, &key_nulls, &key_count);

124

125 entries = (Datum *) palloc(sizeof(Datum) * key_count);

126

127 for (i = 0, j = 0; i < key_count; ++i)

freebsd32_util.h (https://bitbucket.org/freebsd/freebsd-base.git) C Header · 124 lines

55

56 #define FREEBSD32_PS_STRINGS \

57 (FREEBSD32_USRSTACK - sizeof(struct freebsd32_ps_strings))

58

59 extern struct sysent freebsd32_sysent[];

74 static int syscallname##_syscall32 = FREEBSD32_SYS_##syscallname; \

75 static struct sysent syscallname##_sysent32 = { \

76 (sizeof(struct syscallname ## _args ) \

77 / sizeof(register_t)), \

84 #define SYSCALL32_INIT_HELPER_F(syscallname, flags) { \

85 .new_sysent = { \

86 .sy_narg = (sizeof(struct syscallname ## _args ) \

87 / sizeof(register_t)), \

94 #define SYSCALL32_INIT_HELPER_COMPAT_F(syscallname, flags) { \

95 .new_sysent = { \

96 .sy_narg = (sizeof(struct syscallname ## _args ) \

97 / sizeof(register_t)), \

map.c (https://github.com/kevjames3/linux-2.6.git) C · 237 lines

42 char *cwd, int cwdlen)

43 {

44 struct map *self = malloc(sizeof(*self));

45

46 if (self != NULL) {

54

55 if (n == cwdlen) {

56 snprintf(newfilename, sizeof(newfilename),

57 ".%s", filename + n);

58 filename = newfilename;

63

64 if (anon) {

65 snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", event->pid);

66 filename = newfilename;

67 }

mask.c (https://github.com/nickg/nvc.git) C · 204 lines

27 m->size = size;

28 if (size > 64)

29 m->ptr = xcalloc_array((size + 63) / 64, sizeof(uint64_t));

30 else

31 m->bits = 0;

top860.c (https://bitbucket.org/kasimling/u-boot.git) C · 148 lines

92

93 upmconfig (UPMA, (uint *) edo_60ns_25MHz_tbl,

94 sizeof (edo_60ns_25MHz_tbl) / sizeof (uint));

95 memctl->memc_mptpr = 0x0200;

96 memctl->memc_mamr = 0x0ca20330;

streaming-sampler.h (https://gitlab.com/s9perween/Impala) C Header · 150 lines

48 current_sample_total_time_(0) {

49 DCHECK_LE(samples_collected_, MAX_SAMPLES);

50 memcpy(samples_, &initial_samples[0], sizeof(T) * samples_collected_);

51 }

52

103 period_ = period;

104 samples_collected_ = samples.size();

105 memcpy(samples_, &samples[0], sizeof(T) * samples_collected_);

106 current_sample_sum_ = 0;

107 current_sample_count_ = 0;

fb_nand.c (https://gitlab.com/gmbnomis/u-boot) C · 229 lines

70 int ret;

71

72 memset(&opts, 0, sizeof(opts));

73 opts.offset = part->offset;

74 opts.length = part->size;

apc-handle.cpp (https://gitlab.com/iranjith4/hhvm) C++ · 245 lines

1 /*

2 +----------------------------------------------------------------------+

3 | HipHop for PHP |

4 +----------------------------------------------------------------------+

5 | Copyright (c) 2010-2016 Facebook, Inc. (http://www.facebook.com) |

6 +----------------------------------------------------------------------+

7 | This source file is subject to version 3.01 of the PHP license, |

8 | that is bundled with this package in the file LICENSE, and is |

9 | available through the world-wide-web at the following url: |

10 | http://www.php.net/license/3_01.txt |

11 | If you did not receive a copy of the PHP license and are unable to |

12 | obtain it through the world-wide-web, please send a note to |

13 | license@php.net so we can mail you a copy immediately. |

14 +----------------------------------------------------------------------+

15 */

Test_mindot.cpp (https://bitbucket.org/wlitzlbauer/spacecrafts_old.git) C++ · 269 lines

39 {

40 // Init an array flanked by guard pages

41 btSimdFloat4 *data = (btSimdFloat4*) GuardCalloc( 1, MAX_SIZE * sizeof(btSimdFloat4), NULL );

42 float *fp = (float*) data;

43 long correct, test;

make_rsn.c (https://bitbucket.org/odellus/stage.git) C · 240 lines

181 pos_t *build_pos_list(void)

182 {

183 pos_list = (pos_t*)malloc(sizeof(pos_t) * num_nodes);

184

185 if(!strcmp(shape_name, "random")) return make_random();

TinyBooter.cpp (https://bitbucket.org/pmfsampaio/netmf-lpc.git) C++ · 139 lines

89 cmd.m_source = CLR_DBG_Commands::Monitor_Ping::c_Ping_Source_TinyBooter;

90

91 g_eng.m_controller.SendProtocolMessage( CLR_DBG_Commands::c_Monitor_Ping, WP_Flags::c_NonCritical, sizeof(cmd), (UINT8*)&cmd );

92 }

93

rmd160.c (https://github.com/srikard/linux.git) C · 367 lines

266 rctx->state[4] = RMD_H4;

267

268 memset(rctx->buffer, 0, sizeof(rctx->buffer));

269

270 return 0;

275 {

276 struct rmd160_ctx *rctx = shash_desc_ctx(desc);

277 const u32 avail = sizeof(rctx->buffer) - (rctx->byte_count & 0x3f);

278

279 rctx->byte_count += len;

281 /* Enough space in buffer? If so copy and we're done */

282 if (avail > len) {

283 memcpy((char *)rctx->buffer + (sizeof(rctx->buffer) - avail),

284 data, len);

285 goto out;

cms_item_list.php (https://gitlab.com/anurat/earththailand) PHP · 516 lines

1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

2

3 /**

298 ->find();

299

300 $window = min( $window, sizeof( $ils ) );

301

302 $il1 = $ils[0];

380

381 $table_ids = explode( ',', $mm_table_id );

382 $reorder_no = sizeof( $table_ids );

383 $reorder_highest_pos = $this->_get_reorder_highest_pos( $table, $table_ids );

384 echo "\nreorder highest pos =" .$reorder_highest_pos;

patch-bgpd_buffer.c (https://github.com/vongrippen/pfsense-tools.git) C · 234 lines

158 - if ((n = write(sock, buf->buf + buf->rpos,

159 - buf->size - buf->rpos)) == -1) {

160 + bzero(&iov, sizeof(iov));

161 + TAILQ_FOREACH(buf, &msgbuf->bufs, entry) {

162 + if (i >= IOV_MAX)

207 union {

208 - struct cmsghdr hdr;

209 - char buf[CMSG_SPACE(sizeof(int))];

210 + struct cmsghdr hdr;

211 + char buf[CMSG_SPACE(sizeof(int))];

212 } cmsgbuf;

213

214 bzero(&iov, sizeof(iov));

215 @@ -167,7 +229,7 @@ msgbuf_write(struct msgbuf *msgbuf)

216 if (i >= IOV_MAX)

cleanblog.php (https://github.com/katzgrau/notes.git) PHP · 114 lines

5 <title><?= $site->display_name ?> - <?= $pageContent->page_title ?></title>

6

7 <?php $this->load->helper('url'); ?>

8 <?php $this->load->helper( config_item('uploads_strategy_helper') ); ?>

37 <!-- Main Navigation -->

38 <ul id="nav">

39 <?php foreach( $sitePageMeta as $page ): ?>

40 <li <?php if($page->page_title == $pageContent->page_title) echo 'id="active"'; ?>><a href="<?= base_url() ?><?= $site->site_name ?>/<?= $page->page_slug ?>"><?= $page->page_title ?></a></li>

64 <?= $site->display_name ?>

65 </div>

66 <?php if( sizeof( $files ) > 0 ): ?>

67 <h4>Attachments</h4>

68 <ul class="side-nav">

73 <?php endif; ?>

74

75 <?php if( sizeof( $links ) > 0 ): ?>

76 <h4>Links</h4>

77 <ul class="side-nav">

sched_autogroup.c (https://bitbucket.org/androidarmv6/android_kernel_samsung_msm7x27.git) C · 230 lines

44 static inline struct autogroup *autogroup_create(void)

45 {

46 struct autogroup *ag = kzalloc(sizeof(*ag), GFP_KERNEL);

47 struct task_group *tg;

48

2.cc (https://bitbucket.org/pizzafactory/blackfin-toolchain.git) C++ · 147 lines

41 const char title04[] = "never as tired as when i'm waking up";

42

43 const size_t N1 = sizeof(title01);

44 const size_t N2 = sizeof(title02);

45 const size_t N3 = sizeof(title03);

46 const size_t N4 = sizeof(title04);

OutputLinkTest.php (https://gitlab.com/ElvisAns/tiki) PHP · 280 lines

62 $link->setIdentifier('TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabase');

63

64 $this->assertLinkIs('<a href="tiki-editpage.php?page=TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSize" title="Create page: TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSize" class="wiki wikinew text-danger tips">TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabase</a>', $link->getHtml());

65 }

66

76

77 $link = new WikiParser_OutputLink();

78 $link->setIdentifier('TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeTHISMUSTBETRIMMED');

79 $link->setWikiLookup([$this, 'getPageInfo']);

80 $link->setWikiLinkBuilder([$this, 'getWikiLink']);

81

82 $this->assertLinkIs('<a href="TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSize" title="Testing" class="wiki wiki_page">TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeTHISMUSTBETRIMMED</a>', $link->getHtml());

83 }

84

ParameterTest.class.php (https://github.com/treuter/xp-framework.git) PHP · 506 lines

1 <?php

2 /* This class is part of the XP framework

3 *

144 $params= $this->getClass()->getMethod('setName')->getParameters();

145 $this->assertArray($params);

146 $this->assertEquals(1, sizeof($params));

147 $this->assertClass($params[0], 'lang.reflect.Parameter');

148 }

156 $params= $this->getClass()->getMethod('serialize')->getParameters();

157 $this->assertArray($params);

158 $this->assertEquals(2, sizeof($params));

159 $this->assertClass($params[0], 'lang.reflect.Parameter');

160 $this->assertClass($params[1], 'lang.reflect.Parameter');

msm_camera_eeprom.c (https://bitbucket.org/anders3408/kernel_oppo_find5.git) C · 196 lines

89 if (copy_from_user(&cdata,

90 (void *)argp,

91 sizeof(struct msm_eeprom_cfg_data)))

92 return -EFAULT;

93 mutex_lock(e_ctrl->eeprom_mutex);

104 if (copy_to_user((void *)argp,

105 &cdata,

106 sizeof(struct msm_eeprom_cfg_data)))

107 rc = -EFAULT;

108 break;

117 if (copy_to_user((void *)argp,

118 &cdata,

119 sizeof(struct msm_eeprom_cfg_data)))

120 rc = -EFAULT;

121 break;

XLS.class.php (https://github.com/lievenjanssen/The-DataTank.git) PHP · 141 lines

1 <?php

2 /**

3 * This class handles a XLS file

8 * @author Lieven Janssen

9 */

10 include_once("model/resources/strategies/ATabularData.class.php");

11

12 class XLS extends ATabularData {

13

14 public function __construct() {

15 if(Config::$PHPEXCEL_IOFACTORY_PATH!="") {

16 if(!file_exists(Config::$PHPEXCEL_IOFACTORY_PATH)){

17 throw new NotFoundTDTException("Could not include " . Config::$PHPEXCEL_IOFACTORY_PATH);

18 } else {

19 include_once(Config::$PHPEXCEL_IOFACTORY_PATH);

MmapAllocator.h (https://bitbucket.org/xwd/moses-csp.git) C Header · 204 lines

116 size_type max_size () const throw()

117 {

118 return std::numeric_limits<size_t>::max() / sizeof(value_type);

119 }

120

121 pointer allocate (size_type num, const void* = 0)

122 {

123 m_map_size = num * sizeof(T);

124

125 if(!m_fixed)

150 {

151 if(!m_fixed) {

152 munmap(p, num * sizeof(T));

153 }

154 else {

Wstringop-overflow-11.c (https://gitlab.com/adotout/gcc) C · 321 lines

186 d += off2; \

187 const char str[] = "0123456789"; \

188 const char *s = str + sizeof str - 1 - n; \

189 strcpy (d, s); \

190 sink (d); \

COpenGL.h (https://github.com/RJPalmer/OpenGLWinForm.git) C Header · 202 lines

128 {

129 PIXELFORMATDESCRIPTOR pfd = {

130 sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd

131

132 1, // version number

s3c2410_wdt.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 552 lines ✨ Summary

This C code implements a watchdog timer driver for the S3C2410 processor. It provides a platform device driver that manages the watchdog’s state, including enabling and disabling it, saving and restoring its state during suspend/resume operations, and handling shutdown. The driver is designed to work with the Linux kernel and can be used in various applications requiring reliable system startup and shutdown.

283 case WDIOC_GETSUPPORT:

284 return copy_to_user(argp, &s3c2410_wdt_ident,

285 sizeof(s3c2410_wdt_ident)) ? -EFAULT : 0;

286 case WDIOC_GETSTATUS:

287 case WDIOC_GETBOOTSTATUS:

cfm.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 628 lines ✨ Summary

This C code is part of a network management system, specifically for managing switches and routers. It appears to be responsible for handling the configuration and state transitions of a switch’s ports and interfaces. The code defines various paths and states for different scenarios, such as isolated mode, wrap-around modes, and through modes. It also provides functions for getting the input and output ports of a MAC interface based on its current state.

601 case SC0_ISOLATED :

602 path = smc->s.sas ? path_iso_s : path_iso ;

603 len = smc->s.sas ? sizeof(path_iso_s) : sizeof(path_iso) ;

604 break ;

605 case SC9_C_WRAP_A :

606 path = path_wrap_a ;

607 len = sizeof(path_wrap_a) ;

608 break ;

609 case SC10_C_WRAP_B :

610 path = path_wrap_b ;

611 len = sizeof(path_wrap_b) ;

612 break ;

613 case SC4_THRU_A :

JNIUtilityPrivate.cpp (git://github.com/CyanogenMod/android_external_webkit.git) C++ · 294 lines ✨ Summary

This C++ code is part of a JavaScript engine that converts JavaScript values to Java values for use on Android platforms. It handles various data types, including arrays and objects, and provides a way to convert them into their corresponding Java representations. The conversion process involves checking the type of the input value and selecting the appropriate Java representation based on its type.

221 } else if (!result.l)

222 // ANDROID

223 memset(&result, 0, sizeof(jvalue)); // Handle it the same as a void case

224 }

225 break;

280 {

281 // ANDROID

282 memset(&result, 0, sizeof(jvalue));

283 }

284 break;

stdbool.m4 (git://github.com/xbmc/xbmc.git) m4 · 116 lines ✨ Summary

This M4 code checks if a compiler supports stdbool.h that conforms to C99 standards. It compiles a test program with various boolean expressions and checks for errors, then defines macros based on the results. If the standard library is supported, it defines HAVE_STDBOOL_H to 1, indicating that the compiler meets the C99 requirements.

69 char f[(_Bool) 0.0 == false ? 1 : -1];

70 char g[true];

71 char h[sizeof (_Bool)];

72 char i[sizeof s.t];

73 enum { j = false, k = true, l = false * true, m = true * 256 };

74 _Bool n[m];

75 char o[sizeof n == m * sizeof n[0] ? 1 : -1];

76 char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];

77 #if defined __xlc__ || defined __GNUC__

proc.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 168 lines ✨ Summary

This C code implements a procfs interface for displaying information about cryptographic algorithms used in Linux. It provides a command-line interface to view details such as algorithm names, drivers, priorities, and flags. The code also handles initialization and cleanup of the procfs interface, including registration and deregistration of sysctl tables and removal of the “crypto” proc entry when exiting.

29 .procname = "fips_enabled",

30 .data = &fips_enabled,

31 .maxlen = sizeof(int),

32 .mode = 0444,

33 .proc_handler = &proc_dointvec

.cvsignore (https://swig.svn.sourceforge.net/svnroot/swig) Unknown · 336 lines

207 return_value_scope

208 rname

209 sizeof_pointer

210 sizet

211 smart_pointer_const

memory.c (https://swig.svn.sourceforge.net/svnroot/swig) C · 220 lines ✨ Summary

This C code implements a memory management system for objects, including allocation and deallocation of memory blocks. It creates a pool of memory and manages a list of free objects to reduce fragmentation. The DohObjMalloc function allocates memory for new objects, while DohObjFree frees the allocated memory. The DohMemoryDebug function displays statistics on memory usage and object types.

44 CreatePool() {

45 Pool *p = 0;

46 p = (Pool *) DohMalloc(sizeof(Pool));

47 assert(p);

48 p->ptr = (DohBase *) DohMalloc(sizeof(DohBase)*PoolSize);

49 assert(p->ptr);

50 memset(p->ptr,0,sizeof(DohBase)*PoolSize);

51 p->len = PoolSize;

52 p->blen = PoolSize*sizeof(DohBase);

85 /*

86 pptr = (char *) p->ptr;

87 if ((cptr >= pptr) && (cptr < (pptr+(p->current*sizeof(DohBase))))) return 1; */

88 p = p->next;

89 }

percpu.h (http://photon-android.googlecode.com/svn/) C++ Header · 247 lines ✨ Summary

This C header file provides a set of functions and macros for managing per-cpu data structures, which are shared among multiple CPUs in a system. It allows for dynamic allocation and deallocation of memory for per-cpu variables, as well as optimized access to these variables. The code is designed to be platform-agnostic and can be used on various architectures.

189 #endif /* CONFIG_SMP */

190

191 #define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \

192 __alignof__(type))

193

csr1212.c (http://photon-android.googlecode.com/svn/) C · 1468 lines ✨ Summary

This C code is part of a firmware implementation for a specific CPU architecture, likely the ARMv7-A. It reads and parses configuration data from a Config ROM image stored in memory. The code creates a hierarchical data structure to represent the configuration data, including directories, leaf entries, and cache regions. It also handles errors and invalid data, returning an error code if necessary.

85

86

87 #define quads_to_bytes(_q) ((_q) * sizeof(u32))

88 #define bytes_to_quads(_b) DIV_ROUND_UP(_b, sizeof(u32))

167 struct csr1212_csr *csr;

168

169 csr = CSR1212_MALLOC(sizeof(*csr));

170 if (!csr)

171 return NULL;

216 return NULL;

217

218 kv = CSR1212_MALLOC(sizeof(*kv));

219 if (!kv)

220 return NULL;

338 BUG_ON(!kv || !dir || dir->key.type != CSR1212_KV_TYPE_DIRECTORY);

339

340 dentry = CSR1212_MALLOC(sizeof(*dentry));

341 if (!dentry)

342 return -ENOMEM;

unicode.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 493 lines ✨ Summary

This C code is part of a file system implementation, specifically for handling Unicode file names on Unix-like systems. It translates file names from a proprietary format to a standard format, replacing non-standard characters with marks and encoding special characters using hexadecimal codes. The code also handles file extensions and CRC (Cyclic Redundancy Check) values.

35 return 0;

36

37 memset(dest, 0, sizeof(struct ustr));

38 memcpy(dest->u_name, src, strlen);

39 dest->u_cmpID = 0x08;

54 BUG_ON(size < 2);

55

56 usesize = min_t(size_t, ptr[size - 1], sizeof(dest->u_name));

57 usesize = min(usesize, size - 2);

58 dest->u_cmpID = ptr[0];

59 dest->u_len = usesize;

60 memcpy(dest->u_name, ptr + 1, usesize);

61 memset(dest->u_name + usesize, 0, sizeof(dest->u_name) - usesize);

62

63 return 0;

twofish.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 215 lines ✨ Summary

This C code implements a Twofish cipher algorithm for encryption and decryption of blocks of data. It provides a generic driver for the Twofish algorithm, which can be used in various cryptographic applications. The code defines a struct twofish_ctx to hold the algorithm’s state, and functions twofish_encrypt and twofish_decrypt to perform the encryption and decryption operations, respectively.

186 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,

187 .cra_blocksize = TF_BLOCK_SIZE,

188 .cra_ctxsize = sizeof(struct twofish_ctx),

189 .cra_alignmask = 3,

190 .cra_module = THIS_MODULE,

ILTF.cc (https://freespeech.svn.sourceforge.net/svnroot/freespeech) C++ · 134 lines ✨ Summary

This C++ code implements a digital signal processing (DSP) node called ILTF, which performs a specific filter operation on input data. It takes two inputs: INPUT and FILTER, and produces an output based on these inputs. The filter is applied to the input data with a specified delay, and the output status is set to valid if the input data is valid.

45

46

47 //float *i_heap = ((float *)malloc( sizeof(float) * 2048))+2047;

48

49 class ILTF : public FrameOperation {

xfs_ag.h (http://omnia2droid.googlecode.com/svn/trunk/) C Header · 254 lines ✨ Summary

This C header file defines a set of data structures and constants for the XFS (extensible filesystem) implementation. It provides definitions for various components, such as allocation groups, inode radix trees, and file system blocks, which are used to manage the filesystem’s metadata and data storage. The code is part of the Linux kernel’s XFS module.

154 #define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))

155 #define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))

156 #define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t))

157 #define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp))

158

eloop_win.c (https://bitbucket.org/freebsd/freebsd-head/) C · 612 lines ✨ Summary

This C code implements an event-driven I/O system, allowing multiple tasks to wait for specific events (e.g., network connections, file reads) and handling timeouts, termination, and destruction of the system. It provides functions for creating and managing events, waiting for events, and destroying the system, with features like signal processing and synchronization.

80 int eloop_init(void)

81 {

82 os_memset(&eloop, 0, sizeof(eloop));

83 eloop.num_handles = 1;

84 eloop.handles = os_malloc(eloop.num_handles *

85 sizeof(eloop.handles[0]));

86 if (eloop.handles == NULL)

87 return -1;

106 return 0;

107 n = os_realloc(eloop.handles,

108 eloop.num_handles * 2 * sizeof(eloop.handles[0]));

109 if (n == NULL)

110 return -1;

path_table.cpp (http://hadesmem.googlecode.com/svn/trunk/) C++ · 0 lines ✨ Summary

This C++ code generates an HTML table comparing path decomposition results for POSIX and Windows operating systems. It reads input paths from a file, decomposes them into their constituent parts using different constructors, and outputs the results to another file in HTML format, highlighting any discrepancies between the two implementations. The output is intended to facilitate comparison of the two systems’ behavior.

172 outfile << "<tr>\n<td><code>\"" << test_case << "\"</code></td>\n";

173

174 for ( int i = 0; i < sizeof(column)/sizeof(column_abc&); ++i )

175 {

176 do_cell( test_case, i );

197 outfile << "<tr><td><b>Constructor<br>argument</b></td>\n";

198

199 for ( int i = 0; i < sizeof(column)/sizeof(column_abc&); ++i )

200 {

201 outfile << "<td><b>" << column[i]->heading() << "</b></td>\n";

qstringbuilder.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 196 lines

157 if (QString::codecForCStrings && len) {

158 QString tmp = QString::fromAscii(a, len > 0 ? len - 1 : -1);

159 memcpy(out, reinterpret_cast<const char *>(tmp.constData()), sizeof(QChar) * tmp.size());

160 out += tmp.length();

161 return;

IconDatabase.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 2250 lines

376 0xFC, 0x80, 0x00, 0x00, 0x27, 0x10, 0x00, 0x0A, 0xFC, 0x80, 0x00, 0x00, 0x27, 0x10 };

377

378 DEFINE_STATIC_LOCAL(RefPtr<SharedBuffer>, defaultIconBuffer, (SharedBuffer::create(defaultIconData, sizeof(defaultIconData))));

379 defaultIconRecord->setImageData(defaultIconBuffer);

380 }

scm.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 317 lines ✨ Summary

This C code implements a part of the Linux kernel’s file descriptor management system, specifically for sending file descriptors over network connections using the SCM_RIGHTS message type. It allows a process to send its open files to another process, which can then receive and use them without having to create new file descriptors. The code provides functions for creating, manipulating, and sending file descriptor lists between processes.

64 int i, num;

65

66 num = (cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr)))/sizeof(int);

67

68 if (num <= 0)

74 if (!fpl)

75 {

76 fpl = kmalloc(sizeof(struct scm_fp_list), GFP_KERNEL);

77 if (!fpl)

78 return -ENOMEM;

140 err = -EINVAL;

141

142 /* Verify that cmsg_len is at least sizeof(struct cmsghdr) */

143 /* The first check was omitted in <= 2.2.5. The reasoning was

144 that parser checks cmsg_len in any case, so that

packet_history.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 490 lines ✨ Summary

This C code implements a timestamp-based congestion control algorithm for TCP-like protocols, specifically DCCP (Datagram Congestion Control Protocol). It manages a ring buffer to store timestamp and CCVal values, sampling RTT (Round-Trip Time) from these values to adjust congestion control parameters. The code provides functions for allocating and purging the ring buffer, as well as computing RTT samples based on timestamp and CCVal values.

61 {

62 tfrc_tx_hist_slab = kmem_cache_create("tfrc_tx_hist",

63 sizeof(struct tfrc_tx_hist_entry),

64 0, SLAB_HWCACHE_ALIGN, NULL);

65 return tfrc_tx_hist_slab == NULL ? -ENOBUFS : 0;

136 {

137 tfrc_rx_hist_slab = kmem_cache_create("tfrc_rxh_cache",

138 sizeof(struct tfrc_rx_hist_entry),

139 0, SLAB_HWCACHE_ALIGN, NULL);

140 return tfrc_rx_hist_slab == NULL ? -ENOBUFS : 0;

memory.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 93 lines ✨ Summary

This C code initializes and manages memory allocation for a distributed lock manager (DLM). It creates a cache for allocating large blocks of memory, allocates and frees memory for DLM structures such as dlm_lkb and dlm_rsb, and handles user data associated with these allocations. The code is part of an operating system or kernel implementation.

23 int ret = 0;

24

25 lkb_cache = kmem_cache_create("dlm_lkb", sizeof(struct dlm_lkb),

26 __alignof__(struct dlm_lkb), 0, NULL);

27 if (!lkb_cache)

58 DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,);

59

60 r = kzalloc(sizeof(*r) + namelen, ls->ls_allocation);

61 return r;

62 }

qdrawhelper_sse2.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 544 lines

208 {

209 if (const_alpha == 255) {

210 ::memcpy(dst, src, length * sizeof(uint));

211 } else {

212 const int ialpha = 255 - const_alpha;

410 {

411 quint32 *dest = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x;

412 const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32);

413

414 const __m128i c128 = _mm_set1_epi32(color);

462 const quint16 c = qt_colorConvert<quint16, quint32>(color, 0);

463 quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(y)) + x;

464 const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);

465

466 const __m128i c128 = _mm_set1_epi16(c);

traps.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 768 lines ✨ Summary

This C code defines a set of exception handlers for a Linux kernel, which are triggered when specific conditions occur during execution. The handlers catch and handle exceptions such as stack overflows, division by zero, and data corruption, among others. They print error messages, trigger system calls, and perform other necessary actions to prevent the program from crashing or causing further damage.

87 while (1) {

88 sp = sp & PSW_ADDR_INSN;

89 if (sp < low || sp > high - sizeof(*sf))

90 return sp;

91 sf = (struct stack_frame *) sp;

98 if (!sp)

99 break;

100 if (sp <= low || sp > high - sizeof(*sf))

101 return sp;

102 sf = (struct stack_frame *) sp;

106 /* Zero backchain detected, check for interrupt frame. */

107 sp = (unsigned long) (sf + 1);

108 if (sp <= low || sp > high - sizeof(*regs))

109 return sp;

110 regs = (struct pt_regs *) sp;

csharp.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 167 lines

121 <KEYWORD1>return</KEYWORD1>

122 <KEYWORD1>sealed</KEYWORD1>

123 <KEYWORD1>sizeof</KEYWORD1>

124 <KEYWORD1>stackalloc</KEYWORD1>

125 <KEYWORD1>static</KEYWORD1>

window.c (https://freespeech.svn.sourceforge.net/svnroot/freespeech) C · 67 lines ✨ Summary

This C code implements a window function for audio processing, specifically for the Ogg Vorbis codec. It creates an array of double values representing a sinusoidal window shape, which is used to modify audio signals in the MDCT (Modulated Discrete Cosine Transform) algorithm. The vorbis_window function takes parameters such as window type and size, and returns a dynamically allocated array of the calculated window values.

26

27 double *_vorbis_window(int type, int window,int left,int right){

28 double *ret=calloc(window,sizeof(double));

29

30 switch(type){

hts_strtab.h (git://github.com/xbmc/xbmc.git) C Header · 62 lines ✨ Summary

This C header file provides a simple string-to-value and value-to-string mapping system for use with TVHeadend, a digital television software. It defines two macros, str2val and val2str, which take a string or value as input and return the corresponding mapped value or string from an array of struct strtab. The array is initialized with strings and values in the header file itself.

42 }

43

44 #define str2val(str, tab) str2val0(str, tab, sizeof(tab) / sizeof(tab[0]))

45

46 static const char * val2str0(int val, struct strtab tab[], int l)

57 }

58

59 #define val2str(val, tab) val2str0(val, tab, sizeof(tab) / sizeof(tab[0]))

60

61 #endif /* STRTAB_H_ */

pspUsbGpsSatInfo.java (http://jpcsp.googlecode.com/svn/trunk/) Java · 57 lines

22 */

23 public class pspUsbGpsSatInfo extends pspAbstractMemoryMappedStructure {

24 public static final int SIZEOF = 8;

25 public int id;

26 public int elevation;

51

52 @Override

53 public int sizeof() {

54 return SIZEOF;

mac_scsi.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 599 lines ✨ Summary

This C code defines a SCSI driver for the NCR5380 controller used in Macintosh computers. It provides functions for detecting and releasing devices, handling commands, and interacting with the bus. The code includes various utility functions and data structures to manage the driver’s behavior. It is part of a larger SCSI module that integrates with other components to provide a complete SCSI interface.

268 /* Once we support multiple 5380s (e.g. DuoDock) we'll do

269 something different here */

270 instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));

271 #if NDEBUG

272 default_instance = instance;

wc_regex_traits.cpp (http://hadesmem.googlecode.com/svn/trunk/) C++ · 0 lines ✨ Summary

This C++ code defines a set of traits classes for working with regular expressions, specifically for wide character types (wchar_t). It provides functions for transforming and looking up collation names, checking character types, and converting values to integers based on radix. The code is designed to be used in conjunction with the Boost Regex library.

204 idx = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());

205 }

206 BOOST_ASSERT(idx+1 < static_cast<int>(sizeof(masks) / sizeof(masks[0])));

207 return masks[idx+1];

208 }

af_key.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 3845 lines ✨ Summary

This C code implements a part of the Linux kernel’s IPsec protocol, specifically for the PF_KEY socket family. It sets up and registers various components, including protocols, sockets, and networking subsystems, to enable secure communication over the internet. The code is used in conjunction with other IPsec modules to provide end-to-end encryption and authentication services.

422 switch (addr->sa_family) {

423 case AF_INET:

424 len = DIV_ROUND_UP(sizeof(*sp) + sizeof(*sin), sizeof(uint64_t));

425 if (sp->sadb_address_len != len ||

426 sp->sadb_address_prefixlen > 32)

429 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)

430 case AF_INET6:

431 len = DIV_ROUND_UP(sizeof(*sp) + sizeof(*sin6), sizeof(uint64_t));

432 if (sp->sadb_address_len != len ||

433 sp->sadb_address_prefixlen > 128)

906 sizeof(struct sadb_lifetime));

907 lifetime->sadb_lifetime_len =

908 sizeof(struct sadb_lifetime)/sizeof(uint64_t);

909 lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_CURRENT;

910 lifetime->sadb_lifetime_allocations = x->curlft.packets;

994 sa2 = (struct sadb_x_sa2 *) skb_put(skb, sizeof(struct sadb_x_sa2));

995 sa2->sadb_x_sa2_len = sizeof(struct sadb_x_sa2)/sizeof(uint64_t);

996 sa2->sadb_x_sa2_exttype = SADB_X_EXT_SA2;

997 if ((mode = pfkey_mode_from_xfrm(x->props.mode)) < 0) {

dmain2.d (git://github.com/AlexeyProkhin/druntime.git) D · 641 lines ✨ Summary

This D code is a runtime environment for executing user-provided code. It initializes and manages various components, such as memory management, exception handling, and thread synchronization. The code sets up a framework for running user-defined functions, including error handling and cleanup mechanisms. It also provides features like debugging and testing tools.

135 return null;

136

137 auto buf = cast(wchar_t*)malloc((len+1) * wchar_t.sizeof);

138 if (buf is null)

139 return null;

448 _STI_critical_init();

449

450 char[][] args = (cast(char[]*) alloca(argc * (char[]).sizeof))[0 .. argc];

451 version (Windows)

452 {

494

495 {

496 auto buff = cast(char[]*) alloca(argc * (char[]).sizeof + totalArgsLength);

497

498 char[][] argsCopy = buff[0 .. argc];

testclosure.c (git://github.com/stevedekorte/io.git) C · 71 lines ✨ Summary

This C code tests a closure function that takes a struct as an argument and prints its fields to the console. It creates a struct, prepares a CIF (C Interface File) for the closure, allocates memory for the closure, and then calls the closure with the struct as an argument, verifying that the output matches the expected values.

39 ffi_cif cif;

40 void *code;

41 ffi_closure *pcl = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure), &code);

42 ffi_type* cls_struct_fields0[5];

43 ffi_type cls_struct_type0;

gdk_color.e (git://github.com/tybor/Liberty.git) Specman e · 158 lines ✨ Summary

This is a Specman e code that defines a class GDK_COLOR which represents a color structure used by the Gdk library. It provides methods to create, copy, and dispose of colors, as well as access their red, green, and blue components. The class also provides low-level C-style functions for accessing and modifying these components.

20 struct_size: INTEGER is

21 external "C inline use <gdk/gdk.h>"

22 alias "sizeof(GdkColor)"

23 end

24

ngx_http_ajp_module.c (git://github.com/yaoweibin/nginx_ajp_module.git) C · 1071 lines ✨ Summary

This C code is part of an Nginx module for handling AJP (Apache Jserv Protocol) connections. It processes configuration options and initializes various data structures, such as cache zones and hash tables, to manage AJP requests. The code also sets up functions for hiding headers in responses and intercepting errors. Its purpose is to enable AJP protocol support in Nginx web servers.

410 if (n) {

411

412 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));

413

414 sc.cf = cf;

436 }

437

438 ngx_memzero(&u, sizeof(ngx_url_t));

439

440 u.url.len = url->len - add;

497 value[1].len++;

498

499 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));

500

501 sc.cf = cf;

pcnet_cs.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 1797 lines ✨ Summary

This C code defines a Linux kernel module that provides support for PCMCIA (Personal Computer Memory Card International) network cards, specifically those using the PCnet CS chipset. It registers a driver with the pcmcia_register_driver function and provides probe, remove, suspend, and resume functions to manage the device’s lifecycle. The code is part of the Linux kernel’s networking subsystem.

233 {

234 char *p = netdev_priv(dev);

235 return (pcnet_dev_t *)(p + sizeof(struct ei_device));

236 }

237

269

270 /* Create new ethernet device */

271 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t));

272 if (!dev) return -ENOMEM;

273 info = PRIV(dev);

glops.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 460 lines ✨ Summary

This C code defines a set of operations for managing file system locks and metadata. It provides a framework for handling different types of locks, including inode, rgrp, non-disk, iopen, flock, quota, and journal locks. The operations are implemented as structs that contain functions for lock acquisition, release, demotion, dumping, and other related tasks. The code is likely part of a larger file system implementation.

43 struct gfs2_trans tr;

44

45 memset(&tr, 0, sizeof(tr));

46 tr.tr_revokes = atomic_read(&gl->gl_ail_count);

47

50

51 /* A shortened, inline version of gfs2_trans_begin() */

52 tr.tr_reserved = 1 + gfs2_struct2blk(sdp, tr.tr_revokes, sizeof(u64));

53 tr.tr_ip = (unsigned long)__builtin_return_address(0);

54 INIT_LIST_HEAD(&tr.tr_list_buf);