Changeset 245
- Timestamp:
- Feb 2, 2003, 9:22:17 PM (23 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/stringh.h
r240 r245 72 72 ULONG cbSource); 73 73 74 size_t XWPENTRY strlcpy(char *dst, 75 const char *src, 76 size_t siz); 77 78 size_t strlcat(char *dst, 79 const char *src, 80 size_t siz); 81 74 82 ULONG XWPENTRY strhlen(PCSZ pcsz); 75 83 … … 144 152 PCSZ pcszSource); 145 153 154 BOOL XWPENTRY strhKillChar(PSZ psz, 155 CHAR c, 156 PULONG pulLength); 157 146 158 PSZ XWPENTRY strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib); 147 159 -
trunk/include/helpers/winh.h
r243 r245 78 78 #endif 79 79 80 #ifndef PP_FIELDBACKGROUNDCOLOR 81 #define PP_FIELDBACKGROUNDCOLOR 57L 82 #endif 83 84 #ifndef PP_PAGEFOREGROUNDCOLOR 85 #define PP_PAGEFOREGROUNDCOLOR 68L 86 #endif 87 88 #ifndef PP_PAGEBACKGROUNDCOLOR 89 #define PP_PAGEBACKGROUNDCOLOR 69L 90 #endif 91 92 #ifndef CM_SETGRIDINFO 93 #define CM_SETGRIDINFO 0x0354 94 #define CM_QUERYGRIDINFO 0x0355 95 #define CM_SNAPTOGRID 0x0356 96 #define CRA_LOCKED 0x00000400L /* record is locked. */ 97 #endif 98 80 99 /* ****************************************************************** 81 100 * -
trunk/make/link_exe.in
r243 r245 65 65 $(MODULESDIR)\$(MODULESTEM).exe: $(LINKOBJS) $(MODULEDEF) $(DEPEND_RES) 66 66 @echo ### [$@]: Linking $(@F) 67 $(LINK) /OUT:$@ $(MODULEDEF) $(LINKOBJS) $(PMPRINTF_LIB) 67 $(LINK) @<< 68 /OUT:$@ $(MODULEDEF) $(LINKOBJS) $(PMPRINTF_LIB) 69 <<KEEP 68 70 !ifdef DEPEND_RES 69 71 @echo ### [$@]: Appending $(@B).res -
trunk/src/helpers/_call_filedlg.c
r243 r245 400 400 PGROUPRECORD preccFirst; 401 401 402 CHAR szTest[12]; 403 ULONG len; 404 405 len = strlcpy(szTest, "~Group name", sizeof(szTest)); 406 strhKillChar(szTest, '~', &len); 407 402 408 // set up cnr details view 403 409 xfi[i].ulFieldOffset = FIELDOFFSET(GROUPRECORD, gid); … … 407 413 408 414 xfi[i].ulFieldOffset = FIELDOFFSET(GROUPRECORD, recc.pszIcon); 409 xfi[i].pszColumnTitle = "Group name"; // @@todo localize415 xfi[i].pszColumnTitle = szTest; // "Group name"; // @@todo localize 410 416 xfi[i].ulDataType = CFA_STRING; 411 417 xfi[i++].ulOrientation = CFA_CENTER; -
trunk/src/helpers/cctl_cnr.c
r243 r245 486 486 } 487 487 488 _PmpfF(("cyColTitlesBox %d, new cy: %d", pData->cyColTitlesBox, cy));489 490 488 if (fl & DDFL_WINDOWSIZECHANGED) 491 489 WinSetWindowPos(pData->dwdContent.hwnd, … … 508 506 cy, 509 507 SWP_MOVE | SWP_SIZE); 510 511 _PmpfF(("updating VScroll, cy: %d, scrw.szlWorkarea.cy: %d",512 cy,513 pData->scrw.szlWorkarea.cy));514 508 } 515 509 … … 523 517 pData->scrw.cyScrollBar, 524 518 SWP_MOVE | SWP_SIZE); 525 526 _PmpfF(("updating HScroll, cx: %d, scrw.szlWorkarea.cx: %d",527 cx,528 pData->scrw.szlWorkarea.cx));529 519 } 530 520 -
trunk/src/helpers/makefile
r243 r245 89 89 !include helpers_pre.in 90 90 91 # The main target:92 # If we're called from the main makefile, MAINMAKERUNNING is defined,93 # and we'll set $(OBJS) as our targets (which will go on).94 # Otherwise, we call the main makefile, which will again call ourselves later.95 96 all: \97 !ifndef MAINMAKERUNNING98 callmainmake99 @echo ----- Leaving $(MAKEDIR)100 !else101 $(OUTPUTDIR)\helpers.lib102 #$(OBJS)103 @echo ----- Leaving $(MAKEDIR)104 !endif105 106 91 plainc: \ 107 92 !ifndef MAINMAKERUNNING … … 123 108 @echo ----- Leaving $(MAKEDIR) 124 109 !endif 125 126 127 callmainmake:128 @echo $(MAKEDIR)\makefile: Recursing to main makefile.129 @cd $(PROJECT_BASE_DIR)130 @nmake131 @echo $(MAKEDIR)\makefile: Returned from main makefile. Done.132 133 # The "dep" target: run fastdep on the sources.134 # "nmake dep" gets called from src\makefile if nmake dep135 # is running on the main makefile.136 dep:137 $(RUN_FASTDEP) *.c138 @echo ----- Leaving $(MAKEDIR)139 110 140 111 # Define the main dependency between the output HELPERS.LIB and … … 181 152 182 153 !include helpers_post.in 154 155 ALLTARGET = $(OUTPUTDIR)\helpers.lib 156 157 !include ..\..\make\targets.in 183 158 184 159 ################################################### -
trunk/src/helpers/stringh.c
r242 r245 409 409 410 410 return ul; 411 } 412 413 /* 414 *@@ strlcpy: 415 * copies src to string dst of size siz. At most siz-1 characters 416 * will be copied. Always NUL terminates, unless siz == 0. 417 * 418 * Returns strlen(src); if retval >= siz, truncation occurred. 419 * 420 * Taken from the OpenBSD sources at 421 * 422 + ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libc/string/strlcpy.c 423 * 424 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 425 * All rights reserved. 426 * 427 * OpenBSD licence applies (see top of that file). 428 * 429 *@@added V1.0.1 (2003-01-29) [umoeller] 430 */ 431 432 size_t strlcpy(char *dst, 433 const char *src, 434 size_t siz) 435 { 436 register char *d = dst; 437 register const char *s = src; 438 register size_t n = siz; 439 440 /* Copy as many bytes as will fit */ 441 if (n != 0 && --n != 0) 442 { 443 do 444 { 445 if ((*d++ = *s++) == 0) 446 break; 447 } while (--n != 0); 448 } 449 450 /* Not enough room in dst, add NUL and traverse rest of src */ 451 if (n == 0) 452 { 453 if (siz != 0) 454 *d = '\0'; /* NUL-terminate dst */ 455 while (*s++) 456 ; 457 } 458 459 return (s - src - 1); /* count does not include NUL */ 460 } 461 462 /* 463 *@@ strlcat: 464 * appends src to string dst of size siz. Unlike strncat, 465 * siz is the full size of dst, not space left. At most 466 * siz-1 characters will be copied. Always NUL terminates, 467 * unless siz <= strlen(dst). 468 * 469 * Returns strlen(src) + MIN(siz, strlen(initial dst)), 470 * in other words, strlen(dst) after the concatenation. 471 * If retval >= siz, truncation occurred. 472 * 473 * Taken from the OpenBSD sources at 474 * 475 + ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libc/string/strlcat.c 476 * 477 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 478 * All rights reserved. 479 * 480 * OpenBSD licence applies (see top of that file). 481 * 482 *@@added V1.0.1 (2003-01-29) [umoeller] 483 */ 484 485 size_t strlcat(char *dst, 486 const char *src, 487 size_t siz) 488 { 489 register char *d = dst; 490 register const char *s = src; 491 register size_t n = siz; 492 size_t dlen; 493 494 /* Find the end of dst and adjust bytes left but don't go past end */ 495 while (n-- != 0 && *d != '\0') 496 d++; 497 dlen = d - dst; 498 n = siz - dlen; 499 500 if (n == 0) 501 return(dlen + strlen(s)); 502 while (*s != '\0') 503 { 504 if (n != 1) 505 { 506 *d++ = *s; 507 n--; 508 } 509 s++; 510 } 511 *d = '\0'; 512 513 return (dlen + (s - src)); /* count does not include NUL */ 411 514 } 412 515 … … 1160 1263 1161 1264 return (pTarget - pszTarget); 1265 } 1266 1267 /* 1268 *@@ strhKillChar: 1269 * removes the first occurence of c in psz 1270 * by overwriting it with the following characters. 1271 * 1272 * For this to work, you _must_ pass in strlen(psz) 1273 * in the ULONG pointed to by ulLength. If 1274 * 1275 * Returns TRUE only if c was actually found. In 1276 * that case, *pulLength is decremented. 1277 * 1278 *@@added V1.0.1 (2003-01-30) [umoeller] 1279 */ 1280 1281 BOOL strhKillChar(PSZ psz, 1282 CHAR c, 1283 PULONG pulLength) 1284 { 1285 PSZ p; 1286 if (p = strchr(psz, c)) 1287 { 1288 // "string~rest" 1289 // ÀÄÄÄÄÄÙ 6 chars (p - pszBuf) 1290 // ÀÄÄÄÄÄÄÄÄÄÄÙ 11 chars (ulLen) 1291 // ^ p (pszBuf + 6) 1292 // ^ pszBuf 1293 memmove(p, // pszBuf + 6 1294 p + 1, // pszBuf + 7 1295 // include null byte 1296 *pulLength // 11 1297 - (p - psz)); // - 6 = 5 1298 --(*pulLength); 1299 1300 return TRUE; 1301 } 1302 1303 return FALSE; 1162 1304 } 1163 1305 … … 2032 2174 } 2033 2175 } 2176 2034 2177 return NULL; // Found nothing 2035 2178 } 2036 2179 2180 -
trunk/src/helpers/xstring.c
r222 r245 1113 1113 * especially with large string bufffers. 1114 1114 * 1115 * None of the pointers can be NULL, but if pstrReplace 1116 * is empty, this effectively erases pstrSearch in pxstr. 1115 * pxstr and pstrReplace may not be NULL, but if 1116 * pstrReplace is null or empty, this effectively 1117 * erases pstrSearch in pxstr. 1117 1118 * 1118 1119 * Returns the length of the new string (exclusing the … … 1169 1170 *@@changed V0.9.6 (2000-11-12) [umoeller]: now using strhmemfind 1170 1171 *@@changed V0.9.7 (2001-01-15) [umoeller]: renamed from xstrrpl; extracted new xstrrpl 1172 *@@changed V1.0.1 (2003-02-02) [umoeller]: now allowing for NULL pstrReplace 1171 1173 */ 1172 1174 … … 1175 1177 // out: ofs of first char after replacement string 1176 1178 const XSTRING *pstrSearch, // in: search string; cannot be NULL 1177 const XSTRING *pstrReplace, // in: replacement string ; cannot beNULL1179 const XSTRING *pstrReplace, // in: replacement string or NULL 1178 1180 size_t *pShiftTable, // in: shift table (see strhmemfind) 1179 1181 PBOOL pfRepeatFind) // in: repeat find? (see strhmemfind) … … 1181 1183 ULONG ulrc = 0; // default: not found 1182 1184 1183 if ((pxstr) && (pstrSearch) && (pstrReplace))1185 if ((pxstr) && (pstrSearch)) 1184 1186 { 1185 1187 ULONG cSearchLen = pstrSearch->ulLength; … … 1201 1203 { 1202 1204 ULONG ulFirstReplOfs = pFound - pxstr->psz; 1205 ULONG lenRepl = pstrReplace ? (pstrReplace->ulLength) : 0; 1203 1206 // found in buffer from ofs: 1204 1207 // replace pFound with pstrReplace … … 1206 1209 ulFirstReplOfs, // where to start 1207 1210 cSearchLen, // chars to replace 1208 pstrReplace ->psz,1209 pstrReplace->ulLength); // adjusted V0.9.11 (2001-04-22) [umoeller]1211 pstrReplace ? (pstrReplace->psz) : NULL, 1212 lenRepl); // adjusted V0.9.11 (2001-04-22) [umoeller] 1210 1213 1211 1214 // return new length 1212 *pulOfs = ulFirstReplOfs + pstrReplace->ulLength;1215 *pulOfs = ulFirstReplOfs + lenRepl; 1213 1216 } // end if (pFound) 1214 1217 } // end if ( (*pulOfs < pxstr->ulLength) ...
Note:
See TracChangeset
for help on using the changeset viewer.