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
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);
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
280 if (fabs(diff) >= 0.01)
281 scnprintf(buf, sizeof(buf), "%+4.2F%%", diff);
283 return scnprintf(hpp->buf, hpp->size, fmt, buf);
309 if (ratio > 0.0)
310 scnprintf(buf, sizeof(buf), "%+14.6F", ratio);
312 return scnprintf(hpp->buf, hpp->size, fmt, buf);
338 if (wdiff != 0)
339 scnprintf(buf, sizeof(buf), "%14ld", wdiff);
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;
229 memset(rctx->buffer, 0, sizeof(rctx->buffer));
231 return 0;
236 {
237 struct rmd128_ctx *rctx = shash_desc_ctx(desc);
238 const u32 avail = sizeof(rctx->buffer) - (rctx->byte_count & 0x3f);
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);
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 }
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
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']));
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);
116 Point(centreX, centreY + dimOn2 - dimOn4),
117 };
118 surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
119 fore.allocated, back.allocated);
134 Point(centreX - armSize, centreY + 1),
135 };
136 surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
137 fore.allocated, back.allocated);
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;
504 {
505 struct bmi_cmd cmd;
506 u32 cmdlen = sizeof(cmd.id) + sizeof(cmd.set_app_start);
507 int ret;
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
shake.c (https://github.com/arendst/Sonoff-Tasmota.git) C · 590 lines
sn76489.c (https://github.com/nicoya/OpenEmu.git) C · 307 lines
57 psg->output_channels = 0xFF; /* All Channels, both sides */
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;
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
parse-events.y (https://github.com/rjwysocki/linux-pm.git) Happy · 532 lines
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;
199 bmp_t *bvm2bmp(bvol_t *b) {
200 bmp_t *bmp = malloc(sizeof(bmp_t));
202 bmp_file_header_t file_header;
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);
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;
52 m_nShmSize = (nBitmapSize+7)/8 + sizeof(SHead);
53 m_nMaxIndex = nBitmapSize;
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));
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);
338 if (hdr == NULL) {
339 hdr = calloc(1, sizeof(*hdr));
340 hdr->name = strdup(name);
advanced_ftpserver.inc.php (https://github.com/BenBE/ispCP.git) PHP · 257 lines
1 <?php
3 // -------------------------------------------------------------------------------
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") . "&image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n";
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
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
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));
301 public static int Memcmp(byte* left, byte* right, int count)
derrec.c (https://github.com/zye/cmvs_dep.git) C · 359 lines
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.
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));
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);
158 // Test From String
311 /* Collect the values for this row as a string */
312 void** values = calloc(db->tables[table]->columnCount, sizeof(void*));
314 int i;
ttap3_util.c (https://gitlab.com/farmos_public/libtp3) C · 958 lines
234 TP3_SC_NOT_PROPER_DEVTYPE);
236 memset ((void *)pnode, 0x00, sizeof (tp3_nodedata_t));
238 pnode->numofdev = numofdev;
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 }
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__) \
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);
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
object.c (https://github.com/eagafonov/jabberd2.git) C · 326 lines
41 p = pool_new();
42 os = (os_t) pmalloco(p, sizeof(struct os_st));
44 os->p = p;
85 log_debug(ZONE, "creating new object");
87 o = (os_object_t) pmalloco(os->p, sizeof(struct os_object_st));
88 o->os = os;
136 log_debug(ZONE, "adding field %s (val %x type %d) to object", key, val, type);
138 osf = pmalloco(o->os->p, sizeof(struct os_field_st));
139 osf->key = pstrdup(o->os->p, key);
SkNx.h (https://gitlab.com/Atomic-ROM/external_skia) C Header · 294 lines
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.
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));
51 if (dip == NULL)
72 dtrace_typeinfo_t dtt;
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))
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 */
131 $users = $this->searchAllByCriteria($criteria);
133 if (sizeof($users)) {
134 $userMapper = $toolkit->getMapper('user', 'user', 'user');
135 }
PickupLocationMapper.php (https://github.com/seosamba/ecommerce.git) PHP · 149 lines
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));
25 new->next = assignments;
81 return;
83 new = (struct descriptor *) mm_alloc(sizeof(struct descriptor));
85 new->next = descriptors;
333 };
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;
230 p = (core *)MALLOC(sizeof(core) + i * sizeof(short));
231 NO_SPACE(p);
299 n = (unsigned)(iend - isp1);
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;
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
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);
58 for (i = 0; i < count; ++i)
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);
125 entries = (Datum *) palloc(sizeof(Datum) * key_count);
127 for (i = 0, j = 0; i < key_count; ++i)
freebsd32_util.h (https://bitbucket.org/freebsd/freebsd-base.git) C Header · 124 lines
56 #define FREEBSD32_PS_STRINGS \
57 (FREEBSD32_USRSTACK - sizeof(struct freebsd32_ps_strings))
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));
46 if (self != NULL) {
55 if (n == cwdlen) {
56 snprintf(newfilename, sizeof(newfilename),
57 ".%s", filename + n);
58 filename = newfilename;
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
top860.c (https://bitbucket.org/kasimling/u-boot.git) C · 148 lines
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 }
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
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
make_rsn.c (https://bitbucket.org/odellus/stage.git) C · 240 lines
TinyBooter.cpp (https://bitbucket.org/pmfsampaio/netmf-lpc.git) C++ · 139 lines
rmd160.c (https://github.com/srikard/linux.git) C · 367 lines
266 rctx->state[4] = RMD_H4;
268 memset(rctx->buffer, 0, sizeof(rctx->buffer));
270 return 0;
275 {
276 struct rmd160_ctx *rctx = shash_desc_ctx(desc);
277 const u32 avail = sizeof(rctx->buffer) - (rctx->byte_count & 0x3f);
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');
3 /**
298 ->find();
300 $window = min( $window, sizeof( $ils ) );
302 $il1 = $ils[0];
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;
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>
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; ?>
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
2.cc (https://bitbucket.org/pizzafactory/blackfin-toolchain.git) C++ · 147 lines
OutputLinkTest.php (https://gitlab.com/ElvisAns/tiki) PHP · 280 lines
62 $link->setIdentifier('TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabase');
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 }
77 $link = new WikiParser_OutputLink();
78 $link->setIdentifier('TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeTHISMUSTBETRIMMED');
79 $link->setWikiLookup([$this, 'getPageInfo']);
80 $link->setWikiLinkBuilder([$this, 'getWikiLink']);
82 $this->assertLinkIs('<a href="TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSize" title="Testing" class="wiki wiki_page">TestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeOfTheDatabaseTestWithAVeryBigNameThatExceedsTheColumnSizeTHISMUSTBETRIMMED</a>', $link->getHtml());
83 }
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");
12 class XLS extends ATabularData {
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 }
121 pointer allocate (size_type num, const void* = 0)
122 {
123 m_map_size = num * sizeof(T);
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
COpenGL.h (https://github.com/RJPalmer/OpenGLWinForm.git) C Header · 202 lines
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.
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.
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.
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.
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.
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.
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.
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.
.cvsignore (https://swig.svn.sourceforge.net/svnroot/swig) Unknown · 336 lines
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.
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.
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.
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.
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.
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;
169 csr = CSR1212_MALLOC(sizeof(*csr));
170 if (!csr)
171 return NULL;
216 return NULL;
218 kv = CSR1212_MALLOC(sizeof(*kv));
219 if (!kv)
220 return NULL;
338 BUG_ON(!kv || !dir || dir->key.type != CSR1212_KV_TYPE_DIRECTORY);
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.
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;
37 memset(dest, 0, sizeof(struct ustr));
38 memcpy(dest->u_name, src, strlen);
39 dest->u_cmpID = 0x08;
54 BUG_ON(size < 2);
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);
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.
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.
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.
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.
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.
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.
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.
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.
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";
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";
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
IconDatabase.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 2250 lines
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.
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;
66 num = (cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr)))/sizeof(int);
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;
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.
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.
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.
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);
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);
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.
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
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.
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.
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.
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.
pspUsbGpsSatInfo.java (http://jpcsp.googlecode.com/svn/trunk/) Java · 57 lines
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.
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.
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.
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.
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.
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.
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;
137 auto buf = cast(wchar_t*)malloc((len+1) * wchar_t.sizeof);
138 if (buf is null)
139 return null;
448 _STI_critical_init();
450 char[][] args = (cast(char[]*) alloca(argc * (char[]).sizeof))[0 .. argc];
451 version (Windows)
452 {
495 {
496 auto buff = cast(char[]*) alloca(argc * (char[]).sizeof + totalArgsLength);
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.
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.
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.
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.
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.
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.
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.
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.
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.
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;
45 memset(&tr, 0, sizeof(tr));
46 tr.tr_revokes = atomic_read(&gl->gl_ail_count);
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);